feat(planner): persist reusable action semantics
Tests / Test passed: 879

This commit is contained in:
2026-07-15 18:14:28 +08:00
parent 361dada276
commit d69be48f96
41 changed files with 733 additions and 116 deletions
+22 -1
View File
@@ -61,7 +61,9 @@ def test_observe_leaves_current_page_unchanged_without_semantic_scene() -> None:
assert model.state.current_page == "Chat"
def test_observe_updates_current_app_for_successful_launch_and_clear_for_terminate() -> None:
def test_observe_updates_current_app_for_successful_launch_and_clear_for_terminate() -> (
None
):
model = WorldModel(config=WorldConfig(history_size=2))
launch = PlannedStep(
action="launch_app",
@@ -188,3 +190,22 @@ def test_observe_appends_semantic_or_raw_scene_history_with_eviction() -> None:
assert [event.action for event in model.state.history] == ["second", "third"]
assert model.state.history[0].scene_summary.to_dict() == _scene().to_dict()
assert model.state.history.maxlen == 2
def test_observe_records_executed_action_arguments_and_metadata() -> None:
model = WorldModel(config=WorldConfig(history_size=2))
step = PlannedStep(
action="tap",
description="Open settings.",
args={"x": 12, "y": 34},
purpose="Open settings.",
expected_outcome="The settings page is visible.",
)
model.observe(_scene(), _semantic_scene("Settings"), step, _result(step))
event = model.state.history[0]
assert event.action == "tap"
assert event.arguments == {"x": 12, "y": 34}
assert event.purpose == "Open settings."
assert event.expected_outcome == "The settings page is visible."