+
    .pÐjº(  ã                  ó  € 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HtHtHt ^ RIHt ]! 0 Rm4      tR R lt]	 ! R	 R
4      4       t]	 ! R R4      4       t]	 ! R R4      4       t ! R R]4      t ! R R]4      tR# )aƒ  Abstract backend interface for computer use. Any implementation (cua-driver over MCP, a plugin
driver, the test noop) returns the shapes below. All methods are synchronous; async is handled inside
the backend implementation if needed. :class:`ComputerUseProvider` is the factory a provider plugin
registers (see :mod:`plugins.computer_use`); ``computer_use.backend`` selects exactly one.)ÚannotationsN)ÚABCÚabstractmethod)Ú	dataclassÚfield)ÚAnyÚDictÚListÚOptionalÚTuple)ÚProviderBasec               ó    € V ^8„  d   QhRRRR/# )é   ÚrawÚbytesÚreturnúOptional[tuple[int, int]]© )Úformats   "Ú)/opt/hermes/tools/computer_use/backend.pyÚ__annotate__r      s   € ÷ ñ  Uð Ð/Hñ ó    c                óš  € V P                  R4      '       dG   \        V 4      ^8¼  d7   \        P                  ! RV R,          4      w  r\	        V4      \	        V4      3# V P                  R4      '       EdV   \        V 4      ^8”  EdE   ^pV^	,           \        V 4      8  Ed+   W,          ^ÿ8w  d   V^,          pK0  W^,           ,          V^,           r4V^ÿ8X  d#   V\        V 4      8  d   W,          V^,           r4K)  VR9   d   Ky  V^Ú8X  g   V^,           \        V 4      8”  d    R# \        P                  WV^,            R4      pV^8  g   W5,           \        V 4      8”  d    R# V\        9   dT   V^8¼  dM   \        P                  W^,           V^,            R4      \        P                  W^,           V^,            R4      3# W5,          pEKB  R# )zÐ(width, height) for PNG / JPEG bytes, or None when unreadable. PNG: IHDR. JPEG: walk
segments (skipping 0xFF fill bytes) to the first SOF marker; stop at SOS. Used by the
tool layer's provider min-size guard.s   ‰PNG

z>II:é   é   Ns   ÿØÚbigN>   éØ   éÙ   )Ú
startswithÚlenÚstructÚunpackÚintÚ
from_bytesÚ_JPEG_SOF_MARKERS)r   ÚwidthÚheightÚiÚmarkerÚsegment_lens   &     r   Úimage_dimensions_from_bytesr*      sv  € ð ‡~�~Ð*×+Ò+´°C³¸B´ÜŸš e¨S°­ZÓ8‰ˆÜ�5‹zœ3˜v›;Ð&Ð&Ø
‡~�~�k×"Ó"¤s¨3£x°!¥|ØˆØ�!�e”c˜#“hÕØ�v˜Œ~Ø�Q•�ÙØ �E�
 A¨¥E�AØ˜D”. Q¬¨S«¤\Ø�F A¨¥EšØ˜Ô%ÙØ˜Œ~  Q¥¬¨S«Ô!1Øñ ô Ÿ.™.¨¨q°1­u¨°uÓ=ˆKØ˜QŒ !¥/´C¸³HÔ"<Øñ ð Ô*Ô*¨{¸aÔ/?Ü—~‘~ c¨a­%°°AµÐ&6¸Ó>ÄÇÁÈsÐWXÕSXÐYZÐ]^ÕY^ÐO_ÐafÓ@gÐgÐgØÕ‹AÙr   c                  ó    € ] tR t^/t$ RtR]R&   R]R&   RtR]R&   RtR]R	&   RtR]R
&   ^ t	R]R&   ^ t
R]R&   ]! ]R7      tR]R&   RtR]R&   RtR# )Ú	UIElementz/One interactable element on the current screen.r"   ÚindexÚstrÚroleÚ Úlabelztuple[int, int, int, int]ÚboundsÚappÚpidÚ	window_id©Údefault_factoryúdict[str, Any]Ú
attributesNúOptional[str]Úelement_tokenr   )é    r<   r<   r<   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r1   r2   r3   r4   r5   r   Údictr9   r;   Ú__static_attributes__r   r   r   r,   r,   /   sZ   ‡ á9àƒJØ
ƒIØ€Eˆ3ƒOØ(4€FÐ%Ó4Ø€CˆƒMØ€CˆƒLØ€IˆsÓÙ!&°tÔ!<€J�Ó<ð $(€M�=×'r   r,   c                  ó¸   € ] tR t^At$ RtR]R&   R]R&   R]R&   RtR]R	&   ]! ]R
7      t	R]R&   Rt
R]R&   RtR]R&   ^ tR]R&   RtR]R&   RtR]R&   ^ tR]R&   RtR# )ÚCaptureResultuø   Result of a screen capture call. mode="vision" â†’ png_b64 only; mode="ax" â†’ elements
only; mode="som" (default) â†’ both: the PNG already carries numbered overlays drawn by
the backend and `elements` holds the matching index â†’ element mapping.r.   Úmoder"   r%   r&   Nr:   Úpng_b64r6   zlist[UIElement]Úelementsr0   r3   Úwindow_titleÚpng_bytes_lenÚimage_mime_typeÚnoteÚax_max_elementsr   )r=   r>   r?   r@   rA   rB   rH   r   ÚlistrI   r3   rJ   rK   rL   rM   rN   rD   r   r   r   rF   rF   A   sr   ‡ ñPð ƒIØƒJØƒKØ!€Gˆ]Ó!Ù %°dÔ ;€HˆoÓ;Ø€CˆƒMØ€L�#ÓØ€M�3Óð &*€O�]Ó)ð €Dˆ#ƒNð €O�S×r   rF   c                  óÊ   € ] tR t^[t$ RtR]R&   R]R&   RtR]R&   RtR	]R
&   ]! ]	R7      t
R]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR# )ÚActionResultuL  Result of any action (click / type / scroll / drag / key / wait). ``ok`` is
tool/transport success only â€” NOT the semantic verdict; read ``effect`` / ``escalation``
(cua-driver's structured verdict) to pick the next rung of the verify â†’ escalate ladder.
Structured fields are optional and additive: an older driver that omits
``structuredContent`` leaves them ``None``, behavior unchanged.

Beyond the transport-level ``ok`` flag, this carries cua-driver's structured action verdict so the model
can follow the documented verify â†’ escalate ladder (NousResearch/hermes-agent#67052).
ÚboolÚokr.   Úactionr0   ÚmessageNzOptional[CaptureResult]Úcapturer6   r8   ÚmetazOptional[bool]Úverifiedr:   ÚeffectzOptional[dict[str, Any]]Ú
escalationÚpathÚdegradedÚdelivery_modeÚcoder   )r=   r>   r?   r@   rA   rB   rU   rV   r   rC   rW   rX   rY   rZ   r[   r\   r]   r^   rD   r   r   r   rQ   rQ   [   s~   ‡ ñð 	ƒHØƒKØ€GˆSÓØ'+€GÐ$Ó+Ù °Ô6€Dˆ.Ó6Ø#€HˆnÓ#Ø €FˆMÓ à+/€JÐ(Ó/Ø€Dˆ-ÓØ#€HˆnÓ#Ø#'€M�=Ó'Ø€Dˆ-×r   rQ   c                  óÆ  € ] tR t^vtRt]R R l4       t]R R l4       t]R R l4       t]R/R	 R
 ll4       t	]RRRRRRRRR^RRRRRR/R R ll4       t
]RRRRRRRRRRRRRRRR/R R ll4       t]R^RRRRRRRRRRRR/R R ll4       t]RRRR/R  R! ll4       t]RRRR/R" R# ll4       t]R$ R% l4       tR& R' lt]R0R( R) ll4       t]R1R* R+ ll4       tR, R- ltR.tR# )2ÚComputerUseBackenda¯  Lifecycle: `start()` before first use, `stop()` at shutdown. Pointer/keyboard actions
take ``delivery_mode`` (background (default) | foreground) and ``bring_to_front``;
``button`` is left | right | middle; ``modifiers`` a list of key names. ``element`` args
are 1-based SOM indices from a prior capture. `direction` is up | down | left | right and
`amount` is wheel ticks; `keys` is a combo such as 'cmd+s', 'ctrl+alt+t', 'return'.c               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner   )r   s   "r   r   ÚComputerUseBackend.__annotate__~   s   € × Ñ �tÑ r   c                	ó   € R # ©Nr   ©Úselfs   &r   ÚstartÚComputerUseBackend.start}   s   € Ù r   c               ó   € V ^8„  d   QhRR/# rb   r   )r   s   "r   r   rd   �   s   € ×Ñ�dÑr   c                	ó   € R # rf   r   rg   s   &r   ÚstopÚComputerUseBackend.stop€   s   € Ùr   c               ó   € V ^8„  d   QhRR/# ©r   r   rR   r   )r   s   "r   r   rd   „   s   € ×'Ñ'˜dÑ'r   c                	ó   € R # rf   r   rg   s   &r   Úis_availableÚComputerUseBackend.is_availableƒ   s   € Ù$'r   Nc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r   rG   r.   r3   r:   r4   úOptional[int]r5   r   rF   r   )r   s   "r   r   rd   ‡   s8   € ÷ Gñ G˜Cð G¨mð GÈð GØ(ðGØ4AñGr   c                	ó   € R # rf   r   )rh   rG   r3   r4   r5   s   &&&&&r   rV   ÚComputerUseBackend.capture†   s   € áCFr   ÚelementÚxÚyÚbuttonÚleftÚclick_countÚ	modifiersr]   Úbring_to_frontFc               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRR/	# )r   rx   ru   ry   rz   r{   r.   r}   r"   r~   úOptional[list[str]]r]   r:   r   rR   r   rQ   r   )r   s   "r   r   rd   ‹   s]   € ÷ fñ f ð f¸ð fÐR_ð fØðfØ14ðfØEXðfà*ðfàCGðfàT`ñfr   c               	ó   € R # rf   r   )	rh   rx   ry   rz   r{   r}   r~   r]   r   s	   &$$$$$$$$r   ÚclickÚComputerUseBackend.clickŠ   s	   € ñ cfr   Úfrom_elementÚ
to_elementÚfrom_xyÚto_xyc               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRR/	# )r   r…   ru   r†   r‡   r   rˆ   r{   r.   r~   r�   r]   r:   r   rR   r   rQ   r   )r   s   "r   r   rd   �   sg   € ÷ eñ e Mð eÀmð eØ/ðeØ?Xðeàðeà.Aðeð *ðeð CGðeð T`ñer   c               	ó   € R # rf   r   )	rh   r…   r†   r‡   rˆ   r{   r~   r]   r   s	   &$$$$$$$$r   ÚdragÚComputerUseBackend.drag�   s	   € ñ ber   Úamountc               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRR/	# )r   Ú	directionr.   r�   r"   rx   ru   ry   rz   r~   r�   r]   r:   r   rR   r   rQ   r   )r   s   "r   r   rd   –   s\   € ÷ gñ g 3ð g°ð gÀ-ð gØðgØ+8ðgØL_ðgà+ðgàDHðgàUañgr   c               	ó   € R # rf   r   )	rh   r�   r�   rx   ry   rz   r~   r]   r   s	   &$$$$$$$$r   ÚscrollÚComputerUseBackend.scroll•   s	   € ñ dgr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Útextr.   r]   r:   r   rR   r   rQ   r   )r   s   "r   r   rd   ›   s0   € ÷ Eñ E˜cð E°]ð EØ"&ðEØ3?ñEr   c               	ó   € R # rf   r   )rh   r”   r]   r   s   &&$$r   Ú	type_textÚComputerUseBackend.type_textš   s   € áADr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Úkeysr.   r]   r:   r   rR   r   rQ   r   )r   s   "r   r   rd   Ÿ   s   € ×wÑw˜Ðw¨}ÐwÐUYÐwÐfrÑwr   c               	ó   € R # rf   r   )rh   r™   r]   r   s   &&$$r   ÚkeyÚComputerUseBackend.keyž   s   € Ùtwr   c               ó   € V ^8„  d   QhRR/# ©r   r   zlist[dict[str, Any]]r   )r   s   "r   r   rd   ¢   s   € ×4Ñ4Ð/Ñ4r   c                	ó   € R # rf   r   rg   s   &r   Ú	list_appsÚComputerUseBackend.list_apps¡   s   € Ù14r   c               ó   € V ^8„  d   QhRR/# rž   r   )r   s   "r   r   rd   ¤   s   € ÷ ñ Ð2ñ r   c                ó   € . # )zžVisible native windows with PID and window identifiers. Optional compatibility hook: backends that
predate window discovery stay instantiable and report none.r   rg   s   &r   Úlist_windowsÚComputerUseBackend.list_windows¤   s	   € ð ˆ	r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r3   r.   Úraise_windowrR   r   rQ   r   )r   s   "r   r   rd   ª   s   € ×RÑR˜SÐR°ÐRÀÑRr   c                	ó   € R # rf   r   )rh   r3   r§   s   &&&r   Ú	focus_appÚComputerUseBackend.focus_app©   s   € ÙORr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úvaluer.   rx   ru   r   rQ   r   )r   s   "r   r   rd   ­   s   € ×WÑW˜sÐW¨]ÐWÀlÑWr   c                	ó   € R # rf   r   )rh   r¬   rx   s   &&&r   Ú	set_valueÚComputerUseBackend.set_value¬   s   € ÙTWr   c               ó    € V ^8„  d   QhRRRR/# )r   ÚsecondsÚfloatr   rQ   r   )r   s   "r   r   rd   ¯   s   € ÷ Vñ V˜Eð V lñ Vr   c           	     	ó|   € \         P                  ! \        R \        VR4      4      4       \	        RRRVR R2R7      # )g        g      >@TÚwaitzwaited z.2fÚs)rS   rT   rU   )ÚtimeÚsleepÚmaxÚminrQ   )rh   r±   s   &&r   r´   ÚComputerUseBackend.wait¯   s7   € Ü�
Š
”3�sœC ¨Ó.Ó/Ô0Ü˜t¨F¸gÀgÈcÀ]ÐRSÐ<TÔUÐUr   r   )ÚsomNNN)Frf   )r=   r>   r?   r@   rA   r   ri   rm   rr   rV   rƒ   r‹   r‘   r–   r›   r    r¤   r©   r®   r´   rD   r   r   r   r`   r`   v   sÚ  † ñ[ð Ü ó Ø àÜó ØàÜ'ó Ø'àöGó ðGð ðf°ð fÈð fÐbfð fØ"ðfØ78ðfØ[_ðfà-1ðfàJOöfó ðfð ðe°Dð eÐVZð eØ26ðeØ[_ðeà!ðeàDHðeð -1ðeð JOöeó ðeð
 ðg°að gÐRVð gØ"&ðgØ;?ðgØbfðgà.2ðgàKPögó ðgð ðEÀTð EØ).öEó ðEð Øw¸tÐwÐ\aÖwó ØwàÜ4ó Ø4õð
 ÞRó ØRàÞWó ØW÷Vñ Vr   r`   c                  óH   € ] tR t^´tRt]R R l4       tR R ltR R ltRt	R	# )
ÚComputerUseProvideraÜ  Factory for one computer_use driver, registered via ``ctx.register_computer_use_provider`` from a provider
plugin whose directory name is the ``computer_use.backend`` value (built-in: ``plugins/computer_use/cua``). Only
the selected provider is imported and instantiated. The model-facing tool schema is identical for every backend:
an action the driver cannot perform returns ``ActionResult(ok=False, code="unsupported_action", message=...)``
rather than changing the schema.c               ó    € V ^8„  d   QhRRRR/# )r   Úpermission_moder.   r   r`   r   )r   s   "r   r   Ú ComputerUseProvider.__annotate__¼   s   € ÷ jñ j°ð jÐ9Kñ jr   c               ó   € R# )z¹A fresh, unstarted backend for one Hermes session (the tool calls ``start()``/``stop()``).
``permission_mode`` is ``standard`` | ``bounded`` | ``unrestricted`` (approval bypass active).Nr   )rh   r¿   s   &$r   Úcreate_backendÚ"ComputerUseProvider.create_backend»   s   ‚ r   c               ó   € V ^8„  d   QhRR/# rp   r   )r   s   "r   r   rÀ   À   s   € ÷ ñ ˜dñ r   c                ó   € R# )zXUsable on this host right now (the tool's ``check_fn``). Cheap: no network, no spawning.Tr   rg   s   &r   rr   Ú ComputerUseProvider.is_availableÀ   s   € ár   c               ó   € V ^8„  d   QhRR/# )r   r   ru   r   )r   s   "r   r   rÀ   Ä   s   € ÷ ñ ˜ñ r   c                ó   € R# )zŒ``hermes computer-use doctor`` for this backend: print findings, return the exit code.
``None`` (default) means the backend ships no doctor.Nr   rg   s   &r   ÚdoctorÚComputerUseProvider.doctorÄ   s   € ñ r   r   N)
r=   r>   r?   r@   rA   r   rÂ   rr   rÉ   rD   r   r   r   r½   r½   ´   s,   † ñ(ð ôjó ðjõ÷ñ r   r½   >   éÀ   éÁ   éÂ   éÃ   éÅ   éÆ   éÇ   éÉ   éÊ   éË   éÍ   éÎ   éÏ   )rA   Ú
__future__r   r    r¶   Úabcr   r   Údataclassesr   r   Útypingr   r   r	   r
   r   Úagent.provider_baser   Ú	frozensetr$   r*   r,   rF   rQ   r`   r½   r   r   r   Ú<module>rÞ      sœ   ðñ^õ
 #ã Û ß #ß (ß 3Õ 3å ,áÒlÓmÐ õð: ÷(ð (ó ð(ð" ÷ð ó ðð2 ÷ð ó ðô4;V˜ô ;Vô|˜,ö r   