feat(planner): expose long_press/double_tap to the AI planner

This commit is contained in:
2026-07-15 19:45:06 +08:00
parent dda70940c0
commit 5a93651db7
5 changed files with 79 additions and 4 deletions
+27 -2
View File
@@ -16,8 +16,8 @@ from runtime.tool_specs import (
def test_action_tool_specs_has_five_entries_and_all_tool_specs_adds_finish_task() -> (
None
):
assert len(ACTION_TOOL_SPECS) == 5
assert len(ALL_TOOL_SPECS) == 6
assert len(ACTION_TOOL_SPECS) == 7
assert len(ALL_TOOL_SPECS) == 8
assert ALL_TOOL_SPECS == [*ACTION_TOOL_SPECS, FINISH_TASK_SPEC]
assert FINISH_TASK_SPEC not in ACTION_TOOL_SPECS
@@ -110,3 +110,28 @@ def test_finish_task_spec_requires_success_and_reason() -> None:
def test_no_tool_spec_declares_device_id() -> None:
for spec in ALL_TOOL_SPECS:
assert "device_id" not in spec.parameters["properties"]
def test_long_press_and_double_tap_are_action_tools():
from runtime.tool_specs import ACTION_TOOL_NAMES
assert "long_press" in ACTION_TOOL_NAMES
assert "double_tap" in ACTION_TOOL_NAMES
def test_long_press_spec_has_duration_with_default():
from runtime.tool_specs import LONG_PRESS_SPEC
props = LONG_PRESS_SPEC.parameters["properties"]
assert props["x"]["type"] == "number"
assert props["y"]["type"] == "number"
assert props["duration_ms"]["default"] == 1200
# purpose/expected_outcome are required metadata
assert "purpose" in LONG_PRESS_SPEC.parameters["required"]
def test_double_tap_spec_has_interval_with_default():
from runtime.tool_specs import DOUBLE_TAP_SPEC
props = DOUBLE_TAP_SPEC.parameters["properties"]
assert props["interval_ms"]["default"] == 80