Skip to content

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.

refactor(mobile): Find is the only search results list

dee78cc6bd378b9
diff --git a/mobile/lib/phone/agents_list_page.dart b/mobile/lib/phone/agents_list_page.dart
index 3ba1808e0..14ad092e7 100644
--- a/mobile/lib/phone/agents_list_page.dart
+++ b/mobile/lib/phone/agents_list_page.dart
@@ -114,7 +114,6 @@ class _AgentsListPageState extends State<AgentsListPage> {
PhoneSearchField(
controller: _controller,
focus: _focus,
- autofocus: false,
// This field filters the list below it; it is not the door to
// the modes, which Find carries.
hintText: 'Search harnesses',
diff --git a/mobile/lib/phone/branch_picker_sheet.dart b/mobile/lib/phone/branch_picker_sheet.dart
index 176fb76aa..f002a7dc1 100644
--- a/mobile/lib/phone/branch_picker_sheet.dart
+++ b/mobile/lib/phone/branch_picker_sheet.dart
@@ -159,10 +159,6 @@ class _BranchPickerState extends State<_BranchPicker> {
child: PhoneSearchField(
controller: _controller,
focus: _focus,
- // ⚠️ Not autofocused. The list is worth reading first — most
- // repositories have a handful of branches and the answer is on
- // screen already; the keyboard would bury it.
- autofocus: false,
hintText: 'Search branches',
onChanged: (value) => setState(() => _query = value),
onClear: () => setState(() {
diff --git a/mobile/lib/phone/compact_age.dart b/mobile/lib/phone/compact_age.dart
deleted file mode 100644
index d0fac185a..000000000
--- a/mobile/lib/phone/compact_age.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-/// How long ago [at] was, in the fewest characters a row's trailing edge can
-/// hold: `now`, `4m`, `2h`, `3d`, `5w`, `1y`.
-///
-/// A time in the future — a machine whose clock runs ahead of the phone's —
-/// reads as `now` rather than as a negative age.
-String compactAge(DateTime at, DateTime now) {
- final age = now.difference(at);
- if (age.inMinutes < 1) return 'now';
- if (age.inHours < 1) return '${age.inMinutes}m';
- if (age.inDays < 1) return '${age.inHours}h';
- if (age.inDays < 7) return '${age.inDays}d';
- if (age.inDays < 365) return '${age.inDays ~/ 7}w';
- return '${age.inDays ~/ 365}y';
-}
-
-/// How long ago a harness was last active, as the desktop's monitor writes it — `49m`, `3h`, `2d`.
-///
-/// Not [compactAge]: the monitor has no `now`, `w` or `y`, and a row that reads `1w` on the phone
-/// beside `9d` on the desktop is the same agent looking like two. `—` when the machine never said.
-String harnessActivityAge(DateTime? activity, DateTime now) {
- if (activity == null) return '—';
- final elapsed = now.difference(activity);
- if (elapsed.inDays >= 1) return '${elapsed.inDays}d';
- if (elapsed.inHours >= 1) return '${elapsed.inHours}h';
- return '${elapsed.inMinutes.clamp(0, 59)}m';
-}
diff --git a/mobile/lib/phone/fzf.dart b/mobile/lib/phone/fzf.dart
index bc087f2c9..be5fc71e5 100644
--- a/mobile/lib/phone/fzf.dart
+++ b/mobile/lib/phone/fzf.dart
@@ -1,114 +1,9 @@
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
import 'package:harness_mobile/core/fuzzy_match.dart';
-import 'composing_keyboard.dart';
-import 'tty.dart';
-
-/// fzf, drawn for a thumb: one-line rows over a `> ` prompt, the best match next to the prompt,
-/// matched letters in fzf's green, `3/14` above the prompt. Find is built from these, and so is
-/// every chooser New opens — the same list everywhere, the one a terminal user already reads
-/// without thinking.
-
-/// One row: an optional mark in fzf's gutter, the name with its matched letters lit, the detail
-/// in the dim face after it, and one word at the right edge (an age, or a state).
-class FzfRow extends StatelessWidget {
- const FzfRow({
- super.key,
- required this.title,
- this.detail,
- this.trailing,
- this.trailingColor,
- this.terms = const [],
- this.mark,
- this.markColor,
- this.enabled = true,
- this.cursor = false,
- this.onTap,
- });
-
- /// fzf's cursor row — the one Enter takes: `▌` in red in the gutter, the selection ground behind,
- /// the name in bold.
- final bool cursor;
-
- final String title;
- final String? detail;
- final String? trailing;
- final Color? trailingColor;
-
- /// What was typed, to light in [title] — fzf's `hl`.
- final List<String> terms;
-
- /// One character in the gutter: `*` for the agent on screen, `✓` for a chosen value.
- final String? mark;
- final Color? markColor;
-
- final bool enabled;
- final VoidCallback? onTap;
-
- static const double height = 40;
-
- @override
- Widget build(BuildContext context) {
- final tty = Tty.of(context);
- final ink = enabled ? tty.text : tty.dim;
- final row = TtyTap(
- minHeight: height,
- onTap: enabled && onTap != null
- ? () {
- HapticFeedback.selectionClick();
- onTap!();
- }
- : null,
- child: Row(
- children: [
- SizedBox(
- width: 24,
- child: Center(
- child: TtyText(
- cursor ? '▌' : (mark ?? ' '),
- color: cursor ? tty.red : (markColor ?? tty.red),
- weight: FontWeight.w600,
- ),
- ),
- ),
- Expanded(
- child: Text.rich(
- TextSpan(
- children: [
- ...fzfHighlight(
- title,
- terms,
- base: tty.style(
- color: ink,
- weight: cursor ? FontWeight.w600 : FontWeight.w400,
- ),
- hit: tty.style(color: tty.green, weight: FontWeight.w600),
- ),
- if (detail case final detail? when detail.isNotEmpty)
- TextSpan(
- text: ' $detail',
- style: tty.style(color: tty.faint),
- ),
- ],
- ),
- maxLines: 1,
- softWrap: false,
- overflow: TextOverflow.clip,
- ),
- ),
- if (trailing case final trailing?)
- Padding(
- padding: const EdgeInsets.only(left: 8, right: 12),
- child: TtyText(trailing, color: trailingColor ?? tty.dim),
- ),
- ],
- ),
- );
- return cursor ? ColoredBox(color: tty.selected, child: row) : row;
- }
-}
+/// fzf's way of saying things, for Find's rows (`find_row.dart`): the typed letters lit in
+/// fzf's green, and an age the way a terminal writes one.
/// [text] as spans with each typed term lit — a substring where there is one (one that starts a
/// word first: "port" lights "windows port", not "support"), else scattered letters in order.
@@ -181,130 +76,6 @@ List<TextSpan> fzfHighlight(
return spans;
}
-/// fzf's info line: ` 3/14 ──────` and, at its right edge, the words that act — `+new`, `esc`.
-class FzfInfoLine extends StatelessWidget {
- const FzfInfoLine({
- super.key,
- required this.matched,
- required this.total,
- this.actions = const [],
- this.label,
- });
-
- final int matched;
- final int total;
-
- /// A word in place of the count, for a list that counts itself elsewhere — `:`'s models.
- final String? label;
- final List<({String label, VoidCallback onTap})> actions;
-
- @override
- Widget build(BuildContext context) {
- final tty = Tty.of(context);
- return SizedBox(
- height: 36,
- child: Row(
- children: [
- const SizedBox(width: 24),
- // fzf's info line: always `matched/total`, then its rule drawn in `─`, not a hairline.
- TtyText(label ?? '$matched/$total', color: tty.yellow),
- const SizedBox(width: 8),
- Expanded(
- child: ClipRect(child: TtyText('─' * 80, color: tty.dim)),
- ),
- for (final action in actions)
- TtyTap(
- onTap: action.onTap,
- minHeight: 36,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: TtyText(action.label, color: tty.cyan),
- ),
- ),
- const SizedBox(width: 4),
- ],
- ),
- );
- }
-}
-
-/// fzf's prompt: `> ` and the query, on the terminal's ground — no box, no border, no magnifier.
-class FzfPrompt extends StatelessWidget {
- const FzfPrompt({
- super.key,
- required this.controller,
- required this.focus,
- required this.onChanged,
- this.hint,
- this.onSubmitted,
- });
-
- final TextEditingController controller;
- final FocusNode focus;
- final ValueChanged<String> onChanged;
- final String? hint;
- final VoidCallback? onSubmitted;
-
- @override
- Widget build(BuildContext context) {
- final tty = Tty.of(context);
- return SizedBox(
- height: 48,
- child: Row(
- // ⚠️ On the text's baseline, not centred: a field and a glyph centred separately sat the
- // query ~9pt above its `>`.
- crossAxisAlignment: CrossAxisAlignment.baseline,
- textBaseline: TextBaseline.alphabetic,
- children: [
- SizedBox(
- width: 24,
- child: Center(
- child: TtyText('>', color: tty.blue, weight: FontWeight.w600),
- ),
- ),
- Expanded(
- child: TextField(
- textAlignVertical: TextAlignVertical.center,
- controller: controller,
- focusNode: focus,
- onChanged: onChanged,
- onSubmitted: (_) => onSubmitted?.call(),
- // ⚠️ The keyboard's own composing, left on: Vietnamese Telex on iOS rides on
- // autocorrection, and a prompt that turned it off could not be typed in. Dashes and
- // quotes stay straight — they are search text, not prose. See [ComposingKeyboard].
- autocorrect: ComposingKeyboard.autocorrect,
- enableSuggestions: ComposingKeyboard.enableSuggestions,
- smartDashesType: SmartDashesType.disabled,
- smartQuotesType: SmartQuotesType.disabled,
- textCapitalization: TextCapitalization.none,
- textInputAction: TextInputAction.search,
- cursorColor: tty.text,
- cursorWidth: 2,
- style: tty.style(),
- // Bare: the app theme fills and rounds every field, and a prompt has neither.
- decoration: InputDecoration(
- isCollapsed: true,
- // The app theme gives every field a minimum height, which floated the text to the
- // top of a taller box.
- constraints: const BoxConstraints(),
- filled: false,
- border: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- disabledBorder: InputBorder.none,
- contentPadding: EdgeInsets.zero,
- hintText: hint,
- hintStyle: tty.style(color: tty.faint),
- ),
- ),
- ),
- const SizedBox(width: 12),
- ],
- ),
- );
- }
-}
-
/// How long ago, the way a terminal would say it: `now`, `3m`, `2h`, `5d`.
String fzfAge(DateTime? at, DateTime now) {
if (at == null) return '';
diff --git a/mobile/lib/phone/phone_search_field.dart b/mobile/lib/phone/phone_search_field.dart
index 5b06d4448..4035070ca 100644
--- a/mobile/lib/phone/phone_search_field.dart
+++ b/mobile/lib/phone/phone_search_field.dart
@@ -4,22 +4,13 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'composing_keyboard.dart';
-import 'phone_search_controller.dart';
-import 'sheet_list.dart';
-/// The search page's whole header: one bar, with the way out inside it.
+/// A field over a list it filters — the All harnesses page and the branch picker: one rimmed bar,
+/// the rim lit while it has the keyboard, and a clear button once there is something to clear.
///
-/// Drawn here rather than through [PhoneHeader]: the page has no title. The
-/// field IS the header, because nothing else on the screen is worth the 32pt
-/// line a large title would take from the results.
-///
-/// The way back is a chevron at the bar's leading edge rather than a "Cancel"
-/// beside it. The word cost the field a fifth of the screen's width to say what
-/// the edge swipe, Android's back button and the chevron every other page wears
-/// already say; the chevron takes the place of the magnifier, which the hint
-/// text made redundant.
-///
-/// The terminal's sheet draws its own — see [SheetSearchField].
+/// ⚠️ **It never takes the keyboard on the way in.** Both lists are worth reading before anything
+/// is typed — most repositories have a handful of branches and the answer is on screen already —
+/// and a keyboard raised as the page appears would bury half of what the person opened it to see.
class PhoneSearchField extends StatelessWidget {
const PhoneSearchField({
super.key,
@@ -27,9 +18,7 @@ class PhoneSearchField extends StatelessWidget {
required this.focus,
required this.onChanged,
required this.onClear,
- this.onBack,
- this.autofocus = true,
- this.hintText = kPhoneSearchHint,
+ required this.hintText,
});
final TextEditingController controller;
@@ -37,26 +26,7 @@ class PhoneSearchField extends StatelessWidget {
final ValueChanged<String> onChanged;
final VoidCallback onClear;
- /// The chevron inside the bar. Null leaves it out, for a field that is not the
- /// page's whole header — [AgentsListPage] has a [PhoneHeader] of its own above
- /// it, whose back band is the way out, and a second chevron under the first
- /// would be two ways back stacked one over the other.
- final VoidCallback? onBack;
-
- /// Whether the field takes the keyboard as it appears.
- ///
- /// True on [PhoneSearchPage], which exists only to be typed into. False where
- /// the field sits over a list worth reading first: raising the keyboard there
- /// would bury half of what the person opened the screen to look at.
- final bool autofocus;
-
- /// What the empty field says it can do.
- ///
- /// ⚠️ **It names all four kinds, and that is the point.** It used to read
- /// "Search agents", which was true and was also the whole reason nobody on the
- /// phone knew that `>`, `#`, `@` and `?` existed — the desktop teaches its
- /// modes here and only here. The controller narrows it once a mode is open
- /// ("Search projects…"), so the long form is only ever read on an empty box.
+ /// What the empty field says it searches.
final String hintText;
@override
@@ -90,23 +60,13 @@ class PhoneSearchField extends StatelessWidget {
),
child: Row(
children: [
- if (onBack != null)
- _BackButton(onTap: onBack!)
- else
- // The chevron's place, so the text starts on the same vertical
- // whether or not the bar carries one.
- const SizedBox(width: 14),
+ const SizedBox(width: 14),
Expanded(
child: _QueryInput(
controller: controller,
focus: focus,
onChanged: onChanged,
- autofocus: autofocus,
hintText: hintText,
- // A size down from the query's own 16pt: the hint spells out
- // four modes and has to survive a 390pt screen without
- // ellipsing the last of them.
- hintStyle: TextStyle(color: AppPalette.textFaint, fontSize: 13),
),
),
_ClearButton(controller: controller, onTap: onClear),
@@ -117,306 +77,31 @@ class PhoneSearchField extends StatelessWidget {
}
}
-/// The terminal sheet's field: iOS's own search bar — a filled box with the
-/// magnifier at its head, and "Cancel" beside it while the sheet is searching.
-///
-/// ```
-/// ┌─────────────────────────┐
-/// │ ⌕ Search harnesses │ Cancel
-/// └─────────────────────────┘
-/// ```
-///
-/// ⚠️ **Not [PhoneSearchField], though it types the same.** That one is a
-/// page's header — a rimmed bar with the way back inside it. This one sits in
-/// a sheet the system's own sheets are drawn like, over a list drawn like
-/// iOS's grouped lists, and a rimmed Material box at the top of it was the one
-/// thing on the sheet speaking another language. What is typed is set up
-/// identically — both hand their text to [_QueryInput].
-///
-/// ⚠️ **No rim on focus.** Cancel sliding in is what says the field has the
-/// keyboard — the caret and the word are iOS's own way of saying it, and a
-/// ring on top of them would be the same news told twice.
-///
-/// The hint names harnesses and nothing else: the modes `>` `#` `@` `?` are
-/// offered as chips under the field once it is focused (see
-/// `terminal_search.dart`), which is room this box never had to spell them out
-/// in.
-class SheetSearchField extends StatelessWidget {
- const SheetSearchField({
- super.key,
- required this.controller,
- required this.focus,
- required this.onChanged,
- required this.onClear,
- required this.hintText,
- this.onCancel,
- this.onNew,
- this.onSubmitted,
- });
-
- /// The return key: Find opens the top row, as Enter does in the desktop's ⌘P.
- final VoidCallback? onSubmitted;
-
- final TextEditingController controller;
- final FocusNode focus;
- final ValueChanged<String> onChanged;
- final VoidCallback onClear;
- final String hintText;
-
- /// A `+` beside the box, for a new agent. Null leaves it out — and it IS null while [onCancel] is
- /// set, so the two never stand side by side.
- final VoidCallback? onNew;
-
- /// "Cancel", beside the box. Null leaves it out.
- ///
- /// Set for as long as the sheet is searching: it ends the SEARCH — results
- /// out, tabs back — and leaves the sheet up. It slides in as it is set and
- /// out as it is cleared, the box giving it room as it comes; see
- /// [_CancelButton].
- final VoidCallback? onCancel;
-
- /// The box's height — `UISearchBar`'s, a size under a row's so the field
- /// reads as part of the sheet's chrome rather than as its first row.
- static const double _height = 36;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Padding(
- // Close under the grip, and closer still to what follows: the pills and
- // the chips under it bring 6pt of their own, so the two gaps land level.
- padding: const EdgeInsets.fromLTRB(16, 6, 16, 4),
- child: Row(
- children: [
- Expanded(
- child: GestureDetector(
- // The magnifier is part of the box, and a tap on it is a tap on
- // the field — the TextField itself only reaches from the hint on.
- onTap: focus.requestFocus,
- child: Container(
- height: _height,
- padding: const EdgeInsets.symmetric(horizontal: 8),
- decoration: BoxDecoration(
- // The rows' own fill: iOS fills its search field with the
- // same lift over the sheet as the cells below it, so the
- // box reads as part of the list it searches.
- color: sheetRowFill,
- borderRadius: BorderRadius.circular(10),
- ),
- child: Row(
- children: [
- Icon(
- LucideIcons.search,
- size: 16,
- color: AppPalette.textSecondary,
- ),
- const SizedBox(width: 6),
- Expanded(
- child: _QueryInput(
- controller: controller,
- focus: focus,
- onChanged: onChanged,
- // Opened to read the recent agents; focus is what
- // brings the keyboard.
- autofocus: false,
- hintText: hintText,
- onSubmitted: onSubmitted,
- // The query's own size, and ink a step under it: the
- // hint is one short phrase here, and iOS draws its
- // placeholder bright enough to be read at a glance.
- hintStyle: TextStyle(
- color: AppPalette.textSecondary,
- fontSize: 16,
- ),
- ),
- ),
- _ClearButton(controller: controller, onTap: onClear),
- ],
- ),
- ),
- ),
- ),
- _CancelButton(onTap: onCancel),
- if (onNew != null && onCancel == null) _NewButton(onTap: onNew!),
- ],
- ),
- );
- }
-}
-
-/// `+`, for a new agent — see [SheetSearchField.onNew].
-class _NewButton extends StatelessWidget {
- const _NewButton({required this.onTap});
-
- final VoidCallback onTap;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Semantics(
- button: true,
- label: 'New agent',
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Padding(
- // Padding, not a gap: the space between the box and the mark is part of the target.
- padding: const EdgeInsets.only(left: 12),
- child: SizedBox(
- width: 32,
- height: 44,
- child: Center(
- child: Icon(
- LucideIcons.plus,
- size: 24,
- color: AppPalette.accentOnSurface,
- ),
- ),
- ),
- ),
- ),
- );
- }
-}
-
-/// "Cancel" — see [SheetSearchField.onCancel].
-///
-/// ⚠️ **Kept built while it leaves, and dead while it does.** The word has to
-/// be on screen to be seen sliding out; taken down with the search, the box
-/// would jump back to its full width over a gap. And the tap that ended the
-/// search must not land on it a second time on the way out.
-class _CancelButton extends StatelessWidget {
- const _CancelButton({required this.onTap});
-
- final VoidCallback? onTap;
-
- static const Duration _slide = Duration(milliseconds: 250);
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final onTap = this.onTap;
- return TweenAnimationBuilder<double>(
- tween: Tween(end: onTap == null ? 0 : 1),
- duration: _slide,
- curve: Curves.easeOutCubic,
- builder: (context, shown, child) => shown == 0
- ? const SizedBox.shrink()
- : ClipRect(
- child: Align(
- // Pinned by its LEFT edge to the room the box gives up, so the
- // word arrives from the right-hand edge of the screen and
- // leaves the same way.
- alignment: Alignment.centerLeft,
- widthFactor: shown,
- child: Opacity(opacity: shown, child: child),
- ),
- ),
- child: Semantics(
- button: true,
- enabled: onTap != null,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Padding(
- // Padding, not a gap: the space between the box and the word is
- // part of the word's target.
- padding: const EdgeInsets.only(left: 12),
- child: SizedBox(
- height: SheetSearchField._height,
- child: Center(
- child: Text(
- 'Cancel',
- maxLines: 1,
- style: TextStyle(
- // The accent the caret already wears: the word belongs to
- // the state the caret is in, and goes with it. Regular
- // weight, as the system's own Cancel is — it is a way out,
- // not the thing the sheet is for.
- color: AppPalette.accentOnSurface,
- fontSize: 16,
- ),
- ),
- ),
- ),
- ),
- ),
- ),
- );
- }
-}
-
-/// The bar's full height and a thumb's width, not the glyph's: the chevron sits
-/// against the bar's rounded edge, where a miss is the easiest to make.
-class _BackButton extends StatelessWidget {
- const _BackButton({required this.onTap});
-
- final VoidCallback onTap;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Semantics(
- button: true,
- label: 'Back',
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: SizedBox(
- width: 40,
- height: 44,
- child: Icon(
- LucideIcons.chevronLeft300,
- size: 22,
- color: AppPalette.textPrimary,
- ),
- ),
- ),
- );
- }
-}
-
class _QueryInput extends StatelessWidget {
const _QueryInput({
required this.controller,
required this.focus,
required this.onChanged,
- required this.autofocus,
required this.hintText,
- required this.hintStyle,
- this.onSubmitted,
});
final TextEditingController controller;
final FocusNode focus;
final ValueChanged<String> onChanged;
-
- /// The keyboard's return key. Null puts the keyboard away and nothing more.
- final VoidCallback? onSubmitted;
- final bool autofocus;
final String hintText;
- /// The hint's size and ink, which is the one thing the two fields that
- /// share this input disagree on — see the call sites for why each is sized
- /// as it is.
- final TextStyle hintStyle;
-
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
return TextField(
controller: controller,
focusNode: focus,
- autofocus: autofocus,
onChanged: onChanged,
// The list is already filtered by the time a key is released; there is
// nothing left for the return key to submit, so it stays a plain "done"
// that drops the keyboard and leaves the results up.
textInputAction: TextInputAction.search,
- onSubmitted: (_) {
- focus.unfocus();
- onSubmitted?.call();
- },
+ onSubmitted: (_) => focus.unfocus(),
// Composing stays on — or Telex types `thoi tiet` for `thời tiết`. See
// [ComposingKeyboard]; with autocorrect on, iOS would also start curling
// quotes and joining dashes, which a query means literally.
@@ -428,9 +113,8 @@ class _QueryInput extends StatelessWidget {
// — and a capital forced onto the first letter of one is a wrong query.
textCapitalization: TextCapitalization.none,
// With the decoration's padding zeroed below, the field is exactly one line
- // tall inside its box (44pt on the page, 36 in the sheet); this is what
- // centres that line on the chevron or magnifier beside it instead of
- // letting it sit on the box's top edge.
+ // tall inside its 44pt box; this is what centres that line in the box
+ // instead of letting it sit on the box's top edge.
textAlignVertical: TextAlignVertical.center,
style: TextStyle(color: AppPalette.textPrimary, fontSize: 16),
cursorColor: AppPalette.accentOnSurface,
@@ -457,7 +141,9 @@ class _QueryInput extends StatelessWidget {
contentPadding: EdgeInsets.zero,
constraints: const BoxConstraints(),
hintText: hintText,
- hintStyle: hintStyle,
+ // A size down from the query's own 16pt. Set when the hint spelled out
+ // four modes on a 390pt screen, and kept.
+ hintStyle: TextStyle(color: AppPalette.textFaint, fontSize: 13),
),
);
}
diff --git a/mobile/lib/phone/phone_search_results.dart b/mobile/lib/phone/phone_search_results.dart
index 172ccb690..282a04b50 100644
--- a/mobile/lib/phone/phone_search_results.dart
+++ b/mobile/lib/phone/phone_search_results.dart
@@ -1,11 +1,9 @@
import 'dart:async';
import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:harness_mobile/core/last_opened_agent.dart' show AgentRef;
import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/shared/widgets/empty_state.dart';
import 'package:harness_mobile/notify/agent_notice.dart' show NoticeKind;
import 'package:harness_mobile/state/app_state.dart';
import 'package:harness_mobile/state/external_session.dart';
@@ -19,12 +17,9 @@ import 'phone_search_catalog.dart' show phoneAgentId;
import 'phone_search_commands.dart';
import 'phone_search_controller.dart';
import 'phone_search_rank.dart';
-import 'phone_search_row.dart';
import 'resume_agent.dart';
import 'search_result_text.dart'
show phoneResultMatches, snippetLead, snippetRuns;
-import 'sheet_list.dart';
-import 'sheet_search_row.dart';
import 'tty.dart';
import 'tty_controls.dart';
@@ -52,8 +47,6 @@ class PhoneSearchResults extends StatefulWidget {
required this.notifier,
required this.controller,
this.onOpen,
- this.grouped = false,
- this.fzf = false,
this.showing,
this.onNewHarness,
});
@@ -63,9 +56,6 @@ class PhoneSearchResults extends StatefulWidget {
final void Function(({String machineId, String folder, String label})? place)?
onNewHarness;
- /// Find's list: two-line rows growing down from the field at the top — see [FindRow].
- final bool fzf;
-
final AppNotifier notifier;
final PhoneSearchController controller;
@@ -77,14 +67,8 @@ class PhoneSearchResults extends StatefulWidget {
/// search away first. Null on the pick-up page, which is a route of its own.
final VoidCallback? onOpen;
- /// Draws the rows as one inset group of [SheetSearchRow]s — the terminal
- /// sheet's list, whose tabs are drawn the same way — rather than the page's
- /// flat list in the terminal's face. What is listed, and what a tap does, is
- /// the same either way.
- final bool grouped;
-
- /// The agent the terminal sheet was opened over, whose row wears the check
- /// in the grouped list. Unread by the flat one.
+ /// The agent Find was opened over: its row says `current`, sits after the recent ones, and a
+ /// tap on it is Cancel.
final AgentRef? showing;
@override
@@ -165,42 +149,7 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {
builder: (context, _) {
AppTheme.watch(context);
final search = widget.controller;
- final rows = search.rows;
- if (widget.fzf) return _find(search, rows);
- if (widget.grouped) return _grouped(search, rows);
- if (rows.isEmpty) return _empty(search);
- final terms = phoneSearchTerms(search.matchQuery);
- final now = DateTime.now();
- final previews = widget.notifier.sessionPreviews;
- return ListView.builder(
- // The keyboard is up and the finger is already on the glass; dragging
- // the list is how somebody reaches a result without putting it away
- // first.
- keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
- padding: EdgeInsets.fromLTRB(
- 16,
- 4,
- 16,
- MediaQuery.paddingOf(context).bottom + 16,
- ),
- itemCount: rows.length,
- itemBuilder: (context, index) {
- final row = rows[index];
- return PhoneSearchRow(
- row: row,
- terms: terms,
- now: now,
- openable: search.canSubmit(row),
- resuming: _resuming == row.id,
- busy: _resuming != null,
- // A row that is here for something said in its conversation quotes
- // it in place of its detail: nothing else on the row would explain
- // why it matched.
- quote: phoneContentSnippet(row, terms, previews),
- onTap: () => _tap(row),
- );
- },
- );
+ return _find(search, search.rows);
},
);
@@ -491,67 +440,6 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {
row.entry?.machineId == showing.machineId &&
row.entry?.agent.id == showing.agentId;
- Widget _grouped(PhoneSearchController search, List<PhoneDestination> rows) {
- final bottom = MediaQuery.paddingOf(context).bottom + 16;
- if (rows.isEmpty) {
- // ⚠️ **In a list, though it is one thing.** The sheet can be left a
- // couple of rows' height above the keyboard, and the empty state is
- // taller than that — laid out bare, it would overflow the sheet.
- return ListView(
- padding: EdgeInsets.fromLTRB(kSheetInset, 8, kSheetInset, bottom),
- children: [_empty(search, compact: true)],
- );
- }
- final terms = phoneSearchTerms(search.matchQuery);
- final previews = widget.notifier.sessionPreviews;
- final showing = widget.showing;
- return ListView.builder(
- // ⚠️ **A drag keeps the keyboard, unlike the flat list's.** The sheet
- // stands on the keyboard, so putting the keys away mid-scroll dropped
- // the whole sheet under the finger and took the field's focus with it.
- // The return key and Cancel are how this search puts them away.
- // No top padding: the caption or the chips over the list end in the gap
- // a group keeps from what labels it.
- padding: EdgeInsets.fromLTRB(kSheetInset, 0, kSheetInset, bottom),
- itemCount: rows.length,
- itemBuilder: (context, index) {
- final row = rows[index];
- final entry = row.entry;
- return SheetSearchRow(
- row: row,
- terms: terms,
- openable: search.canSubmit(row),
- resuming: _resuming == row.id,
- busy: _resuming != null,
- quote: phoneContentSnippet(row, terms, previews),
- onScreen:
- showing != null &&
- entry != null &&
- entry.machineId == showing.machineId &&
- entry.agent.id == showing.agentId,
- first: index == 0,
- last: index == rows.length - 1,
- onTap: () => _tap(row),
- );
- },
- );
- }
-
- Widget _empty(PhoneSearchController search, {bool compact = false}) {
- if (search.total == 0 && search.matchQuery.trim().isEmpty) {
- return EmptyState(
- icon: LucideIcons.laptopMinimal300,
- title: 'Nothing to search yet',
- message: 'Link a machine and its harnesses will be findable from here.',
- compact: compact,
- );
- }
- return EmptyState.noMatches(
- compact: compact,
- message: 'Nothing matches “${search.matchQuery.trim()}”.',
- );
- }
-
/// A tap goes to the controller first, which absorbs the ones that only move
/// the search: a `?` row taking its mode, a project or machine narrowing it.
/// What comes back is something to actually open.
diff --git a/mobile/lib/phone/phone_search_row_trailing.dart b/mobile/lib/phone/phone_search_row_trailing.dart
index c7fb091ef..c1389d78b 100644
--- a/mobile/lib/phone/phone_search_row_trailing.dart
+++ b/mobile/lib/phone/phone_search_row_trailing.dart
@@ -45,8 +45,7 @@ class PhoneSearchTrailing extends StatelessWidget {
}
/// The word a result ends in, or null for a row a tap simply opens — see
-/// [PhoneSearchTrailing]. Shared with the terminal sheet's rows
-/// (`sheet_search_row.dart`), which say the same thing in their own type.
+/// [PhoneSearchTrailing].
String? phoneSearchBadge(PhoneDestination row, {required bool openable}) {
final machine = row.machine;
return switch (row.kind) {
diff --git a/mobile/lib/phone/sheet_agent_lines.dart b/mobile/lib/phone/sheet_agent_lines.dart
deleted file mode 100644
index 80ab79651..000000000
--- a/mobile/lib/phone/sheet_agent_lines.dart
+++ /dev/null
@@ -1,218 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/core/agent_output_stats.dart';
-import 'package:harness_mobile/core/models.dart';
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-
-import 'agent_index.dart';
-import 'compact_age.dart';
-import 'phone_prompt_context.dart';
-import 'search_result_text.dart';
-
-// An agent's row in the sheet, said the way the desktop's Harness Monitor says it
-// (`desktop/lib/widgets/harness_session_manager.dart`, `_SessionRow`):
-//
-// ```
-// Logo Harness_4.svg update · 50m Start failed
-// ▭ MacBookPro2021.local ▢ autonomous-harness ⑂ feat/mobile…
-// 4.5M tokens · +120 −48 · 2 PRs
-// ```
-//
-// ⚠️ **Shared by the tabs and the search**, which the sheet swaps in place: an agent keeps the row
-// it had in the tabs when the field takes focus, so the swap changes what is listed, never how.
-
-/// Metadata in the monitor's face — the terminal's monospace, as the desktop's `monoMeta` is.
-TextStyle _meta(Color color) => phoneBoxMonoStyle(size: 11.5, color: color);
-
-/// The monitor's two place colours: the folder in teal, the branch in green.
-const _folderTint = Color(0xff79bbaf);
-const _branchTint = Color(0xff8dbb79);
-
-/// The edit counts' own colours — added in the branch's green, removed red — as the desktop draws
-/// them.
-const _addedTint = _branchTint;
-const _removedTint = Color(0xffd28f87);
-
-/// The word the monitor puts after a row's age when something is wrong with it, or null.
-///
-/// Only the exceptions: ready, working, waiting and paused already have their own mark on the row
-/// (its status dot, or `Stopped` at its end), and saying them twice is noise. The desktop's `status`,
-/// less its `View only` — a phone lists no shared harnesses.
-String? agentAttention(AgentEntry entry) {
- final agent = entry.agent;
- if (entry.machine.nodeOnline == false) return 'Offline';
- if (agent.isStopped) return null;
- return switch (agent.launchState) {
- 'failed' => 'Start failed',
- 'starting' => 'Starting',
- _ => null,
- };
-}
-
-/// The name, then how long ago the agent last moved, then [agentAttention].
-///
-/// The age is the machine's `updatedAt` — the same clock the list is sorted on
-/// ([compareMonitorOrder]), so the ages read down the list in order.
-class SheetAgentTitle extends StatelessWidget {
- const SheetAgentTitle({
- super.key,
- required this.entry,
- required this.name,
- required this.now,
- });
-
- final AgentEntry entry;
-
- /// The name as the caller draws it — plain in the tabs, with the query's hits in bold in search.
- final Widget name;
-
- final DateTime now;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final activity = entry.agent.updatedAt;
- final attention = agentAttention(entry);
- return Row(
- children: [
- // ⚠️ The unread mark used to lead this row and no longer does: it is at
- // the row's other end now, in the slot that spins while the agent works
- // — see [SheetAgentStatus].
- Flexible(child: name),
- if (activity != null)
- Padding(
- padding: const EdgeInsets.only(left: 8),
- child: Text(
- '· ${harnessActivityAge(activity, now)}',
- maxLines: 1,
- style: _meta(AppPalette.textSecondary),
- ),
- ),
- if (attention != null)
- Padding(
- padding: const EdgeInsets.only(left: 10),
- child: Text(
- attention,
- maxLines: 1,
- style: _meta(AppPalette.textSecondary),
- ),
- ),
- ],
- );
- }
-}
-
-/// Where the agent runs — machine, folder, branch, each with its mark — and, when its machine has
-/// measured any, what it has produced.
-class SheetAgentMeta extends StatelessWidget {
- const SheetAgentMeta({
- super.key,
- required this.entry,
- this.matches = const [],
- });
-
- final AgentEntry entry;
-
- /// What the query reached, set in bold where it lands. Empty in the tabs, where nothing was
- /// searched.
- final Iterable<PhoneFieldMatch> matches;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final project = entry.project;
- final folder = project?.label;
- final branch = project?.shownBranch;
- final agent = entry.agent;
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- _part(
- LucideIcons.monitor,
- entry.machineName,
- AppPalette.textSecondary,
- ),
- if (folder != null && folder.isNotEmpty) ...[
- const SizedBox(width: 10),
- _part(LucideIcons.folder, folder, _folderTint),
- ],
- if (branch != null && branch.isNotEmpty) ...[
- const SizedBox(width: 10),
- _part(LucideIcons.gitBranch, branch, _branchTint),
- ],
- ],
- ),
- if (agent.hasMonitorStats) ...[
- const SizedBox(height: 3),
- _AgentStats(agent: agent),
- ],
- ],
- );
- }
-
- /// One mark and its words, giving way to the others when the row runs short.
- Widget _part(IconData icon, String text, Color color) => Flexible(
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(icon, size: 11, color: color),
- const SizedBox(width: 4),
- Flexible(
- child: SearchResultText(text, matches: matches, style: _meta(color)),
- ),
- ],
- ),
- );
-}
-
-/// `4.5M tokens · +120 −48 · 2 PRs` — the desktop's `_MonitorStats`, each part only when the machine
-/// reported it.
-class _AgentStats extends StatelessWidget {
- const _AgentStats({required this.agent});
-
- final Agent agent;
-
- @override
- Widget build(BuildContext context) {
- final style = _meta(AppPalette.textSecondary);
- final stats = agent.outputStats;
- final tokens = agent.tokensUsed;
- final pullRequests = stats?.pullRequestsCreated;
- final parts = <InlineSpan>[
- if (tokens != null) TextSpan(text: '${formatCount(tokens)} tokens'),
- if (stats != null && stats.hasEdits)
- TextSpan(
- children: [
- TextSpan(
- text: '+${formatCount(stats.linesAdded!)}',
- style: const TextStyle(color: _addedTint),
- ),
- const TextSpan(text: ' '),
- TextSpan(
- text: '−${formatCount(stats.linesRemoved!)}',
- style: const TextStyle(color: _removedTint),
- ),
- ],
- ),
- if (pullRequests != null)
- TextSpan(text: '$pullRequests ${pullRequests == 1 ? 'PR' : 'PRs'}'),
- ];
- return Text.rich(
- TextSpan(
- style: style,
- children: [
- for (var i = 0; i < parts.length; i++) ...[
- if (i > 0) const TextSpan(text: ' · '),
- parts[i],
- ],
- ],
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- );
- }
-}
diff --git a/mobile/lib/phone/sheet_list.dart b/mobile/lib/phone/sheet_list.dart
index 051674dda..3c7191199 100644
--- a/mobile/lib/phone/sheet_list.dart
+++ b/mobile/lib/phone/sheet_list.dart
@@ -1,18 +1,11 @@
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
-import 'package:harness_mobile/notify/agent_notice.dart';
-import 'package:harness_mobile/notify/unread_marks.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/widgets/engine_identity.dart';
-import 'phone_prompt_context.dart';
-import 'phone_status.dart';
-import 'status_pill.dart';
-
-// The pieces the terminal's search sheet lists with: iOS's inset-grouped list
-// — one card of rows with hairlines between them, a caption over it. See
-// [SheetRow] for why the tabs and the results share them.
+// The pieces the branch picker (`branch_picker_sheet.dart`) lists with: iOS's
+// inset-grouped list — one card of rows with hairlines between them, a caption
+// over it.
/// How far a group stands in from the sheet's sides — the field and the tab
/// pills keep the same margin, so the sheet has one left edge.
@@ -67,91 +60,6 @@ Color get sheetRowPressedFill =>
TextStyle sheetRowTitleStyle() =>
TextStyle(color: AppPalette.textPrimary, fontSize: 16, height: 1.25);
-/// The line under a row's name.
-TextStyle sheetRowSubtitleStyle() =>
- TextStyle(color: AppPalette.textSecondary, fontSize: 13, height: 1.3);
-
-/// The line over a run of rows: what the run is, and how many it holds.
-///
-/// With [onBack] it is also the way out of what it names — a project or a
-/// machine the search was narrowed to. iOS has no back button to do that, and
-/// without it the only way out of a machine was Cancel, which throws the
-/// search away with it.
-class SheetCaption extends StatelessWidget {
- const SheetCaption({super.key, required this.label, this.count, this.onBack});
-
- final String label;
-
- /// The run's size, or `4/14` once a query has narrowed it. Null leaves the
- /// right-hand end empty.
- final String? count;
-
- final VoidCallback? onBack;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final onBack = this.onBack;
- final style = TextStyle(
- // The ink of the line under a row's name, not the faint one: on the
- // lifted sheet the faint ink fell under 3:1 at this size.
- color: onBack == null
- ? AppPalette.textSecondary
- : AppPalette.accentOnSurface,
- fontSize: 12,
- fontWeight: FontWeight.w500,
- letterSpacing: 0.4,
- );
- final caption = Padding(
- // Closer to the rows it labels than to what is above it, so it reads as
- // theirs.
- padding: const EdgeInsets.fromLTRB(
- kSheetCaptionInset,
- 10,
- kSheetCaptionInset,
- 7,
- ),
- child: Row(
- children: [
- if (onBack != null) ...[
- Icon(LucideIcons.chevronLeft500, size: 14, color: style.color),
- const SizedBox(width: 2),
- ],
- Expanded(
- child: Text(
- label.toUpperCase(),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: style,
- ),
- ),
- if (count != null)
- Padding(
- padding: const EdgeInsets.only(left: 12),
- child: Text(
- count!,
- style: style.copyWith(
- color: AppPalette.textSecondary,
- fontFeatures: AppFont.tabularFigures,
- ),
- ),
- ),
- ],
- ),
- );
- if (onBack == null) return Semantics(header: true, child: caption);
- return Semantics(
- button: true,
- label: 'Back',
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onBack,
- child: caption,
- ),
- );
- }
-}
-
/// One row of an inset group: a tile, a name with a line under it, and what
/// the row ends in.
///
@@ -166,16 +74,6 @@ class SheetCaption extends StatelessWidget {
/// ╰──────────────────────────────────────╯
/// ```
///
-/// ⚠️ **One row for the tabs and for the search, and that is what it is for.**
-/// The sheet reads the account's tabs until its field is focused, then swaps
-/// them in place for results — and the same agent was drawn two unrelated
-/// ways either side of that swap: a tall card in the tabs, a flat monospaced
-/// line in the results. The swap read as a second app arriving. Both lists are
-/// built from this now, so focusing the field changes which rows are listed
-/// and nothing about how a row looks.
-///
-/// Status is said with a mark, not a word — see [SheetAgentStatus].
-///
/// ⚠️ **Each row draws its own share of the card**, rounding the corners only
/// where it opens or closes the group ([first], [last]). A card drawn once
/// around the rows would have to be a column of every row in it, and the
@@ -356,118 +254,6 @@ class SheetTile extends StatelessWidget {
);
}
-/// An agent's tile: its engine's own mark on a wash of the engine's colour.
-///
-/// ⚠️ **A wash, not the solid tile iOS Settings draws.** Settings can fill its
-/// tiles because it draws the glyphs on them, in white. These are the engines'
-/// own marks — most of them full-colour pictures (Codex's blue cloud, Amp's
-/// whole app icon) — and a solid fill behind one is a picture on a picture,
-/// while a white mark on white (Pi, Grok) disappears outright. The wash keeps
-/// the tile telling engines apart by colour and leaves each mark as its
-/// owner draws it.
-class SheetEngineTile extends StatelessWidget {
- const SheetEngineTile({super.key, required this.engine, this.displayName});
-
- final String? engine;
- final String? displayName;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final identity = engineIdentity(engine, displayName: displayName);
- return SheetTile(
- fill: identity.color.withValues(alpha: 0.2),
- child: EngineMark(engine: engine, displayName: displayName, size: 18),
- );
- }
-}
-
-/// A tile holding the character that reaches its row from the field: `>` for
-/// a command, `#` a project, `@` a machine. The row is its own lesson in the
-/// modes.
-class SheetGlyphTile extends StatelessWidget {
- const SheetGlyphTile(this.glyph, {super.key});
-
- final String glyph;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return SheetTile(
- fill: AppSurface.recessHover,
- child: Text(
- glyph,
- // ⚠️ Sized to the tile, which does not grow with the app's text size
- // — so neither may the glyph, or it outgrows its own square.
- textScaler: TextScaler.noScaling,
- style: phoneBoxMonoStyle(
- size: 14,
- color: AppPalette.textPrimary,
- weight: FontWeight.w600,
- ).copyWith(height: 1),
- ),
- );
- }
-}
-
-/// What an agent's row ends in: the check on the agent already on screen, and
-/// otherwise what it is doing — only when that is something, and never in
-/// words.
-///
-/// ⚠️ **The spinner is drawn in the row's own grey, not the accent.** A list
-/// with four agents working is four spinners, and four accent-blue ones were
-/// the loudest thing on the sheet — louder than the names. Waiting keeps its
-/// colour: it is the one state somebody has to act on.
-class SheetAgentStatus extends StatelessWidget {
- const SheetAgentStatus({
- super.key,
- required this.summary,
- this.onScreen = false,
- this.unread,
- });
-
- final PhoneSummary summary;
-
- /// News nobody has gone to yet — a turn finished, or a question asked, while
- /// the person was elsewhere. Drawn here as an [UnreadDot].
- ///
- /// ⚠️ **It takes this slot from the spinner rather than sitting beside it.**
- /// One mark at the end of a row is read at a glance; two are a pair to be
- /// told apart, on a row whose other two lines are already full. And the
- /// clash is rarer than it looks — an agent carries unread news because it
- /// STOPPED, so it is almost never spinning at the same time. When it is, the
- /// news is what somebody needs to be sent to; that it has since picked up
- /// more work is on the screen the dot takes them to.
- final NoticeKind? unread;
-
- /// The agent this sheet was opened over: it says so, and nothing else —
- /// whatever it is doing is on the screen behind the sheet.
- final bool onScreen;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- if (onScreen) {
- return Icon(
- LucideIcons.check500,
- size: 18,
- color: AppPalette.accentOnSurface,
- );
- }
- if (unread case final kind?) {
- return UnreadDot(kind: kind, diameter: UnreadDot.trailing);
- }
- return switch (summary.tone) {
- PhoneTone.busy || PhoneTone.attention => StatusDot(
- summary: summary,
- size: 11,
- spinnerColor: AppPalette.textSecondary,
- ),
- _ => const SizedBox.shrink(),
- };
- }
-}
-
/// A row's quiet word at its end — `Stopped`, `Offline` — iOS's detail text.
class SheetRowNote extends StatelessWidget {
const SheetRowNote(this.text, {super.key});
@@ -484,20 +270,3 @@ class SheetRowNote extends StatelessWidget {
);
}
}
-
-/// The wait on a row being brought back — stopped work resuming.
-class SheetRowSpinner extends StatelessWidget {
- const SheetRowSpinner({super.key});
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return SizedBox.square(
- dimension: 13,
- child: CircularProgressIndicator(
- strokeWidth: 1.6,
- color: AppPalette.textFaint,
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/sheet_search_row.dart b/mobile/lib/phone/sheet_search_row.dart
deleted file mode 100644
index 9e56c7e6a..000000000
--- a/mobile/lib/phone/sheet_search_row.dart
+++ /dev/null
@@ -1,158 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-
-import 'phone_destination.dart';
-import 'phone_search_row_trailing.dart';
-import 'sheet_agent_lines.dart';
-import 'search_result_text.dart';
-import 'sheet_list.dart';
-
-/// One result in the terminal sheet's search: what [PhoneSearchRow] says,
-/// drawn as the row the sheet's tabs are drawn with — see [SheetRow].
-///
-/// ⚠️ **Set in the app's own face, not the terminal's.** [PhoneSearchRow] sets
-/// its names in the terminal font for parity with the desktop's box, and on
-/// the search page that holds. In the sheet the same agents were drawn in the
-/// app's face a moment before, in the tabs these results replace — so the row
-/// an agent had there is the row it keeps here, and the swap between the two
-/// changes what is listed rather than how.
-class SheetSearchRow extends StatelessWidget {
- const SheetSearchRow({
- super.key,
- required this.row,
- required this.terms,
- required this.openable,
- required this.first,
- required this.last,
- required this.onTap,
- this.quote,
- this.resuming = false,
- this.busy = false,
- this.onScreen = false,
- });
-
- final PhoneDestination row;
- final List<String> terms;
-
- /// Whether a tap can do anything — see [PhoneSearchRow.openable]. A row that
- /// cannot is dimmed, with the reason at its end.
- final bool openable;
-
- /// Whether this row opens its group, and whether it closes it.
- final bool first, last;
-
- final VoidCallback onTap;
-
- /// See [PhoneSearchRow.quote].
- final String? quote;
-
- /// See [PhoneSearchRow.resuming].
- final bool resuming;
-
- /// See [PhoneSearchRow.busy].
- final bool busy;
-
- /// Whether this is the agent the sheet was opened over. It wears the check,
- /// as it does in the tabs.
- final bool onScreen;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final row = this.row;
- final matches = phoneResultMatches(row, terms);
- return SheetRow(
- first: first,
- last: last,
- enabled: openable,
- selected: onScreen,
- // ⚠️ **No unfocus here.** A tap on a project, a machine or a `?` row
- // only narrows the search, and the keyboard has to stay up for the rest
- // of the query; [PhoneSearchResults] puts it away once a tap is known to
- // open something.
- onTap: openable && !busy ? onTap : null,
- leading: _tile(row),
- title: _heading(row, matches),
- subtitle: _subtitle(row, matches),
- trailing: _trailing(row),
- chevron: openable && !onScreen && !resuming,
- );
- }
-
- static Widget _tile(PhoneDestination row) => switch (row.kind) {
- PhoneDestinationKind.agent => SheetEngineTile(
- engine: row.engine,
- displayName: row.entry?.agent.engineDisplayName,
- ),
- PhoneDestinationKind.machine => const SheetGlyphTile('@'),
- PhoneDestinationKind.project => const SheetGlyphTile('#'),
- PhoneDestinationKind.command => const SheetGlyphTile('>'),
- PhoneDestinationKind.mode => SheetGlyphTile(_modeGlyph(row) ?? '?'),
- PhoneDestinationKind.external => SheetEngineTile(
- engine: row.engine,
- displayName: row.external?.engineLabel,
- ),
- };
-
- /// A `?` row's own character — the one a tap on it puts in the field.
- static String? _modeGlyph(PhoneDestination row) {
- final glyph = row.pickerQuery?.trim();
- return glyph == null || glyph.isEmpty ? null : glyph;
- }
-
- /// The name — for an agent, with the monitor's age and attention after it ([SheetAgentTitle]).
- static Widget _heading(PhoneDestination row, List<PhoneFieldMatch> matches) {
- final name = SearchResultText(
- _title(row),
- matches: matches.where((match) => match.title),
- style: sheetRowTitleStyle(),
- );
- final entry = row.entry;
- if (entry == null) return name;
- return SheetAgentTitle(entry: entry, name: name, now: DateTime.now());
- }
-
- /// The name as the row draws it. A `?` row's title carries its character at
- /// its head — `> Commands` — and the tile beside it already says that.
- static String _title(PhoneDestination row) {
- final glyph = row.isMode ? _modeGlyph(row) : null;
- if (glyph == null || !row.title.startsWith(glyph)) return row.title;
- return row.title.substring(glyph.length).trimLeft();
- }
-
- /// The line under the name — in [PhoneSearchRow]'s own order of preference:
- /// a quote from the conversation when that is why the row is here, where
- /// the agent is when it is one, and otherwise the detail a group or a
- /// command carries.
- Widget? _subtitle(PhoneDestination row, List<PhoneFieldMatch> matches) {
- final details = matches.where((match) => !match.title);
- final quote = this.quote;
- if (quote != null) {
- return SearchResultText(
- quote,
- matches: phoneContentMatches(terms),
- style: sheetRowSubtitleStyle(),
- );
- }
- final entry = row.entry;
- if (entry != null) return SheetAgentMeta(entry: entry, matches: details);
- if (row.detail.isEmpty) return null;
- return SearchResultText(
- row.detail,
- matches: details,
- style: sheetRowSubtitleStyle(),
- );
- }
-
- /// What the row ends in: the wait while it resumes, the word for why it will
- /// not simply open, or else — for an agent — what it is doing.
- Widget? _trailing(PhoneDestination row) {
- if (resuming) return const SheetRowSpinner();
- final badge = phoneSearchBadge(row, openable: openable);
- if (badge != null) return SheetRowNote(badge);
- final entry = row.entry;
- if (entry == null) return null;
- return SheetAgentStatus(summary: entry.summary, onScreen: onScreen);
- }
-}
diff --git a/mobile/lib/phone/terminal_search.dart b/mobile/lib/phone/terminal_search.dart
index 178d48ba6..32a6f68d4 100644
--- a/mobile/lib/phone/terminal_search.dart
+++ b/mobile/lib/phone/terminal_search.dart
@@ -505,7 +505,6 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
key: _results,
notifier: widget.notifier,
controller: _search,
- fzf: true,
showing: widget.showing,
onOpen: _close,
onNewHarness: newAgent == null
diff --git a/mobile/lib/phone/welcome/pick_up_page.dart b/mobile/lib/phone/welcome/pick_up_page.dart
index ebf4a2336..f0cb9a390 100644
--- a/mobile/lib/phone/welcome/pick_up_page.dart
+++ b/mobile/lib/phone/welcome/pick_up_page.dart
@@ -119,7 +119,6 @@ class _PickUpPageState extends State<PickUpPage> {
child: PhoneSearchResults(
notifier: widget.notifier,
controller: _search,
- fzf: true,
onNewHarness: _newHarness,
),
),
diff --git a/mobile/test/phone_search_test.dart b/mobile/test/phone_search_test.dart
index 5ae76f228..a93825c4f 100644
--- a/mobile/test/phone_search_test.dart
+++ b/mobile/test/phone_search_test.dart
@@ -1313,11 +1313,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
- body: PhoneSearchResults(
- notifier: app,
- controller: search,
- fzf: true,
- ),
+ body: PhoneSearchResults(notifier: app, controller: search),
),
),
);
@@ -1351,11 +1347,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
- body: PhoneSearchResults(
- notifier: app,
- controller: search,
- fzf: true,
- ),
+ body: PhoneSearchResults(notifier: app, controller: search),
),
),
);
@@ -1404,11 +1396,7 @@ void main() {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
- body: PhoneSearchResults(
- notifier: app,
- controller: search,
- fzf: true,
- ),
+ body: PhoneSearchResults(notifier: app, controller: search),
),
),
);
diff --git a/mobile/test/sheet_agent_lines_test.dart b/mobile/test/sheet_agent_lines_test.dart
deleted file mode 100644
index f7165d89c..000000000
--- a/mobile/test/sheet_agent_lines_test.dart
+++ /dev/null
@@ -1,130 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness_mobile/core/agent_output_stats.dart';
-import 'package:harness_mobile/core/models.dart';
-import 'package:harness_mobile/phone/agent_index.dart';
-import 'package:harness_mobile/phone/compact_age.dart';
-import 'package:harness_mobile/phone/sheet_agent_lines.dart';
-import 'package:harness_mobile/state/app_state.dart';
-
-/// An agent's row in the sheet reads as the desktop's Harness Monitor reads it.
-void main() {
- final now = DateTime.utc(2026, 9, 23, 12);
-
- AgentEntry entryOf(Agent agent) => AgentEntry(
- machine: MachineState(
- const Machine(
- machineId: 'm',
- authMode: MachineAuthMode.remote,
- name: 'MacBookPro2021.local',
- ),
- )..nodeOnline = true,
- agent: agent,
- );
-
- Map<String, dynamic> wire({Object? tokenUsage, Object? outputStats}) => {
- 'id': 'a',
- 'name': 'api',
- 'engine': 'claude',
- 'tokenUsage': ?tokenUsage,
- 'outputStats': ?outputStats,
- };
-
- group('what the machine measured', () {
- test('is read as the desktop reads it', () {
- final agent = Agent.fromJson(
- wire(
- tokenUsage: {
- 'totalTokens': 4500000,
- 'updatedAt': '2026-09-23T11:00:00Z',
- },
- outputStats: {
- 'linesAdded': 120,
- 'linesRemoved': 48,
- 'pullRequestsCreated': 2,
- },
- ),
- );
- expect(agent.tokensUsed, 4500000);
- expect(agent.tokensUpdatedAt, DateTime.utc(2026, 9, 23, 11));
- expect(agent.outputStats?.linesAdded, 120);
- expect(agent.outputStats?.pullRequestsCreated, 2);
- expect(agent.hasMonitorStats, isTrue);
- });
-
- test('drops what no count could be, and half an edit pair', () {
- final agent = Agent.fromJson(
- wire(
- tokenUsage: {'totalTokens': -1},
- outputStats: {'linesAdded': 3},
- ),
- );
- expect(agent.tokensUsed, isNull);
- expect(agent.outputStats, isNull);
- expect(agent.hasMonitorStats, isFalse);
- });
- });
-
- test('counts and ages are the desktop\'s strings', () {
- expect(formatCount(980), '980');
- expect(formatCount(12300), '12.3k');
- expect(formatCount(4500000), '4.5M');
- expect(harnessActivityAge(now.subtract(const Duration(minutes: 49)), now), '49m');
- expect(harnessActivityAge(now.subtract(const Duration(hours: 21)), now), '21h');
- expect(harnessActivityAge(now.subtract(const Duration(days: 9)), now), '9d');
- expect(harnessActivityAge(null, now), '—');
- });
-
- testWidgets('a row says its age, its trouble, its place and its output', (
- tester,
- ) async {
- final entry = entryOf(
- Agent(
- id: 'a',
- name: 'Respond to greeting',
- engine: 'claude',
- updatedAt: now.subtract(const Duration(minutes: 50)),
- launchState: 'failed',
- project: const AgentProject(
- name: 'autonomous-harness',
- cwd: '/work/autonomous-harness',
- branch: 'main',
- ),
- tokensUsed: 4500000,
- outputStats: const AgentOutputStats(
- linesAdded: 120,
- linesRemoved: 48,
- pullRequestsCreated: 1,
- ),
- ),
- );
- await tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Column(
- children: [
- SheetAgentTitle(
- entry: entry,
- name: const Text('Respond to greeting'),
- now: now,
- ),
- SheetAgentMeta(entry: entry),
- ],
- ),
- ),
- ),
- );
-
- expect(find.text('· 50m'), findsOneWidget);
- expect(find.text('Start failed'), findsOneWidget);
- expect(find.text('MacBookPro2021.local'), findsOneWidget);
- expect(find.text('autonomous-harness'), findsOneWidget);
- expect(find.text('main'), findsOneWidget);
- expect(
- find.textContaining('4.5M tokens', findRichText: true),
- findsOneWidget,
- );
- expect(find.textContaining('+120 −48', findRichText: true), findsOneWidget);
- expect(find.textContaining('1 PR', findRichText: true), findsOneWidget);
- });
-}