Ë
    ãß²jÏ  ã            
       óî   — d Z ddlmZ ddlmZmZ ddlmZmZ d"de	de	fd„Z
d„ d	„ d
„ dœZd„ Zddddg d¢dœdddœdddœdddœdddœdœdgdœdœZ ej                  ddeed¬«       ddlZd"de	d e	de	fd!„Zy)#u�  The `desktop_preview` tool â€” the preview pane beside the chat, as ONE tool.

open/close/read used to be three tools that each re-taught "the preview pane" world;
one action enum states it once (~576 -> ~210 schema tokens). action=read keeps its
agent-level callback dispatch (agent_runtime_helpers -> agent.read_preview_callback).
Lives in the ``desktop_ui`` toolset â€” desktop-app sessions only.
é    )Ú
desktop_ui)Ú_normalize_targetÚopen_preview_tool)ÚregistryÚ
tool_errorÚurlÚreturnc           	      ód   — t        | xs d«      }t        j                  dd|iddd|xs ddœ«      S )	NÚ zpreview.closer   zFailed to close the preview: z=The preview pane is only available in the Hermes desktop app.TÚall)ÚsuccessÚclosed)r   r   Úemit_or_error)r   Útargets     ú7/home/ubuntu/.hermes/hermes-agent/tools/preview_tool.pyÚpreview_closer      s?   € Ü˜sšy bÓ)€FÜ×#Ñ#ØØ	�ˆØ'ØGØ F¢O¨eÑ4óð ó    c                 ó\   — t        | j                  dd«      | j                  dd«      ¬«      S )Nr   r   Úlabel©r   r   )r   Úget©Úargss    r   ú<lambda>r      s&   € Ô*¨t¯x©x¸¸rÓ/BÈ$Ï(É(ÐSZÐ\^ÓJ_Ô`€ r   c                 ó:   — t        | j                  dd«      ¬«      S )Nr   r   )r   )r   r   r   s    r   r   r      s   € œ-¨D¯H©H°U¸BÓ,?Ô@€ r   c                 ó   — t        d«      S )NzFpreview read must run inside a desktop session (no GUI callback here).)r   r   s    r   r   r      s   € œØPóR€ r   )ÚopenÚcloseÚreadc                 ó˜   — t         j                  | j                  d«      xs dj                  «       «      }|€t        d«      S  || «      S )zDNon-read actions only: action=read is dispatched at the agent level.Úactionr   z)action must be one of: open, close, read.)Ú_ACTIONSr   Ústripr   )r   ÚkwÚfns      r   Ú_handle_previewr&   #   sA   € ä	�‰�t—x‘x Ó)Ò/¨R×6Ñ6Ó8Ó	9€BØ	€zÜÐEÓFÐFÙˆd‹8€Or   Údesktop_previewuú  Open, close, or read the preview pane beside the chat. open: show a web URL (bare domains fine), a localhost dev server, or a file path (HTML renders live) â€” opens for the current window only. close: dismiss the whole pane, or one tab via url. read: what the pane currently shows â€” returns {kind, url, title, text, start, end, total_chars}; a Browser tab's text is the rendered page's visible text, paged with start/count (char offsets); a file tab answers identity only (read the file with read_file).ÚobjectÚstring)ÚtypeÚenumz;open: the target. close: one tab (omit for the whole pane).)r*   Údescriptionzopen: optional tab label.Úintegerzread: 0-indexed char offset.z(read: chars to return (capped per read).)r!   r   r   ÚstartÚcountr!   )r*   Ú
propertiesÚrequired)Únamer,   Ú
parametersr   u   ðŸ–¼ï¸�)r2   ÚtoolsetÚschemaÚhandlerÚemojiNr   c                 ó   — t        | |¬«      S )Nr   )r   r   s     r   Úpreview_openr9   W   s   € Ü ¨EÔ2Ð2r   )r   )Ú__doc__Útoolsr   Útools.open_preview_toolr   r   Útools.registryr   r   Ústrr   r"   r&   ÚPREVIEW_SCHEMAÚregisterÚjsonr9   © r   r   ú<module>rC      sÛ   ðñõ ß Hß /ñ�sð  Có ñ aÙ@ñRñ	€òð ð	ð à'Ò1JÑKà Ø\ñð 'Ð7RÑSØ'Ð8VÑWØ'Ð8bÑcñ	
ð �Jññ€ð: €× Ñ Ø	ØØØØ
õó ñ3�cð 3 #ð 3¨sô 3r   