Behavior-neutral structural pass over tools/*: god-file extractions into sibling modules (file_operations_common/lint/search, file_tools_paths/ read_tracking/write, code_execution_env/rpc, tool_search_catalog/names/ validation, tts_command_provider, ...), duplicate helper unification, if/elif -> dispatch tables, dead-code removal, docstring compaction. Tool schemas (get_tool_definitions) verified byte-identical to base.
23 lines
832 B
Python
23 lines
832 B
Python
#!/usr/bin/env python3
|
|
"""Close the Hermes desktop GUI's preview pane, or one of its tabs.
|
|
|
|
Registration moved into `desktop_preview`; kept for its ``preview.close`` action. The
|
|
renderer drops the matching tab — or the whole pane when no url is given — for the
|
|
window that asked, never a background session's view.
|
|
"""
|
|
|
|
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},
|
|
)
|