"""Logic for the `dev` domain. Transport-agnostic (D-263).""" from __future__ import annotations import time from collections.abc import Iterator def slow_work(seconds: float, steps: int = 10) -> Iterator[tuple[int, int]]: """Yield (step, total) over roughly `seconds`, so a caller can report progress. A generator rather than something that takes a callback, because the service must not know how progress is reported — that is the router's business, and handing the service a printer is how a service learns it lives in a CLI. """ steps = max(1, steps) interval = max(0.0, seconds) / steps for step in range(1, steps + 1): time.sleep(interval) yield step, steps