+
    jHàj9  ã                  óD  € R t ^ RIHt ^ RIt^ RIHt ^ RIHtHtH	t	H
t
 ^ RIHt ]'       d   ^ RIHt ]P                   ! ]4      tRt]! ]4      P*                  tR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]P<                  4      tR R lt R R lt!R# )a/  Computer-use provider discovery: bundled ``plugins/computer_use/<name>/`` (the built-in ``cua`` driver lives
here too) then user ``$HERMES_HOME/plugins/<name>/`` (bundled wins on collision). Exactly one provider is active:
``computer_use.backend`` in the active profile's config.yaml names its directory (default ``cua``), read per call.
Only that provider is imported; the others stay on disk, so a plugin that is installed but not selected is just an
option in ``hermes tools``. A configured name that resolves to nothing fails; there is no fallback driver.)ÚannotationsN)ÚPath)ÚTYPE_CHECKINGÚListÚOptionalÚTuple)Úplugin_loader©ÚComputerUseProviderÚcuaÚ_hermes_user_computer_usec               ó    € V ^8„  d   QhRRRR/# )é   Úpathr   ÚreturnÚbool© )Úformats   "ÚB/home/ubuntu/.hermes/hermes-agent/plugins/computer_use/__init__.pyÚ__annotate__r      s   € ÷ Yñ Y˜tð Y¨ñ Yó    c                óŽ   €  V R,          P                  RRR7      R,          pRT9   ;'       g    RT9   #   \         d     R# i ; i)	zRCheap text heuristic: ``__init__.py`` mentions the computer-use provider contract.z__init__.pyÚreplacez	utf-8-sig)ÚerrorsÚencoding:Ni    NFÚregister_computer_use_providerr
   )Ú	read_textÚOSError)r   Úsources   & r   Ú_is_computer_use_dirr      sW   € ðØ˜Õ&×1Ñ1¸È[Ð1ÓYÐZ_Õ`ˆð ,¨vÑ5×XÐXÐ9NÐRXÑ9XÐXøô ô Úðús   ‚!5 µAÁAc               ó   € V ^8„  d   QhRR/# )r   r   zlist[tuple[str, Path]]r   )r   s   "r   r   r   #   s   € ÷ ñ Ð3ñ r   c                 óJ  a€ \         P                  ! \        4       U u. uF  q P                  V 3NK  	  pp V UUu0 uF  w  r#VkK	  	  uppo\         P                  ! 4       pV'       d0   VP                  V3R l\         P                  ! V4       4       4       V# u up i u uppi )zM``(name, path)`` for bundled then user providers; bundled wins on collisions.c              3  óŒ   <"  € T F9  pVP                   S9  g   K  \        V4      '       g   K)  VP                   V3x € K;  	  R # 5i©N)Únamer   )Ú.0ÚchildÚseens   & €r   Ú	<genexpr>Ú&_iter_provider_dirs.<locals>.<genexpr>)   s=   øé € ð OÑ5W¨EØ—z‘z¨Ñ-ô (Ü2FÀu×2Mô (�U—Z‘Z Õ'Ó5Wùs   ƒA›A®A)Ú_loaderÚiter_plugin_dirsÚ_CU_PLUGINS_DIRr$   Úuser_plugins_dirÚextend)r&   Údirsr$   Ú_Úuser_dirr'   s        @r   Ú_iter_provider_dirsr2   #   s†   ø€ ä-4×-EÒ-EÄoÔ-VÓWÑ-V E�Z‰Z˜ÓÑ-V€DÐWÙ $Ô%¡‘W�T‹D¡Ò%€DÜ×'Ò'Ó)€HßØ�‰ô O´W×5MÒ5MÈhÔ5Wó Oô 	Oà€Kùò XùÛ%s
   žB»Bc               ó   € V ^8„  d   QhRR/# )r   r   zlist[tuple[str, str]]r   )r   s   "r   r   r   .   s   € ÷ eñ eÐ)>ñ er   c                 óv   € \        4        U Uu. uF  w  rV \        P                  ! V4      3NK  	  upp # u upp i )zW``[(name, description), ...]`` from plugin.yaml only: listing never imports a provider.)r2   r*   Úread_plugin_description)r$   r&   s     r   Údiscover_computer_use_providersr6   .   s1   € äNaÔNcÔdÑNc¹{¸tˆT”7×2Ò2°5Ó9Ó:ÑNcÒdÐdùÓds   Ž#5c               ó    € V ^8„  d   QhRRRR/# )r   r$   Ústrr   zOptional[Path]r   )r   s   "r   r   r   3   s   € ÷ Xñ X˜Cð X Nñ Xr   c                ó@   a € \        V 3R l\        4        4       R4      # )zNResolve a provider name to its directory (bundled first, then user-installed).c              3  ó>   <"  € T F  w  rVS8X  g   K  Vx € K  	  R # 5ir#   r   )r%   Úfoundr   r$   s   &  €r   r(   Ú$find_provider_dir.<locals>.<genexpr>5   s   øé € ÐPÑ)>™+˜%À%È4Á-—’Ó)>ùs   ƒ“
N)Únextr2   )r$   s   fr   Úfind_provider_dirr>   3   s   ø€ äÔPÔ)<Ô)>ÓPÐRVÓWÐWr   c               ó    € V ^8„  d   QhRRRR/# )r   r$   r8   r   úOptional[ComputerUseProvider]r   )r   s   "r   r   r   8   s   € ÷ >ñ > Sð >Ð-Jñ >r   c           	     ój   € \        V 4      pVf   R# \        P                  ! W\        RR\        R7      # )zdImport the named provider and return its ComputerUseProvider; None if not found or it fails to load.NzComputer-use providerÚprovider)ÚkindÚnounÚlogger)r>   r*   Ú
load_namedÚ_load_provider_from_dirrE   )r$   Úprovider_dirs   & r   Úload_computer_use_providerrI   8   s5   € ä$ TÓ*€LØÒÙÜ×Ò˜dÔ2IÐPgØ#-´fô>ð >r   c               ó    € V ^8„  d   QhRRRR/# )r   rH   r   r   r@   r   )r   s   "r   r   r   A   s   € ÷ "ñ "¨$ð "Ð3Pñ "r   c           	     ó6  € ^ RI Hp V P                  pV P                  \        8H  p\
        P                  ! V'       d   RV 2M
\         RV 2T R\        V'       d   RM\        R7      pT;'       d)    \
        P                  ! V\        4       RVV\        R7      # )	é    r	   zplugins.computer_use.Ú.N)ÚparentsrE   Úsynthetic_namespacerB   )Ú	collectorÚcollected_attrÚbase_clsr$   rE   )Úpluginszplugins.computer_use)Útools.computer_use.backendr
   r$   Úparentr,   r*   Úload_plugin_moduleÚ_USER_NAMESPACErE   Úinstance_from_moduleÚ_ProviderCollector)rH   r
   r$   Ú
is_bundledÚmods   &    r   rG   rG   A   s‘   € õ ?Ø×Ñ€DØ×$Ñ$¬Ñ7€JÜ
×
$Ò
$ß*4Ð
 ˜vÑ&¼_Ð<MÈQÈtÈfÐ:UÐWcØ3¼Fß$.™D´OôE€Cð ÷ "ð "”7×/Ò/ØÔ)Ó+¸JÐQdØœ&ô"ð "r   c                  ó&   € ] tR t^PtRtR tR tRtR# )rY   zEFake plugin context that captures ``register_computer_use_provider``.c                	ó   € R V n         R # r#   ©rB   )Úselfs   &r   Ú__init__Ú_ProviderCollector.__init__S   s	   € ØˆŽr   c                	ó   € Wn         R # r#   r^   )r_   rB   s   &&r   r   Ú1_ProviderCollector.register_computer_use_providerV   s   € Ø Žr   r^   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r`   r   Ú__static_attributes__r   r   r   rY   rY   P   s   † ÙOòö!r   rY   c               ó   € V ^8„  d   QhRR/# )r   r   r8   r   )r   s   "r   r   r   Z   s   € ÷ Tñ T ñ Tr   c                 ó  € ^ RI Hp  V ! 4       ;'       g    / P                  R4      ;'       g    / P                  R4      p\        V\        4      '       d'   VP                  4       '       d   VP                  4       # \        # )zT``computer_use.backend`` from the active profile's config.yaml (``cua`` when unset).)Úload_config_readonlyÚcomputer_useÚbackend)Úhermes_cli.configrl   ÚgetÚ
isinstancer8   ÚstripÚDEFAULT_BACKEND)rl   Úraws     r   Úconfigured_backend_nameru   Z   sZ   € å6á Ó"×(Ð( b×-Ñ-¨nÓ=×CÐCÀ×
HÑ
HÈÓ
S€CÜ$ S¬#×.Ò.°3·9±9·;²;ˆ3�9‰9‹;ÐSÄOÐSr   c               ó   € V ^8„  d   QhRR/# )r   r   r
   r   )r   s   "r   r   r   b   s   € ÷ 
ñ 
Ð0ñ 
r   c            	     óÎ   € \        4       p \        V 4      pVfL   RP                  R \        4        4       4      p\	        V 4      '       d   RMRp\        RV : RV RV R24      hV# )	zgThe one provider ``computer_use.backend`` selects; ``LookupError`` naming the available ones otherwise.z, c              3  ó*   "  € T F	  w  rVx € K  	  R # 5ir#   r   )r%   r;   r0   s   &  r   r(   Ú&get_active_provider.<locals>.<genexpr>g   s   é € ÐVÑ4U©¨�eÓ4Uùs   ‚z!could not be loaded (see the log)zis not installedzcomputer_use.backend is z!, but that computer-use provider z (available: zT). Install it under ~/.hermes/plugins/<name>/ or pick a backend with `hermes tools`.)ru   rI   Újoinr6   r>   ÚLookupError)r$   rB   Ú	availableÚstates       r   Úget_active_providerr~   b   s€   € ä"Ó$€DÜ)¨$Ó/€HØÒØ—I‘IÑVÔ4SÔ4UÓVÓVˆ	Ü7HÈ×7NÒ7NÑ3ÐTfˆÜØ& t¡hÐ.OÐPUÈwÐVcÐdmÐcnð o`ð `óað 	að €Or   )"rh   Ú
__future__r   ÚloggingÚpathlibr   Útypingr   r   r   r   rS   r   r*   rT   r
   Ú	getLoggerrd   rE   rs   Ú__file__rU   r,   rW   r   r2   r6   r>   rI   rG   ÚNoopPluginContextrY   ru   r~   r   r   r   Ú<module>r†      sŒ   ðñnõ #ã Ý ß 7Ó 7å ,çÝ>à	×	Ò	˜8Ó	$€à€Ù�x“.×'Ñ'€à-€õYõõeõ
Xõ
>õ"ô!˜×2Ñ2ô !õT÷
r   