Compute the next phase and required actions given the current phase and an event. This is a **pure function** with no side effects. The caller (orchestrator) is responsible for executing the returned actions. Unknown or empty phase values are normalized to `Idle` for backward compatibility with session state files created before phase tracking. # Arguments `current` — The current session phase
(current: Phase, event: Event, ctx: TransitionContext)
| 450 | /// assert!(r.requires_recording()); |
| 451 | /// ``` |
| 452 | pub fn transition(current: Phase, event: Event, ctx: TransitionContext) -> TransitionResult { |
| 453 | match current { |
| 454 | Phase::Idle => transition_from_idle(event), |
| 455 | Phase::Active => transition_from_active(event), |
| 456 | Phase::ActiveRecorded => transition_from_active_recorded(event), |
| 457 | Phase::Ended => transition_from_ended(event, ctx), |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | fn transition_from_idle(event: Event) -> TransitionResult { |
| 462 | match event { |