Ë
    âß²j‘�  ã                  óJ  — U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZ ddlmZmZmZ dd	l m!Z! dd
l"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+ erddl,m-Z-m.Z.  ej^                  d«      Z0dZ1 ejd                  «       Z3i Z4de5d<   dZ6dZ7dZ8g Z9de5d<    ejt                  «       Z; ejx                  «       Z= G d„ de>«      Z?d$d„Z@d%d„ZAd&d„ZBd'd„ZCd(d„ZDd„ ZEed)d„«       ZFd*d „ZGd+d!„ZH G d"„ d#«      ZIy),uz  Plugin loading: directory/entry-point module import, deferred bundled platforms, portable packages,
dependency/config-schema warnings. Mixed into :class:`hermes_cli.plugins.PluginManager`.

Origin-internal names (``PluginContext``, ``LoadedPlugin``, ``_PLUGINS_DEBUG`` â€¦) are imported lazily
through ``hermes_cli.plugins`` so tests that patch them on the origin keep working.
é    )ÚannotationsN)Úcontextmanager©Úwraps)ÚPath)ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚListÚMappingÚOptionalÚUnion)Úget_hermes_homeÚreset_hermes_home_overrideÚset_hermes_home_override)Úreplacement_coordinator)ÚENTRY_POINTS_GROUPÚ_select_entry_point_group)ÚPluginManifestÚmanifest_keyÚportable_mcp_server_nameÚvalidate_config_schema)Ú_plugin_settings_entry)ÚLoadedPluginÚPluginContextzhermes_cli.pluginsÚhermes_pluginszDict[str, str]Ú_BARE_MODULE_SCOPEg      $@g     À‚@é   zList[threading.Thread]Ú_ABANDONED_LOADERSc                  ó   — e Zd ZdZy)ÚPluginLoadTimeoutzZRaised on the loading thread when a plugin's import + ``register()`` overran its deadline.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú>/home/ubuntu/.hermes/hermes-agent/hermes_cli/plugins_loader.pyr"   r"   4   s   „ Údr(   r"   c                 ó6   — t        t        t        dd«      «      S )zcTrue on a deadline worker thread; re-entrant discovery from there must not block on its own parent.ÚactiveF)ÚboolÚgetattrÚ_IN_PLUGIN_LOADr'   r(   r)   Úin_plugin_load_workerr/   8   s   € ä”œ¨°5Ó9Ó:Ð:r(   c                 ó¸  — t         } 	 ddlm}  |«       xs i j                  d«      }t	        |t
        «      r|j                  d«      €| S t        |d   «      }|dk  rt        j                  d|| «       | S |t        kD  r!t        j                  d|t        «       t        S |S # t        t        f$ r t        j                  d| «       | cY S t        $ r | cY S w xY w)z¬Effective per-plugin load deadline from ``plugins.load_timeout_seconds`` (default 10s; ``0`` runs
    loads inline with no deadline; clamped to ``_MAX_LOAD_TIMEOUT_SECS``).r   )Úload_config_readonlyÚpluginsÚload_timeout_secondsz?plugins.load_timeout_seconds is not a number; using default %gsz>plugins.load_timeout_seconds=%g is negative; using default %gsz9plugins.load_timeout_seconds=%g exceeds max %gs; clamping)Ú_LOAD_TIMEOUT_SECSÚhermes_cli.configr1   ÚgetÚ
isinstanceÚdictÚfloatÚ	TypeErrorÚ
ValueErrorÚloggerÚwarningÚ	ExceptionÚ_MAX_LOAD_TIMEOUT_SECS)Údefaultr1   Úplugins_cfgÚtimeouts       r)   Ú_resolve_plugin_load_timeoutrC   =   sÙ   € ô !€Gð
Ý:Ù+Ó-Ò3°×8Ñ8¸ÓCˆÜ˜+¤tÔ,°·±Ð@VÓ0WÐ0_ØˆNÜ˜Ð$:Ñ;Ó<ˆð �‚{Ü�‰ÐWÐY`ÐbiÔjØˆØÔ'Ò'Ü�‰ÐRÐT[Ü-ô	/ä%Ð%Ø€Nøô ”zÐ"ò Ü�‰ÐXÐZaÔbØŠÜò ØŠðús   ˆAB# ÁB# Â#'CÃ
CÃCc                 ó  — t         5  t        D � cg c]  } | j                  «       sŒ| ‘Œ c} t        dd t        t        «      t        k  r
	 ddd«       y	 ddd«       t        dt        › d�«      ‚c c} w # 1 sw Y   Œ!xY w)zýDrop finished abandoned loaders; refuse the load once the live cap is reached. Refusing beats
    loading inline: at the cap the process already holds several hung loaders, so an inline load is the
    exact startup hang this deadline exists to prevent.Nznot loaded: zl abandoned plugin loader thread(s) are still running (plugins.load_timeout_seconds); restart Hermes to retry)Ú_ABANDONED_LOADERS_LOCKr    Úis_aliveÚlenÚ_MAX_ABANDONED_LOADERSr"   )Úts    r)   Ú_reserve_abandoned_loader_slotrJ   V   sƒ   € ô 
!ñ Ü,>Ö O qÀ!Ç*Á*Å,¢Ò OÔ™1ÐÜÔ!Ó"Ô%;Ò;Ø÷ð à;÷ô Ø
Ô-Ð.ð /Bð 	Cóð ùò !P÷ð ús    ‡	A5�A0¦A0ª!A5Á0A5Á5A>c                óì  ‡‡‡— t        «       }|dk  r ‰«       S t        «        g Šg Šd
ˆˆˆfd„}t        j                  t	        j
                  «       j                  |fd| › �d¬«      }|j                  «        |j                  |«       |j                  «       rD|j                  «        t        5  t        j                  |«       ddd«       t        d|d›d	�«      ‚‰r‰d   ‚‰d   S # 1 sw Y   Œ%xY w)aÏ  Run ``fn`` (a plugin's import + ``register()``) under the per-plugin deadline.

    The worker inherits the caller's context (the Hermes-home override is a ContextVar). On timeout the
    worker is abandoned as a daemon, ``ctx`` is marked so any registration it still attempts is ignored,
    and :class:`PluginLoadTimeout` is raised on the calling thread so the usual failure path records the
    reason and disposes whatever was registered before the hang.
    r   c                 ó˜   •— dt         _        	 ‰j                   ‰«       «       y # t        $ r} ‰j                  | «       Y d } ~ y d } ~ ww xY w)NT)r.   r+   ÚappendÚBaseException)ÚexcÚfailureÚfnÚoutcomes    €€€r)   Ú_workerz'run_with_load_deadline.<locals>._workers   s=   ø€ Ø!%ŒÔð	 Ø�N‰N™2›4Õ øÜò 	 Ø�N‰N˜3×Ñûð	 ús   Ž% ¥	A	®AÁA	zplugin-load:T)ÚtargetÚargsÚnameÚdaemonNzload timed out after Úgz&s (import + register() never returned)©ÚreturnÚNone)rC   rJ   Ú	threadingÚThreadÚcontextvarsÚcopy_contextÚrunÚstartÚjoinrF   Ú_abandon_loadrE   r    rM   r"   )Ú
plugin_keyÚctxrQ   rB   rS   ÚworkerrP   rR   s     `   @@r)   Úrun_with_load_deadlinerg   d   sè   ú€ ô +Ó,€GØ�!‚|Ù‹tˆÜ"Ô$Ø€GØ#%€G÷ ô ×ÑÜ×'Ñ'Ó)×-Ñ-°W°JÀ|ÐT^ÐS_ÐE`Ðimô€Fð ‡L�L„NØ
‡K�K�ÔØ‡�ÔØ×ÑÔÜ$ñ 	.Ü×%Ñ% fÔ-÷	.äÐ"7¸À°{ÐBhÐ iÓjÐjÙØ�a‰jÐØ�1‰:Ð÷	.ð 	.ús   Â0C*Ã*C3c                ó®   — | › d�}t         j                  D �cg c]  }|| k(  s|j                  |«      sŒ|‘Œ c}D ]  }t         j                  |= Œ yc c}w )zPDrop ``module_name`` and every ``module_name.*`` submodule from ``sys.modules``.ú.N)ÚsysÚmodulesÚ
startswith)Úmodule_nameÚprefixÚnrV   s       r)   Ú_evict_modulesrp   ‰   sM   € àˆ}˜AÐ€FÜŸK™KÖT�q¨1°Ò+;¸q¿|¹|ÈFÕ?S’ÒTò ˆÜ�K‰K˜ÑñùÒTs
   ˜A´Ac                ó.   ‡ — t        ‰ «      ˆ fd„«       }|S )uD   Make snapshot â†’ write â†’ lease attachment one atomic transaction.c                 óh   •— t        j                  «       5   ‰| i |¤Žcd d d «       S # 1 sw Y   y xY w©N)r   Útransaction)rU   ÚkwargsÚmethods     €r)   Úwrappedz(_serialized_replacement.<locals>.wrapped’   s1   ø€ ä$×0Ñ0Ó2ñ 	+Ù˜4Ð* 6Ñ*÷	+÷ 	+ò 	+ús   –(¨1r   )rv   rw   s   ` r)   Ú_serialized_replacementrx   �   s    ø€ ä
ˆ6ƒ]ó+ó ð+ð €Nr(   c              #  ób   K  — t        | «      }	 d–— t        |«       y# t        |«       w xY w­w)zBBind discovery and loading to the manager's immutable Hermes home.N)r   r   )ÚhomeÚtokens     r)   Ú_plugin_home_scoper|   š   s+   è ø€ ô % TÓ*€Eð*Ûä" 5Õ)øÔ" 5Õ)üs   ‚/� “/Ÿ,¬/c                óX   — t        | t        «      rd| j                  ›d�S t        | «      S )z_Human-readable load failure; ``sys.exit(0)`` has an empty ``str()`` so name the class and code.zSystemExit(z!) raised during import/register())r7   Ú
SystemExitÚcodeÚstr)rO   s    r)   Ú_load_error_textr�   ¤   s)   € ä�#”zÔ"Ø˜SŸX™X˜LÐ(IÐJÐJÜˆs‹8€Or(   c                óö   — t        j                  d| d¬«      d   j                  «       }|sy	 t        j                  j                  |«       y# t        j                  j                  $ r Y yt        $ r Y yw xY w)z[Best-effort presence probe on a requirement's distribution name; ``None`` when unprobeable.z[<>=!~\[;\s]é   )Úmaxsplitr   NTF)ÚreÚsplitÚstripÚ	importlibÚmetadataÚversionÚPackageNotFoundErrorr>   )ÚreqÚdists     r)   Ú_dist_installedrŽ   «   sm   € ä�8‰8�O S°1Ô5°aÑ8×>Ñ>Ó@€DÙØðÜ×Ñ×"Ñ" 4Ô(ØøÜ×Ñ×2Ñ2ò ÙÜò Ùðús   ®A ÁA8Á-A8Á7A8c                  óÈ   — e Zd Zdd„Zdd„Zedd„«       Zdd„Zedd„«       Z	dd„Z
dd„Zdd„Zdd	„Zdd
„Zdd„Z	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zdd„Zddœ	 	 	 	 	 dd„Zdd„Zy)ÚPluginLoaderMixinc                ó~   ‡‡— t        ‰«      st        d«      ‚| j                  Š‰j                  ‰«       dˆˆfd„}|S )uÔ  Subscribe to "a discovery sweep loaded plugins this process did not have": fires from INSIDE
        :meth:`discover_and_load` (never emitted by an install RPC) with one
        ``{name, key, activated_now, deferred}`` summary per NEWLY loaded plugin â€” every plugin at boot,
        just the newcomer after a mid-run ``hermes plugins install/enable``, Desktop / dashboard /
        ``plugins.manage`` install-enable-update, a tool-triggered force re-discovery or the gateway's
        ``reload-plugins`` verb (all of which run ``discover_plugins(force=True)``; a non-forced call
        short-circuits on ``_discovered`` and never fires). See
        :func:`hermes_cli.plugins_activation.plugin_activation_summary` for the payload: ``activated_now``
        (gateway commands/transforms/hooks/callbacks, live at once) vs ``deferred`` (``tools``/``prompt``
        until the next session, ``mcp_servers`` â€” the plugin's mcp.json server names â€” until ``mcp.reload``).
        Listeners belong to the process (gateway runner, TUI server), not to a plugin, so ``unload()``
        never clears them. Returns an unsubscribe callable. Fires on the discovering thread with the
        discovery lock released; marshal onto your own loop.z$on_plugin_loaded requires a callablec                 óH   •— 	 ‰j                  ‰ «       y # t        $ r Y y w xY wrs   )Úremover;   )ÚcallbackÚ	listenerss   €€r)   Ú_unsubscribez8PluginLoaderMixin.on_plugin_loaded.<locals>._unsubscribeÍ   s(   ø€ ðØ× Ñ  Õ*øÜò Ùðús   ƒ •	! !rY   )Úcallabler;   Ú_plugin_loaded_listenersrM   )Úselfr”   r–   r•   s    ` @r)   Úon_plugin_loadedz"PluginLoaderMixin.on_plugin_loadedº   s?   ù€ ô ˜Ô!ÜÐCÓDÐDØ×1Ñ1ˆ	Ø×Ñ˜Ô"ö	ð
 Ðr(   c                ó  — | j                   syddlm}  || «      D �cg c]  }|d   |vsŒ|‘Œ }}|syt        | j                   «      D ]  }	  ||«       Œ yc c}w # t        $ r t
        j                  d|d¬«       Y Œ7w xY w)z²Fire every :meth:`on_plugin_loaded` listener for the plugins this sweep added over
        ``loaded_before``; nothing new = no event. One raising listener never starves the rest.Nr   )Úactivation_summariesÚkeyz plugin-loaded listener %r raisedT©Úexc_info)r˜   Úhermes_cli.plugins_activationrœ   Úlistr>   r<   r=   )r™   Úloaded_beforerœ   ÚsÚ	summariesr”   s         r)   Ú_notify_plugin_loadedz'PluginLoaderMixin._notify_plugin_loadedÔ   s“   € ð ×,Ò,ØÝFÙ 4°TÓ :Ö\˜1¸aÀ¹hÈmÒ>[’QÐ\ˆ	Ð\ÙØÜ˜T×:Ñ:Ó;ò 	\ˆHð\Ù˜Õ#ñ	\ùò ]øô ò \Ü—‘ÐAÀ8ÐVZ�Ö[ð\ús   žA«AÁAÁ!BÂ Bc                ó¼   — | j                   xs d}|j                  d«      r|dt        d«        S | j                  rt	        | j                  «      j                   S |S )z¬Derive the platform name without importing the adapter: strip a trailing ``-platform`` from the
        manifest name, else the directory basename (the bundled convention).Ú z	-platformN)rV   ÚendswithrG   Úpathr   )ÚmanifestrV   s     r)   Ú_platform_name_from_manifestz.PluginLoaderMixin._platform_name_from_manifestã   sT   € ð �}‰}Ò" ˆØ�=‰=˜Ô%ØÐ+œ3˜{Ó+Ð+Ð,Ð,Ø+3¯=ª=Œt�H—M‘MÓ"×'Ñ'ÐB¸dÐBr(   c                óÆ   — ddl m} t        |«      } ||dd¬«      }|| j                  |<   | j	                  ||«      s| j                  |«       y| j                  ||«       y)zäRegister a lazy loader for a bundled platform: the adapter imports only when the
        ``platform_registry`` is first asked for it; a placeholder ``LoadedPlugin`` keeps it visible in
        ``hermes plugins list`` until then.r   )r   T)rª   ÚenabledÚdeferredN)Úhermes_cli.pluginsr   r   Ú_pluginsÚ_lease_deferred_platformÚ_load_pluginÚ!_register_deferred_platform_tools)r™   rª   r   Ú
lookup_keyÚloadeds        r)   Ú_register_deferred_platformz-PluginLoaderMixin._register_deferred_platformì   s`   € õ 	4Ü! (Ó+ˆ
Ù x¸ÈÔMˆØ$*ˆ�‰�jÑ!Ø×,Ñ,¨X°zÔBð ×Ñ˜hÔ'ØØ×.Ñ.¨x¸Õ@r(   c           
     óà  ‡ ‡‡‡— ‰ j                  |«      Š	 ddlmŠ ‰ j                  Š|fdˆˆˆˆ fd„}‰j	                  ‰‰¬«      }‰j                  ‰|‰¬«       ‰j	                  ‰‰¬«      }|d   €>|d   |u r7‰ j                  j                  ‰«       ‰ j                  |d‰‰||ˆˆ fd„¬«       t        j                  d	‰|«       y# t        $ r t        j                  d
|d¬«       Y yw xY w)zXPublish the deferred loader as a ledger-owned lease; False when the registry refused it.r   )Úplatform_registryc                ó  •— ‰j                   5  t        ‰j                  «      5  ‰j                  ‰‰¬«      r	 d d d «       d d d «       y ‰j	                  | «       d d d «       d d d «       y # 1 sw Y   ŒxY w# 1 sw Y   y xY w©N©Úscope)Ú_discovery_lockr|   Ú	home_pathÚis_deferred_load_cancelledÚ_load_plugin_scoped)Ú	_manifestÚplatform_namer¸   r¼   r™   s    €€€€r)   Ú_loaderz;PluginLoaderMixin._lease_deferred_platform.<locals>._loader  sz   ø€ ð ×)Ñ)ñ 8Ô+=¸d¿n¹nÓ+Mñ 8Ø(×CÑCÀMÐY^ÐCÔ_Ø÷8÷ 8ð 8ð ×,Ñ,¨YÔ7÷8÷ 8÷ 8ñ 8ú÷ 8ð 8ús-   ŽA8¤A,¹A8Á
A,ÁA8Á,A5	Á1A8Á8Br»   rƒ   Úplatformc                 ó&   •— ‰j                  ‰ «      S rs   )Ú _remove_platform_name_if_unowned)rÂ   r™   s   €€r)   ú<lambda>z<PluginLoaderMixin._lease_deferred_platform.<locals>.<lambda>  s   ø€  T×%JÑ%JÈ=Ó%Y€ r(   )Úfinalizez3Registered deferred platform loader: %s (plugin=%s)z=Deferred platform registration failed for '%s'; eager-loadingTrž   F)rÁ   r   rZ   r[   )r«   Úgateway.platform_registryr¸   Ú	scope_keyÚsnapshot_registrationÚregister_deferredÚ_plugin_platform_namesÚaddÚ_track_scoped_registrationr<   Údebugr>   )	r™   rª   r´   rÃ   ÚpreviousÚcurrentrÂ   r¸   r¼   s	   `     @@@r)   r±   z*PluginLoaderMixin._lease_deferred_platformü   s  û€ ð ×9Ñ9¸(ÓCˆð	ÝCØ—N‘NˆEà4<÷ 8ñ 8ð )×>Ñ>¸}ÐTYÐ>ÓZˆHØ×/Ñ/°¸wÈeÐ/ÔTØ'×=Ñ=¸mÐSXÐ=ÓYˆGØ�q‰zÐ! g¨a¡j°GÑ&;Ø×+Ñ+×/Ñ/°Ô>Ø×/Ñ/Ø˜j¨-Ð9JÈGÐU]ÜYð 0ô ô �L‰LÐNÐP]Ð_iÔjð
 øô	 ò 	Ü�L‰LØOÐQ[Ðfjð ô láð	ús   —B1C	 Ã	!C-Ã,C-c           	     óœ  ‡ ‡‡‡— ddl m}m} |j                  syt	        |«      Št        |j                  «      }|j                  rt        |j                  «      nd}|�|dz  j                  «       st        j                  d‰|«       yt        ‰ j                  «      Šdˆˆˆˆ fd„}	 ‰ j                  |«      }|‰_        |‰ j                  ‰<   t!        j"                  |j$                  › d�«      }	t'        |	dd«      }
|
€t        j                  d	‰|«       y |
 ||‰ «      «        |«       }t        j)                  d
‰t+        |«      |«       y# t,        t.        f$ rk} |«       t+        |«      }}t+        |«      |k\  }|sd|› d�n|rd|› d�ndt+        |«      › d|› d�}t        j                  d‰|||rdnd|¬«       Y d}~yd}~ww xY w)uR  Register a deferred platform's *client* tools without its adapter. Deferring the plugin would
        otherwise defer its outbound tools too, so CLI/TUI processes (which never materialize platforms)
        would miss them in ``hermes tools`` / ``platform_toolsets``. Opt-in is explicit via ``provides_tools``;
        tools live in a ``tools`` submodule so ``__init__`` stays import-light.

        A platform plugin can ship two independent things: an inbound adapter (heavy â€” it imports the
        platform SDK) and outbound client tools the agent calls like any other tool. Deferring the plugin
        defers both, so in a CLI/TUI process the client tools never register at all: ``resolve_toolset()``
        returns ``[]``, the toolset is missing from the ``hermes tools`` checklist, and even an explicit
        ``platform_toolsets`` entry is dropped because the key is unknown. The same tools work in
        gateway/web processes only because those materialize every platform at startup (issue #78050).
        Opting in is explicit: the manifest must declare ``provides_tools`` (the field the plugin list and
        web server already read to name a plugin's tools, per #78538). Keying off the mere presence of a
        ``tools.py`` would opt a plugin in by accident â€” a platform is free to put internal helpers there â€”
        and would leave the contract invisible to anyone reading the manifest. ``tools.py`` remains where
        the code is imported from; ``provides_tools`` is what asks for it. A platform that does not declare
        the field is untouched and stays fully deferred.
        r   )r   Ú_PLUGINS_DEBUGNztools.pyzrPlugin '%s' declares provides_tools %s but has no tools.py; those tools will not be available in CLI/TUI sessions.c                 ó~   •— ‰j                   D � cg c]	  } | ‰vsŒ| ‘Œ }} |r|‰_        |‰j                  ‰<   |S c c} w )z@Attribute every tool registered since ``before`` to this plugin.)Ú_plugin_tool_namesÚtools_registeredÚ_predeclared_tools)rI   Ú
registeredÚbeforerµ   r´   r™   s     €€€€r)   Ú_creditzDPluginLoaderMixin._register_deferred_platform_tools.<locals>._creditF  sI   ø€ à%)×%<Ñ%<ÖP ÀÈÂš!ÐPˆJÐPÙØ*4�Ô'Ø6@�×'Ñ'¨
Ñ3ØÐùò	 Qs   �	:š:z.toolsÚregister_toolszŠPlugin '%s' declares provides_tools %s but its tools.py has no register_tools(ctx); those tools will not be available in CLI/TUI sessions.z;Deferred platform '%s': pre-registered %d client tool(s) %szbefore registering any of its z declared tool(s)zafter registering all zafter registering z of z;Plugin '%s': client-tool pre-registration failed %s (%s).%sr§   z5 The remainder will be missing from CLI/TUI sessions.rž   )rZ   ú	List[str])r¯   r   rÔ   Úprovides_toolsr   r¡   r©   r   Úis_filer<   r=   ÚsetrÖ   Ú_load_directory_moduleÚmoduleÚ_predeclared_modulesrˆ   Úimport_moduler#   r-   rÐ   rG   r>   r~   )r™   rª   rµ   r   rÔ   ÚdeclaredÚ
plugin_dirrÛ   râ   Útools_modulerÜ   rÙ   rO   ÚpartialÚtotalÚcompleter¼   rÚ   r´   s   ` `              @@r)   r³   z3PluginLoaderMixin._register_deferred_platform_tools  sá  û€ ÷& 	EØ×&Ò&ØÜ! (Ó+ˆ
ô ˜×/Ñ/Ó0ˆØ,4¯MªM”T˜(Ÿ-™-Ô(¸tˆ
ØÐ j°:Ñ&=×%FÑ%FÔ%Hä�N‰NðIØJTÐV^ô	ð Ü�T×,Ñ,Ó-ˆ÷	ð 	ð$	Ø×0Ñ0°Ó:ˆFð #ˆFŒMØ4:ˆD×%Ñ% jÑ1Ü$×2Ñ2°f·o±oÐ5FÀfÐ3MÓNˆLÜ$ \Ð3CÀTÓJˆNØÐ%Ü—‘ð5à6@À(ôð
 Ù™=¨°4Ó8Ô9Ù ›ˆJÜ�L‰LØMÈzÔ[^Ð_iÓ[jØõøô œ:Ð&ò 	ñ %›Y¬¨H«�UˆGÜ˜7“| uÑ,ˆHáQXÐ0°°Ð7HÑIÙJRÐ-¨e¨WÐ4EÑFØ)¬#¨g«,¨°t¸E¸7ÐBSÐTð ô
 �N‰NØMÈzÐ[`ÐbeÙ‘Ð$[Ø'ð ÷ ñ ûð	ús    Â)A/E Ä7E ÅGÅ A!GÇGc           
     óJ  — |j                   }|syt        |«      }|D �cg c]  }t        |«      du sŒ|‘Œ }}|r?t        j	                  d|dj                  |«      |dj                  d„ |D «       «      «       yt        j                  d|dj                  |«      «       yc c}w )u0  Warn about declared pip dependencies missing at load time. Installing happens at
        ``hermes plugins install``/``enable`` and after ``hermes update`` (``hermes_cli.plugin_python_deps``)
        under core constraints; the loader itself never installs â€” import time is not a consent point.
        NFz›Plugin %s declares Python dependencies that are not installed: %s. Run `hermes plugins enable %s` to install them, or install them yourself: pip install %sz, ú c              3  ó(   K  — | ]
  }d |› d �–— Œ y­w)ú'Nr'   )Ú.0Úms     r)   ú	<genexpr>z>PluginLoaderMixin._warn_python_dependencies.<locals>.<genexpr>ƒ  s   è ø€ Ò6QÀA¸¸1¸#¸Q´xÑ6Qùs   ‚z+Plugin %s python_dependencies satisfied: %s)Úpython_dependenciesr   rŽ   r<   r=   rb   rÐ   )r™   rª   Údepsr�   rŒ   Úmissings         r)   Ú_warn_python_dependenciesz+PluginLoaderMixin._warn_python_dependenciest  s—   € ð
 ×+Ñ+ˆÙØÜ˜8Ó$ˆØ"&ÖH˜3¬/¸#Ó*>À%Ò*G’3ÐHˆÐHÙÜ�N‰Nð;ð �T—Y‘Y˜wÓ'¨¨c¯h©hÑ6QÈÔ6QÓ.Qõ	ô �L‰LÐFÈÈTÏYÉYÐW[Ë_Õ]ùò Is
   ŸB ²B c                óŒ  — |j                   syt        |«      }i }	 ddlm} t	         |«       xs i |«      xs i }|j                  d«      }t        |t        «      s|j                  d«      }t        |t        «      r|ni }t        ||j                   |«      D ]  }t        j                  d||«       Œ y# t        $ r i }Y ŒAw xY w)zmWarn (never block) on plugins.entries.<id> settings that violate config_schema.

        See #64165.
        Nr   )Úload_configÚsettingsÚconfigzPlugin %s config: %s)Úconfig_schemar   r5   r÷   r   r6   r7   r   r>   r   r<   r=   )r™   rª   Ú	plugin_idrø   r÷   ÚentryÚrawr=   s           r)   Ú_validate_plugin_config_schemaz0PluginLoaderMixin._validate_plugin_config_schemaˆ  s¿   € ð
 ×%Ò%ØÜ  Ó*ˆ	Ø&(ˆð	Ý5Ü*©;«=Ò+>¸BÀ	ÓJÒPÈbˆEØ—)‘)˜JÓ'ˆCÜ˜c¤7Ô+Ø—i‘i Ó)�Ü(¨¬gÔ6‘s¸BˆHô .¨i¸×9OÑ9OÐQYÓZò 	GˆGÜ�N‰NÐ1°9¸gÕFñ	Gøô ò 	ØŠHð	ús   œA%B5 Â5CÃCc                ó¼   — | j                   5  t        | j                  «      5  | j                  |«       ddd«       ddd«       y# 1 sw Y   ŒxY w# 1 sw Y   yxY w)z?Import a plugin module and call its ``register(ctx)`` function.N)r½   r|   r¾   rÀ   )r™   rª   s     r)   r²   zPluginLoaderMixin._load_plugin�  sO   € à×!Ñ!ñ 	/Ô#5°d·n±nÓ#Eñ 	/Ø×$Ñ$ XÔ.÷	/÷ 	/÷ 	/ñ 	/ú÷ 	/ð 	/ús!   �A£AµAÁA	ÁAÁAc                ó2  ‡ ‡‡‡‡‡— ddl m}m}m}  |‰¬«      Št	        ‰«      Št
        j                  d‰‰j                  ‰j                  ‰j                  «       ‰j                  r‰ j                  ‰‰«       yddlm}  |‰«      }|r.|‰_        t
        j                  d‰|«       ‰‰ j                   ‰<   yddlm}  |‰«      }|r8|‰_        t
        j                  d	‰j&                  |«       ‰‰ j                   ‰<   yt)        ‰ j*                  «      }‰ j-                  ‰«      Š‰ j/                  ‰‰«        |‰‰ «      Šdˆˆˆˆˆˆ fd
„}		 t1        ‰‰|	«      rL‰ j3                  ‰‰|«       d‰_        ddlm}
 ‰ j;                   |
‰j&                  ‰j<                  «      «       ‰j4                  s‰ jL                  jO                  ‰d«       ‰‰ j                   ‰<   y# t>        t@        f$ r¨}‰ j*                  D �cg c]  }|jB                  ‰k(  sŒ|‘Œ nc c}w }}‰ jE                  |«       ‰ jG                  |«       tI        |«      ‰_        ‰ jK                  ‰«       t
        j                  d‰j&                  tI        |«      |¬«       Y d}~Œêd}~ww xY w)z9Load one plugin with the manager's home bound as current.r   )r   r   rÔ   )rª   z1Loading plugin '%s' (source=%s, kind=%s, path=%s)N)Úrequires_hermes_errorzPlugin '%s' skipped: %s)Údisable_reasonzPlugin '%s' not loaded: %sc                 óæ  •— ‰j                   j                  ‰d«      } | €"‰j                  dv r‰j                  ‰‰¬«      } n| €‰j	                  ‰«      } d}| �Qt        | t        j                  «      s7t        | «      r,| }t        j                  j                  t        |dd«      «      } | ‰_        |€t        | dd«      }|€(d‰_        t        j!                  d‰j"                  «       y	 |‰«       y
)uT   Import + register() â€” the part a plugin controls, so the part the deadline covers.N>   ÚuserÚbundledÚproject©rm   r$   r§   Úregisterzno register() functionz&Plugin '%s' has no register() functionFT)rã   ÚpopÚsourcerá   Ú_load_entrypoint_moduler7   ÚtypesÚ
ModuleTyper—   rj   rk   r6   r-   râ   Úerrorr<   r=   rV   )râ   Úregister_fnre   rµ   rª   rm   rd   r™   s     €€€€€€r)   Ú_import_and_registerzCPluginLoaderMixin._load_plugin_scoped.<locals>._import_and_registerÄ  sæ   ø€ ð ×.Ñ.×2Ñ2°:¸tÓDˆFØˆ~ (§/¡/Ð5SÑ"SØ×4Ñ4°XÈ;Ð4ÓW‘Ø�Ø×5Ñ5°hÓ?�ØˆKØÐ!¬*°V¼U×=MÑ=MÔ*NÔS[Ð\bÔScð %�ÜŸ™Ÿ™¬°¸lÈBÓ)OÓP�Ø"ˆFŒMØÐ"Ü% f¨j¸$Ó?�ØÐ"Ø7�”Ü—‘ÐGÈÏÉÔWØÙ˜ÔØr(   T)Ú_hook_source_ofzFailed to load plugin '%s': %srž   ©rZ   r,   )(r¯   r   r   rÔ   r   r<   rÐ   r
  Úkindr©   ÚportableÚ_load_portable_pluginÚhermes_cli.plugins_manifestr  r  r=   r°   Úhermes_cli.plugin_compatr  rV   rG   Ú_registration_orderÚ_policy_module_nameÚ_track_tool_override_policyrg   Ú_attribute_registrationsr­   Úhermes_cli.plugins_ledgerr  Ú_drop_fallback_hooksrâ   r>   r~   rd   Ú_dispose_registrationsÚ_forget_registrationsr�   Ú_remove_plugin_subscriptionsrØ   r	  )r™   rª   r   r   rÔ   r  Úreasonr  Úregistration_startr  r  rO   ÚrÚownedre   rµ   rm   rd   s   ``            @@@@r)   rÀ   z%PluginLoaderMixin._load_plugin_scoped¢  s6  ý€ çRÑRÙ xÔ0ˆÜ! (Ó+ˆ
Ü�‰Ø?Ø˜Ÿ™¨¯©¸¿¹ô	
ð ×ÒØ×&Ñ& x°Ô8ØåEÙ& xÓ0ˆÙØ!ˆFŒLÜ�N‰NÐ4°jÀ&ÔIØ(.ˆD�M‰M˜*Ñ%Øõ 	<Ù Ó)ˆÙØ!ˆFŒLÜ�N‰NÐ7¸¿¹ÈÔOØ(.ˆD�M‰M˜*Ñ%ØÜ  ×!9Ñ!9Ó:ÐØ×.Ñ.¨xÓ8ˆØ×(Ñ(¨°;Ô?Ù˜H dÓ+ˆ÷	ò 	ð2	|Ü% j°#Ð7KÔLØ×-Ñ-¨f°jÐBTÔUØ!%�”ÝEà×)Ñ)©/¸(¿-¹-ÈÏÉÓ*WÔXð& �~Š~Ø×#Ñ#×'Ñ'¨
°DÔ9Ø$*ˆ�‰�jÒ!øô) œ:Ð&ò 	|ð
 !%× 8Ñ 8ÖW˜1¸A¿L¹LÈJÓ<V’QÑWùÒWˆEÐWØ×'Ñ'¨Ô.Ø×&Ñ& uÔ-Ü+¨CÓ0ˆFŒLð ×-Ñ-¨jÔ9Ü�N‰NÐ;¸X¿]¹]ÔL\Ð]`ÓLaÐlzˆN×{Ñ{ûð	|ús,   ÅAG ÇJÇ.JÇ<HÈHÈA7JÊJc           
     óˆ  ‡‡‡‡— ddl m} ddlmŠ | j                  Št        j                  «       5  ‰j                  ‰‰¬«      }‰j                  ‰ ||| «      j                  d«      ‰¬«      Št        j                  d‰‰f‰|ˆˆˆˆfd„¬«      }| j                  |d‰|j                  «       d	d	d	«       y	# 1 sw Y   y	xY w)
zTInstall the plugin's tool-override policy in tools.registry as a ledger-owned lease.r   ©r   )Úregistryr»   r§   Útool_override_policyc                ó.   •— ‰j                  ‰‰| ‰¬«      S rº   )Úrestore_plugin_override_policy)ÚreplacementÚ	_registryÚcurrent_policyrm   r¼   s    €€€€r)   rÇ   z?PluginLoaderMixin._track_tool_override_policy.<locals>.<lambda>  s!   ø€ ¨I×,TÑ,TØ °ÀEð -Uó -€ r(   )rÒ   rÑ   ÚrestoreN)r¯   r   Útools.registryr'  rÊ   r   rt   Úsnapshot_plugin_override_policyÚregister_plugin_override_policyÚ_tool_override_allowedÚacquireÚ_track_registrationÚdispose)	r™   rª   rm   r   Úprevious_policyÚpolicy_leaser,  r-  r¼   s	     `   @@@r)   r  z-PluginLoaderMixin._track_tool_override_policyú  sÂ   û€ å4Ý8Ø—‘ˆÜ$×0Ñ0Ó2ñ 	jØ'×GÑGÈÐ[`ÐGÓaˆOØ&×FÑFØ™]¨8°TÓ:×QÑQÐRTÓUÐ]bð Gó ˆNô 3×:Ñ:Ø'¨°Ð<ÀnØ(öôˆLð ×$Ñ$ XÐ/EÀ{ÐT`×ThÑThÔi÷	j÷ 	jñ 	jús   ±A>B8Â8Cc                óª  ‡‡	— | j                   |d D �cg c]  }|j                  |k(  r|j                  r|‘Œ! c}Š	d	ˆ	fd„Š| j                  j	                  |g «      D �cg c]  }|| j
                  v sŒ|‘Œ }}| ‰d«      D �cg c]	  }||vsŒ|‘Œ c}z   |_         ‰d«      |_         ‰d«      |_         ‰d«      |_	        t        j                  dt        |j                  «      t        |j                  «      t        |j                  «      t        |j                  «      t        ˆfd„| j                  D «       «      «       yc c}w c c}w c c}w )
zUFill ``loaded.*_registered`` from the ledger slice this plugin's register() produced.Nc                ób   •— ‰D �cg c]  }|j                   | k(  sŒ|j                  ‘Œ  c}S c c}w rs   )r  r�   )r  r#  Úregistrationss     €r)   Ú_keysz9PluginLoaderMixin._attribute_registrations.<locals>._keys  s%   ø€ Ø#0ÖC˜a°A·F±F¸d³N�A—E“EÒCÐCùÒCs   †,›,ÚtoolÚhookÚ
middlewareÚcommandz[  registered: %d tool(s), %d hook(s), %d middleware, %d slash command(s), %d CLI command(s)c              3  ó8   •K  — | ]  }| ‰d «      v sŒd–— Œ y­w)Úcli_commandrƒ   Nr'   )rï   Úcr;  s     €r)   rñ   z=PluginLoaderMixin._attribute_registrations.<locals>.<genexpr>$  s   øè ø€ ÒK�a°±e¸MÓ6JÒ1J”ÑKùs   ƒ“)r  r€   rZ   rÝ   )r  rd   r+   rØ   r	  rÖ   r×   Úhooks_registeredÚmiddleware_registeredÚcommands_registeredr<   rÐ   rG   ÚsumÚ_cli_commands)
r™   rµ   rd   r"  r#  rI   ÚpredeclaredÚkr;  r:  s
           @@r)   r  z*PluginLoaderMixin._attribute_registrations  s,  ù€ ð
 ×/Ñ/Ð0BÐ0CÐDö
ØØ�|‰|˜zÒ)¨a¯hªhò ò
ˆõ
	Dð
 #'×"9Ñ"9×"=Ñ"=¸jÈ"Ó"MÖn˜QÐQRÐVZ×VmÑVmÒQm’qÐnˆÐnØ"-¹EÀ&»MÖ0b°qÈQÐVaÒMa²Ò0bÑ"bˆÔÙ"'¨£-ˆÔÙ',¨\Ó':ˆÔ$Ù%*¨9Ó%5ˆÔ"Ü�‰ØiÜ�×'Ñ'Ó(¬#¨f×.EÑ.EÓ*FÜ�×,Ñ,Ó-¬s°6×3MÑ3MÓ/NÜÓK˜4×-Ñ-ÔKÓKõ		
ùò
ùò oùÚ0bs   ”$EÁEÁ3EÂ	EÂEc           
     ó"  ‡ ‡‡— ddl m} t        |«      }	 ddlm}  |t        |j                  «      t        «       dz  |j                  z  «      } ||‰ «      }|j                  D ].  }t        j                  d||j                  |j                  «       Œ0 |j                  D ]?  }		 |j                  |	j                   |	j"                  |	j$                  |	j&                  «       ŒA ddlmŠm} dd	lmŠ g }	 |j2                  j5                  «       D ]Ö  \  }}t7        ||«      }|‰ j8                  v r3t        j                  d
||‰ j:                  j=                  |d«      «       ŒSt?        |«      ‰ j8                  |<   |‰ j:                  |<   |j@                  j=                  |«      }|�/‰jC                  ||j0                  «        |||jD                  «       |jG                  |«       ŒØ |D ]   }|fdˆˆˆ fd„}‰ jI                  |d||«       Œ" d|_%        	 |‰ jX                  |<   y# t(        $ r-}
t        j                  d||	j                   |
«       Y d}
~
�Œ´d}
~
ww xY w# tL        $ rZ |D ]S  }‰ j8                  jO                  |d«       ‰ j:                  jO                  |d«       ‰jQ                  |«        ‰|«       ŒU ‚ w xY w# t(        tR        f$ r;}
tU        |
«      |_+        t        j                  d||jV                  «       Y d}
~
Œôd}
~
ww xY w)zALoad validated portable components without importing Python code.r   r&  )Úload_agent_pluginzplugin-datazAgent Plugin '%s' [%s]: %sz(Agent Plugin '%s' skill '%s' skipped: %sN)Ú_clear_livenessÚ_set_liveness)Údeclarationz_Agent Plugin '%s' MCP server '%s' skipped: name already taken by plugin '%s'; rename one serverú?c                ó¨   •— ‰j                   j                  | d «       ‰j                  j                  | d «       ‰j                  | «        ‰| «       y rs   )Ú_portable_mcp_serversr	  Ú_portable_mcp_server_pluginsÚ
unregister)rV   rL  rN  r™   s    €€€r)   Úreleasez8PluginLoaderMixin._load_portable_plugin.<locals>.releaseI  sE   ø€ Ø×2Ñ2×6Ñ6°t¸TÔBØ×9Ñ9×=Ñ=¸dÀDÔIØ#×.Ñ.¨tÔ4Ù'¨Õ-r(   Úportable_mcpTzAgent Plugin '%s' disabled: %s)rV   r€   rZ   r[   )-r¯   r   r   Úhermes_cli.agent_pluginsrK  r   r©   r   Úskill_namespaceÚdiagnosticsr<   r=   r¼   ÚmessageÚskillsÚregister_skillrV   Úskill_mdÚdescriptionÚfrontmatterr>   rL  rM  Úhermes_platformrN  Úmcp_serversÚitemsr   rQ  rR  r6   r8   Úserver_declarationsr  ÚlivenessrM   r4  r­   rN   r	  rS  r~   r�   r  r°   )r™   rª   rµ   r   r´   rK  Úpackagere   Ú
diagnosticÚskillrO   rM  rÙ   Úserver_namerù   Úinternal_nameÚserver_declrT  rL  rN  s   `                 @@r)   r  z'PluginLoaderMixin._load_portable_plugin'  sç  ú€ å4Ü! (Ó+ˆ
ð/	WÝBÙ'Ü�X—]‘]Ó#¤_Ó%6¸Ñ%FÈ×IaÑIaÑ%aócˆGá ¨$Ó/ˆCØ%×1Ñ1ò o�
Ü—‘Ð;¸ZÈ×IYÑIYÐ[e×[mÑ[mÕnðoà Ÿ™ò l�ðlØ×&Ñ& u§z¡z°5·>±>À5×CTÑCTÐV[×VgÑVgÕhðl÷
 PÝ3Ø$&ˆJðØ+2×+>Ñ+>×+DÑ+DÓ+Fò 5Ñ'�K Ü$<¸ZÈÓ$U�MØ$¨×(BÑ(BÑBÜŸ™ð  (IØ'1°=À$×BcÑBc×BgÑBgÐhuÐwzÓB{ô}à Ü@DÀVÃ�D×.Ñ.¨}Ñ=ØGQ�D×5Ñ5°mÑDØ")×"=Ñ"=×"AÑ"AÀ+Ó"N�KØ"Ð.Ø#×,Ñ,¨]¸K×<SÑ<SÔTÙ% m°[×5IÑ5IÔJØ×%Ñ% mÕ4ð5ð &0ò _�MØ,9÷ .ð .ð ×,Ñ,¨X°~À}ÐV]Õ^ð_ð "&�•ð %+ˆ�‰�jÒ!øôM !ò lÜ—N‘NÐ#MÈzÐ[`×[eÑ[eÐgj×kÒkûðlûô8 !ò Ø%/ò 3�MØ×.Ñ.×2Ñ2°=À$ÔGØ×5Ñ5×9Ñ9¸-ÈÔNØ×*Ñ*¨=Ô9Ù# MÕ2ð	3ð
 ðûô œ:Ð&ò 	WÜ+¨CÓ0ˆFŒLÜ�N‰NÐ;¸ZÈÏÉ×VÑVûð	WúsV   –BK Â&<H%Ã"K Ã5DI È%	IÈ."IÉK ÉIÉK ÉA#KËK ËLË1L	Ì	Lc                ó¢  — t        |«      j                  dd«      j                  dd«      }t        › d|› �}t        5  t        j                  || j                  «      | j                  k(  r|cddd«       S t        j                  | j                  j                  d«      «      j                  «       dd }|› d	|› �cddd«       S # 1 sw Y   yxY w)
z¶Profile-safe import namespace for a directory plugin: the bare ``hermes_plugins.<slug>`` for the
        first scope that claims it, a ``__home_<digest>`` suffix for any other scope.ú/Ú__ú-Ú_ri   Nzutf-8é   Ú__home_)r   ÚreplaceÚ
_NS_PARENTÚ_MODULE_NAMESPACE_LOCKr   Ú
setdefaultrÊ   ÚhashlibÚsha256ÚencodeÚ	hexdigest)r™   rª   ÚslugÚ	bare_nameÚdigests        r)   Ú_directory_module_namez(PluginLoaderMixin._directory_module_name]  s¹   € ô ˜HÓ%×-Ñ-¨c°4Ó8×@Ñ@ÀÀcÓJˆÜ!�l ! D 6Ð*ˆ	Ü#ñ 	1Ü!×,Ñ,¨Y¸¿¹ÓGÈ4Ï>É>ÒYØ ÷	1ñ 	1ô —^‘^ D§N¡N×$9Ñ$9¸'Ó$BÓC×MÑMÓOÐPSÐQSÐTˆFØ�[ ¨ xÐ0÷		1÷ 	1ò 	1ús   ½/CÁ6ACÃCc                óÌ   — |j                   dk(  rE|j                  r9t        |j                  «      j                  d«      d   j	                  «       }|r|S | j                  |«      S )z?Return the module prefix whose callbacks inherit plugin policy.Ú
entrypointú:r   )r
  r©   r€   Ú	partitionr‡   r|  )r™   rª   rm   s      r)   r  z%PluginLoaderMixin._policy_module_nameh  sU   € à�?‰?˜lÒ*¨x¯}ª}Ü˜hŸm™mÓ,×6Ñ6°sÓ;¸AÑ>×DÑDÓFˆKÙØ"Ð"Ø×*Ñ*¨8Ó4Ð4r(   Nr  c               óô  — t        |j                  «      }|dz  }|j                  «       st        d|› �«      ‚t        t
        j                  vrBt        j                  t        «      }g |_	        t        |_
        |t
        j                  t        <   |xs | j                  |«      }t        |«       t        j                  j                  ||t!        |«      g¬«      }|�|j"                  €t%        d|› �«      ‚t        j                  j'                  |«      }||_
        t!        |«      g|_	        |t
        j                  |<   	 |j"                  j)                  |«       |S # t*        $ r t        |«       ‚ w xY w)z—Import a directory plugin as ``hermes_plugins.<slug>`` (slug from ``manifest.key`` so
        ``image_gen/openai`` cannot collide with ``tts/openai``).z__init__.pyzNo __init__.py in )Úsubmodule_search_locationszCannot create module spec for )r   r©   ÚexistsÚFileNotFoundErrorrr  rj   rk   r  r  Ú__path__Ú__package__r|  rp   rˆ   ÚutilÚspec_from_file_locationr€   ÚloaderÚImportErrorÚmodule_from_specÚexec_modulerN   )r™   rª   rm   ræ   Ú	init_fileÚns_pkgÚspecrâ   s           r)   rá   z(PluginLoaderMixin._load_directory_modulep  sP  € ô
 ˜(Ÿ-™-Ó(ˆ
Ø Ñ.ˆ	Ø×ÑÔ!Ü#Ð&8¸¸Ð$EÓFÐFÜœSŸ[™[Ñ(Ü×%Ñ%¤jÓ1ˆFØ ˆFŒOÜ!+ˆFÔØ&,ŒC�K‰Kœ
Ñ#Ø!ÒJ T×%@Ñ%@ÀÓ%Jˆô
 	�{Ô#Ü�~‰~×5Ñ5Ø˜ÄÀJÃÐ?Pð 6ó Rˆàˆ<˜4Ÿ;™;Ð.ÜÐ >¸y¸kÐJÓKÐKÜ—‘×0Ñ0°Ó6ˆØ(ˆÔÜ˜z›?Ð+ˆŒØ#)Œ�‰�KÑ ð	Ø�K‰K×#Ñ# FÔ+ð ˆøô ò 	ô ˜;Ô'Øð		ús   ÅE! Å!E7c                óú   — t        t        j                  j                  «       t        «      D ]-  }|j
                  |j
                  k(  sŒ|j                  «       c S  t        d|j
                  › dt        › d�«      ‚)z¾Load a pip-installed plugin via its entry-point reference: the module for a bare ``module`` target,
        the referenced attribute (normally ``register``) for the ``module:function`` form.zEntry point 'z' not found in group 'rî   )r   rˆ   r‰   Úentry_pointsr   rV   ÚloadrŠ  )r™   rª   Úeps      r)   r  z)PluginLoaderMixin._load_entrypoint_module•  sj   € ô ,¬I×,>Ñ,>×,KÑ,KÓ,MÔOaÓbò 	!ˆBØ�w‰w˜(Ÿ-™-Ó'Ø—w‘w“yÒ ð	!ô ˜M¨(¯-©-¨Ð8NÔOaÐNbÐbcÐdÓeÐer(   )r”   z%Callable[[List[Dict[str, Any]]], Any]rZ   zCallable[[], None])r¢   Ú	frozensetrZ   r[   )rª   r   rZ   r€   )rª   r   rZ   r[   )rª   r   r´   r€   rZ   r,   )rª   r   rµ   r   rZ   r[   )rª   r   rm   r€   rZ   r[   )rµ   r   rd   r€   r"  ÚintrZ   r[   )rª   r   rm   zOptional[str]rZ   ztypes.ModuleType)rª   r   rZ   z+Union[types.ModuleType, Callable[..., Any]])r#   r$   r%   rš   r¥   Ústaticmethodr«   r¶   rx   r±   r³   rõ   rþ   r²   rÀ   r  r  r  r|  r  rá   r  r'   r(   r)   r�   r�   ¹   sÂ   „ óó4\ð òCó ðCóAð  òó ðó>Vóp^ó(Gó*/ó
V+ópjð&
Ø"ð
Ø03ð
ØILð
à	ó
ó44+ól	1ó5ð IMñ#Ø&ð#Ø8Eð#à	ó#ôJfr(   r�   r  )rZ   r9   rY   )rd   r€   re   z'PluginContext'rQ   zCallable[[], Any]rZ   r	   )rm   r€   rZ   r[   )rz   r   )rO   rN   rZ   r€   )rŒ   r€   rZ   zOptional[bool])Jr&   Ú
__future__r   r^   ru  rˆ   Úimportlib.metadataÚimportlib.utilÚloggingr…   rj   r\   r  Ú
contextlibr   Ú	functoolsr   Úpathlibr   Útypingr   r	   r
   r   r   r   r   r   Úhermes_constantsr   r   r   Úregistration_lifecycler   Úhermes_cli.plugins_discoveryr   r   r  r   r   r   r   Úhermes_cli.plugins_stater   r¯   r   r   Ú	getLoggerr<   rr  ÚRLockrs  r   Ú__annotations__r4   r?   rH   r    ÚLockrE   Úlocalr.   r>   r"   r/   rC   rJ   rg   rp   rx   r|   r�   rŽ   r�   r'   r(   r)   ú<module>r¨     s"  ðòõ #ã Û Û Û Û Û Û 	Û 
Û Û Ý %Ý Ý ß U× UÓ Uç bÑ bÝ :ß Vß vÓ vÝ ;áß>à	ˆ×	Ñ	Ð/Ó	0€à€
Ø(˜Ÿ™Ó*Ð Ø%'Ð �NÓ 'ð Ð ØÐ ØÐ Ø-/Ð Ð*Ó /Ø(˜)Ÿ.™.Ó*Ð Ø!�)—/‘/Ó#€ôe˜	ô eó;ó
ó2ó"óJòð ò*ó ð*óó÷bfò bfr(   