The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(mobile): fold Find recaps behind a chevron on the row
tony6dea5191107a
diff --git a/mobile/lib/phone/agent_recap.dart b/mobile/lib/phone/agent_recap.dartindex a2d79c1e1..f105df4e4 100644--- a/mobile/lib/phone/agent_recap.dart+++ b/mobile/lib/phone/agent_recap.dart@@ -3,290 +3,156 @@ import 'package:flutter/services.dart';import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';-import 'package:harness_mobile/shared/widgets/skeleton.dart';import 'package:harness_mobile/state/session_preview.dart';+import 'find_row.dart';import 'tty.dart';import 'tty_controls.dart';-/// What a session's last finished turn came to, as Find shows it under the-/// session's row.-class PhoneRecap {- const PhoneRecap({- required this.headline,- required this.body,- required this.bodyAddsMore,- });-- /// One paragraph, markup and line breaks flattened out — what the folded row- /// shows, two lines at most.- final String headline;-- /// The reply as it was written — what the row unfolds to.- final String body;-- /// Whether [body] says anything [headline] does not, before [headline] is- /// even measured against the room it has: a turn's own recap is a line about- /// a reply that is usually much longer.- final bool bodyAddsMore;-}--/// How much of a reply is flattened into a headline. Two lines of a phone row-/// hold a small part of this; the rest is only ever read unfolded.-const _headlineSource = 600;--/// The recap [previews] holds for [key], or null when it holds none.+/// What a session's last finished turn said, as Find unfolds it under the session's row — or null+/// when [previews] holds nothing it said.///-/// The headline is the turn's own `recap` where it had one-/// ([SessionPreview.recap]), paired with the reply that same summary carried —-/// never with a reply from another turn. Otherwise it is the reply on record-/// ([SessionPreview.response]), flattened: a provider that writes no recap has-/// still said something, and what it said is the truest line to show.-PhoneRecap? phoneRecap(SessionPreviewStore previews, SessionPreviewKey? key) {+/// The reply the turn's own `recap` was written for, where it had one ([SessionPreview.savedText]+/// beside [SessionPreview.recap]) — never a reply from another turn. Otherwise the reply on record+/// ([SessionPreview.response]): a provider that writes no recap has still said something.+String? phoneRecap(SessionPreviewStore previews, SessionPreviewKey? key) {if (key == null) return null;final preview = previews.read(key);if (preview == null) return null;- final headline = preview.recap;final saved = preview.savedText;- final body = preview.response;- // Find rebuilds on every preview the store publishes — as often as every 80 ms while an agent- // streams — and a streamed delta moves none of these three. Same strings, same recap: the- // flattening is not run again.- final memo = _recaps[preview];- if (memo != null &&- identical(memo.headline, headline) &&- identical(memo.saved, saved) &&- identical(memo.body, body)) {- return memo.recap;- }- final recap = _recapOf(headline, saved, body);- _recaps[preview] = (- headline: headline,- saved: saved,- body: body,- recap: recap,- );- return recap;+ final text = preview.recap != null && saved != null+ ? saved+ : preview.response;+ return text == null || text.trim().isEmpty ? null : text;}-/// The last recap [phoneRecap] made for each preview, with the strings it was made from. Held-/// beside the preview rather than in it, so it goes when the store lets the preview go.-final _recaps =- Expando<- ({String? headline, String? saved, String? body, PhoneRecap? recap})- >('phoneRecap');--PhoneRecap? _recapOf(String? headline, String? saved, String? body) {- if (headline != null && saved != null) {- final flat = flattenRecap(headline);- if (flat.isNotEmpty) {- return PhoneRecap(- headline: flat,- body: saved,- bodyAddsMore: _flattenHead(saved) != flat,- );- }- }- if (body == null) return null;- final flat = _flattenHead(body);- if (flat.isEmpty) return null;- return PhoneRecap(- headline: flat,- body: body,- // Cut before flattening, so the headline cannot be all of it; and a reply- // laid out in lines or lists reads differently unfolded than run together.- bodyAddsMore: body.length > _headlineSource || body.contains('\n'),- );-}--String _flattenHead(String text) => flattenRecap(- text.length > _headlineSource ? text.substring(0, _headlineSource) : text,-);--/// [text] as one plain paragraph: no headings, list markers, quote marks,-/// emphasis or code ticks, and every run of whitespace a single space.-String flattenRecap(String text) => text- .replaceAll(- RegExp(r'^[ \t]*(?:#{1,6}[ \t]+|[-*+][ \t]+|>[ \t]?)', multiLine: true),- '',- )- .replaceAll(RegExp(r'\*\*|__|`'), '')- .replaceAll(RegExp(r'\s+'), ' ')- .trim();--/// The recap under one of Find's rows: two lines folded, the whole reply-/// unfolded.+/// The chevron at the end of a Find row's first line, beside `idle · 25m`: shows the session's+/// recap under the row, and hides it again.///-/// ⚠️ **Its own tap target, beside the row's and not inside it.** A tap on the-/// row opens the session; a tap here only folds or unfolds. Nested in the row,-/// every tap on the recap would light the row as though it were about to open.+/// The recap is folded away by default — which session to open is decided by its name, state and+/// age, and what it last said is only there for the one somebody wonders about.///-/// Folds only where there is more to see — a recap that already fits in two-/// lines and says all its reply does draws no chevron and takes no tap.-class AgentRecap extends StatelessWidget {- const AgentRecap({+/// Given to the row as its [FindRow.accessory], which draws it over the row rather than inside it,+/// so a tap here never lights the row. Wide enough for a thumb, as tall as the row gives it, the+/// chevron centred in it; [room] is what the row keeps clear for it.+class AgentRecapToggle extends StatelessWidget {+ const AgentRecapToggle({super.key,- required this.recap,required this.expanded,required this.onToggle,});- final PhoneRecap recap;final bool expanded;final VoidCallback onToggle;- static const _rule = 1.0;- static const _inset = 10.0;- static const _gap = 8.0;- static const _chevron = 14.0;+ static const double _width = 36;+ static const double _chevron = 14;- /// The row's own gutter, so the rule stands under the first letter of the- /// name above it.- static const _outer = EdgeInsets.fromLTRB(Tty.origin, 0, Tty.origin, 10);+ /// Between the row's state words and the chevron.+ static const double _gap = 8;- static TextStyle _style(Tty tty, bool expanded) =>- tty.style(color: expanded ? tty.text : tty.faint, size: TtySize.meta);-- static Color _ruleColor(Tty tty) => tty.text.withValues(alpha: 0.16);-- /// Whether [headline] runs past two lines in [width].- static bool _clipped(- BuildContext context,- String headline,- TextStyle style,- double width,- ) {- if (width <= 0) return false;- final painter = TextPainter(- text: TextSpan(- text: headline,- style: DefaultTextStyle.of(context).style.merge(style),- ),- maxLines: 2,- textDirection: Directionality.of(context),- textScaler: MediaQuery.textScalerOf(context),- )..layout(maxWidth: width);- final clipped = painter.didExceedMaxLines;- painter.dispose();- return clipped;- }+ /// What [FindRow.accessoryRoom] keeps for this: the gap and the chevron, less the row's own+ /// gutter, which the toggle's hit area overlaps.+ static const double room = _gap + (_width + _chevron) / 2 - Tty.origin;@overrideWidget build(BuildContext context) {final tty = Tty.of(context);- final style = _style(tty, expanded);final motion = MediaQuery.disableAnimationsOf(context)? Duration.zero: AppMotion.fold;- return Padding(- padding: _outer,- child: LayoutBuilder(- builder: (context, constraints) {- final textWidth =- constraints.maxWidth - _rule - _inset - _gap - _chevron;- final foldable =- expanded ||- recap.bodyAddsMore ||- _clipped(context, recap.headline, style, textWidth);- final framed = Container(- padding: const EdgeInsets.only(left: _inset),- decoration: BoxDecoration(- border: Border(- left: BorderSide(- width: _rule,- color: expanded ? tty.faint : _ruleColor(tty),- ),+ return Semantics(+ button: true,+ label: expanded ? 'Hide the recap' : 'Show the recap',+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () {+ HapticFeedback.selectionClick();+ onToggle();+ },+ child: SizedBox(+ width: _width,+ child: Center(+ child: AnimatedRotation(+ turns: expanded ? 0.5 : 0,+ duration: motion,+ curve: AppMotion.curve,+ child: Icon(+ LucideIcons.chevronDown,+ size: _chevron,+ color: expanded ? tty.text : tty.faint,),),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(- child: AnimatedSize(- duration: motion,- curve: AppMotion.curve,- alignment: Alignment.topLeft,- child: Text(- expanded ? recap.body : recap.headline,- maxLines: expanded ? null : 2,- overflow: expanded ? null : TextOverflow.ellipsis,- style: style,- ),- ),- ),- if (foldable) ...[- const SizedBox(width: _gap),- Padding(- padding: const EdgeInsets.only(top: 1),- child: AnimatedRotation(- turns: expanded ? 0.5 : 0,- duration: motion,- curve: AppMotion.curve,- child: Icon(- LucideIcons.chevronDown,- size: _chevron,- color: tty.faint,- ),- ),- ),- ] else- // Keeps a folded and an unfoldable recap the same width, so- // their lines break at the same place down the list.- const SizedBox(width: _gap + _chevron),- ],- ),- );- if (!foldable) return framed;- return Semantics(- button: true,- onTapHint: expanded ? 'Fold the recap' : 'Show the whole recap',- child: GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- HapticFeedback.selectionClick();- onToggle();- },- child: framed,- ),- );- },+ ),+ ),),);}}-/// The recap's place held while it is being read, so the row does not grow-/// under the reader's eye when it lands. Two lines, as a folded recap is.-class AgentRecapPlaceholder extends StatelessWidget {- const AgentRecapPlaceholder({super.key});+/// A session's recap under its Find row: nothing while folded, the reply as it was written while+/// [expanded], growing into place rather than appearing.+///+/// ⚠️ **Its own tap target, beside the row's and not inside it.** A tap on the row opens the+/// session; a tap here folds the recap away, as the row's [AgentRecapToggle] does — the larger+/// target, and where the eye is once the reading is done.+class AgentRecap extends StatelessWidget {+ const AgentRecap({+ super.key,+ required this.text,+ required this.expanded,+ required this.onToggle,+ });++ final String text;+ final bool expanded;+ final VoidCallback onToggle;++ static const double _rule = 1.0;+ static const double _inset = 10.0;++ /// The row's own gutter, so the rule stands under the first letter of the name above it.+ static const _outer = EdgeInsets.fromLTRB(Tty.origin, 0, Tty.origin, 12);@overrideWidget build(BuildContext context) {final tty = Tty.of(context);- final style = AgentRecap._style(tty, false);- return Padding(- padding: AgentRecap._outer,- child: Container(- padding: const EdgeInsets.only(- left: AgentRecap._inset,- right: AgentRecap._gap + AgentRecap._chevron,- ),- decoration: BoxDecoration(- border: Border(- left: BorderSide(- width: AgentRecap._rule,- color: AgentRecap._ruleColor(tty),+ final motion = MediaQuery.disableAnimationsOf(context)+ ? Duration.zero+ : AppMotion.fold;+ return AnimatedSize(+ duration: motion,+ curve: AppMotion.curve,+ alignment: Alignment.topLeft,+ child: !expanded+ ? const SizedBox(width: double.infinity)+ : Semantics(+ button: true,+ onTapHint: 'Fold the recap',+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () {+ HapticFeedback.selectionClick();+ onToggle();+ },+ child: Padding(+ padding: _outer,+ child: Container(+ width: double.infinity,+ padding: const EdgeInsets.only(left: _inset),+ decoration: BoxDecoration(+ border: Border(+ left: BorderSide(width: _rule, color: tty.faint),+ ),+ ),+ child: Text(+ text,+ style: tty.style(color: tty.text, size: TtySize.meta),+ ),+ ),+ ),+ ),),- ),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- SkeletonText(style: style),- SkeletonText(style: style, widthFactor: 0.6),- ],- ),- ),);}}diff --git a/mobile/lib/phone/find_row.dart b/mobile/lib/phone/find_row.dartindex c90821201..4110247ea 100644--- a/mobile/lib/phone/find_row.dart+++ b/mobile/lib/phone/find_row.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -11,8 +13,8 @@ import 'tty_controls.dart';/// ```/// api-fix asking/// "Run the migration on the test db?"-/// docs-rewrite working-/// M2:site ⑂ docs-v2 · 2m+/// docs-rewrite working · 2m ⌄+/// M2:site ⑂ docs-v2/// ```class FindRow extends StatelessWidget {const FindRow({@@ -24,12 +26,15 @@ class FindRow extends StatelessWidget {this.tail,this.state,this.stateColor,+ this.stateTail,this.terms = const [],this.selected = false,this.enabled = true,this.onTap,this.strict = false,this.said,+ this.accessory,+ this.accessoryRoom = 0,});final String title;@@ -55,6 +60,23 @@ class FindRow extends StatelessWidget {final String? state;final Color? stateColor;+ /// After [state] on line 1, behind a `·`: the age, or `current`. On line 1 rather than as [tail],+ /// where a long folder and branch cut it off.+ final String? stateTail;++ /// A control at the end of line 1, beside [state] — Find's recap toggle — centred on that line.+ ///+ /// ⚠️ **Over the row, not inside it.** The row lights the moment a finger rests on it+ /// ([TtyTap]), and a control nested in it would light the whole row as though it were about to+ /// open. Drawn above it in a [Stack] instead, the control takes its own taps and the row never+ /// sees them. It is given a band centred on line 1 and whatever width it takes, flush with the+ /// row's right edge; [accessoryRoom] keeps the words clear of it.+ final Widget? accessory;++ /// Room kept at the end of line 1 for [accessory]. Keep it on rows without one too, so a list's+ /// state words stand in one column.+ final double accessoryRoom;+/// What was typed, lit green in [title] and [detail].final List<String> terms;@@ -65,6 +87,12 @@ class FindRow extends StatelessWidget {static const double height = 60;+ /// Above line 1 and below line 2.+ static const double _pad = 9;++ /// Between line 1 and line 2.+ static const double _gap = 3;+TextStyle _base(Tty tty) =>tty.style(color: detailColor ?? tty.faint, size: TtySize.meta);@@ -84,7 +112,7 @@ class FindRow extends StatelessWidget {Widget build(BuildContext context) {final tty = Tty.of(context);final ink = enabled ? tty.text : tty.faint;- return TtyTap(+ final row = TtyTap(minHeight: height,onTap: enabled && onTap != null? () {@@ -95,7 +123,12 @@ class FindRow extends StatelessWidget {child: ColoredBox(color: selected ? ttyRaised(tty) : Colors.transparent,child: Padding(- padding: const EdgeInsets.fromLTRB(Tty.origin, 9, Tty.origin, 9),+ padding: const EdgeInsets.fromLTRB(+ Tty.origin,+ _pad,+ Tty.origin,+ _pad,+ ),child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,mainAxisSize: MainAxisSize.min,@@ -130,16 +163,36 @@ class FindRow extends StatelessWidget {),if (state case final state?) ...[const SizedBox(width: 12),- TtyText(- state,- color: stateColor ?? tty.faint,- size: TtySize.meta,+ Text.rich(+ TextSpan(+ children: [+ TextSpan(+ text: state,+ style: tty.style(+ color: stateColor ?? tty.faint,+ size: TtySize.meta,+ ),+ ),+ if (stateTail case final tail? when tail.isNotEmpty)+ TextSpan(+ text: ' · $tail',+ style: tty.style(+ color: tty.faint,+ size: TtySize.meta,+ ),+ ),+ ],+ ),+ maxLines: 1,+ softWrap: false,+ overflow: TextOverflow.clip,),],+ if (accessoryRoom > 0) SizedBox(width: accessoryRoom),],),if (said case final said?) ...[- const SizedBox(height: 3),+ const SizedBox(height: _gap),Text.rich(TextSpan(children: [@@ -158,7 +211,7 @@ class FindRow extends StatelessWidget {overflow: TextOverflow.ellipsis,),] else if (detail case final detail? when detail.isNotEmpty) ...[- const SizedBox(height: 3),+ const SizedBox(height: _gap),Text.rich(TextSpan(children: [@@ -181,6 +234,44 @@ class FindRow extends StatelessWidget {),),);+ final accessory = this.accessory;+ if (accessory == null) return row;+ final center = _lineOneCenter(context, tty);+ return Stack(+ // The row sized exactly as it would be alone: a loose width would let it shrink to its words.+ fit: StackFit.passthrough,+ children: [+ row,+ Positioned(+ top: 0,+ right: 0,+ // Line 1's centre, and as much height around it as the row has above it: the control+ // centres on the name without reaching past the row's top.+ height: center * 2,+ child: accessory,+ ),+ ],+ );+ }++ /// How far below the row's top the middle of line 1 is.+ ///+ /// Arithmetic, not a measurement: [Tty.style] pins every line to its size × its `height`, and+ /// [TtyTap] centres content shorter than [height] — which a row of two lines at the default text+ /// size is.+ double _lineOneCenter(BuildContext context, Tty tty) {+ final scaler = MediaQuery.textScalerOf(context);+ double line(double size) {+ final style = tty.style(size: size);+ return scaler.scale(size) * (style.height ?? 1);+ }++ final one = line(TtySize.row);+ final two = said != null || (detail?.isNotEmpty ?? false)+ ? _gap + line(TtySize.meta)+ : 0.0;+ final content = _pad * 2 + one + two;+ return math.max(0.0, (height - content) / 2) + _pad + one / 2;}}diff --git a/mobile/lib/phone/phone_search_results.dart b/mobile/lib/phone/phone_search_results.dartindex ce6093d78..c6f13cd23 100644--- a/mobile/lib/phone/phone_search_results.dart+++ b/mobile/lib/phone/phone_search_results.dart@@ -453,10 +453,11 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {);}- /// One session's entry in the list: its row, and under it what the session last came to.+ /// One session's entry in the list: its row, and under it what the session last came to — folded+ /// away until the chevron on the row's first line unfolds it.////// Keyed by the row's id — what [ListView.builder]'s `findChildIndexCallback` looks it up by — so- /// a recap somebody is unfolding stays with its session when a match moves it up the list.+ /// a recap somebody unfolded stays with its session when a match moves it up the list.Widget _session(PhoneDestination row,List<String> terms,@@ -464,50 +465,55 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {Tty tty, {required bool selected,}) {- final line = _findRow(row, terms, now, tty, selected: selected);final recap = _recap(row);+ final expanded = recap != null && _unfolded.contains(row.id);+ void toggle() => setState(() {+ if (!_unfolded.remove(row.id)) _unfolded.add(row.id);+ });return KeyedSubtree(key: ValueKey(row.id),- child: recap == null- ? line- : Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- mainAxisSize: MainAxisSize.min,- children: [line, recap],- ),+ // A column whether or not there is a recap, so the row keeps its element when one lands.+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ mainAxisSize: MainAxisSize.min,+ children: [+ _findRow(+ row,+ terms,+ now,+ tty,+ selected: selected,+ // No chevron until there is something under it: a session still being read, or one+ // that has said nothing, has nothing to unfold. The room is kept either way.+ recapToggle: recap == null+ ? null+ : AgentRecapToggle(expanded: expanded, onToggle: toggle),+ ),+ if (recap != null)+ AgentRecap(text: recap, expanded: expanded, onToggle: toggle),+ ],+ ),);}- /// What [row]'s session last came to, folded under it — or its place held while it is read, or- /// nothing for a row that is not a harness or a session that has not said anything yet.- Widget? _recap(PhoneDestination row) {+ /// What [row]'s session last said, or null for a row that is not a harness, or a session not yet+ /// read or that has said nothing. Asks for it as the row is drawn — see [_want].+ String? _recap(PhoneDestination row) {if (!row.isAgent) return null;- final previews = widget.notifier.sessionPreviews;final key = row.previewKey;if (key != null) _want(key);- final recap = phoneRecap(previews, key);- if (recap != null) {- return AgentRecap(- recap: recap,- expanded: _unfolded.contains(row.id),- onToggle: () => setState(() {- if (!_unfolded.remove(row.id)) _unfolded.add(row.id);- }),- );- }- if (key != null && previews.isPending(key)) {- return const AgentRecapPlaceholder();- }- return null;+ return phoneRecap(widget.notifier.sessionPreviews, key);}- /// One harness (or command) as a Find row — see [FindRow].+ /// One harness (or command) as a Find row — see [FindRow]. A session's row keeps room at the end+ /// of its first line for [recapToggle], so every session's `idle · 25m` stands in one column.Widget _findRow(PhoneDestination row,List<String> terms,DateTime now,Tty tty, {required bool selected,+ Widget? recapToggle,}) {final entry = row.entry;final openable = widget.controller.canSubmit(row);@@ -521,10 +527,10 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {title: row.title,detail: row.detail,branch: null,- tail: [- external.engineLabel,- if (row.lastAt case final at?) fzfAge(at, now),- ].join(' · '),+ tail: external.engineLabel,+ // Beside the state, as a harness row's age is.+ stateTail: fzfAge(row.lastAt, now),+ accessoryRoom: AgentRecapToggle.room,said: hit == null || hit.snippet.isEmpty || hit.field == 'name'? null: (lead: snippetLead(hit.field), runs: snippetRuns(hit.snippet)),@@ -575,19 +581,22 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {title: row.title,strict: true,said: said,- // `M2:site ⑂ docs-v2 · 2m` — or, while it asks, its question.+ // `M2:site ⑂ docs-v2` — or, while it asks, its question.detail: asking? '"${question.split('\n').first}"': '${entry.machineName}:${entry.agent.displayProject?.label ?? entry.project?.name ?? ''}',branch: asking || branch == null || branch.isEmpty ? null : branch,- tail: asking+ detailColor: question != null && entry.isWaiting ? tty.text : null,+ state: state.word,+ stateColor: state.color,+ // `idle · 2m` on line 1, where a long folder and branch on line 2 cannot cut the age off.+ stateTail: asking? null: onScreen? 'current': fzfAge(entry.agent.updatedAt, now),- detailColor: question != null && entry.isWaiting ? tty.text : null,- state: state.word,- stateColor: state.color,+ accessory: recapToggle,+ accessoryRoom: AgentRecapToggle.room,terms: terms,selected: selected,enabled: openable || _resuming == row.id,diff --git a/mobile/lib/state/session_preview.dart b/mobile/lib/state/session_preview.dartindex d2b141933..58d873712 100644--- a/mobile/lib/state/session_preview.dart+++ b/mobile/lib/state/session_preview.dart@@ -2,10 +2,9 @@/// search reaches the same session content the desktop's Open Agent picker/// does. Keep the two in step; the additions here are/// [SessionPreview.searchParts], which the phone's result rows quote from,-/// [SessionPreviewStore.markStale], for turns a sleeping phone never heard, and-/// [SessionPreview.recap] with [SessionPreviewStore.isPending], for the recap-/// under each row of the Harnesses list, and-/// [SessionPreviewStore.maxInFlight], so that list's rows fill in faster.+/// [SessionPreviewStore.markStale], for turns a sleeping phone never heard,+/// [SessionPreview.recap], for the recap a row of Find unfolds, and+/// [SessionPreviewStore.maxInFlight], so those recaps arrive sooner.library;import 'dart:async';@@ -153,25 +152,6 @@ class SessionPreviewStore extends ChangeNotifier {/// until [freshFor] runs out and something happens to warm it again.void markStale(SessionPreviewKey key) => _records[key]?._attemptedAt = null;- /// Whether what [key] said is still to come: being read, queued to be, or- /// never read at all — what lets a row hold a placeholder for content on its- /// way rather than grow when it lands.- ///- /// ⚠️ **Never read counts.** Find warms the rows it draws one frame after- /// drawing them, so a row scrolled into view is not queued yet on its first- /// frame — and is about to be. A row that held nothing there and a- /// placeholder a frame later would flicker at the edge of every scroll.- ///- /// False for a key that can no longer be fetched: a queued read of it is- /// dropped without a word ([_drain]), and a placeholder waiting on it would- /// wait for ever. False, too, once a read has answered, even with nothing or- /// an error: that session has nothing to show, not something on its way.- bool isPending(SessionPreviewKey key) {- if (!canFetch(key)) return false;- if (_inFlight.contains(key) || _queue.contains(key)) return true;- return !(_records[key]?.fetched ?? false);- }-SessionPreview _entry(SessionPreviewKey key) {final entry = _records.remove(key) ?? SessionPreview();entry._searchText = null;