Files
hermes-agent/tools/close_preview_tool.py
Teknium 5442a2a371 refactor(tools): trim small tool modules (docstrings, dead constant, prefix table)
- audio_container: CONTAINER_TO_EXT built from one tuple; fixed-prefix sniffs table-driven.
- apply_layout_tool: dead _TIMEOUT_NOTE indirection inlined.
- Module/function docstrings compacted by hand; regexes, byte patterns, schemas and
  registry.register kwargs byte-identical (SCHEMA_SAME verified).
2026-09-02 22:36:16 -07:00

16 lines
724 B
Python

"""Close the Hermes desktop GUI's preview pane, or one tab (``preview.close``).
Registration lives in `desktop_preview`. The renderer drops the matching tab — or
the whole pane when no url is given — only for the window that asked."""
from tools import desktop_ui
from tools.open_preview_tool import _normalize_target
def close_preview_tool(url: str = "") -> str:
"""Ask the desktop GUI to close the preview pane, or the tab for ``url``."""
target = _normalize_target(url or "")
return desktop_ui.emit_or_error(
"preview.close", {"url": target}, "Failed to close the preview pane: ",
"The preview pane is only available in the Hermes desktop app.", {"success": True, "url": target},
)