feat: checkpoint device agent runtime milestones

This commit is contained in:
2026-07-06 17:24:03 +08:00
parent 2d4251e98e
commit 5658735bca
153 changed files with 8060 additions and 65 deletions
+36
View File
@@ -0,0 +1,36 @@
from __future__ import annotations
from dataclasses import dataclass
from core.models import Scene
@dataclass(frozen=True)
class IconSearchResult:
found: bool
name: str
x: float | None = None
y: float | None = None
reason: str | None = None
def to_dict(self) -> dict[str, object]:
return {
"found": self.found,
"name": self.name,
"x": self.x,
"y": self.y,
"reason": self.reason,
}
def find_icon(scene: Scene, name: str) -> IconSearchResult:
query = name.casefold()
for element in scene.elements:
if element.type not in {"image", "icon", "button"}:
continue
label = (element.text or element.id).casefold()
if query in label:
x, y = element.center
return IconSearchResult(found=True, name=name, x=x, y=y)
return IconSearchResult(found=False, name=name, reason="not found")