"""Step selector — picks the next pending step from a plan.""" from __future__ import annotations from typing import Optional from core.state import Plan, PlanStep, StepStatus def select_next_step(plan: Plan) -> Optional[PlanStep]: """Return the first step with PENDING status, or None if all steps are done.""" for step in plan.steps: if step.status == StepStatus.PENDING: return step return None