sessionPowerAssertions function

PowerAssertionController? sessionPowerAssertions(
  1. AgentCliConfig config,
  2. void onWarn(
    1. String message
    )
)

Builds the session's sleep-prevention controller (issues #325/#326) from the host-injected runner + configured level + hold lifecycle; a null runner (tests, web) means no assertions — power is host-best-effort.

Implementation

PowerAssertionController? sessionPowerAssertions(
  AgentCliConfig config,
  void Function(String message) onWarn,
) => config.powerRunner == null
    ? null
    : PowerAssertionController(
        runner: config.powerRunner!,
        level: config.powerSleepPrevention,
        hold: config.powerSleepPreventionHold,
        onWarn: onWarn,
      );