"""Create recovery_planner
Generated by Phi-Octopus Eden
2025-11-07 18:42:18.269553
"""

```python
from typing import Dict, Any


class RecoveryPlanner:
    """
    A class designed to handle limited error recovery in a system.
    This planner helps in managing states and transitions when errors occur,
    ensuring that operations can continue or be restarted with minimal data loss.

    Attributes:
        state_transitions (Dict[str, str]): Mapping of current states to possible next states.
        error_recoveries (Dict[str, Any]): Actions taken during recovery from specific errors.
    """

    def __init__(self):
        self.state_transitions = {
            "initial": "preparing",
            "preparing": "running",
            "running": ["recovering", "terminated"],
            "recovering": ["recovered", "terminating"],
            "recovered": "idle",
            "terminated": "initial"
        }
        self.error_recoveries = {}

    def handle_error(self, state: str, error_info: Dict[str, Any]) -> None:
        """
        Handle an error by transitioning to a recovery state and recording actions taken.

        Args:
            state (str): The current state of the system.
            error_info (Dict[str, Any]): Information about the error encountered.
        """
        if state in self.state_transitions["running"]:
            next_state = "recovering"
            action = {"error_type": error_info.get("type"), "message": error_info.get("message")}
            self.error_recoveries[next_state] = action
            print(f"Transitioned to {next_state} due to error: {action}")
        else:
            print(f"No recovery plan for current state: {state}")

    def transition_states(self, new_state: str) -> None:
        """
        Transition the system's state from its current state to a new one.

        Args:
            new_state (str): The target state to transition into.
        """
        if new_state in self.state_transitions["recovered"]:
            print(f"Transitioned directly to {new_state}")
        else:
            next_states = self.state_transitions.get(self.error_recoveries[new_state].get("next_state"))
            for ns in next_states:
                if ns == new_state:
                    print(f"Successfully transitioned from recovery state to {ns}")


# Example usage
if __name__ == "__main__":
    planner = RecoveryPlanner()
    error_info1 = {"type": "Timeout", "message": "Connection lost after 5 minutes"}
    planner.handle_error("running", error_info1)
    
    # Simulating the next step in recovery
    planner.transition_states("recovered")
```

This code defines a `RecoveryPlanner` class that can manage state transitions and handle errors with specific actions. The example usage demonstrates how to use this class to handle an error and transition through states accordingly.