feat: add gesture sequences and calibrated pixel drags

This commit is contained in:
chenmingxuan committed 2026-11-02 11:53:27 +08:00
1 parent 2a3bbaa3fb
commit 479a185192
31 files changed
+2440 -44

No files matched your search

+16
View File
@@ -1555,6 +1555,22 @@ class OperatorNode:
"""The recorded target semantics: observed (index) or described (coords)."""
return {k: v for k, v in el.items() if k != "center"}
if tool_name in {"drag", "action_sequence"}:
from artemis.mcp.gestures import DragRequest, SequenceRequest, plan_drag, plan_sequence
try:
if tool_name == "drag":
request = DragRequest.model_validate(args)
planned = plan_drag(request, width, height)
return [{**planned, "args": request.model_dump(mode="json")}], None
request_sequence = SequenceRequest.model_validate(args)
plan_sequence(request_sequence, width, height, self._max_burst_actions())
return [
{"action": "action_sequence", "args": request_sequence.model_dump(mode="json")}
], None
except ValueError as exc:
return [], f"Error during {tool_name}: {exc}"
if tool_name == "click":
target = args.get("target")
times = args.get("times", 1)