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
@@ -1,7 +1,7 @@
## MODIFIED Requirements
### Requirement: Bounded history of recent scene/action pairs
The system SHALL maintain `WorldState.history` as a fixed-size, bounded collection of the most recent per-step records, automatically evicting the oldest entry when a new entry is added past the configured bound. Each history record SHALL store the action name, success flag, page context (from `WorldState.current_page` at the time of recording), and optional rationale and thinking fields sourced from the executed `PlannedStep`. The `scene_summary` field SHALL be retained as an optional field for backward compatibility but SHALL NOT be required for new entries.
The system SHALL maintain `WorldState.history` as a fixed-size, bounded collection of the most recent per-step records, automatically evicting the oldest entry when a new entry is added past the configured bound. Each history record SHALL store the action name, executable action arguments, success flag, page context (from `WorldState.current_page` at the time of recording), and optional rationale, thinking, purpose, and expected-outcome fields sourced from the executed `PlannedStep`. The `scene_summary` field SHALL be retained as an optional field for backward compatibility but SHALL NOT be required for new entries.
#### Scenario: WorldState survives across steps within a task
- **WHEN** a task executes multiple steps in sequence
@@ -23,6 +23,14 @@ The system SHALL maintain `WorldState.history` as a fixed-size, bounded collecti
- **WHEN** the executed `PlannedStep` carries a non-None `thinking`
- **THEN** the resulting `WorldEvent` stores that thinking string
#### Scenario: History record includes reusable action metadata
- **WHEN** an executed `PlannedStep` carries a purpose and expected outcome
- **THEN** the resulting `WorldEvent` stores both values for the next planning turn and later reuse
#### Scenario: History record includes executed action arguments
- **WHEN** a `PlannedStep` executes with action arguments such as a tap's `x` and `y` coordinates
- **THEN** the resulting `WorldEvent` stores those executable arguments with the action name
#### Scenario: History record captures current page at time of recording
- **WHEN** a step is appended to history and `WorldState.current_page` is non-None at that moment
- **THEN** `WorldEvent.page` is set to that page value