viewerBannerText function

String viewerBannerText(
  1. SessionLease lease, {
  2. required bool stale,
})

The viewer banner (AC3/AC9). Live: Driven by fa CLI (pid 85634) since 14:32 — you are viewing. Your messages are delivered to the live agent. Stale (owner's heartbeat expired while we watch): the same provenance plus the reopen hint — a viewer still never drives; the reopen is a fresh drive-open of a free lease.

Implementation

String viewerBannerText(SessionLease lease, {required bool stale}) {
  final since = DateTime.tryParse(lease.acquiredAt)?.toLocal();
  final clock = since == null
      ? '?'
      : '${since.hour.toString().padLeft(2, '0')}:'
            '${since.minute.toString().padLeft(2, '0')}';
  final head =
      'Driven by ${leaseOwnerLabel(lease.host)} (pid ${lease.pid}) '
      'since $clock';
  return stale
      ? '$head — the owner looks gone (stale). Close and reopen this '
            'session to drive it; your messages still go to its inbox.'
      : '$head — you are viewing. Your messages are delivered to the '
            'live agent.';
}