buildDigest method

String? buildDigest()

The merged digest for every RUNNING child, or null when none is running. A child that settled before the tick never appears (E1/E3: the completion notice is the only word — no zombie-ghost line).

Implementation

String? buildDigest() {
  final now = _now();
  final stall = _stallMinutes();
  final lines = <String>[];
  for (final handle in manager.handles) {
    if (handle.status != SubagentStatus.running) continue;
    lines.add(_lineOf(handle, now, stall));
  }
  if (lines.isEmpty) return null;
  return '<system-notice>\n'
      'Subagent heartbeat — ${lines.length} running:\n'
      '${lines.join('\n')}\n'
      '</system-notice>';
}