idleSourcesFor function
Every IdleSource for operatingSystem, best-first.
Taking the OS as a parameter rather than reading Platform inside keeps this a pure function, so the Windows and macOS arms are exercisable from the Linux CI host. The same reason the shell takes an injected clock: a decision that depends on ambient state cannot be tested where that state differs.
A list rather than a single source because macOS briefly had two competing bindings and the parity harness needed to read both in one batch. It returns one entry per platform now — the CoreGraphics candidate was measured against IOKit on CI and lost (ADR-0004) — but the shape stays, since it is also what lets the harness compare a binding against the implementation it replaces.
Implementation
List<IdleSource> idleSourcesFor(String operatingSystem) {
switch (operatingSystem) {
case 'windows':
return const [WindowsIdleSource()];
case 'macos':
return const [MacOsIoKitIdleSource()];
default:
return [UnsupportedIdleSource(operatingSystem)];
}
}