Files
skill-template/tools/ui_inspector/drivers/base.py
chendelian 633ecff4e2 chore: archive tools/ui_inspector snapshot before migration removal.
Keep the last in-template copy on main so history can restore it; product continues in jiangchang-ui-recorder.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 11:19:14 +08:00

39 lines
1.0 KiB
Python

"""Driver protocol: dump one step's UI tree for a surface."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Optional, Protocol
@dataclass
class DumpResult:
surface: str
driver: str
window: dict[str, Any]
tree: dict[str, Any]
index: list[dict[str, Any]]
locatable: list[dict[str, Any]]
stats: dict[str, Any]
selection: dict[str, Any] = field(default_factory=dict)
url: str = ""
page_title: str = ""
locatable_text: str = ""
tree_text: str = ""
screenshot_bytes: Optional[bytes] = None # if set, artifacts write screen.png from bytes
use_hwnd_screenshot: bool = True # windows: ImageGrab by hwnd
class SurfaceDriver(Protocol):
def dump(
self,
*,
info: Any,
selection_meta: dict[str, Any],
max_depth: int = 16,
max_nodes: int = 8000,
warmup_mode: str = "full",
merge_same_pid_if_sparse: bool = True,
warmed_pids: Optional[set[int]] = None,
) -> DumpResult: ...