Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/askui/tools/agent_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,14 @@ def screenshot(self, report: bool = True) -> Image.Image:
raise NotImplementedError

@abstractmethod
def mouse_move(self, x: int, y: int) -> None:
def mouse_move(self, x: int, y: int, duration: int = 500) -> None:
"""
Moves the mouse cursor to specified screen coordinates.

Args:
x (int): The horizontal coordinate (in pixels) to move to.
y (int): The vertical coordinate (in pixels) to move to.
duration (int): The duration (in ms) the movement should take.
"""
raise NotImplementedError

Expand Down
5 changes: 3 additions & 2 deletions src/askui/tools/askui/askui_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,14 @@ def screenshot(self, report: bool = True) -> Image.Image:

@telemetry.record_call()
@override
def mouse_move(self, x: int, y: int) -> None:
def mouse_move(self, x: int, y: int, duration: int = 500) -> None:
"""
Moves the mouse cursor to specified screen coordinates.

Args:
x (int): The horizontal coordinate (in pixels) to move to.
y (int): The vertical coordinate (in pixels) to move to.
duration (int): The duration (in ms) the movement should take.
"""
self._reporter.add_message(
"AgentOS",
Expand All @@ -385,7 +386,7 @@ def mouse_move(self, x: int, y: int) -> None:
action_parameters=controller_v1_pbs.ActionParameters(
mouseMove=controller_v1_pbs.ActionParameters_MouseMove(
position=controller_v1_pbs.Coordinate2(x=x, y=y),
milliseconds=500,
milliseconds=duration,
Comment thread
philipph-askui marked this conversation as resolved.
)
),
)
Expand Down
4 changes: 2 additions & 2 deletions src/askui/tools/computer_agent_os_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def screenshot(self, report: bool = True) -> Image.Image:
)
return scale_image_to_fit(screenshot, self._target_resolution)

def mouse_move(self, x: int, y: int) -> None:
def mouse_move(self, x: int, y: int, duration: int = 500) -> None:
scaled_x, scaled_y = self._scale_coordinates_back(x, y)
self._agent_os.mouse_move(scaled_x, scaled_y)
self._agent_os.mouse_move(scaled_x, scaled_y, duration)

def get_mouse_position(self) -> Coordinate:
mouse_position = self._agent_os.get_mouse_position()
Expand Down
3 changes: 2 additions & 1 deletion src/askui/tools/playwright/agent_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,14 @@ def screenshot(self, report: bool = True) -> Image.Image:
return Image.open(io.BytesIO(screenshot_bytes))

@override
def mouse_move(self, x: int, y: int) -> None:
def mouse_move(self, x: int, y: int, _duration: int = 500) -> None:
"""
Moves the mouse cursor to specified coordinates on the page.

Args:
x (int): The horizontal coordinate (in pixels) to move to.
y (int): The vertical coordinate (in pixels) to move to.
_duration (int): Unused parameter as it is not applicable here.
"""
if not self._page:
error_msg = "No active page. Call connect() first."
Expand Down
3 changes: 2 additions & 1 deletion src/askui/tools/pynput_agent_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,14 @@ def screenshot(self, report: bool = True) -> Image.Image:
return image

@override
def mouse_move(self, x: int, y: int) -> None:
def mouse_move(self, x: int, y: int, _duration: int = 500) -> None:
"""
Move the mouse cursor to specified screen coordinates.

Args:
x (int): The horizontal coordinate (in pixels) to move to.
y (int): The vertical coordinate (in pixels) to move to.
_duration (int): Unused parameter as it is not applicable here.
Comment thread
programminx-askui marked this conversation as resolved.
Outdated
"""
self._reporter.add_message(
"AgentOS",
Expand Down