Implement Apex Agent MVP scaffold
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Driver(ABC):
|
||||
"""Driver-independent device capability interface.
|
||||
|
||||
Implementations may hold a live connection handle, but no task or business
|
||||
state belongs here.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def connect(self) -> None:
|
||||
"""Open the device connection."""
|
||||
|
||||
@abstractmethod
|
||||
def disconnect(self) -> None:
|
||||
"""Close the device connection."""
|
||||
|
||||
@abstractmethod
|
||||
def screenshot(self) -> bytes:
|
||||
"""Return the current screen as image bytes."""
|
||||
|
||||
@abstractmethod
|
||||
def tap(self, x: float, y: float) -> None:
|
||||
"""Tap the screen at the given coordinates."""
|
||||
|
||||
@abstractmethod
|
||||
def swipe(
|
||||
self,
|
||||
start_x: float,
|
||||
start_y: float,
|
||||
end_x: float,
|
||||
end_y: float,
|
||||
duration_ms: int = 500,
|
||||
) -> None:
|
||||
"""Swipe between two screen coordinates."""
|
||||
|
||||
@abstractmethod
|
||||
def input(self, text: str) -> None:
|
||||
"""Input text into the current focused field."""
|
||||
|
||||
@abstractmethod
|
||||
def launch(self, app_id: str) -> None:
|
||||
"""Launch an app by bundle id or driver-supported app identifier."""
|
||||
|
||||
@abstractmethod
|
||||
def terminate(self, app_id: str) -> None:
|
||||
"""Terminate an app by bundle id or driver-supported app identifier."""
|
||||
|
||||
@abstractmethod
|
||||
def tree(self) -> Any:
|
||||
"""Return the raw UI tree from the device driver."""
|
||||
|
||||
@abstractmethod
|
||||
def home(self) -> None:
|
||||
"""Press the device home button."""
|
||||
|
||||
@abstractmethod
|
||||
def lock(self) -> None:
|
||||
"""Lock the device."""
|
||||
|
||||
@abstractmethod
|
||||
def unlock(self) -> None:
|
||||
"""Unlock the device."""
|
||||
|
||||
Reference in New Issue
Block a user