feat(tools): add double_tap tool with humanize hook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from device.manager import DeviceManager
|
||||
from tools._device import get_driver
|
||||
from tools.humanize import get_rng, jitter_duration, jitter_point, load_humanize_config
|
||||
|
||||
|
||||
def double_tap(
|
||||
x: float,
|
||||
y: float,
|
||||
*,
|
||||
interval_ms: int = 80,
|
||||
device_id: str | None = None,
|
||||
manager: DeviceManager | None = None,
|
||||
) -> dict[str, object]:
|
||||
cfg = load_humanize_config()
|
||||
px, py = x, y
|
||||
interval = interval_ms
|
||||
if cfg.enabled:
|
||||
rng = get_rng()
|
||||
px, py = jitter_point(x, y, radius=cfg.tap_radius_px, rng=rng)
|
||||
interval = jitter_duration(interval_ms, spread=cfg.duration_spread, rng=rng)
|
||||
get_driver(device_id, manager=manager).double_tap(px, py, interval)
|
||||
return {
|
||||
"ok": True,
|
||||
"action": "double_tap",
|
||||
"x": px,
|
||||
"y": py,
|
||||
"interval_ms": interval,
|
||||
}
|
||||
Reference in New Issue
Block a user