sessionUsageFooterLine function

String? sessionUsageFooterLine(
  1. SessionUsageSnapshot usage,
  2. SessionRetentionConfig retention
)

The /sessions usage footer (gh-1746 Visibility): one dim line — total: X across N sessions · cap: Y — NULL when no cap is configured, so a cap-free listing stays byte-identical legacy (REG-1: the footer line is ABSENT without a cap).

Implementation

String? sessionUsageFooterLine(
  SessionUsageSnapshot usage,
  SessionRetentionConfig retention,
) {
  if (!retention.hasCap) return null;
  return 'total: ${formatRetentionBytes(usage.totalBytes)} across '
      '${usage.sessions.length} sessions · cap: '
      '${formatRetentionBytes(retention.maxTotalBytes)}';
}