§
    øžyjŸ	  ã                   óŠ   — d Z ddlZddlmZ ddlmZmZ dedefd„Zdd	d
ddddœidgdœdœZ	 ej
        dde	d„ d¬¦  «         dS )uÂ  Close a read-only agent terminal tab in the Hermes desktop GUI.

Each ``terminal(background=true)`` process is mirrored as a read-only tab in the
desktop's terminal pane. This tool lets the agent drop a tab it no longer needs
to show â€” WITHOUT killing the process (use ``process(action='kill')`` for that).
The output keeps buffering and the user can reopen the tab from the status stack.

It routes through the process registry's ``on_close`` sink, which the desktop
gateway wires to emit a ``terminal.close`` event the renderer handles. Like
``read_terminal`` it lives in the ``desktop_ui`` toolset, which the GUI gateway
enables only for desktop-sourced sessions, so it never appears outside the GUI.
é    N)Úprocess_registry)ÚregistryÚ
tool_errorÚ
process_idÚreturnc                 ó    — | pd                      ¦   «         }|st          d¦  «        S t          j        t	          j        |¦  «        d¬¦  «        S )zBAsk the desktop GUI to close a background process's read-only tab.Ú zCprocess_id is required (the background process whose tab to close).F)Úensure_ascii)Ústripr   ÚjsonÚdumpsr   Úrequest_close_terminal)r   Úpids     ú?/home/ragecks/.hermes/hermes-agent/tools/close_terminal_tool.pyÚclose_terminal_toolr      sR   € àÐ˜×
"Ò
"Ñ
$Ô
$€CØð aÝÐ_Ñ`Ô`Ð`åŒ:Õ&Ô=¸cÑBÔBÐQVÐWÑWÔWÐWó    Úclose_terminaluº  Close the read-only terminal tab for one of your background processes in the Hermes desktop GUI (the tabs mirroring terminal(background=true) runs). This does NOT kill the process â€” it only drops the tab/view; the output keeps buffering and the user can reopen it from the status stack. Use it to tidy up when a background process's live terminal is no longer worth showing. To actually stop the process, use process(action='kill') instead.ÚobjectÚstringz�The background process's session id (from terminal(background=true) output or process(action='list')) whose tab should be closed.)ÚtypeÚdescription)r   Ú
propertiesÚrequired)Únamer   Ú
parametersÚ
desktop_uic                 óJ   — t          |                      dd¦  «        ¬¦  «        S )Nr   r	   )r   )r   Úget)ÚargsÚkws     r   ú<lambda>r!   <   s!   € Õ2¸d¿hºhÀ|ÐUWÑ>XÔ>XÐYÑYÔY€ r   u   ðŸ–¥ï¸�)r   ÚtoolsetÚschemaÚhandlerÚemoji)Ú__doc__r   Útools.process_registryr   Útools.registryr   r   Ústrr   ÚCLOSE_TERMINAL_SCHEMAÚregister© r   r   ú<module>r-      sï   ððð ð €€€à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /ðX Cð X¨Cð Xð Xð Xð Xð ð	Uð àØ ðTðð ð
ð "�Nðð ðð Ð ð4 €Ô Ø	ØØ ØYÐYØ
ðñ ô ð ð ð r   