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): delete the ten files nothing imports

dee74a1787f1ae2
diff --git a/mobile/lib/phone/agents_list_page.dart b/mobile/lib/phone/agents_list_page.dart
index 9d673a176..3ba1808e0 100644
--- a/mobile/lib/phone/agents_list_page.dart
+++ b/mobile/lib/phone/agents_list_page.dart
@@ -108,16 +108,15 @@ class _AgentsListPageState extends State<AgentsListPage> {
// magnifier would have pushed a second screen over this one to answer a question
// this one is already showing.
//
- // ⚠️ No autofocus and no back chevron in the bar — both belong to [PhoneSearchPage],
- // where the field IS the header. Here the list is worth reading before anything is
- // typed, and the header above already carries the way out.
+ // ⚠️ No autofocus and no back chevron in the bar. Here the list is worth reading
+ // before anything is typed, and the header above already carries the way out.
if (all.isNotEmpty)
PhoneSearchField(
controller: _controller,
focus: _focus,
autofocus: false,
// This field filters the list below it; it is not the door to
- // the modes, which [PhoneSearchPage] carries.
+ // the modes, which Find carries.
hintText: 'Search harnesses',
onChanged: (value) => setState(() => _query = value),
onClear: () {
@@ -144,11 +143,7 @@ class _AgentsListPageState extends State<AgentsListPage> {
}
class _Body extends StatefulWidget {
- const _Body({
- required this.notifier,
- required this.all,
- required this.query,
- });
+ const _Body({required this.notifier, required this.all, required this.query});
final AppNotifier notifier;
@@ -176,8 +171,8 @@ class _BodyState extends State<_Body> {
final all = widget.all;
final query = widget.query;
if (all.isEmpty) return _empty();
- // The same ranking [PhoneSearchPage] applies, so an agent found by a word here is the agent
- // that word finds there. Grouping happens after: ranking decides the order the rows arrive in,
+ // The same ranking Find applies, so an agent found by a word here is the agent that word
+ // finds there. Grouping happens after: ranking decides the order the rows arrive in,
// and [phoneMachineGroups] preserves it — so the best match still heads the first group.
final rows = query.isEmpty
? all
@@ -235,7 +230,9 @@ class _BodyState extends State<_Body> {
icon: notifier.machines.isEmpty
? LucideIcons.laptopMinimal300
: LucideIcons.squareTerminal300,
- title: notifier.machines.isEmpty ? 'No machines yet' : 'No harnesses to show',
+ title: notifier.machines.isEmpty
+ ? 'No machines yet'
+ : 'No harnesses to show',
message: notifier.machines.isEmpty
? 'Link a machine and its harnesses will be listed here.'
: 'Harnesses appear here once a machine is linked and answering. '
@@ -245,10 +242,7 @@ class _BodyState extends State<_Body> {
/// Opens the agent as a pager over the other rows on screen, resuming stopped
/// work first — the same [resumeAgentForOpen] the search uses, so tapping the
/// same agent on either screen does the same thing.
- Future<void> _open(
- List<PhoneDestination> drawn,
- PhoneDestination row,
- ) async {
+ Future<void> _open(List<PhoneDestination> drawn, PhoneDestination row) async {
// The keyboard goes away with the screen rather than a frame after it, so the push does not
// animate over a collapsing inset. [PhoneSearchRow] does this for its own tap; a row opened
// by any other path still has to.
@@ -261,9 +255,8 @@ class _BodyState extends State<_Body> {
if (!mounted) return;
setState(() => _resuming = null);
if (error != null) {
- ScaffoldMessenger.maybeOf(
- context,
- )?.showSnackBar(SnackBar(content: Text(error)));
+ ScaffoldMessenger.maybeOf(context)
+ ?.showSnackBar(SnackBar(content: Text(error)));
return;
}
} else if (!entry.agent.terminalAvailable) {
diff --git a/mobile/lib/phone/link_page.dart b/mobile/lib/phone/link_page.dart
index 5eacad166..c6915897e 100644
--- a/mobile/lib/phone/link_page.dart
+++ b/mobile/lib/phone/link_page.dart
@@ -8,7 +8,7 @@ import 'tty.dart';
import 'tty_controls.dart';
import 'welcome/unlock_computer.dart';
-/// A machine's password form, as a phone page — the same [LinkMachineScreen] the desktop pops
+/// A machine's password form, as a phone page — the form the desktop's `LinkMachineScreen` pops
/// up, since the exchange behind it is the same.
///
/// It leaves by itself either way — once the link lands, and when the form's own Close is pressed —
diff --git a/mobile/lib/phone/machine_tile.dart b/mobile/lib/phone/machine_tile.dart
deleted file mode 100644
index 9bcc65d62..000000000
--- a/mobile/lib/phone/machine_tile.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/state/app_state.dart';
-
-import 'phone_card.dart';
-import 'phone_status.dart';
-import 'status_pill.dart';
-
-/// One machine on the phone's first screen: its name, its state, and — in the trailing glyph —
-/// what a tap does. A padlock means the tap asks for this machine's own password.
-class MachineTile extends StatelessWidget {
- const MachineTile({super.key, required this.machine, required this.onTap});
-
- final MachineState machine;
-
- /// Null for a row that does not open — an offline machine — which then has no trailing glyph.
- final VoidCallback? onTap;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final status = phoneMachineStatusOf(machine);
- final offline = status == PhoneMachineStatus.offline;
- return PhoneCard(
- onTap: onTap,
- child: Row(
- children: [
- PhoneCardGlyph(
- child: Icon(
- LucideIcons.laptopMinimal300,
- size: 22,
- color: offline ? AppPalette.textFaint : AppPalette.textSecondary,
- ),
- ),
- const SizedBox(width: 14),
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- machine.machine.displayName,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppPalette.textPrimary,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- const SizedBox(height: 5),
- StatusPill(summary: phoneMachineSummary(machine)),
- ],
- ),
- ),
- if (onTap != null) ...[
- const SizedBox(width: 8),
- Icon(
- status == PhoneMachineStatus.needsPassword
- ? LucideIcons.lockKeyhole300
- : LucideIcons.chevronRight300,
- size: 22,
- color: AppPalette.textFaint,
- ),
- ],
- ],
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/phone_search_button.dart b/mobile/lib/phone/phone_search_button.dart
deleted file mode 100644
index 1744ec8ce..000000000
--- a/mobile/lib/phone/phone_search_button.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/shared/widgets/app_icon_button.dart';
-import 'package:harness_mobile/state/app_state.dart';
-
-import 'phone_search_page.dart';
-
-/// The way into [PhoneSearchPage], drawn in a tab header's `trailing`.
-///
-/// One widget for both tabs rather than the same four lines written twice: the
-/// search it opens spans agents AND machines, so the two tabs must offer it
-/// identically. A glyph that sat at a different size or opened a differently
-/// configured page on one of them would read as two different features.
-class PhoneSearchButton extends StatelessWidget {
- const PhoneSearchButton({super.key, required this.notifier});
-
- final AppNotifier notifier;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Padding(
- // Clear of the header's own right padding, so the glyph sits on the same
- // vertical as the large title beside it rather than jammed to the edge.
- padding: const EdgeInsets.only(right: 2),
- child: AppIconButton(
- icon: LucideIcons.search300,
- size: 22,
- tooltip: 'Search',
- color: AppPalette.textSecondary,
- onPressed: () => openPhoneSearch(context, notifier),
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/phone_search_page.dart b/mobile/lib/phone/phone_search_page.dart
deleted file mode 100644
index d7975edfc..000000000
--- a/mobile/lib/phone/phone_search_page.dart
+++ /dev/null
@@ -1,141 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/state/app_state.dart';
-
-import 'phone_navigation.dart';
-import 'phone_search_actions.dart';
-import 'phone_search_commands.dart';
-import 'phone_search_controller.dart';
-import 'phone_search_field.dart';
-import 'phone_search_results.dart';
-import 'phone_search_scope_bar.dart';
-
-/// One query over every agent, machine and project the account can reach.
-///
-/// A screen of its own rather than a field above either list, and that is the
-/// whole point: the two tabs each answer half the question, and somebody who
-/// remembers "that review thing" does not know which half holds it.
-///
-/// This is the phone's version of the desktop's box, mode for mode —
-/// [PhoneSearchController] carries `>` commands, `#` projects, `@` machines and
-/// `?` help, and ranks with the desktop's own scorer, so a query that finds an
-/// agent on the laptop finds the same agent here.
-///
-/// ⚠️ Keystrokes never ask a machine anything. They filter what the app already
-/// holds, so typing on two bars of signal stays instant.
-///
-/// Returns when the search closes, so a caller whose own chrome depends on
-/// being the top route can rebuild — see `terminal_page.dart`, where the header
-/// buttons hide behind a keyboard this page did not raise.
-Future<void> openPhoneSearch(BuildContext context, AppNotifier notifier) =>
- Navigator.of(
- context,
- ).push(phoneRoute((_) => PhoneSearchPage(notifier: notifier)));
-
-class PhoneSearchPage extends StatefulWidget {
- const PhoneSearchPage({
- super.key,
- required this.notifier,
- this.commands,
- });
-
- final AppNotifier notifier;
-
- /// What `>` offers. Defaults to [phoneSearchCommands], the app's real set;
- /// overridden by tests, which must not push the real Settings screen to find
- /// out whether a command ran.
- final List<PhoneCommand> Function()? commands;
-
- @override
- State<PhoneSearchPage> createState() => _PhoneSearchPageState();
-}
-
-class _PhoneSearchPageState extends State<PhoneSearchPage> {
- final _controller = TextEditingController();
- final _focus = FocusNode(debugLabel: 'Phone search');
- late final PhoneSearchController _search = PhoneSearchController(
- notifier: widget.notifier,
- history: widget.notifier.searchHistory,
- commands:
- widget.commands ??
- () => phoneSearchCommands(context, widget.notifier),
- );
-
- @override
- void initState() {
- super.initState();
- // The order the box opens in comes off disk. Not awaited: what is known
- // draws now, and the visits fold in a frame later, before anything has been
- // read let alone tapped.
- widget.notifier.searchHistory.load().then((_) {
- if (mounted) _search.setQuery(_search.query);
- });
- }
-
- @override
- void dispose() {
- _controller.dispose();
- _focus.dispose();
- _search.dispose();
- super.dispose();
- }
-
- /// Back leaves the chosen project or machine first, and only then the screen —
- /// the same step `#`/`@` took to get in.
- void _back() {
- if (_search.back()) {
- _controller.text = _search.query;
- return;
- }
- Navigator.of(context).maybePop();
- }
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Scaffold(
- backgroundColor: AppPalette.windowBg,
- // The keyboard is up for this page's whole life, so the body must shrink
- // rather than let the list run underneath it.
- resizeToAvoidBottomInset: true,
- body: SafeArea(
- bottom: false,
- child: PopScope(
- canPop: !_search.canGoBack,
- onPopInvokedWithResult: (didPop, _) {
- if (!didPop) _back();
- },
- child: Column(
- children: [
- ListenableBuilder(
- listenable: _search,
- builder: (context, _) => PhoneSearchField(
- controller: _controller,
- focus: _focus,
- hintText: _search.hint,
- onChanged: _search.setQuery,
- onClear: () {
- _controller.clear();
- _search.setQuery('');
- // Clearing is a step back into browsing, not out of the
- // screen — the caret stays where the next query will go.
- _focus.requestFocus();
- },
- onBack: _back,
- ),
- ),
- PhoneSearchScopeBar(search: _search),
- Expanded(
- child: PhoneSearchResults(
- notifier: widget.notifier,
- controller: _search,
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/phone_search_results.dart b/mobile/lib/phone/phone_search_results.dart
index 9b777aa1a..172ccb690 100644
--- a/mobile/lib/phone/phone_search_results.dart
+++ b/mobile/lib/phone/phone_search_results.dart
@@ -30,11 +30,12 @@ import 'tty_controls.dart';
/// What the query reaches, drawn.
///
-/// ⚠️ Public because two screens draw it: [PhoneSearchPage], and the terminal's
-/// own in-place search (see `terminal_search.dart`), which fades up over the
-/// terminal rather than pushing a route. Both hand it one
-/// [PhoneSearchController], so the two cannot return different rows — or walk a
-/// different pager — for the same words.
+/// ⚠️ Public because two screens draw it: Find, the terminal's own in-place
+/// search (see `terminal_search.dart`), which slides over the terminal rather
+/// than pushing a route, and the first screen after pairing
+/// (`welcome/pick_up_page.dart`). Both hand it one [PhoneSearchController], so
+/// the two cannot return different rows — or walk a different pager — for the
+/// same words.
///
/// ⚠️ **One flat ranked list, no folder headers.** The desktop has none either,
/// and grouping fought the ranking it sat on: a folder whose best row was third
@@ -73,7 +74,7 @@ class PhoneSearchResults extends StatefulWidget {
/// ⚠️ For the in-place search, which is not a route and so is not popped by
/// opening something. Its field still holds the keyboard, and the terminal it
/// is covering is about to be replaced underneath it — this is what puts the
- /// search away first. Null on [PhoneSearchPage], where the pop does it.
+ /// 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
diff --git a/mobile/lib/phone/phone_search_scope_bar.dart b/mobile/lib/phone/phone_search_scope_bar.dart
deleted file mode 100644
index 5108cf71f..000000000
--- a/mobile/lib/phone/phone_search_scope_bar.dart
+++ /dev/null
@@ -1,71 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-
-import 'phone_search_controller.dart';
-
-/// The line between the field and the results: what is being searched, and how
-/// much of it the query has left.
-///
-/// The desktop's box title and its `4/7`. The count is the quickest answer to
-/// "did that narrow it, or is it just not here?", and on the phone the title is
-/// also the only thing that says a mode is open at all — there is no box chrome
-/// around the list to carry it.
-///
-/// Absent on a plain empty query, where the list IS the answer and a header over
-/// it would cost a row.
-class PhoneSearchScopeBar extends StatelessWidget {
- const PhoneSearchScopeBar({super.key, required this.search});
-
- final PhoneSearchController search;
-
- @override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: search,
- builder: (context, _) {
- AppTheme.watch(context);
- final scoped = search.canGoBack;
- final typed = search.matchQuery.trim().isNotEmpty;
- if (!scoped && !typed && search.title == 'Search') {
- return const SizedBox.shrink();
- }
- final faint = TextStyle(color: AppPalette.textFaint, fontSize: 12);
- return Padding(
- padding: const EdgeInsets.fromLTRB(26, 6, 26, 6),
- child: Row(
- children: [
- if (scoped) ...[
- Icon(
- LucideIcons.cornerDownRight300,
- size: 13,
- color: AppPalette.textFaint,
- ),
- const SizedBox(width: 6),
- ],
- Flexible(
- child: Text(
- search.title,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: faint.copyWith(
- color: AppPalette.textSecondary,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- const Spacer(),
- Text(
- // Only once the query has actually excluded something: `7/7`
- // over an untouched list is noise dressed as information.
- search.matchCount == search.total
- ? '${search.total}'
- : '${search.matchCount}/${search.total}',
- style: faint.copyWith(fontFeatures: AppFont.tabularFigures),
- ),
- ],
- ),
- );
- },
- );
-}
diff --git a/mobile/lib/phone/phone_section_label.dart b/mobile/lib/phone/phone_section_label.dart
deleted file mode 100644
index 76b6fb02c..000000000
--- a/mobile/lib/phone/phone_section_label.dart
+++ /dev/null
@@ -1,34 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-
-/// The small uppercase line over one run of a phone list — "Linked", "Recent".
-class PhoneSectionLabel extends StatelessWidget {
- const PhoneSectionLabel(
- this.text, {
- super.key,
- this.padding = const EdgeInsets.fromLTRB(4, 8, 4, 8),
- });
-
- final String text;
-
- /// Lines the label up with the content under it, whose inset differs by list.
- final EdgeInsetsGeometry padding;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Padding(
- padding: padding,
- child: Text(
- text.toUpperCase(),
- style: TextStyle(
- color: AppPalette.textFaint,
- fontSize: 11.5,
- fontWeight: FontWeight.w600,
- letterSpacing: 0.5,
- ),
- ),
- );
- }
-}
diff --git a/mobile/lib/phone/settings_row.dart b/mobile/lib/phone/settings_row.dart
index f33559f16..ddb31a7e4 100644
--- a/mobile/lib/phone/settings_row.dart
+++ b/mobile/lib/phone/settings_row.dart
@@ -67,32 +67,6 @@ class SettingsCaption extends StatelessWidget {
}
}
-/// A quiet sentence under a run, explaining something the rows cannot say themselves.
-class SettingsNote extends StatelessWidget {
- const SettingsNote(this.text, {super.key});
-
- final String text;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Padding(
- // 10 rather than 8, and the extra 2 is doing work: the caption above a group sits at 8, so a
- // note at the same gap reads as another caption for whatever follows rather than as a remark
- // on the group it belongs to.
- padding: const EdgeInsets.fromLTRB(4, 10, 4, 0),
- child: Text(
- text,
- style: TextStyle(
- color: AppPalette.textFaint,
- fontSize: 12.5,
- height: 1.45,
- ),
- ),
- );
- }
-}
-
/// One run of rows, drawn as a single card with hairlines between them.
class SettingsGroup extends StatelessWidget {
const SettingsGroup({super.key, required this.children});
diff --git a/mobile/lib/phone/stats_page.dart b/mobile/lib/phone/stats_page.dart
deleted file mode 100644
index 95a9df861..000000000
--- a/mobile/lib/phone/stats_page.dart
+++ /dev/null
@@ -1,278 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/stats/harness_stats.dart';
-
-import 'phone_header.dart';
-import 'settings_row.dart';
-
-/// What this app has done, on a phone: agents spawned, time agents worked, turns — and the date
-/// the counting started under them.
-///
-/// The figures come from [harnessStats], the app's own counters. They are not a vendor's and not a
-/// file on disk, so unlike the desktop's Settings ▸ Usage there is no ledger half here and no
-/// permission to ask: a phone has none of the `~/.claude` / `~/.codex` transcripts that half reads,
-/// and every token figure would be zero for agents that really are running.
-///
-/// ⚠️ **Deliberately NOT the desktop's `StatsSummaryCards` layout.** That draws three cards in a
-/// row — a shape that collapses to one column below 420pt anyway, which is every phone — with an
-/// 11.5pt label and a 20pt figure sized for a settings pane read at desk distance. This stacks
-/// three full-width rows instead, each with its glyph, its label and a figure large enough to read
-/// at arm's length, which is also what lets the number carry the unit ("3h 24m") without wrapping.
-class StatsPage extends StatelessWidget {
- const StatsPage({super.key, this.stats});
-
- /// The counters to draw. Defaults to the singleton; the parameter exists so a caller can pass
- /// its own instance, exactly as the desktop's `UsageSection` takes one.
- final HarnessStats? stats;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- // [HarnessStats] is a `ChangeNotifier` and every hook in `AppNotifier` notifies, so the figures
- // move while this page is open — an agent started from another tab lands here without a
- // refresh, and a turn's minutes land the moment it ends. Nothing to pull.
- return ListenableBuilder(
- listenable: stats ?? harnessStats,
- builder: (context, _) {
- AppTheme.watch(context);
- return Scaffold(
- backgroundColor: AppPalette.windowBg,
- body: SafeArea(
- bottom: false,
- child: Column(
- children: [
- const PhoneHeader(title: 'Stats'),
- Expanded(
- child: _Body(summary: (stats ?? harnessStats).summary),
- ),
- ],
- ),
- ),
- );
- },
- );
- }
-}
-
-class _Body extends StatelessWidget {
- const _Body({required this.summary});
-
- final StatsSummary summary;
-
- @override
- Widget build(BuildContext context) => ListView(
- physics: const AlwaysScrollableScrollPhysics(),
- padding: EdgeInsets.fromLTRB(
- 16,
- 4,
- 16,
- MediaQuery.paddingOf(context).bottom + 24,
- ),
- children: summary.isEmpty
- // "Nothing tracked yet" and "0, 0, 0" read very differently: three zeroes look like a
- // broken counter, and this says what would make them move.
- ? const [
- _EmptyState(),
- SettingsNote(
- 'These are this app’s own counters — what it watched happen, not what any '
- 'agent account was billed. Nothing here is sent anywhere.',
- ),
- ]
- : [
- _StatCard(
- icon: LucideIcons.bot300,
- label: 'Harnesses spawned',
- value: formatStatCount(summary.agentsSpawned),
- ),
- const SizedBox(height: kStatCardGap),
- _StatCard(
- icon: LucideIcons.clock300,
- label: 'Time harnesses worked',
- value: formatWorkedTime(summary.timeWorked),
- ),
- const SizedBox(height: kStatCardGap),
- _StatCard(
- icon: LucideIcons.messagesSquare300,
- label: 'Turns',
- value: formatStatCount(summary.turns),
- ),
- if (summary.firstEventAt case final since?)
- SettingsNote('Tracking since ${formatTrackingDate(since)}.'),
- ],
- );
-}
-
-/// The gap between two stat cards — the same one two phone cards keep, so a column of these reads
-/// as the same kind of list as the machines and agents tabs.
-const double kStatCardGap = 10;
-
-/// One figure, full width: its glyph and label on one line, the number under them.
-///
-/// The number sits BELOW the label rather than opposite it, which is the other shape a row like
-/// this could take. A right-aligned figure has to share the row with a label that can be as long as
-/// "Time agents worked", and the longest value ("3d 21h") then lands in a different place on every
-/// row; stacked, all three numbers start on the same left margin and can be compared down the
-/// column at a glance.
-class _StatCard extends StatelessWidget {
- const _StatCard({
- required this.icon,
- required this.label,
- required this.value,
- });
-
- final IconData icon;
- final String label;
- final String value;
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Container(
- width: double.infinity,
- padding: const EdgeInsets.fromLTRB(14, 13, 14, 15),
- decoration: BoxDecoration(
- color: AppGlass.rowFill,
- borderRadius: BorderRadius.circular(AppCard.radius),
- border: Border.all(color: AppGlass.hair),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Row(
- children: [
- Icon(icon, size: 15, color: AppPalette.textFaint),
- const SizedBox(width: 8),
- Expanded(
- child: Text(
- label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppPalette.textSecondary,
- fontSize: 12.5,
- ),
- ),
- ),
- ],
- ),
- const SizedBox(height: 6),
- Text(
- value,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppPalette.textPrimary,
- fontSize: 28,
- fontWeight: FontWeight.w600,
- letterSpacing: -0.5,
- // Tabular, so a counter ticking from 9 to 10 while the page is open does not reflow
- // the figure beside it.
- fontFeatures: AppFont.tabularFigures,
- ),
- ),
- ],
- ),
- );
- }
-}
-
-/// Nothing has happened yet. A sentence rather than three zeroes.
-class _EmptyState extends StatelessWidget {
- const _EmptyState();
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Container(
- width: double.infinity,
- padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 26),
- decoration: BoxDecoration(
- color: AppSurface.recess,
- borderRadius: BorderRadius.circular(AppCard.radius),
- border: Border.all(color: AppGlass.hair),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(LucideIcons.bot300, size: 26, color: AppPalette.textFaint),
- const SizedBox(height: 12),
- Text(
- 'Nothing tracked yet',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: AppPalette.textPrimary,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- ),
- const SizedBox(height: 6),
- Text(
- 'Start your first harness and this page begins counting.',
- textAlign: TextAlign.center,
- style: TextStyle(
- color: AppPalette.textSecondary,
- fontSize: 13,
- height: 1.4,
- ),
- ),
- ],
- ),
- );
- }
-}
-
-/// `1,284` — a count with its thousands grouped.
-///
-/// Grouped by hand rather than through `intl`: this package deliberately carries no localisation
-/// dependency, and the one separator a stat needs is not worth adding one for.
-String formatStatCount(int count) {
- final digits = count.abs().toString();
- final out = StringBuffer(count < 0 ? '-' : '');
- for (var i = 0; i < digits.length; i++) {
- // A separator before every digit whose distance from the end is a multiple of three, except at
- // the very start — which is what keeps `1,000` from coming out as `,1,000`.
- if (i > 0 && (digits.length - i) % 3 == 0) out.write(',');
- out.write(digits[i]);
- }
- return out.toString();
-}
-
-/// `4h 12m`, `3d 5h`, `18m` — a worked duration at a glance.
-///
-/// The desktop's `formatWorkedTime` exactly, kept in step deliberately: the same counter is drawn
-/// in both apps, and a phone that rounded differently would look like it had counted differently.
-/// Days and hours past a day, hours and minutes past an hour, minutes below. Never seconds: the
-/// smallest thing being summed is a turn, and a figure that ticked every second would be the only
-/// moving thing on the screen.
-String formatWorkedTime(Duration worked) {
- if (worked <= Duration.zero) return '0m';
- if (worked.inDays > 0) return '${worked.inDays}d ${worked.inHours % 24}h';
- if (worked.inHours > 0) return '${worked.inHours}h ${worked.inMinutes % 60}m';
- return '${worked.inMinutes}m';
-}
-
-/// `Sep 16, 2026` — the date the counting started.
-///
-/// The month as a name rather than a number, because `9/16/2026` and `16/9/2026` are the same
-/// string read two ways and this line has no second figure to disambiguate it.
-String formatTrackingDate(DateTime at) {
- const months = [
- 'Jan',
- 'Feb',
- 'Mar',
- 'Apr',
- 'May',
- 'Jun',
- 'Jul',
- 'Aug',
- 'Sep',
- 'Oct',
- 'Nov',
- 'Dec',
- ];
- final local = at.toLocal();
- return '${months[local.month - 1]} ${local.day}, ${local.year}';
-}
diff --git a/mobile/lib/phone/terminal_action_column.dart b/mobile/lib/phone/terminal_action_column.dart
index a7029be00..2daf33e69 100644
--- a/mobile/lib/phone/terminal_action_column.dart
+++ b/mobile/lib/phone/terminal_action_column.dart
@@ -26,12 +26,6 @@ import 'voice_mic_fab.dart';
/// corner under it, and the mic rides above. The two share one column so they
/// read as one set of controls rather than two strays.
///
-/// ⚠️ **The mic and what it is doing are one capsule.** The status body is
-/// stacked UNDER the mic and reaches out to its left, with the mic's circle
-/// closing its right end — see `voice_status_pill.dart`. The mic never moves:
-/// the body grows away from it, and the row keeps the mic's height however
-/// many lines a notice wraps to.
-///
/// ⚠️ **The gaps are set by the mic's hit area, not by the look.** The mic's
/// target spills [VoiceMicButton.touchOverhang] past its slot on every side and
/// is generous on purpose — a button under it that sat any closer would lose
diff --git a/mobile/lib/phone/terminal_header_action.dart b/mobile/lib/phone/terminal_header_action.dart
deleted file mode 100644
index d467c6312..000000000
--- a/mobile/lib/phone/terminal_header_action.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/shared/widgets/app_icon_button.dart';
-import 'package:harness_mobile/shared/widgets/touch_target.dart';
-
-/// One mark in the terminal header's trailing row — `⋮`, beside the Take
-/// control button.
-///
-/// Its own file because [gap] is an invariant with arithmetic behind it and
-/// a test that checks it (`terminal_header_action_test.dart`); a private class
-/// inside a 2,500-line page could not be reached to check.
-class TerminalHeaderAction extends StatelessWidget {
- const TerminalHeaderAction({
- required this.icon,
- required this.tooltip,
- required this.onPressed,
- this.size = 21,
- this.last = false,
- });
-
- final IconData icon;
- final String tooltip;
- final VoidCallback onPressed;
- final double size;
-
- /// The rightmost action, whose trailing padding is dropped: [PhoneHeader]
- /// already insets the row's right edge, and keeping it here would push the
- /// last mark further from the edge than the others are from each other.
- final bool last;
-
- /// Half the gap between two marks — each neighbour contributes one, so the
- /// boxes end up 20 apart.
- ///
- /// ⚠️ **10, not 7, and the reason is the hit area rather than the look.**
- /// An action draws a 24pt box and [TouchTarget] reaches 44pt around it — 10
- /// past each edge. Two actions therefore need their centres 44 apart, and a
- /// centre-to-centre distance is `2 * gap + 24`. At the old 7 that came to 38,
- /// so the two reaches OVERLAPPED by 6pt — and a [Row] hit-tests in reverse
- /// paint order, so `⋯` was tested first and took that strip off the right
- /// edge of the tabs mark beside it. The tabs mark simply did not answer
- /// there. 10 makes it exactly 44: the targets meet and neither steals.
- ///
- /// This replaces an earlier rule that set the gap to half [PhoneHeader]'s own
- /// 14pt right inset so the marks and the screen edge read as evenly spaced.
- /// That is a nicer rhythm and it cost one of two buttons its right-hand
- /// sixth; a mark that does not respond is the worse of the two problems.
- static const double gap = 10;
-
- @override
- Widget build(BuildContext context) => Padding(
- padding: EdgeInsets.fromLTRB(gap, 0, last ? 0 : gap, 0),
- child: AppIconButton(
- icon: icon,
- size: size,
- tooltip: tooltip,
- color: AppPalette.textSecondary,
- onPressed: onPressed,
- ),
- );
-}
diff --git a/mobile/lib/phone/voice_mic_button.dart b/mobile/lib/phone/voice_mic_button.dart
index 8ec1a12cc..9c665ffe2 100644
--- a/mobile/lib/phone/voice_mic_button.dart
+++ b/mobile/lib/phone/voice_mic_button.dart
@@ -22,10 +22,10 @@ import 'voice_mic_mode.dart';
/// the take away, and the face turns to a `×` to say so. No long-press:
/// that gesture is what records.
///
-/// ⚠️ **It is the right end of the voice capsule, and draws nothing past its
-/// circle.** What it is doing — the waveform, the words, the `×` — is in the
-/// capsule body behind it (`voice_status_pill.dart`), so the button's own box
-/// never grows and nothing around it moves.
+/// ⚠️ **It draws nothing past its circle.** What it is doing beyond its face —
+/// the halo, and the words when something went wrong — is drawn around it
+/// (`voice_bar_line.dart`), so the button's own box never grows and nothing
+/// around it moves.
class VoiceMicButton extends StatefulWidget {
const VoiceMicButton({
super.key,
diff --git a/mobile/lib/phone/voice_mic_fab.dart b/mobile/lib/phone/voice_mic_fab.dart
index 04ae6b6d1..52ebc909e 100644
--- a/mobile/lib/phone/voice_mic_fab.dart
+++ b/mobile/lib/phone/voice_mic_fab.dart
@@ -23,8 +23,9 @@ import 'voice_mic_mode.dart';
/// terminal's newest output is the line being read, and it runs left to right:
/// the right end of the last few lines is the least of it.
///
-/// ⚠️ **The `×` is NOT here.** It is in the capsule body behind the mic, at the
-/// far end from it — see `voice_status_pill.dart`.
+/// ⚠️ **No `×` and no status body.** The mic says what it is doing with its own
+/// face and the halo behind it, and words appear above it only when something
+/// went wrong — see `voice_bar_line.dart`.
class VoiceMicFab extends StatefulWidget {
const VoiceMicFab({
super.key,
diff --git a/mobile/lib/phone/voice_status_pill.dart b/mobile/lib/phone/voice_status_pill.dart
deleted file mode 100644
index 6134503dd..000000000
--- a/mobile/lib/phone/voice_status_pill.dart
+++ /dev/null
@@ -1,740 +0,0 @@
-import 'dart:math' as math;
-
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/shared/widgets/pulse.dart';
-
-import 'voice_input_controller.dart';
-import 'voice_mic_action.dart';
-import 'voice_mic_mode.dart';
-import 'voice_take_meter.dart';
-
-/// The body of the voice capsule: what the mic is doing, and the `×` that calls
-/// it off.
-///
-/// ```
-/// ( × ● ▂▃▅▇▅▃▂▁▃▆ 0:07 (↑) ) listening
-/// ( × Transcribing… (•••) )
-/// ( × ⓘ Didn't catch that. Tap (🎤) )
-/// ( the mic to try again. )
-/// ```
-///
-/// ⚠️ **It sits BEHIND the mic, and the mic closes its right end.** The column
-/// stacks the mic over this body's last [micClearance] points, so the two read
-/// as one control that changes shape — growing out from behind the button to
-/// say what it is doing, and tucking back behind it when there is nothing to
-/// say. The `×` is at the far end, away from the thumb that works the mic.
-///
-/// The `×` is the way out of every step: while the mic is opening, recording
-/// or transcribing it throws the take away, with words held from a failed send
-/// it drops them, and with a notice up it dismisses it.
-///
-/// ⚠️ **Nothing at rest.** The body exists only while there is something to
-/// read; one that stayed would sit over the terminal's newest lines.
-///
-/// ⚠️ **Tucking in and out is PAINTED, never laid out.** The body takes its
-/// full size on the first frame and only its drawing grows from behind the
-/// mic — see [_CapsuleReveal]. Laid out, the `×` would spend the first frames
-/// of every take with no width to be pressed in; changes of content once it is
-/// out are laid out ([AnimatedSize]), since by then the `×` is already there.
-class VoiceStatusPill extends StatefulWidget {
- const VoiceStatusPill({
- super.key,
- required this.voice,
- this.slipped,
- this.micClearance = 0,
- });
-
- final VoiceInputController voice;
-
- /// Whether a hold has been dragged off the mic, as the mic reports it —
- /// [VoiceMicMode.holdToTalk] only. The thumb covers the button's own `×`
- /// face, so this body is what says letting go will now cancel. Null where
- /// nothing reports it.
- final ValueListenable<bool>? slipped;
-
- /// How much of the body's right end the mic sits over. Zero for a body that
- /// stands on its own.
- final double micClearance;
-
- /// The body's least height. It stood beside the mic once and took the circle's height to close
- /// round it; it stands over the mic now, on its own.
- static const double height = 52;
-
- @override
- State<VoiceStatusPill> createState() => _VoiceStatusPillState();
-}
-
-/// What the body is saying, one of a handful of shapes.
-enum _Kind {
- starting,
- listening,
- transcribing,
- sending,
- retry,
- notice,
- cancelling,
-}
-
-@immutable
-class _Status {
- const _Status(
- this.kind,
- this.label, {
- required this.cancellable,
- this.lingers = false,
- });
-
- final _Kind kind;
-
- /// The words — shown, or given to the screen reader where the body draws
- /// something else (the take meter).
- final String label;
-
- /// Whether the `×` is offered. Not while sending — a send already on its way
- /// cannot be recalled — nor with a hold slid off, where letting go is itself
- /// the cancel.
- final bool cancellable;
-
- /// A notice that clears itself after [VoiceInputController.noticeLinger],
- /// and so draws the time it has left.
- final bool lingers;
-}
-
-class _VoiceStatusPillState extends State<VoiceStatusPill>
- with SingleTickerProviderStateMixin {
- /// Fast out, long settle: the body reaches most of its size quickly and eases
- /// into the rest, so it reads as springing out rather than being dragged.
- static const Curve _morph = Cubic(0.3, 0.9, 0.25, 1);
- static const Duration _spreadDuration = Duration(milliseconds: 340);
-
- static final List<BoxShadow> _shadow = [
- // It floats over streaming output, like the mic, and needs the same lift
- // to keep its edge over a bright line.
- BoxShadow(
- color: Colors.black.withValues(alpha: 0.35),
- blurRadius: 10,
- offset: const Offset(0, 2),
- ),
- ];
-
- /// 0 tucked behind the mic, 1 all the way out.
- late final AnimationController _reveal = AnimationController(
- vsync: this,
- duration: _spreadDuration,
- )..addStatusListener(_onRevealStatus);
-
- late final Animation<double> _spread = CurvedAnimation(
- parent: _reveal,
- curve: _morph,
- reverseCurve: Curves.easeInCubic,
- );
-
- /// Visible early on the way out, and gone only at the very end of the way
- /// back — by then the body is behind the mic anyway.
- late final Animation<double> _fade = CurvedAnimation(
- parent: _reveal,
- curve: const Interval(0, 0.35),
- );
-
- /// What the voice says right now.
- _Status? _status;
-
- /// What is drawn: [_status], held while the body tucks away after it has
- /// gone null, so it leaves with what it said rather than blank.
- _Status? _shown;
-
- String? _lastNotice;
-
- /// Counts the notices that have landed. Replays the nudge and restarts the
- /// countdown when a new one arrives on top of whatever was showing.
- int _noticeRun = 0;
-
- bool _motion = true;
-
- @override
- void initState() {
- super.initState();
- _subscribe(widget);
- _status = _read();
- _shown = _status;
- // Already out when it mounts mid-take — a page swiped to while talking —
- // rather than springing out as though it had just begun.
- _reveal.value = _status == null ? 0 : 1;
- }
-
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- _motion = !MediaQuery.disableAnimationsOf(context);
- }
-
- @override
- void didUpdateWidget(VoiceStatusPill old) {
- super.didUpdateWidget(old);
- if (old.voice != widget.voice || old.slipped != widget.slipped) {
- _unsubscribe(old);
- _subscribe(widget);
- _apply(_read());
- }
- }
-
- @override
- void dispose() {
- _unsubscribe(widget);
- _reveal.dispose();
- super.dispose();
- }
-
- void _subscribe(VoiceStatusPill pill) {
- pill.voice.addListener(_sync);
- pill.slipped?.addListener(_sync);
- }
-
- void _unsubscribe(VoiceStatusPill pill) {
- pill.voice.removeListener(_sync);
- pill.slipped?.removeListener(_sync);
- }
-
- void _sync() {
- if (!mounted) return;
- setState(() => _apply(_read()));
- }
-
- /// Shows [next], or tucks the body away behind the mic when there is nothing
- /// to say.
- void _apply(_Status? next) {
- _status = next;
- if (next != null) {
- _shown = next;
- if (_motion) {
- _reveal.forward();
- } else {
- _reveal.value = 1;
- }
- return;
- }
- // Nothing out to tuck away, or no motion to tuck it with: gone at once.
- // [_shown] is cleared FIRST, so the dismissal this causes has nothing left
- // for [_onRevealStatus] to do — this can run inside `didUpdateWidget`,
- // where a `setState` would be one too many.
- if (!_motion || _reveal.value == 0) {
- _shown = null;
- _reveal.value = 0;
- return;
- }
- _reveal.reverse();
- }
-
- void _onRevealStatus(AnimationStatus status) {
- if (status != AnimationStatus.dismissed ||
- _status != null ||
- _shown == null ||
- !mounted) {
- return;
- }
- setState(() => _shown = null);
- }
-
- /// What the voice is doing, in the order the old single-line pill read it:
- /// a notice over everything, then what the mic is doing, then words held
- /// from a send that did not land.
- _Status? _read() {
- final voice = widget.voice;
- final notice = voice.notice;
- if (notice != _lastNotice) {
- _lastNotice = notice;
- if (notice != null) _noticeRun++;
- }
- final cancellable = !voice.isSending;
- if (notice != null) {
- return _Status(
- _Kind.notice,
- notice,
- cancellable: cancellable,
- // ⚠️ Not the refused microphone's: that one stays until it is
- // dismissed (see `VoiceInputController._restartNoticeTimer`), and a
- // countdown under it would promise it goes away.
- lingers: voice.status != VoiceInputStatus.unavailable,
- );
- }
- if (voice.status == VoiceInputStatus.listening &&
- (widget.slipped?.value ?? false)) {
- return const _Status(
- _Kind.cancelling,
- 'Release to cancel',
- cancellable: false,
- );
- }
- final activity = voiceActivityLabel(voice);
- final kind = voice.isSending
- ? _Kind.sending
- : switch (voice.status) {
- VoiceInputStatus.starting => _Kind.starting,
- VoiceInputStatus.listening => _Kind.listening,
- VoiceInputStatus.transcribing => _Kind.transcribing,
- VoiceInputStatus.idle || VoiceInputStatus.unavailable => null,
- };
- if (kind != null && activity != null) {
- return _Status(kind, activity, cancellable: cancellable);
- }
- if (voice.transcript.isNotEmpty) {
- return _Status(
- _Kind.retry,
- 'Tap ↑ to send again',
- cancellable: cancellable,
- );
- }
- return null;
- }
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- final shown = _shown;
- if (shown == null) return const SizedBox.shrink();
- final warn = shown.kind == _Kind.notice || shown.kind == _Kind.cancelling;
- return IgnorePointer(
- // Tucking away: what is still drawn is what WAS, and a `×` pressed on it
- // would clear a state that no longer exists.
- ignoring: _status == null,
- child: _Nudge(
- run: _noticeRun,
- enabled: _motion,
- child: FadeTransition(
- opacity: _fade,
- child: _CapsuleReveal(
- reveal: _spread,
- tucked: widget.micClearance > 0
- ? widget.micClearance
- : VoiceStatusPill.height,
- fill: shown.kind == _Kind.cancelling
- ? Color.alphaBlend(
- AppPalette.warn.withValues(alpha: 0.16),
- AppGlass.surfaceFill,
- )
- : AppGlass.surfaceFill,
- rim: warn ? AppPalette.warn.withValues(alpha: 0.42) : AppGlass.lift,
- shadows: _shadow,
- child: AnimatedSize(
- duration: _motion ? _spreadDuration : Duration.zero,
- curve: _morph,
- alignment: Alignment.centerLeft,
- child: _body(shown),
- ),
- ),
- ),
- ),
- );
- }
-
- Widget _body(_Status shown) {
- // The room the mic covers, and a gap before it.
- final trailing = widget.micClearance + 12;
- return ConstrainedBox(
- constraints: const BoxConstraints(minHeight: VoiceStatusPill.height),
- child: Stack(
- alignment: AlignmentDirectional.centerStart,
- children: [
- Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- if (shown.cancellable)
- _CancelButton(onTap: widget.voice.clear)
- else
- const SizedBox(width: 18),
- Flexible(
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 8),
- child: AnimatedSwitcher(
- duration: _motion
- ? const Duration(milliseconds: 240)
- : Duration.zero,
- reverseDuration: _motion
- ? const Duration(milliseconds: 100)
- : Duration.zero,
- switchInCurve: Curves.easeOutCubic,
- switchOutCurve: Curves.easeIn,
- layoutBuilder: _layoutMiddle,
- transitionBuilder: _enterMiddle,
- child: KeyedSubtree(
- key: ValueKey<Object>((
- shown.kind,
- shown.kind == _Kind.notice ? _noticeRun : 0,
- )),
- child: _middle(shown),
- ),
- ),
- ),
- ),
- SizedBox(width: trailing),
- ],
- ),
- if (shown.lingers && _motion)
- Positioned(
- left: 24,
- right: trailing,
- bottom: 5,
- child: _Countdown(run: _noticeRun),
- ),
- ],
- ),
- );
- }
-
- Widget _middle(_Status shown) {
- final style = TextStyle(
- fontSize: 13,
- height: 17 / 13,
- fontWeight: FontWeight.w500,
- color: AppPalette.textPrimary,
- );
- switch (shown.kind) {
- case _Kind.listening:
- // ⚠️ Words, not the meter, in hold-to-talk: the thumb is on the button
- // and the line to its left is the only thing that says what letting go
- // will do — and how to get out without sending.
- if (micHoldsToTalk) {
- return _lead(
- PulseDot(color: AppPalette.accentOnSurface, size: 7),
- _label(shown.label, style),
- );
- }
- return Semantics(
- label: shown.label,
- excludeSemantics: true,
- child: VoiceTakeMeter(
- level: widget.voice.level,
- elapsed: () => widget.voice.takeLength,
- ),
- );
- case _Kind.transcribing:
- case _Kind.sending:
- // Breathes rather than shimmers: the app's one "still working" rhythm,
- // and the reason the skeletons do not sweep either (see [Pulse]).
- return Pulse(
- duration: const Duration(milliseconds: 900),
- child: _label(shown.label, style),
- builder: (context, t, child) =>
- Opacity(opacity: 0.55 + 0.45 * t, child: child),
- );
- case _Kind.retry:
- return _lead(_Dot(color: AppPalette.warn), _label(shown.label, style));
- case _Kind.notice:
- return _lead(
- Icon(LucideIcons.circleAlert300, size: 16, color: AppPalette.warn),
- _label(shown.label, style),
- );
- case _Kind.cancelling:
- return _lead(
- Icon(LucideIcons.circleAlert300, size: 16, color: AppPalette.warn),
- _label(shown.label, style.copyWith(color: AppPalette.warn)),
- );
- case _Kind.starting:
- return _label(shown.label, style);
- }
- }
-
- /// Up to three lines, and it wraps: the notices are whole sentences, and cut
- /// to one line they lost the half that said what to do.
- static Widget _label(String text, TextStyle style) =>
- Text(text, maxLines: 3, overflow: TextOverflow.ellipsis, style: style);
-
- static Widget _lead(Widget mark, Widget label) => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- SizedBox.square(dimension: 16, child: Center(child: mark)),
- const SizedBox(width: 8),
- Flexible(child: label),
- ],
- );
-
- /// ⚠️ **Only the incoming middle sizes the body.** The outgoing one is laid
- /// out beside it but positioned, so it neither holds the body at the larger
- /// of the two sizes while it fades nor stops [AnimatedSize] from heading
- /// straight for the new one.
- ///
- /// ⚠️ **Every child is a keyed [Positioned], the incoming one too** — with no
- /// offsets it is not positioned at all, and sizes the stack. What matters is
- /// that the widget around a child does not change type when it goes from
- /// incoming to outgoing: wrapped only on the way out, it was rebuilt from
- /// scratch there, and the take meter fading out restarted with flat bars.
- static Widget _layoutMiddle(Widget? current, List<Widget> previous) => Stack(
- alignment: AlignmentDirectional.centerStart,
- children: [
- for (final child in previous)
- Positioned(key: child.key, left: 0, child: child),
- if (current != null) Positioned(key: current.key, child: current),
- ],
- );
-
- static Widget _enterMiddle(Widget child, Animation<double> animation) =>
- FadeTransition(
- opacity: animation,
- child: SlideTransition(
- position: Tween<Offset>(
- begin: const Offset(0, 0.2),
- end: Offset.zero,
- ).animate(animation),
- child: child,
- ),
- );
-}
-
-/// The `×`: at the far end of the capsule, away from the thumb on the mic.
-class _CancelButton extends StatelessWidget {
- const _CancelButton({required this.onTap});
-
- final VoidCallback onTap;
-
- @override
- Widget build(BuildContext context) => Semantics(
- button: true,
- label: 'Cancel',
- child: GestureDetector(
- key: const ValueKey('voice-cancel'),
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: SizedBox(
- width: 44,
- height: VoiceStatusPill.height,
- child: Icon(
- LucideIcons.x300,
- size: 18,
- color: AppPalette.textSecondary,
- ),
- ),
- ),
- );
-}
-
-class _Dot extends StatelessWidget {
- const _Dot({required this.color});
-
- final Color color;
-
- @override
- Widget build(BuildContext context) => Container(
- width: 8,
- height: 8,
- decoration: BoxDecoration(shape: BoxShape.circle, color: color),
- );
-}
-
-/// A small sideways shake when a notice lands: something went wrong, and it
-/// should be noticed without being loud.
-///
-/// ⚠️ **Driven by [run] climbing, never by a key.** A key would rebuild the
-/// whole capsule beneath it and cut short the resize and the cross-fade it is
-/// in the middle of. The tween heads for the new count instead, and the shake
-/// is drawn from how far it still has to go.
-class _Nudge extends StatelessWidget {
- const _Nudge({required this.run, required this.enabled, required this.child});
-
- final int run;
- final bool enabled;
- final Widget child;
-
- @override
- Widget build(BuildContext context) {
- if (!enabled) return child;
- return TweenAnimationBuilder<double>(
- tween: Tween<double>(end: run.toDouble()),
- duration: const Duration(milliseconds: 340),
- child: child,
- builder: (context, value, child) {
- final t = 1 - (run - value).clamp(0.0, 1.0);
- final dx = t >= 1 ? 0.0 : 3 * math.sin(t * math.pi * 3) * (1 - t);
- return Transform.translate(offset: Offset(dx, 0), child: child);
- },
- );
- }
-}
-
-/// A hairline along the bottom of a notice, running out as the notice's time
-/// on screen does.
-class _Countdown extends StatelessWidget {
- const _Countdown({required this.run});
-
- /// Which notice it counts for; a new one starts it again from full.
- final int run;
-
- @override
- Widget build(BuildContext context) => TweenAnimationBuilder<double>(
- key: ValueKey(run),
- tween: Tween<double>(begin: 1, end: 0),
- duration: VoiceInputController.noticeLinger,
- builder: (context, left, _) => Align(
- alignment: Alignment.centerLeft,
- child: FractionallySizedBox(
- widthFactor: left,
- child: Container(
- height: 2,
- decoration: BoxDecoration(
- color: AppPalette.warn.withValues(alpha: 0.6),
- borderRadius: BorderRadius.circular(1),
- ),
- ),
- ),
- ),
- );
-}
-
-/// Draws the capsule — its fill, rim and shadow — and clips what is inside it
-/// to the capsule's shape, with the capsule growing out from the RIGHT edge as
-/// [reveal] runs from 0 to 1.
-///
-/// ⚠️ **Paint only: layout and hit testing see the full size throughout.**
-/// That is the point of it — see [VoiceStatusPill].
-class _CapsuleReveal extends SingleChildRenderObjectWidget {
- const _CapsuleReveal({
- required this.reveal,
- required this.tucked,
- required this.fill,
- required this.rim,
- required this.shadows,
- super.child,
- });
-
- final Animation<double> reveal;
-
- /// The drawn width at `reveal == 0`: what the mic covers.
- final double tucked;
-
- final Color fill;
- final Color rim;
- final List<BoxShadow> shadows;
-
- @override
- RenderObject createRenderObject(BuildContext context) =>
- _RenderCapsuleReveal(reveal, tucked, fill, rim, shadows);
-
- @override
- void updateRenderObject(
- BuildContext context,
- _RenderCapsuleReveal renderObject,
- ) {
- renderObject
- ..reveal = reveal
- ..tucked = tucked
- ..fill = fill
- ..rim = rim
- ..shadows = shadows;
- }
-}
-
-class _RenderCapsuleReveal extends RenderProxyBox {
- _RenderCapsuleReveal(
- this._reveal,
- this._tucked,
- this._fill,
- this._rim,
- this._shadows,
- );
-
- Animation<double> _reveal;
- set reveal(Animation<double> value) {
- if (identical(value, _reveal)) return;
- if (attached) _reveal.removeListener(markNeedsPaint);
- _reveal = value;
- if (attached) _reveal.addListener(markNeedsPaint);
- markNeedsPaint();
- }
-
- double _tucked;
- set tucked(double value) {
- if (value == _tucked) return;
- _tucked = value;
- markNeedsPaint();
- }
-
- Color _fill;
- set fill(Color value) {
- if (value == _fill) return;
- _fill = value;
- markNeedsPaint();
- }
-
- Color _rim;
- set rim(Color value) {
- if (value == _rim) return;
- _rim = value;
- markNeedsPaint();
- }
-
- List<BoxShadow> _shadows;
- set shadows(List<BoxShadow> value) {
- if (listEquals(value, _shadows)) return;
- _shadows = value;
- markNeedsPaint();
- }
-
- final LayerHandle<ClipRRectLayer> _clip = LayerHandle<ClipRRectLayer>();
-
- @override
- void attach(PipelineOwner owner) {
- super.attach(owner);
- _reveal.addListener(markNeedsPaint);
- }
-
- @override
- void detach() {
- _reveal.removeListener(markNeedsPaint);
- super.detach();
- }
-
- @override
- void dispose() {
- _clip.layer = null;
- super.dispose();
- }
-
- /// The capsule as drawn right now, in local coordinates.
- RRect _capsule() {
- final full = size.width;
- final from = math.min(_tucked, full);
- final width = from + (full - from) * _reveal.value.clamp(0.0, 1.0);
- return RRect.fromLTRBR(
- full - width,
- 0,
- full,
- size.height,
- const Radius.circular(VoiceStatusPill.height / 2),
- );
- }
-
- @override
- void paint(PaintingContext context, Offset offset) {
- if (child == null) return;
- final capsule = _capsule();
- final drawn = capsule.shift(offset);
- final canvas = context.canvas;
- for (final shadow in _shadows) {
- canvas.drawRRect(
- drawn.shift(shadow.offset).inflate(shadow.spreadRadius),
- shadow.toPaint(),
- );
- }
- canvas.drawRRect(drawn, Paint()..color = _fill);
- _clip.layer = context.pushClipRRect(
- needsCompositing,
- offset,
- capsule.outerRect,
- capsule,
- super.paint,
- oldLayer: _clip.layer,
- );
- // The rim over the content, so nothing inside draws across the edge.
- context.canvas.drawRRect(
- drawn.deflate(0.5),
- Paint()
- ..style = PaintingStyle.stroke
- ..strokeWidth = 1
- ..color = _rim,
- );
- }
-}
diff --git a/mobile/lib/phone/voice_take_meter.dart b/mobile/lib/phone/voice_take_meter.dart
deleted file mode 100644
index 5ab57c74f..000000000
--- a/mobile/lib/phone/voice_take_meter.dart
+++ /dev/null
@@ -1,242 +0,0 @@
-import 'dart:math' as math;
-
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/scheduler.dart';
-
-import 'package:harness_mobile/logging/app_log.dart';
-import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/shared/widgets/pulse.dart';
-
-/// A take being recorded, drawn: a live dot, the microphone's level scrolling
-/// past as bars, and how long the take has run.
-///
-/// ```
-/// ● ▂▃▅▇▅▃▂▁▃▆▇▅▃▁ 0:07
-/// ```
-///
-/// ⚠️ **The bars are the proof that the mic is hearing.** The ring this
-/// replaced breathed at the same pace whether or not a word was reaching the
-/// microphone, so a muted input looked exactly like a working one until the
-/// take came back empty. These move with the voice, and stay flat without it.
-///
-/// ⚠️ **Sampled on a fixed step, not per buffer.** The platform delivers audio
-/// in bursts of uneven size and spacing; drawn per buffer the bars would
-/// stutter and skip. Each step takes the loudest buffer since the last one,
-/// and a step that got none lets the last bar fall away instead of repeating
-/// it — which is also how a real meter's needle behaves.
-///
-/// ⚠️ Under Reduce Motion the bars hold still, as every other long-running
-/// motion in the app does (see [Pulse]); the dot and the clock still say the
-/// take is running.
-class VoiceTakeMeter extends StatefulWidget {
- const VoiceTakeMeter({super.key, required this.level, required this.elapsed});
-
- /// The microphone's loudness, 0…1 — `VoiceInputController.level`.
- final ValueListenable<double> level;
-
- /// How long the take has run — `VoiceInputController.takeLength`. Read, not
- /// counted here, so a page swiped to mid-take shows the take's time.
- final Duration Function() elapsed;
-
- static const int bars = 22;
- static const double barWidth = 3;
- static const double barGap = 2;
- static const double height = 28;
- static const double minBar = 3;
-
- /// One bar per step: 22 of them cover the last second and a half.
- static const Duration step = Duration(milliseconds: 70);
-
- static double get waveWidth => bars * barWidth + (bars - 1) * barGap;
-
- @override
- State<VoiceTakeMeter> createState() => _VoiceTakeMeterState();
-}
-
-class _VoiceTakeMeterState extends State<VoiceTakeMeter>
- with SingleTickerProviderStateMixin {
- late final Ticker _ticker = createTicker(_tick);
-
- /// Oldest first; the newest bar is drawn on the right, nearest the mic.
- ///
- /// ⚠️ Growable, though its length never changes: each step drops the oldest
- /// bar and adds the newest, and `List.filled` is fixed-length by default —
- /// the first `removeAt` threw, every frame, and left the bars and the clock
- /// frozen.
- final List<double> _history = List<double>.filled(
- VoiceTakeMeter.bars,
- 0,
- growable: true,
- );
- final _Repaint _repaint = _Repaint();
-
- /// The loudest buffer since the last step, and whether one arrived at all.
- double _loudest = 0;
- bool _heard = false;
-
- Duration _lastStep = Duration.zero;
- String _clock = '';
- bool _motion = true;
-
- /// What this meter was given over its life, for the one line it logs when it
- /// goes: flat bars are either no buffers reaching it or buffers that were
- /// all silence, and this says which.
- int _buffers = 0;
- double _peak = 0;
- int _steps = 0;
-
- @override
- void initState() {
- super.initState();
- widget.level.addListener(_onLevel);
- _clock = _format(widget.elapsed());
- _ticker.start();
- }
-
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- _motion = !MediaQuery.disableAnimationsOf(context);
- }
-
- @override
- void didUpdateWidget(VoiceTakeMeter old) {
- super.didUpdateWidget(old);
- if (old.level != widget.level) {
- old.level.removeListener(_onLevel);
- widget.level.addListener(_onLevel);
- }
- }
-
- @override
- void dispose() {
- // Levels only, never audio or words.
- appLog.info(
- 'voice',
- 'meter: $_clock buffers=$_buffers peak=${_peak.toStringAsFixed(2)} '
- 'steps=$_steps motion=$_motion',
- );
- widget.level.removeListener(_onLevel);
- _ticker.dispose();
- _repaint.dispose();
- super.dispose();
- }
-
- void _onLevel() {
- final level = widget.level.value;
- _loudest = math.max(_loudest, level);
- _heard = true;
- _buffers++;
- _peak = math.max(_peak, level);
- }
-
- void _tick(Duration now) {
- if (_motion && now - _lastStep >= VoiceTakeMeter.step) {
- _lastStep = now;
- final next = _heard ? _loudest : _history.last * 0.6;
- _history
- ..removeAt(0)
- ..add(next);
- _loudest = 0;
- _heard = false;
- _steps++;
- _repaint.ping();
- }
- // Rebuilt once a second, not every frame: the bars repaint on their own.
- final clock = _format(widget.elapsed());
- if (clock != _clock) setState(() => _clock = clock);
- }
-
- static String _format(Duration length) {
- final seconds = length.inSeconds;
- return '${seconds ~/ 60}:${(seconds % 60).toString().padLeft(2, '0')}';
- }
-
- @override
- Widget build(BuildContext context) {
- AppTheme.watch(context);
- return Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- SizedBox.square(
- dimension: 16,
- child: Center(
- child: PulseDot(color: AppPalette.accentOnSurface, size: 7),
- ),
- ),
- const SizedBox(width: 8),
- // Its own layer: the bars repaint every step, and the capsule and the
- // glass under the mic beside them should not repaint with them.
- RepaintBoundary(
- child: CustomPaint(
- size: Size(VoiceTakeMeter.waveWidth, VoiceTakeMeter.height),
- painter: _WavePainter(
- history: _history,
- color: AppPalette.textPrimary,
- repaint: _repaint,
- ),
- ),
- ),
- const SizedBox(width: 8),
- Text(
- _clock,
- style: TextStyle(
- fontSize: 12.5,
- fontWeight: FontWeight.w500,
- color: AppPalette.textSecondary,
- // The digits change every second; proportional ones would make the
- // capsule twitch in width as they did.
- fontFeatures: const [FontFeature.tabularFigures()],
- ),
- ),
- ],
- );
- }
-}
-
-class _Repaint extends ChangeNotifier {
- void ping() => notifyListeners();
-}
-
-class _WavePainter extends CustomPainter {
- _WavePainter({
- required this.history,
- required this.color,
- required Listenable repaint,
- }) : super(repaint: repaint);
-
- final List<double> history;
- final Color color;
-
- @override
- void paint(Canvas canvas, Size size) {
- final count = history.length;
- final paint = Paint();
- const width = VoiceTakeMeter.barWidth;
- for (var i = 0; i < count; i++) {
- final level = history[i].clamp(0.0, 1.0);
- final height =
- VoiceTakeMeter.minBar + level * (size.height - VoiceTakeMeter.minBar);
- // Older bars fade: the newest sound is the one nearest the mic.
- final age = count == 1 ? 1.0 : i / (count - 1);
- paint.color = color.withValues(alpha: color.a * (0.35 + 0.65 * age));
- canvas.drawRRect(
- RRect.fromRectAndRadius(
- Rect.fromLTWH(
- i * (width + VoiceTakeMeter.barGap),
- (size.height - height) / 2,
- width,
- height,
- ),
- const Radius.circular(width / 2),
- ),
- paint,
- );
- }
- }
-
- @override
- bool shouldRepaint(_WavePainter old) =>
- old.color != color || !identical(old.history, history);
-}
diff --git a/mobile/lib/shared/widgets/pulse.dart b/mobile/lib/shared/widgets/pulse.dart
index a232c06d8..53b11e580 100644
--- a/mobile/lib/shared/widgets/pulse.dart
+++ b/mobile/lib/shared/widgets/pulse.dart
@@ -94,35 +94,3 @@ class _PulseState extends State<Pulse> with SingleTickerProviderStateMixin {
),
);
}
-
-/// A soft-glowing dot that blinks to signal "live" — the status LED used by the
-/// playground pill and anywhere else a thing is running.
-class PulseDot extends StatelessWidget {
- const PulseDot({super.key, required this.color, this.size = 6});
-
- final Color color;
- final double size;
-
- @override
- Widget build(BuildContext context) {
- return Pulse(
- builder: (context, t, _) {
- final opacity = 0.4 + 0.6 * t;
- return Container(
- width: size,
- height: size,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: color.withValues(alpha: opacity),
- boxShadow: [
- BoxShadow(
- color: color.withValues(alpha: 0.5 * opacity),
- blurRadius: size * 0.85,
- ),
- ],
- ),
- );
- },
- );
- }
-}
diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dart
index 44c5a6170..9d00dcb94 100644
--- a/mobile/lib/state/app_state.dart
+++ b/mobile/lib/state/app_state.dart
@@ -6119,7 +6119,7 @@ class AppNotifier extends ChangeNotifier {
/// take over the whole content area would blank three working terminals
/// belonging to two other machines. The one exception is a machine that
/// already needs linking: that state now surfaces as a blocking popup
- /// (HomeScreen._maybeShowLinkDialog / showLinkMachineScreenDialog) rather
+ /// (the desktop's `HomeScreen._maybeShowLinkDialog`) rather
/// than a tile, so opening one here too would just be a redundant "not
/// linked" pane sitting behind it. Selecting is still worth doing — it's
/// what makes the popup's gate notice this machine — the tile is not.
diff --git a/mobile/lib/stats/harness_stats.dart b/mobile/lib/stats/harness_stats.dart
index 8b5169ab0..ec397616d 100644
--- a/mobile/lib/stats/harness_stats.dart
+++ b/mobile/lib/stats/harness_stats.dart
@@ -1,7 +1,11 @@
/// How much work this app has done: agents started, turns taken, time spent.
///
-/// Ported from Orca's `src/main/stats/` — same three cards, same "tracking
-/// since" line, same balanced start/stop accounting for the clock.
+/// Ported from Orca's `src/main/stats/` — same three figures, same "tracking
+/// since" date, same balanced start/stop accounting for the clock.
+///
+/// ⚠️ **Nothing on the phone draws them.** The Stats page that showed the three
+/// cards had no way in and was deleted; the counters are still kept and written
+/// to disk, so bringing a page back needs only a reader.
///
/// **What it counts and what it does not.** These are the app's OWN events, not
/// a vendor's and not a file on disk: the ledger beside it (`usage/ledger/`)
@@ -19,7 +23,7 @@
/// 2. **No event log is kept.** Orca persists up to 10,000 individual events
/// beside its aggregates, for per-repo breakdowns it does not yet draw. That
/// costs a ~900KB rewrite every few seconds on a busy session, so what is
-/// persisted here is the aggregates alone. [firstEventAt] is the reason Orca
+/// persisted here is the aggregates alone. The first event's time is the reason Orca
/// needed the log to be lossy-safe, and it is stored directly here for the
/// same reason: it is set once and never moves, so trimming can never drag
/// "tracking since" forward.
@@ -44,36 +48,6 @@ const kStatsWriteDebounce = Duration(seconds: 5);
/// snapshot rather than reading one that means something slightly different.
const _kStatsVersion = 1;
-/// The three figures and the date under them.
-@immutable
-class StatsSummary {
- const StatsSummary({
- this.agentsSpawned = 0,
- this.turns = 0,
- this.timeWorked = Duration.zero,
- this.firstEventAt,
- });
-
- /// Agents this app has created. Counted at creation, not at first message —
- /// an agent that was launched and never spoken to was still launched.
- final int agentsSpawned;
-
- /// Turns started. One per time somebody set an agent working.
- final int turns;
-
- /// Time agents spent working, summed across every finished turn.
- final Duration timeWorked;
-
- /// When the first event landed, or null before any has.
- ///
- /// Set once and never moved, so the "Tracking since" line means what it says
- /// however much is later forgotten.
- final DateTime? firstEventAt;
-
- /// Nothing has happened yet — what the empty state keys on.
- bool get isEmpty => agentsSpawned == 0 && turns == 0;
-}
-
class HarnessStats extends ChangeNotifier {
HarnessStats({SnapshotStore? store})
: _store = store ?? FileSnapshotStore('harness-stats');
@@ -97,13 +71,6 @@ class HarnessStats extends ChangeNotifier {
Timer? _writeTimer;
bool _disposed = false;
- StatsSummary get summary => StatsSummary(
- agentsSpawned: _agentsSpawned,
- turns: _turns,
- timeWorked: Duration(milliseconds: _workedMs),
- firstEventAt: _firstEventAt,
- );
-
/// Read the counters back off disk. Never throws.
Future<void> load() async {
final contents = await _store.read();
diff --git a/mobile/lib/widgets/link_machine_screen.dart b/mobile/lib/widgets/link_machine_screen.dart
deleted file mode 100644
index dcb5b783b..000000000
--- a/mobile/lib/widgets/link_machine_screen.dart
+++ /dev/null
@@ -1,275 +0,0 @@
-import 'package:flutter/material.dart';
-
-import '../shared/widgets/app_dialog.dart';
-import '../state/app_state.dart';
-import '../theme/app_theme.dart';
-
-/// Opens [LinkMachineScreen] as a modal popup for [machineId], closing itself automatically once
-/// linking succeeds or the prompt is dismissed (including a barrier tap/Escape, which counts as an
-/// implicit dismiss so the caller's reactive gate doesn't just reopen it next frame).
-///
-/// This is a deliberate exception to the pane grid's normal "never block other tiles" rule (see
-/// `AppNotifier.showMachinePane`'s doc comment) — a machine that still needs linking has nothing
-/// else useful to show in its own tile, and a transient blocking prompt reads better here than a
-/// permanent docked panel that looks like a second tab.
-Future<void> showLinkMachineScreenDialog(
- BuildContext context,
- AppNotifier notifier,
- String machineId,
-) async {
- // Opening IS the answer to "was it dismissed?": a Cancel earlier marked the
- // machine so the reactive gates stop insisting, and the gates check that mark
- // before calling here — so anything that reaches this line is a person asking
- // to see it. Clear the mark, or the check inside pops the dialog on its first
- // frame and the row reads as dead.
- notifier.revisitLinkPrompt(machineId);
- await showAppDialog<void>(
- context: context,
- builder: (context) => Dialog(
- backgroundColor: Colors.transparent,
- elevation: 0,
- insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
- child: ListenableBuilder(
- listenable: notifier,
- builder: (context, _) {
- final state = notifier.stateOf(machineId);
- final stillNeeded =
- state != null &&
- state.needsLink &&
- !notifier.isLinkPromptDismissed(machineId);
- if (!stillNeeded) {
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (Navigator.of(context).canPop()) Navigator.of(context).pop();
- });
- return const SizedBox.shrink();
- }
- return LinkMachineScreen(notifier: notifier, machineState: state);
- },
- ),
- ),
- );
- // Any close that isn't "linked successfully" (barrier tap, Escape, the in-card Close button)
- // must count as a dismiss, or the caller's reactive gate would just reopen this next rebuild.
- final state = notifier.stateOf(machineId);
- if (state != null && state.needsLink) {
- notifier.dismissLinkPrompt(machineId);
- }
-}
-
-/// Shown for a remote machine the local CLI's relay has no linked trust for yet. The CLI now owns
-/// E2EE entirely (see the harness CLI's `harness remote-password set`/`harness link connect`, and
-/// src/lib/remoteRelay.ts) — this screen holds no crypto state, it just walks the user through
-/// entering the remote password set on the OTHER machine.
-class LinkMachineScreen extends StatefulWidget {
- final AppNotifier notifier;
- final MachineState machineState;
- const LinkMachineScreen({
- super.key,
- required this.notifier,
- required this.machineState,
- });
-
- @override
- State<LinkMachineScreen> createState() => _LinkMachineScreenState();
-}
-
-class _LinkMachineScreenState extends State<LinkMachineScreen> {
- final _passwordController = TextEditingController();
- bool _obscure = true;
- bool _submitting = false;
- bool _showTroubleshootingDetails = false;
- String? _error;
- String? _stage;
-
- @override
- void dispose() {
- _passwordController.dispose();
- super.dispose();
- }
-
- Future<void> _submit() async {
- setState(() {
- _submitting = true;
- _error = null;
- _stage = null;
- });
- final error = await widget.notifier.connectWithPassword(
- widget.machineState.machine.machineId,
- _passwordController.text,
- onProgress: (stage) {
- if (mounted) setState(() => _stage = stage);
- },
- );
- if (!mounted) return;
- setState(() {
- _submitting = false;
- _error = error;
- _stage = null;
- });
- if (error == null) _passwordController.clear();
- }
-
- @override
- Widget build(BuildContext context) {
- final machineId = widget.machineState.machine.machineId;
- final machineName = widget.machineState.machine.displayName;
-
- return Container(
- width: 460,
- padding: const EdgeInsets.all(24),
- decoration: BoxDecoration(
- border: Border.all(color: AppColors.border),
- borderRadius: BorderRadius.circular(14),
- color: AppColors.surface,
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Icon(Icons.link, size: 32, color: AppColors.accent),
- const SizedBox(height: 6),
- Text(
- 'Link this machine',
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontFamilyFallback: AppFonts.sansFallback,
- fontSize: 13.5,
- fontWeight: FontWeight.w600,
- color: AppColors.text,
- ),
- ),
- const SizedBox(height: 6),
- Text(
- "This computer isn't linked to $machineName yet. Enter the remote password set "
- 'on that machine to connect.',
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontFamilyFallback: AppFonts.sansFallback,
- fontSize: 11.2,
- color: AppColors.mutedStrong,
- ),
- ),
- const SizedBox(height: 14),
- TextField(
- key: const Key('remote-password-connect-field'),
- controller: _passwordController,
- obscureText: _obscure,
- style: TextStyle(
- fontFamily: AppFonts.mono,
- fontSize: 12.5,
- color: AppColors.textSoft,
- ),
- decoration: InputDecoration(
- hintText: 'Remote password for $machineName',
- hintStyle: TextStyle(fontFamily: AppFonts.mono, fontSize: 12.5),
- prefixIcon: const Icon(Icons.password, size: 17),
- suffixIcon: IconButton(
- icon: Icon(
- _obscure ? Icons.visibility : Icons.visibility_off,
- size: 17,
- ),
- onPressed: () => setState(() => _obscure = !_obscure),
- ),
- ),
- onSubmitted: (_) => _submit(),
- ),
- if (_error != null) ...[
- const SizedBox(height: 6),
- Text(
- _error!,
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontFamilyFallback: AppFonts.sansFallback,
- fontSize: 11.2,
- color: AppColors.danger,
- ),
- ),
- ],
- const SizedBox(height: 10),
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- if (_submitting && _stage != null) ...[
- Text(
- _stage!,
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontFamilyFallback: AppFonts.sansFallback,
- fontSize: 11.2,
- color: AppColors.mutedStrong,
- ),
- ),
- const SizedBox(width: 10),
- ],
- FilledButton(
- key: const Key('remote-password-connect-button'),
- onPressed: _submitting ? null : _submit,
- child: _submitting
- ? const SizedBox(
- width: 14,
- height: 14,
- child: CircularProgressIndicator(strokeWidth: 2),
- )
- : const Text('Link machine'),
- ),
- ],
- ),
- const SizedBox(height: 8),
- Text(
- 'Your previous harness will reconnect automatically after linking.',
- style: TextStyle(
- fontFamily: AppFonts.sans,
- fontSize: 11.2,
- color: AppColors.mutedStrong,
- ),
- ),
- const SizedBox(height: 4),
- TextButton.icon(
- key: const Key('link-troubleshooting-details'),
- onPressed: () => setState(
- () => _showTroubleshootingDetails = !_showTroubleshootingDetails,
- ),
- icon: Icon(
- _showTroubleshootingDetails
- ? Icons.expand_less
- : Icons.expand_more,
- size: 16,
- ),
- label: const Text('Troubleshooting details'),
- ),
- if (_showTroubleshootingDetails)
- Padding(
- padding: const EdgeInsets.only(left: 12),
- child: SelectableText(
- 'Machine ID: $machineId',
- style: TextStyle(
- fontFamily: AppFonts.mono,
- fontSize: 11.2,
- color: AppColors.muted,
- ),
- ),
- ),
- // An explicit way out, in addition to the barrier tap/Escape that
- // showLinkMachineScreenDialog already treats as an implicit dismiss. Closing does
- // not pretend the machine is linked: it still cannot be read and the rail still
- // says so. It only stops the popup from insisting, and choosing that machine again
- // brings it straight back. Bottom-right text button, matching every other dialog in
- // the app (see link_machine_dialog.dart's 'Close').
- const SizedBox(height: 6),
- Align(
- alignment: Alignment.centerRight,
- child: TextButton(
- style: TextButton.styleFrom(
- minimumSize: Size.zero,
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- onPressed: () => widget.notifier.dismissLinkPrompt(machineId),
- child: const Text('Close'),
- ),
- ),
- ],
- ),
- );
- }
-}
diff --git a/mobile/test/phone_search_test.dart b/mobile/test/phone_search_test.dart
index e9c8afd39..5ae76f228 100644
--- a/mobile/test/phone_search_test.dart
+++ b/mobile/test/phone_search_test.dart
@@ -9,7 +9,6 @@ import 'package:harness_mobile/phone/agent_index.dart';
import 'package:harness_mobile/phone/agents_list_page.dart';
import 'package:harness_mobile/phone/phone_destination.dart';
import 'package:harness_mobile/phone/phone_search_catalog.dart';
-import 'package:harness_mobile/phone/phone_search_commands.dart';
import 'package:harness_mobile/phone/phone_search_controller.dart';
import 'package:harness_mobile/phone/phone_search_groups.dart';
import 'package:harness_mobile/phone/phone_search_rank.dart';
diff --git a/mobile/test/terminal_header_action_test.dart b/mobile/test/terminal_header_action_test.dart
deleted file mode 100644
index 555db2e2a..000000000
--- a/mobile/test/terminal_header_action_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness_mobile/phone/terminal_header_action.dart';
-import 'package:harness_mobile/shared/widgets/touch_target.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
-
-/// The terminal header's marks sit close enough that their 44pt reaches used to
-/// overlap, and a [Row] hit-tests in reverse paint order — so the LAST mark was
-/// tested first and answered for a strip of its neighbour.
-///
-/// It was the tabs grid that lost, every time, because `⋮` is drawn after it.
-void main() {
- Future<void> pumpRow(
- WidgetTester tester,
- List<String> pressed,
- ) => tester.pumpWidget(
- MaterialApp(
- home: Scaffold(
- body: Align(
- alignment: Alignment.topLeft,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- TerminalHeaderAction(
- icon: LucideIcons.layoutGrid300,
- tooltip: 'Tabs',
- onPressed: () => pressed.add('tabs'),
- ),
- TerminalHeaderAction(
- icon: LucideIcons.ellipsisVertical300,
- tooltip: 'Agent actions',
- last: true,
- onPressed: () => pressed.add('actions'),
- ),
- ],
- ),
- ),
- ),
- ),
- );
-
- test('two marks are far enough apart for two whole touch targets', () {
- // A mark draws a 24pt box and reaches [minTouchTarget] around it, so two
- // of them need their centres that far apart. The distance between two
- // neighbours is one gap from each plus the box between them.
- const boxWidth = 24.0;
- expect(
- 2 * TerminalHeaderAction.gap + boxWidth,
- greaterThanOrEqualTo(minTouchTarget),
- );
- });
-
- testWidgets('the right edge of the tabs mark still presses the tabs mark', (
- tester,
- ) async {
- final pressed = <String>[];
- await pumpRow(tester, pressed);
-
- final tabs = find.byTooltip('Tabs');
- final box = tester.getRect(tabs);
- // Just inside the far edge of its reach — the strip `⋮` used to take.
- await tester.tapAt(
- Offset(box.center.dx + minTouchTarget / 2 - 1, box.center.dy),
- );
- await tester.pump();
-
- expect(pressed, ['tabs']);
- });
-
- testWidgets('and the actions mark still presses its own', (tester) async {
- final pressed = <String>[];
- await pumpRow(tester, pressed);
-
- await tester.tap(find.byTooltip('Agent actions'));
- await tester.pump();
-
- expect(pressed, ['actions']);
- });
-}
diff --git a/mobile/test/voice_mic_fab_test.dart b/mobile/test/voice_mic_fab_test.dart
index fa85559db..b298e8f80 100644
--- a/mobile/test/voice_mic_fab_test.dart
+++ b/mobile/test/voice_mic_fab_test.dart
@@ -3,13 +3,12 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness_mobile/phone/voice_input_controller.dart';
import 'package:harness_mobile/phone/voice_mic_fab.dart';
import 'package:harness_mobile/phone/voice_notice.dart';
-import 'package:harness_mobile/phone/voice_status_pill.dart';
import 'package:harness_mobile/terminal/terminal_session.dart';
import 'voice_fakes.dart';
/// The mic over the terminal: tap to talk, tap to send — the words go as a
-/// composer turn. `×` in the pill beside it calls the take off.
+/// composer turn.
void main() {
late FakeVoiceRecorder recorder;
late FakeTranscriber backend;
@@ -56,15 +55,7 @@ void main() {
session.dispose();
});
- Widget fab() => Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Flexible(child: VoiceStatusPill(voice: voice)),
- VoiceMicFab(voice: voice, session: session),
- ],
- );
-
- final cancel = find.byKey(const ValueKey('voice-cancel'));
+ Widget fab() => VoiceMicFab(voice: voice, session: session);
Future<void> pumpFab(WidgetTester tester, {Widget? around}) =>
tester.pumpWidget(
@@ -136,21 +127,6 @@ void main() {
expect(voice.isIdle, isTrue);
});
- testWidgets('× while talking throws the take away', (tester) async {
- await pumpFab(tester);
- backend.replies.add('never mind');
-
- await tester.tap(mic);
- await tester.pump();
- await tester.tap(cancel);
- await tester.pumpAndSettle();
-
- expect(recorder.cancels, 1);
- expect(backend.calls, isEmpty);
- expect(typed, isEmpty);
- expect(voice.isIdle, isTrue);
- });
-
testWidgets('no talking while the terminal takes no input', (tester) async {
session.status = TerminalSessionStatus.takenOver;
await pumpFab(tester);