Ë
    ãß²jË  ã            	       óÜ   — d Z ddlmZmZ ddlmZ ddlmZmZ dee   de	de
fd„Z	 	 	 dd
ee   dee   dee   de
fd„ZddddddœdddœdœdœdœZ ej                  dded„ d¬«       dd	lZy	)ar  Read the in-app terminal pane in the Hermes desktop GUI.

The buffer lives in the desktop renderer (xterm.js), so this round-trips through the
gateway's blocking-prompt bridge (as `clarify` does): tui_gateway emits
``terminal.read.request``, the renderer answers ``terminal.read.respond``. Lives in the
``desktop_ui`` toolset, enabled only for desktop-sourced sessions.
é    )ÚCallableÚOptional)Úpassthrough_json)ÚregistryÚ
tool_errorÚcallbackÚerrorsÚreturnc                 ól  — | €t        |d   «      S 	 |D ���ci c]  \  }}}|€Œ
|t        |t        |«      «      “Œ! }}}}	  | di |¤Ž}|st        |d   «      S t        |«      S c c}}}w # t        t        f$ r t        |d   «      cY S w xY w# t
        $ r}t        |d   › |› �«      cY d}~S d}~ww xY w)zçShared body of the read_terminal / read_preview / read_window bridges. ``window`` is
    ``((key, value, floor), ...)`` (None omitted, else int-coerced and floored); ``errors`` =
    (not_desktop, not_integers, fail_prefix, empty).Nr   é   é   é   © )r   ÚmaxÚintÚ	TypeErrorÚ
ValueErrorÚ	Exceptionr   )	r   Úwindowr	   ÚkeyÚvalÚfloorÚkwargsÚrawÚexcs	            ú=/home/ubuntu/.hermes/hermes-agent/tools/read_terminal_tool.pyÚ	read_paner      sÑ   € ð ÐÜ˜& ™)Ó$Ð$ð%ØCI×]Ð]±°°S¸%ÈSÉ_�#”s˜5¤# c£(Ó+Ñ+Ð]ˆÒ]ð/ÙÑ ˜Ñ ˆñ Ü˜& ™)Ó$Ð$Ü˜CÓ Ð ùô ^øÜ”zÐ"ò %Ü˜& ™)Ó$Ò$ð%ûô ò /Ü˜V A™Y˜K¨ uÐ-Ó.Õ.ûð/úsD   ’A+ ˜A$¤A$¼A+ ÁB Á$A+ Á+BÂ
BÂ	B3ÂB.Â(B3Â.B3NÚ
start_lineÚcountc                 ó,   — t        |d| dfd|dffd«      S )zIReturn the in-app terminal's contents (+ line metadata) as a JSON string.Ústartr   r   r   )z:read_terminal is only available in the Hermes desktop app.z&start_line and count must be integers.zFailed to read terminal: z2No in-app terminal is open, or the read timed out.)r   ©r   r   r   s      r   Úread_terminal_toolr#   #   s.   € ô �X ¨*°aÐ 8¸7ÀEÈ1Ð:MÐNð Qó ð ó    Úread_terminalzÏRead the in-app terminal pane beside this chat. No args = visible screen + total_lines; page scrollback with start_line (0 = oldest) + count. JSON: {total_lines, start, end, viewport_rows, cursor_row, text}.ÚobjectÚintegerz?0-indexed first line (0 = oldest). Omit for the visible screen.)ÚtypeÚdescriptionzALines to read from start_line. Defaults to the visible row count.)r   r   )r(   Ú
properties)Únamer)   Ú
parametersÚ
desktop_uic                 óx   — t        | j                  d«      | j                  d«      |j                  d«      ¬«      S )Nr   r   r   r"   )r#   Úget)ÚargsÚkws     r   ú<lambda>r2   M   s/   € Ô1Ø—8‘8˜LÓ)°·±¸'Ó1BÈRÏVÉVÐT^ÓM_ô € r$   u   ðŸ–¥ï¸�)r+   ÚtoolsetÚschemaÚhandlerÚemoji)NNN)Ú__doc__Útypingr   r   Útools.desktop_uir   Útools.registryr   r   ÚtupleÚstrr   r   r#   ÚREAD_TERMINAL_SCHEMAÚregisterÚjsonr   r$   r   ú<module>r@      sÚ   ðñ÷ &å -ß /ð!˜ Ñ*ð !¸Eð !Àcó !ð( !%ØØ#'ñØ˜‘ðà�C‰=ðð �xÑ ðð 	ó	ð ð	ð ð "Ø`ñð
 "Øbññ	
ññÐ ð0 €× Ñ Ø	ØØñð õô r$   