buildDeepLinkBanner function
Build the warning banner for a deep-link-originated session.
Implementation
String buildDeepLinkBanner(DeepLinkBannerInfo info) {
final lines = <String>[
'This session was opened by an external deep link in ${_tildify(info.cwd)}',
];
if (info.repo != null) {
final age = info.lastFetch != null
? _formatRelativeTimeAgo(info.lastFetch!)
: 'never';
final stale =
info.lastFetch == null ||
DateTime.now().millisecondsSinceEpoch -
info.lastFetch!.millisecondsSinceEpoch >
staleFetchWarnMs;
lines.add(
'Resolved ${info.repo} from local clones - last fetched $age${stale ? ' -- NEOMAGE.md may be stale' : ''}',
);
}
if (info.prefillLength != null && info.prefillLength! > 0) {
if (info.prefillLength! > longPrefillThreshold) {
lines.add(
'The prompt below (${info.prefillLength} chars) was supplied by the link -- scroll to review the entire prompt before pressing Enter.',
);
} else {
lines.add(
'The prompt below was supplied by the link -- review carefully before pressing Enter.',
);
}
}
return lines.join('\n');
}