The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
refactor(mobile): drop the tab bar, the machine pager and the header the phone never shows
deeb47bf45e9dc0
diff --git a/mobile/lib/core/last_opened_agent.dart b/mobile/lib/core/last_opened_agent.dartindex 0a845da7e..04eaa232b 100644--- a/mobile/lib/core/last_opened_agent.dart+++ b/mobile/lib/core/last_opened_agent.dart@@ -8,11 +8,11 @@ typedef AgentRef = ({String machineId, String agentId});/// The agent the phone had on screen, so a relaunch can put the person back on it.///-/// ⚠️ **In practice only ever overwritten, never cleared.** [forget] still exists and still works,-/// but nothing calls it: it was the pager's way of saying "the terminal was left", back when leaving-/// it meant landing on a list of agents that the next launch could start on instead. There is no-/// such list any more — the terminal is the phone's home screen — so the only question this answers-/// is *which* agent it opens on, and "none" is not one of the answers. A record naming an agent that+/// ⚠️ **Only ever overwritten, never cleared.** Clearing it was the pager's way of saying "the+/// terminal was left", back when leaving it meant landing on a list of agents that the next launch+/// could start on instead. There is no such list any more — the terminal is the phone's home+/// screen — so the only question this answers is *which* agent it opens on, and "none" is not one+/// of the answers. A record naming an agent that/// has since been deleted simply matches nothing, and the home screen falls through to the first/// agent of the tab the phone was last in ([readTab]).class LastOpenedAgent {@@ -102,23 +102,6 @@ class LastOpenedAgent {_write((storage) => storage.write(_key, encoded));}- /// Clears the record only while it still names [agent].- ///- /// A terminal replaced by another one can be disposed AFTER its successor has remembered itself,- /// and an unconditional clear would then erase the agent actually on screen.- ///- /// ⚠️ **Nothing calls this now, and that is the point rather than an oversight.** The pager used- /// to call it on the way out, back when leaving the terminal meant landing on a list of agents;- /// the terminal is the home screen now, so there is no "left the terminal" to report and clearing- /// the record would only cost the next launch its reopen. Kept because the reopen is a flag away- /// from being turned off again (`_showTabBar` in `phone_shell.dart` restores the list screens),- /// and this is the half of the pair that would have to come back with it.- void forget(AgentRef agent) {- if (_value != agent) return;- _value = null;- _write((storage) => storage.delete(_key));- }-void _write(Future<void> Function(LocalKeyValueStore storage) write) {final storage = _storage;if (storage == null) return;diff --git a/mobile/lib/notify/unread_marks.dart b/mobile/lib/notify/unread_marks.dartdeleted file mode 100644index 250457974..000000000--- a/mobile/lib/notify/unread_marks.dart+++ /dev/null@@ -1,147 +0,0 @@-import 'package:flutter/material.dart';--import 'package:harness_mobile/shared/theme/app_theme.dart';--import 'agent_notice.dart';-import 'agent_unread.dart';--/// A mark's colour says what the news is: amber for an agent waiting on you —-/// the phone's "Waiting for you" tone — and red for one that finished.-///-/// ⚠️ **Red rather than the accent, which is what this used to be.** The accent-/// is the app's ordinary indigo: it is on the selected tab, the send button, the-/// links in the output — so a dot wearing it was the same blue as half the-/// furniture around it, and it read as decoration rather than as news.-///-/// ⚠️ **[AppPalette.dangerFill] and not the theme's error ink, though this is a-/// mark and not a fill.** It is both: [UnreadCountBadge] paints the same colour-/// as a pill UNDER white lettering, and `dangerFill` is the app's one red-/// measured for exactly that (5.38:1 in dark, 6.54:1 in light — see its note).-/// `colorScheme.error` is tuned as ink on a dark surface and leaves white on it-/// at 3.42:1, so a count pill in it would fail where the dot would pass.-///-/// The name is about where that red came from, not about what it means here:-/// nothing on this row is destructive.-Color unreadColor(NoticeKind kind) => switch (kind) {- NoticeKind.question => AppPalette.warn,- NoticeKind.done => AppPalette.dangerFill,-};--/// The mark on one agent's row: it finished, or asked something, while you-/// were elsewhere.-///-/// ⚠️ **Where it sits is the CALLER's, and the two callers differ.** A tab chip-/// keeps it in front of the label, iOS Mail's placement: the strip is a row of-/// pills, and a mark inside one belongs to that pill wherever it is put.-///-/// An agent row does not. It used to lead the title there too, which pushed-/// every name 15pt right and broke the left edge the name shared with the two-/// lines under it — a column gone ragged for a mark that is usually absent. The-/// dot now takes the slot at the row's far end, the one that spins while the-/// agent works (`SheetAgentStatus`): a place the eye already checks for what a-/// row is doing, and the only place on the row where nothing else moves when a-/// mark appears.-///-/// So the dot carries no margin of its own — each caller spaces it — and no-/// single size: see [leading] and [trailing].-class UnreadDot extends StatelessWidget {- const UnreadDot({super.key, required this.kind, this.diameter = leading});-- final NoticeKind kind;-- final double diameter;-- /// In front of a tab chip's label, where it has the pill to itself.- static const double leading = 8;-- /// After an agent row's title.- ///- /// ⚠️ Larger than [leading], and it has to be: a dot that LEADS is found by- /// scanning a column of them, where 8pt is plenty. This one sits at the end of- /// a line already carrying a name, a separator and an age — at 8pt it read as- /// punctuation after the time rather than as a mark of its own.- static const double trailing = 11;-- @override- Widget build(BuildContext context) => Container(- key: const ValueKey('unread-dot'),- width: diameter,- height: diameter,- decoration: BoxDecoration(color: unreadColor(kind), shape: BoxShape.circle),- );-}--/// [child] with the count of agents carrying news in its top-right corner —-/// the dial's bell pill. Nothing is drawn while the count is zero.-///-/// Listens to [unread] alone, so a mark appearing redraws this badge and not-/// the page it sits on.-class UnreadCountBadge extends StatelessWidget {- const UnreadCountBadge({- super.key,- required this.unread,- required this.child,- });-- final AgentUnread unread;- final Widget child;-- @override- Widget build(BuildContext context) => ListenableBuilder(- listenable: unread,- child: child,- builder: (context, child) {- final count = unread.count;- return Stack(- clipBehavior: Clip.none,- children: [- child!,- if (count > 0)- Positioned(- top: -4,- right: -4,- child: IgnorePointer(- child: _CountPill(- count: count,- // Amber as soon as ONE of them is waiting on you: that is- // the one the count is there to send you to.- color: unreadColor(- unread.anyQuestion ? NoticeKind.question : NoticeKind.done,- ),- ),- ),- ),- ],- );- },- );-}--class _CountPill extends StatelessWidget {- const _CountPill({required this.count, required this.color});-- final int count;- final Color color;-- @override- Widget build(BuildContext context) => Container(- key: const ValueKey('unread-count'),- constraints: const BoxConstraints(minWidth: 18),- height: 18,- padding: const EdgeInsets.symmetric(horizontal: 5),- alignment: Alignment.center,- decoration: BoxDecoration(- color: color,- borderRadius: BorderRadius.circular(9),- ),- child: Text(- count > 9 ? '9+' : '$count',- style: const TextStyle(- color: Colors.white,- fontSize: 11,- fontWeight: FontWeight.w700,- height: 1,- ),- ),- );-}diff --git a/mobile/lib/phone/agents_page.dart b/mobile/lib/phone/agents_page.dartindex 29b44f27f..5b63da586 100644--- a/mobile/lib/phone/agents_page.dart+++ b/mobile/lib/phone/agents_page.dart@@ -28,20 +28,11 @@ class AgentsPage extends StatelessWidget {super.key,required this.notifier,required this.machineId,- this.embedded = false,});final AppNotifier notifier;final String machineId;- /// Whether this is a PAGE INSIDE the machine pager rather than a route of its own.- ///- /// The route then belongs to [MachineSwipeHost], and the two places this page would navigate have- /// to stop: the padlock empty state's push of a [LinkPage] over the pager, and the pop after- /// unlinking, which would drop the person back to the tab from a page they were swiping through.- /// Both become a rebuild instead — [MachinePage] watches `needsLink` and draws the form itself.- final bool embedded;-@overrideWidget build(BuildContext context) => ListenableBuilder(listenable: notifier,@@ -91,11 +82,7 @@ class AgentsPage extends StatelessWidget {),if (machine != null)Expanded(- child: _AgentsBody(- notifier: notifier,- machine: machine,- embedded: embedded,- ),+ child: _AgentsBody(notifier: notifier, machine: machine),),],),@@ -169,10 +156,6 @@ class AgentsPage extends StatelessWidget {?.showSnackBar(SnackBar(content: Text(error)));return;}- // Inside the pager the page has already become the password form — `needsLink` is now true and- // [MachinePage] rebuilds on it — so there is nothing to leave, and popping would take the whole- // pager with it.- if (embedded) return;// The page is now showing a machine this phone can no longer open; the list behind it is where// the re-link starts.Navigator.of(context).maybePop();@@ -180,18 +163,11 @@ class AgentsPage extends StatelessWidget {}class _AgentsBody extends StatelessWidget {- const _AgentsBody({- required this.notifier,- required this.machine,- required this.embedded,- });+ const _AgentsBody({required this.notifier, required this.machine});final AppNotifier notifier;final MachineState machine;- /// See [AgentsPage.embedded] — here it decides what the padlock empty state's button does.- final bool embedded;-String get _machineId => machine.machine.machineId;@override@@ -204,17 +180,11 @@ class _AgentsBody extends StatelessWidget {title: 'This machine needs its password',message: 'Every machine has its own. Enter it once to link this phone.',action: FilledButton(- // Embedded, the form is this same page a rebuild away: clearing the dismissal is the whole- // move, and [MachinePage] draws [LinkPage] on the next frame. Pushing a route instead- // would stack a second screen over the pager — and that screen's own `pushReplacement`- // would then replace the pager once the password landed.- onPressed: embedded- ? () => notifier.revisitLinkPrompt(_machineId)- : () => Navigator.of(context).pushReplacement(- phoneRoute(- (_) => LinkPage(notifier: notifier, machineId: _machineId),- ),- ),+ onPressed: () => Navigator.of(context).pushReplacement(+ phoneRoute(+ (_) => LinkPage(notifier: notifier, machineId: _machineId),+ ),+ ),child: const Text('Enter password'),),);diff --git a/mobile/lib/phone/floating_glass.dart b/mobile/lib/phone/floating_glass.dartindex edf41711f..f5d0b3e1f 100644--- a/mobile/lib/phone/floating_glass.dart+++ b/mobile/lib/phone/floating_glass.dart@@ -1,30 +1,8 @@-import 'package:flutter/material.dart';--import 'package:harness_mobile/shared/theme/app_theme.dart';--/// The resting fill of the terminal's floating buttons — the mic, and Find while the keyboard is up.-///-/// ⚠️ **Solid, not see-through.** Over a terminal every button needs its own ground for its glyph to-/// read, and a near-opaque fill gives it one for nothing — the frosted blur that did the same job-/// read the whole backdrop through a GPU filter on every frame the output moved under it.-Color get floatingButtonFill =>- AppTheme.pick(const Color(0xF2FFFFFF), const Color(0xF22A2A2F));-/// The rim that draws the circle's edge over whatever runs under it.-Color get floatingButtonRim =>- AppTheme.pick(const Color(0x29000000), const Color(0x59FFFFFF));--/// The resting shadow under those buttons: enough to lift the edge off a bright-/// line of output.-List<BoxShadow> get floatingButtonShadow => [- BoxShadow(- color: Colors.black.withValues(alpha: 0.3),- blurRadius: 10,- offset: const Offset(0, 3),- ),-];+import 'package:flutter/widgets.dart';/// What stood under a floating button to frost the output behind it — now nothing: the fill is-/// solid ([floatingButtonFill]). Kept as a pass-through so the buttons keep one shape to change.+/// solid, which gives a glyph over a terminal its own ground for nothing. Kept as a pass-through so+/// the buttons keep one shape to change.////// ⚠️ **The blur went for speed.** A `BackdropFilter` re-reads and blurs what is under it every time/// that changes, and under a streaming terminal it changes every frame — the one control that isdiff --git a/mobile/lib/phone/link_page.dart b/mobile/lib/phone/link_page.dartindex c6915897e..f55dbce50 100644--- a/mobile/lib/phone/link_page.dart+++ b/mobile/lib/phone/link_page.dart@@ -24,14 +24,14 @@ class LinkPage extends StatefulWidget {final AppNotifier notifier;final String machineId;- /// Whether this form is a PAGE INSIDE something else — [MachinePage] in the machine pager — rather- /// than a route of its own.+ /// Whether this form is drawn INSIDE another page — [AgentHome], when the account's one machine+ /// needs its password — rather than being a route of its own.////// ⚠️ **It turns off every navigation this page does, and it has to.** The route belongs to the- /// pager, not to this page: a `pushReplacement` here would swap out the PAGER and take the swipe- /// with it, and a `maybePop` would drop the person back to the tab from a page they were only- /// swiping past. Embedded, the page just draws the form; the builder above it watches the same- /// `needsLink` and puts the agents there the moment the link lands.+ /// page around the form, not to the form: a `pushReplacement` here would swap out the home+ /// screen itself, and a `maybePop` has nothing behind it to go back to. Embedded, the page just+ /// draws the form; the builder above it watches the same `needsLink` and puts the agents there+ /// the moment the link lands.final bool embedded;@override@@ -59,10 +59,8 @@ class _LinkPageState extends State<LinkPage> {// run and pops the page on the frame it opened. The desktop fixes the same bug the same way// (`revisitLinkPrompt`, 051ea5b), where the reactive gates check the mark before calling.//- // ⚠️ Embedded, mounting is NOT somebody asking. A pager builds the pages either side of the one- // on screen, so this would clear the dismissal of a machine nobody has opened — reopening a form- // that was Closed, one page over, out of sight. There the mark is [MachinePage]'s to read and the- // "Enter password" button's to clear, and both act on the machine actually being looked at.+ // ⚠️ Embedded, mounting is NOT somebody asking: the page around the form put it up by itself,+ // so the mark is that page's to read and clear, not this form's.if (!widget.embedded) {widget.notifier.revisitLinkPrompt(widget.machineId);widget.notifier.addListener(_follow);@@ -76,7 +74,7 @@ class _LinkPageState extends State<LinkPage> {}void _follow() {- // Embedded, there is nowhere for this page to go: [MachinePage] rebuilds off the same notifier+ // Embedded, there is nowhere for this page to go: [AgentHome] rebuilds off the same notifier// and swaps the form for the agents itself. Listening at all would only risk the pops below.if (widget.embedded || _leaving || !mounted) return;final machine = widget.notifier.stateOf(widget.machineId);diff --git a/mobile/lib/phone/machine_swipe.dart b/mobile/lib/phone/machine_swipe.dartdeleted file mode 100644index e048c6a9b..000000000--- a/mobile/lib/phone/machine_swipe.dart+++ /dev/null@@ -1,193 +0,0 @@-import 'package:flutter/material.dart';--import 'package:harness_mobile/state/app_state.dart';-import 'agents_page.dart';-import 'link_page.dart';--/// The machines a machine page can swipe between, in the order the list drew them.-///-/// A SNAPSHOT, taken when the page opens, for the same reason [AgentSwipeList] is one: the Machines-/// tab sorts on state that moves by itself — a machine that finishes connecting sorts upward, one-/// that drops offline sorts down — so a pager recomputing this list would renumber its own pages-/// under the finger.-///-/// ⚠️ **Machine IDS, not [MachineState]s.** The agent pager can hold its entries because an-/// `AgentEntry` is read once and drawn; a machine page is LIVE — it watches `needsLink` to decide-/// whether it shows the password form or the agents, and the notifier replaces these state objects-/// as machines answer. A held instance would go stale and the page would keep drawing the machine as-/// it was when the list was tapped.-///-/// Every machine is kept, including the ones that need a password or are offline. That is the whole-/// difference from the agent pager, which drops the rows it cannot open: a machine row that cannot-/// be opened still has something to show — the password form is exactly what somebody swiping to it-/// came for, and an offline machine says so in words.-class MachineSwipeList {- MachineSwipeList(List<MachineState> machines)- : machineIds = [- for (final machine in machines) machine.machine.machineId,- ];-- final List<String> machineIds;-- bool get isEmpty => machineIds.isEmpty;-- /// Whether the pager wraps around — past the last machine is the first one again.- ///- /// Needs at least TWO machines, and that is not a formality. With one, every page of an endless- /// pager is the same machine: the screen would take a swipe, move, and land on what it just left,- /// which reads as the gesture having failed rather than as a list with one thing in it.- bool get wraps => machineIds.length > 1;-- /// Where a machine sits in the snapshot, or null if it is not in it.- int? indexOf(String machineId) {- final index = machineIds.indexOf(machineId);- return index < 0 ? null : index;- }-}--/// One machine's page, with the machines beside it a swipe away.-///-/// ⚠️ **The pager holds the route, and the pages inside it no longer do.** Without [neighbours] it-/// is a passthrough, which is how anything still opening a single machine keeps the old behaviour.-///-/// Nothing here mirrors the agent pager's `_attached`/`_detachAll`. That bookkeeping exists because-/// a terminal page ATTACHES a pane — a remote stream with a scrollback and a heartbeat — that-/// nothing else would ever close. A machine page holds no such thing: it reads machine state the-/// notifier keeps anyway, for every machine at once, whether this page is mounted or not. Three-/// mounted pages cost three list widgets.-class MachineSwipeHost extends StatefulWidget {- const MachineSwipeHost({- super.key,- required this.notifier,- required this.machineId,- required this.neighbours,- });-- final AppNotifier notifier;-- /// The machine the route was opened on — the page that is shown first.- final String machineId;-- /// Null for a page opened without neighbours, which is then simply the page.- final MachineSwipeList? neighbours;-- @override- State<MachineSwipeHost> createState() => _MachineSwipeHostState();-}--class _MachineSwipeHostState extends State<MachineSwipeHost> {- /// How many laps of the list the opening page sits above zero — see [initState].- static const _origin = 1000;-- PageController? _controller;-- @override- void initState() {- super.initState();- final neighbours = widget.neighbours;- if (neighbours == null || neighbours.isEmpty) return;- final start = neighbours.indexOf(widget.machineId) ?? 0;- // Opening in the MIDDLE of the endless run, not at its start, is what lets the first swipe go- // either way: page 0 has nothing to its left, and the last machine has to be reachable by- // swiping back from the first one. `_origin` is far enough from both ends that neither is- // reachable by hand — ~1,000 laps of the list — and it is a whole number of laps, so- // `page % length` still names the machine.- final page = neighbours.wraps- ? _origin * neighbours.machineIds.length + start- : start;- _controller = PageController(initialPage: page);- }-- @override- void dispose() {- _controller?.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- final neighbours = widget.neighbours;- final controller = _controller;- if (neighbours == null || controller == null || neighbours.isEmpty) {- return MachinePage(notifier: widget.notifier, machineId: widget.machineId);- }- return PageView.builder(- controller: controller,- // The lists below scroll vertically, so the horizontal axis is free — and here it is the- // pager's ALONE. The route's own edge-swipe back used to compete for it and win at the left- // margin, being registered above this in the tree: a drag started near the edge to reach the- // previous MACHINE left the screen instead. The route is pushed without that gesture now (see- // `phoneRoute`'s `swipeToGoBack`), so going back is the header's back band, or Android's back- // button.- physics: const PageScrollPhysics(),- // No count is what makes it endless: the builder answers for any page, and the modulo below- // wraps it back onto the list. A one-machine list keeps its single page instead — see- // [MachineSwipeList.wraps].- itemCount: neighbours.wraps ? null : neighbours.machineIds.length,- itemBuilder: (context, i) => MachinePage(- // ⚠️ Keyed by PAGE, not by machine: an endless run holds several pages for the same machine- // — the lap before and the lap after — and a machine-shaped key would make Flutter treat two- // live pages as one widget, which throws on a duplicate key the moment both are mounted.- key: ValueKey(i),- notifier: widget.notifier,- machineId:- neighbours.machineIds[i % neighbours.machineIds.length],- ),- );- }-}--/// One machine, drawn as whatever that machine currently needs.-///-/// ⚠️ **This is a SWITCH, not a route, and that is the point.** Both screens used to be pushed:-/// `openMachine` chose one, and [LinkPage] then `pushReplacement`ed its way to [AgentsPage] once the-/// password landed. Inside a pager that replacement would swap out the PAGER — the route is the-/// host's, not the page's — and the swipe would silently die the first time somebody linked a-/// machine from it. Deciding here, off the notifier, keeps the pager whole: the page simply becomes-/// the agents list under the finger, on the same page number, with its neighbours still beside it.-class MachinePage extends StatelessWidget {- const MachinePage({- super.key,- required this.notifier,- required this.machineId,- });-- final AppNotifier notifier;- final String machineId;-- @override- Widget build(BuildContext context) => ListenableBuilder(- listenable: notifier,- builder: (context, _) {- final machine = notifier.stateOf(machineId);- // A machine dropped from the account while its page sits in a pager. The page stays — popping- // one page out of a pager is not a thing a PageView can do — and [AgentsPage] already draws- // an empty machine shell for a null state, which is the honest answer.- //- // ⚠️ The dismissal is half of this test, not a detail. The form's own Close only calls- // `dismissLinkPrompt`; on a pushed [LinkPage] that lands as a pop, but a page cannot pop out of- // a pager, so without reading the mark here Close would do nothing visible and read as broken.- // Dismissed, the page falls through to [AgentsPage]'s padlock empty state — which is the same- // machine, still unlinked, with its "Enter password" calling `revisitLinkPrompt` to come back- // here. Close and that button are then the two directions of one switch.- if (machine != null &&- machine.needsLink &&- !notifier.isLinkPromptDismissed(machineId)) {- return LinkPage(- notifier: notifier,- machineId: machineId,- // The form no longer navigates: this builder is what moves the page on, the moment- // `needsLink` goes false — or the moment Close marks it dismissed.- embedded: true,- );- }- return AgentsPage(- notifier: notifier,- machineId: machineId,- // Unlinking must not pop the pager, and the empty state's "Enter password" must not push a- // second link route over it — this builder handles both by rebuilding.- embedded: true,- );- },- );-}diff --git a/mobile/lib/phone/phone_navigation.dart b/mobile/lib/phone/phone_navigation.dartindex 42a28cb55..61aa02ab9 100644--- a/mobile/lib/phone/phone_navigation.dart+++ b/mobile/lib/phone/phone_navigation.dart@@ -9,7 +9,6 @@ import 'agent_swipe.dart';import 'agent_swipe_list.dart';import 'agents_page.dart';import 'link_page.dart';-import 'machine_swipe.dart';import 'phone_shell_scope.dart';/// Every phone page slides in the iOS way, and goes back with the edge swipe — unless@@ -28,14 +27,14 @@ Route<void> phoneRoute(WidgetBuilder builder, {bool swipeToGoBack = true}) =>/// button and predictive-back (which go through `popDisposition`), and a page popping itself — the/// terminal page does exactly that when its pane disappears.///-/// Used by both pagers — agents and machines — where the horizontal drag belongs to the pager. The-/// edge swipe and the PageView were competing for the same axis: the route's detector sits ABOVE the-/// pager in the tree and wins at the left margin, so a swipe started near the edge to reach the-/// PREVIOUS entry left the screen instead. Only the header now goes back, which is what the whole-/// band across the top is widened for.+/// Used by the agent pager, where the horizontal drag belongs to the pager. The edge swipe and the+/// PageView were competing for the same axis: the route's detector sits ABOVE the pager in the tree+/// and wins at the left margin, so a swipe started near the edge to reach the PREVIOUS entry left+/// the screen instead. Only the header now goes back, which is what the whole band across the top+/// is widened for.///-/// A machine opened on its own keeps the gesture: there is no pager under it competing for the axis,-/// and it is a plain pushed page like any other.+/// A machine keeps the gesture: there is no pager under it competing for the axis, and it is a plain+/// pushed page like any other.class _NoSwipeBackRoute<T> extends CupertinoPageRoute<T> {_NoSwipeBackRoute({required super.builder});@@ -45,37 +44,10 @@ class _NoSwipeBackRoute<T> extends CupertinoPageRoute<T> {/// Where a tap on a machine goes. A machine this device holds no link to opens on ITS password/// form — each machine has its own remote password — and only a linked one opens on its agents.-///-/// [swipeNeighbours] turns the page into a pager over that list — see [MachineSwipeList] and-/// [openMachinePager], which is how the Machines tab calls this.-void openMachine(- BuildContext context,- AppNotifier notifier,- String machineId, {- MachineSwipeList? swipeNeighbours,-}) {+void openMachine(BuildContext context, AppNotifier notifier, String machineId) {final machine = notifier.stateOf(machineId);// Offline: no password form to show and no agents to list — every caller also draws the row inert.if (machine == null || machine.nodeOnline == false) return;- // A pager decides page by page which of the two screens a machine needs, because that answer- // changes under the finger — linking one mid-swipe turns its page into the agents list. Opened on- // its own, the old pair of routes is kept: [LinkPage] then walks forward to [AgentsPage] itself,- // which is the push the back gesture expects to find behind it.- if (swipeNeighbours != null) {- Navigator.of(context).push(- phoneRoute(- (_) => MachineSwipeHost(- notifier: notifier,- machineId: machineId,- neighbours: swipeNeighbours,- ),- // The horizontal axis belongs to the pager here — see [_NoSwipeBackRoute]. The way out is- // the header's back band, and on Android the back button as well.- swipeToGoBack: false,- ),- );- return;- }Navigator.of(context).push(phoneRoute((_) => machine.needsLink@@ -85,25 +57,6 @@ void openMachine();}-/// Opens one machine as a PAGER over [machines]: the page it lands on is the machine tapped, and a-/// horizontal swipe moves to the one beside it.-///-/// Takes the machines as a SNAPSHOT rather than a way to recompute them, for the reason-/// [openAgentPager] does: the list is sorted partly on state that moves by itself — a machine that-/// finishes connecting sorts upward — so a page recomputing "the next one" mid-session would-/// renumber itself under the finger.-void openMachinePager(- BuildContext context,- AppNotifier notifier,- List<MachineState> machines,- String machineId,-) => openMachine(- context,- notifier,- machineId,- swipeNeighbours: MachineSwipeList(machines),-);-/// Opens one agent full screen.////// ONE at a time, and that is the whole difference from the desktop grid: a phone has no roomdiff --git a/mobile/lib/phone/phone_sheet.dart b/mobile/lib/phone/phone_sheet.dartindex f61a5d2ea..33d357af0 100644--- a/mobile/lib/phone/phone_sheet.dart+++ b/mobile/lib/phone/phone_sheet.dart@@ -100,19 +100,12 @@ class PhoneSheetSection {/// [actions] is the first card, with no caption. Each of [sections] is a card after it — under its/// caption, or a gap below the card before when it has none. An empty section is left out.///-/// [titleLeading] is drawn left of the title — the engine mark, on an agent's sheet — and-/// [titleDetail] under [titleParts]: machine, folder and branch.-////// The page behind stands on the app's sheet veil, dimmed and blurred — see [_PhoneSheetRoute].Future<void> showPhoneSheet(BuildContext context, {required String title,List<PhoneSheetAction> actions = const [],List<PhoneSheetSection> sections = const [],- PhoneSheetAction? titleAction,- List<String>? titleParts,- Widget? titleDetail,- Widget? titleLeading,String? titleBranch,}) {assert(debugCheckHasMediaQuery(context));diff --git a/mobile/lib/phone/phone_shell.dart b/mobile/lib/phone/phone_shell.dartindex 7d8b2586e..247a1263d 100644--- a/mobile/lib/phone/phone_shell.dart+++ b/mobile/lib/phone/phone_shell.dart@@ -4,37 +4,20 @@ import 'package:harness_mobile/state/app_state.dart';import '../p2p/phone_terminal_p2p.dart';import 'agent_home.dart';-import 'agent_index.dart';-import 'machines_tab.dart';import 'phone_shell_scope.dart';-import 'phone_tab_bar.dart';-import 'settings_page.dart';-/// Whether the shell draws its tab bar.+/// The signed-in phone app: one page stack, rooted in [AgentHome] — the terminal the phone opens+/// on and stays on. Machines and Settings are pages pushed onto it, from the terminal's menu and+/// from Find.///-/// Off because the terminal is where the phone opens and stays: [AgentHome] is-/// the Agents tab's root, it picks the agent itself, and a bar for steering-/// between tabs by hand is a row of chrome under every screen paying for a case-/// that no longer arises.+/// ⚠️ **One stack, no tabs.** There were three — Agents, Machines, Settings — each with its own+/// navigator under a bottom bar. The bar was hidden once the terminal became the home screen, and+/// with no bar there was no way to reach the other two: they were built out of sight and never+/// shown, so they went with it.///-/// ⚠️ It hides the BAR, not the tabs. All three still exist, still hold their-/// own page stacks, and [_PhoneShellState._select] still pops one back to its-/// root — nothing below this flag knows it is off. What goes with it is the only-/// way to REACH a tab by hand, so with it off the app can only be where it was-/// put: fine while that place is one agent's terminal, and the reason this is a-/// flag rather than a deletion.-const bool _showTabBar = false;--/// The signed-in phone app: three tabs, each with its own page stack.-///-/// Its own [Navigator] per tab, nested under the app's, on purpose. Two reasons, and both are-/// things a single shared navigator gets wrong:-///-/// - `RootShell` swaps this whole shell out on sign-out, and the pages have to go with it rather-/// than stay stacked over the login screen, as they would on the root navigator.-/// - A tab remembers where it was. Walking into a machine's agents, switching to Settings and-/// coming back returns to that machine, not to the root of the tab — which is what every phone-/// OS does and what a single stack cannot express.+/// Its own [Navigator], nested under the app's, on purpose: `RootShell` swaps this whole shell out+/// on sign-out, and the pages have to go with it rather than stay stacked over the sign-in screen,+/// as they would on the root navigator.class PhoneShell extends StatefulWidget {const PhoneShell({super.key, required this.notifier});@@ -45,16 +28,10 @@ class PhoneShell extends StatefulWidget {}class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {- PhoneTab _tab = PhoneTab.agents;+ final _navigator = GlobalKey<NavigatorState>();- final _navigators = {- for (final tab in PhoneTab.values) tab: GlobalKey<NavigatorState>(),- };-- /// One per tab — see the note at the `HeroControllerScope` below for why they cannot be shared.- final _heroControllers = {- for (final tab in PhoneTab.values) tab: HeroController(),- };+ /// The nested navigator's own — see the note at the `HeroControllerScope` below.+ final _heroController = HeroController();@overridevoid initState() {@@ -75,9 +52,7 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {);_linkedMachineId.dispose();_openAgentRequest.dispose();- for (final controller in _heroControllers.values) {- controller.dispose();- }+ _heroController.dispose();super.dispose();}@@ -86,17 +61,17 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {// Almost nothing, now — and that is the change. The shell used to reopen the last agent itself,// fall back to Machines when nothing answered, and time the wait out after 45 seconds, because// the thing it was steering towards was a page it had to PUSH over an agents list. There is no- // list and no push: [AgentHome] is the Agents tab's root, and it reads the last-agent record,- // waits for the machines to answer and picks the agent, all as part of drawing itself.+ // list and no push: [AgentHome] is the stack's root, and it reads the last-agent record, waits+ // for the machines to answer and picks the agent, all as part of drawing itself.//- // One move is left, because it crosses tabs and no page can make it alone: a password accepted on- // the Machines tab takes the person back to Agents, where the machine they just opened is about- // to bring its agents with it.+ // One move is left, because no page can make it alone: a password accepted on a page pushed over+ // the home screen takes the person back to it, where the machine they just opened is about to+ // bring its agents with it./// The machine whose password was just accepted, for [AgentHome] to open once it answers.////// ⚠️ **A notifier and not a field on this State, because a field cannot reach [AgentHome] at- /// all.** Each tab's root is built inside `onGenerateRoute`, which a nested [Navigator] runs ONCE+ /// all.** The stack's root is built inside `onGenerateRoute`, which a nested [Navigator] runs ONCE/// when it creates that route — so the root keeps forever whatever arguments it was first given,/// and `setState` here rebuilds this widget without ever rebuilding it. A value passed down as a/// constructor field would have been read on the first launch frame, when no machine had been@@ -108,19 +83,13 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {final _linkedMachineId = ValueNotifier<String?>(null);/// A password was accepted: the agent is what the person came for, so the phone points itself at- /// that machine and shows the tab an agent lives on.+ /// that machine.////// No waiting and no timeout here, which is what this used to be full of. The machine is still/// connecting at this point and [AgentHome] is already watching for exactly that — it holds/// whatever is on screen while the machine dials, then opens the first agent it reports.- void _followLinkedMachine(String machineId) {- _linkedMachineId.value = machineId;- setState(() {- _tab = PhoneTab.agents;- _tabCanPop =- _navigators[PhoneTab.agents]?.currentState?.canPop() ?? false;- });- }+ void _followLinkedMachine(String machineId) =>+ _linkedMachineId.value = machineId;/// An agent somebody picked — from search, the new-agent form, the attention list — for/// [AgentHome] to put on screen. A notifier for the reason [_linkedMachineId] is one.@@ -131,19 +100,14 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {////// ⚠️ **This is what took the back button off the terminal.** A terminal pushed over search, or/// over the new-agent form, had a page under it, so its header drew a chevron back to a screen the- /// person had finished with. Every stack is emptied back to its root instead and the root terminal+ /// person had finished with. The stack is emptied back to its root instead and the root terminal/// switches agent, so there is never anything to go back to.void _openAgentAtHome(String machineId, String agentId) {- for (final navigator in _navigators.values) {- navigator.currentState?.popUntil((route) => route.isFirst);- }+ _navigator.currentState?.popUntil((route) => route.isFirst);// Reset first, so picking the agent already requested last time still notifies._openAgentRequest.value = null;_openAgentRequest.value = (machineId: machineId, agentId: agentId);- setState(() {- _tab = PhoneTab.agents;- _tabCanPop = false;- });+ setState(() => _canPop = false);}/// A tapped "agent finished" notice: that agent, as the home screen — the@@ -178,50 +142,17 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {widget.notifier.handleAppResumed();}- NavigatorState? get _currentNavigator => _navigators[_tab]?.currentState;-- void _select(PhoneTab tab) {- if (tab == _tab) {- // A second tap on the tab you are already on pops that tab back to its root — the phone- // convention, and the only way back out of a deep stack without walking every page.- _currentNavigator?.popUntil((route) => route.isFirst);- _syncCanPop();- return;- }- // The new tab has a depth of its own, so the back gesture's answer changes with it.- setState(() {- _tab = tab;- _tabCanPop = _navigators[tab]?.currentState?.canPop() ?? false;- });- }-- Widget _rootFor(PhoneTab tab) => switch (tab) {- PhoneTab.agents => AgentHome(- notifier: widget.notifier,- openMachineId: _linkedMachineId,- openAgent: _openAgentRequest,- ),- PhoneTab.machines => MachinesTab(notifier: widget.notifier),- PhoneTab.settings => SettingsPage(notifier: widget.notifier),- };-- /// Whether the tab on screen has a page to go back to — what [PopScope] is given.+ /// Whether the stack has a page to go back to — what [PopScope] is given.////// Kept as state rather than read inline in `build`, because a push or pop inside a nested/// [Navigator] does not rebuild this widget: the flag has to be pushed here by the notification/// below, or `canPop` would answer with whatever was true when the shell last happened to build.- bool _tabCanPop = false;+ bool _canPop = false;- /// Android's back button, handled per tab.- ///- /// ⚠️ Deliberately NOT `NavigatorPopHandler`, which is what a single-stack phone shell would- /// use. It tracks one `canPop` flag fed by `NavigationNotification`s bubbling out of its- /// subtree — and an [IndexedStack] keeps all three navigators MOUNTED and notifying, so the flag- /// ends up reflecting whichever tab spoke last rather than the one on screen. A back press on a- /// root Agents tab would then be swallowed because Settings happened to be two pages deep.+ /// Android's back button: the stack's own pages first, then the system.///- /// So the notification is used only as a SIGNAL that some stack moved, and the answer is then- /// read from the current tab's navigator — the one stack the person is actually looking at.+ /// The notification is used only as a SIGNAL that the stack moved, and the answer is then read+ /// from the navigator itself.bool _onNavigation(NavigationNotification notification) {_syncCanPop();// Let it keep bubbling: the root navigator above this shell tracks its own state from it.@@ -229,21 +160,21 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {}void _syncCanPop() {- final next = _currentNavigator?.canPop() ?? false;- if (next == _tabCanPop) return;+ final next = _navigator.currentState?.canPop() ?? false;+ if (next == _canPop) return;// The notification arrives mid-build of the subtree that sent it, so defer rather than calling// setState inside another widget's build.WidgetsBinding.instance.addPostFrameCallback((_) {if (!mounted) return;- final current = _currentNavigator?.canPop() ?? false;- if (current == _tabCanPop) return;- setState(() => _tabCanPop = current);+ final current = _navigator.currentState?.canPop() ?? false;+ if (current == _canPop) return;+ setState(() => _canPop = current);});}void _handleBack(bool didPop, Object? result) {if (didPop) return;- _currentNavigator?.maybePop().then((_) {+ _navigator.currentState?.maybePop().then((_) {if (mounted) _syncCanPop();});}@@ -255,59 +186,36 @@ class _PhoneShellState extends State<PhoneShell> with WidgetsBindingObserver {child: ListenableBuilder(listenable: widget.notifier,builder: (context, _) => PopScope<Object?>(- // False while this tab has somewhere to go back to, so the gesture reaches [_handleBack]- // instead of leaving the app. True at a tab's root: the press then belongs to the system.- canPop: !_tabCanPop,+ // False while the stack has somewhere to go back to, so the gesture reaches [_handleBack]+ // instead of leaving the app. True at its root: the press then belongs to the system.+ canPop: !_canPop,onPopInvokedWithResult: _handleBack,child: NotificationListener<NavigationNotification>(onNotification: _onNavigation,child: Scaffold(- body: IndexedStack(- index: PhoneTab.values.indexOf(_tab),- sizing: StackFit.expand,- children: [- for (final tab in PhoneTab.values)- // ⚠️ Each tab's navigator needs its OWN HeroController, and without this the- // engine-mark flights simply never happen — silently, with no error.- //- // `MaterialApp` installs one controller for the ROOT navigator only; a nested- // `Navigator` inherits nothing, so its routes have no observer to drive a flight.- // One shared controller is not the fix either — `navigator.dart` on- // `HeroControllerScope`: "The hero controller ... can only subscribe to one- // navigator", and these three are all mounted at once inside the IndexedStack.- HeroControllerScope(- controller: _heroControllers[tab]!,- child: Navigator(- key: _navigators[tab],- // ⚠️ The controller goes in the SCOPE ONLY, never also in `observers`.- // `NavigatorState._updateEffectiveObservers` appends the scope's controller to- // `widget.observers` itself, so listing it here registers it twice and trips- // "A HeroController can not be shared by multiple Navigators" — which reads- // like a sharing bug and is really a double-subscription by one navigator.- onGenerateRoute: (_) => MaterialPageRoute<void>(- builder: (_) => _rootFor(tab),- ),- ),- ),- ],- ),- // ⚠️ Hidden, not removed. The terminal is the screen the phone- // opens on, and the three-tab bar under it is on its way out — but- // the tabs themselves still carry the whole app: every page here is- // rooted in one of them, and [_select] is what pops a tab back and- // keeps its stack. Deleting the bar would take all of that with it.+ // ⚠️ The nested navigator needs its OWN HeroController, and without this the+ // engine-mark flights simply never happen — silently, with no error.//- // So the shell is unchanged and only the bar is not drawn. Flip- // [_showTabBar] to bring it straight back, and everything below is- // still wired to it.- bottomNavigationBar: !_showTabBar- ? null- : PhoneTabBar(- current: _tab,- onSelect: _select,- waitingCount: waitingAgents(agentIndex(widget.notifier))- .length,+ // `MaterialApp` installs one controller for the ROOT navigator only; a nested+ // `Navigator` inherits nothing, so its routes have no observer to drive a flight.+ body: HeroControllerScope(+ controller: _heroController,+ child: Navigator(+ key: _navigator,+ // ⚠️ The controller goes in the SCOPE ONLY, never also in `observers`.+ // `NavigatorState._updateEffectiveObservers` appends the scope's controller to+ // `widget.observers` itself, so listing it here registers it twice and trips+ // "A HeroController can not be shared by multiple Navigators" — which reads+ // like a sharing bug and is really a double-subscription by one navigator.+ onGenerateRoute: (_) => MaterialPageRoute<void>(+ builder: (_) => AgentHome(+ notifier: widget.notifier,+ openMachineId: _linkedMachineId,+ openAgent: _openAgentRequest,),+ ),+ ),+ ),),),),diff --git a/mobile/lib/phone/phone_tab_bar.dart b/mobile/lib/phone/phone_tab_bar.dartdeleted file mode 100644index 557b241cc..000000000--- a/mobile/lib/phone/phone_tab_bar.dart+++ /dev/null@@ -1,187 +0,0 @@-import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import 'package:harness_mobile/shared/theme/app_theme.dart';--/// The three places a phone can be. Agents first: it is where the app opens and the only tab with-/// anything to act on.-///-/// Lucide, like the rest of the app's navigation — Settings' rail and the desktop machine rail are-/// both Lucide 300, and Material's own glyphs are a heavier, rounder family that reads as a-/// different product beside them. `smartToy`, the obvious Material pick for an agent, is a-/// toy robot head; these are terminals, which is what [PhoneTab.agents] actually lists.-enum PhoneTab {- agents(- LucideIcons.squareTerminal300,- LucideIcons.squareTerminal400,- 'Harnesses',- ),- machines(- LucideIcons.laptopMinimal300,- LucideIcons.laptopMinimal400,- 'Machines',- ),- settings(LucideIcons.settings300, LucideIcons.settings400, 'Settings');-- const PhoneTab(this.icon, this.selectedIcon, this.label);-- final IconData icon;-- /// The tab you are on, drawn a weight heavier rather than filled.- ///- /// A line-art set has no filled variant to switch to, and Lucide ships the same glyph at 100–600- /// instead — so the selected tab thickens where a Material one would solidify. Same purpose: a- /// second signal beside colour, for anyone who cannot use the colour.- final IconData selectedIcon;-- final String label;-}--/// The bar along the bottom of the phone's root pages.-///-/// Drawn only on the three root pages. A pushed page — a terminal, a machine's agents — covers it,-/// because a terminal needs the bottom of the screen for its composer and key row, and three-/// layers of chrome stacked under the thumb is what that would otherwise be.-class PhoneTabBar extends StatelessWidget {- const PhoneTabBar({- super.key,- required this.current,- required this.onSelect,- this.waitingCount = 0,- });-- final PhoneTab current;- final ValueChanged<PhoneTab> onSelect;-- /// How many agents are waiting on an answer — the badge on the Agents tab. Zero draws none.- final int waitingCount;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return DecoratedBox(- decoration: BoxDecoration(- color: AppPalette.panelBg,- border: Border(top: BorderSide(color: AppGlass.hair)),- ),- child: SafeArea(- top: false,- child: Padding(- padding: const EdgeInsets.only(top: 6, bottom: 2),- child: Row(- children: [- for (final tab in PhoneTab.values)- Expanded(- child: _Tab(- tab: tab,- selected: tab == current,- badge: tab == PhoneTab.agents ? waitingCount : 0,- onTap: () => onSelect(tab),- ),- ),- ],- ),- ),- ),- );- }-}--class _Tab extends StatelessWidget {- const _Tab({- required this.tab,- required this.selected,- required this.badge,- required this.onTap,- });-- final PhoneTab tab;- final bool selected;- final int badge;- final VoidCallback onTap;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final color = selected- ? AppPalette.accentOnSurface- : AppPalette.textSecondary;- return Semantics(- button: true,- selected: selected,- label: badge > 0 ? '${tab.label}, $badge waiting' : tab.label,- child: InkWell(- onTap: onTap,- borderRadius: BorderRadius.circular(10),- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 5),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- // The badge rides the icon, so the label below stays on one baseline across tabs.- Stack(- clipBehavior: Clip.none,- children: [- Icon(- selected ? tab.selectedIcon : tab.icon,- size: 23,- color: color,- ),- if (badge > 0)- Positioned(top: -4, left: 14, child: _Badge(count: badge)),- ],- ),- const SizedBox(height: 3),- Text(- tab.label,- style: TextStyle(- color: color,- fontSize: 10.5,- fontWeight: FontWeight.w500,- ),- ),- ],- ),- ),- ),- );- }-}--class _Badge extends StatelessWidget {- const _Badge({required this.count});-- final int count;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return Container(- constraints: const BoxConstraints(minWidth: 16),- padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),- decoration: BoxDecoration(- color: AppPalette.warn,- borderRadius: BorderRadius.circular(999),- // A rim in the bar's own colour, so the badge reads as a separate mark rather than- // smudging into the icon it overlaps.- border: Border.all(color: AppPalette.panelBg, width: 1.5),- ),- alignment: Alignment.center,- child: Text(- // Past 99 the exact figure stops meaning anything and the pill would widen off the icon.- count > 99 ? '99+' : '$count',- style: TextStyle(- // The ink follows the theme because the fill does: [AppPalette.warn] is a light amber in- // dark (#FFB020) and a dark ochre in light (#B45309). One fixed ink cannot carry both —- // measured, a dark numeral reads 9.71:1 on dark's fill but only 3.54:1 on light's, under- // the 4.5:1 floor. White on light's fill is 5.02:1.- color: AppTheme.pick(Colors.white, const Color(0xFF181818)),- fontSize: 10,- height: 1.2,- fontWeight: FontWeight.w600,- fontFeatures: AppFont.tabularFigures,- ),- ),- );- }-}diff --git a/mobile/lib/phone/status_pill.dart b/mobile/lib/phone/status_pill.dartindex f1b1ccc2c..6646c6247 100644--- a/mobile/lib/phone/status_pill.dart+++ b/mobile/lib/phone/status_pill.dart@@ -62,18 +62,12 @@ class StatusPill extends StatelessWidget {}/// The status without its words: a dot in the tone's colour, or a small spinner while something is-/// under way. For a place with no room for a label — the terminal header, beside the agent's name.+/// under way. For a place with no room for a label — a machine's heading in the All harnesses list.////// The label is still there for a screen reader, and as a long-press tooltip, so a colour is never/// the only way to learn what it means.class StatusDot extends StatelessWidget {- const StatusDot({- super.key,- required this.summary,- this.ring,- this.size = defaultSize,- this.spinnerColor,- });+ const StatusDot({super.key, required this.summary, this.size = defaultSize});/// The box every screen but the terminal's foot row draws it at.static const double defaultSize = 10;@@ -85,26 +79,16 @@ class StatusDot extends StatelessWidget {/// a solid ring rather than as something turning.final double size;- /// A cut-out ring in this colour around the dot, for a dot laid OVER something — a badge on a- /// mark, the way presence sits on an avatar. It should be the colour behind the mark, so the dot- /// reads as notched into it rather than stuck on top.- final Color? ring;-- /// The spinner's colour in place of the busy tone's, for a spinner drawn over a mark rather than- /// beside its words — see `BadgedEngineMark`. Null keeps the tone's.- final Color? spinnerColor;-@overrideWidget build(BuildContext context) {AppTheme.watch(context);final color = phoneToneColor(summary.tone);- final ring = this.ring;- Widget dot = SizedBox.square(+ final dot = SizedBox.square(dimension: size,child: summary.tone == PhoneTone.busy? CircularProgressIndicator(strokeWidth: 1.6 * size / defaultSize,- color: spinnerColor ?? color,+ color: color,): Center(child: DecoratedBox(@@ -113,12 +97,6 @@ class StatusDot extends StatelessWidget {),),);- if (ring != null) {- dot = DecoratedBox(- decoration: BoxDecoration(color: ring, shape: BoxShape.circle),- child: Padding(padding: const EdgeInsets.all(2), child: dot),- );- }return Tooltip(message: summary.label,child: Semantics(label: summary.label, child: dot),diff --git a/mobile/lib/phone/terminal_action_column.dart b/mobile/lib/phone/terminal_action_column.dartindex 2daf33e69..36e86bba0 100644--- a/mobile/lib/phone/terminal_action_column.dart+++ b/mobile/lib/phone/terminal_action_column.dart@@ -1,44 +1,24 @@import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';-import 'package:harness_mobile/notify/agent_unread.dart';-import 'package:harness_mobile/notify/unread_marks.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';import 'package:harness_mobile/terminal/terminal_session.dart';-import 'floating_glass.dart';-import 'terminal_header.dart';import 'voice_input_controller.dart';import 'voice_mic_button.dart';import 'voice_mic_face.dart';import 'voice_mic_fab.dart';-/// The terminal's floating controls, stacked in its bottom-right corner:-/// the mic, then Search.+/// The terminal's floating control: the mic, low at the foot of the page — see `terminal_page.dart`+/// for where it stands.///-/// ```-/// ( × ● ▂▃▅▇▅▃▂ 0:07 (↑) )-/// (🔍)-/// ```-///-/// ⚠️ **The mic is on top, and that is what "moved up" means.** It used to sit-/// alone in the corner, over the agent's own status line; Search now takes the-/// 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 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-/// the top of its own target to the mic, and a tap aimed at Search would start-/// a recording.-class TerminalActionColumn extends StatefulWidget {+/// ⚠️ **The mic alone.** Search used to ride in a column under it, and over it while the keyboard+/// was up; Find is a swipe right or a tap on the agent's name now, and the column kept only the+/// mic. What the mic is doing is shown by the mic itself — see `voice_bar_line.dart`.+class TerminalActionColumn extends StatelessWidget {const TerminalActionColumn({super.key,required this.voice,required this.session,- required this.onSearch,- this.unread,- this.searchOnly = false,this.working = false,});@@ -47,201 +27,18 @@ class TerminalActionColumn extends StatefulWidget {/// The agent is working: the mic wears a ring — see `VoiceMicCore.working`.final bool working;- /// Agents that finished while you were on this one. Search is where they are- /// reached from, so it wears their count — the dial's bell pill. Null draws- /// the plain button.- final AgentUnread? unread;-/// Null while the terminal is still attaching: the mic is drawn dimmed and/// dead, since there is nothing to talk to yet.final TerminalSession? session;- final VoidCallback onSearch;-- /// Search alone, with no mic over it — what is left while the keyboard is up.- ///- /// ⚠️ **The mic does not merely hide here, it has nothing to do.** Typing is- /// the other way of saying what the mic says, so with a keyboard on screen- /// the two are the same errand and one of them is already under the thumb.- /// Search is not: what it reaches — another harness, another machine — has no- /// equivalent on the key bar, and being unable to reach it without first- /// putting the keyboard away was the whole of the complaint.- final bool searchOnly;-- /// The column's width: the mic's slot, which the smaller buttons centre under.- static const double width = VoiceMicButton.extent;-- /// How far the column sits from the terminal's right and bottom edges.- static const double inset = VoiceMicFab.inset;-- /// How far the orb's slot sits above the foot of the page. Low and centred, where Siri's orb- /// stands over the dock — below the agent's prompt rather than on it — and the terminal runs full- /// screen under it.- ///- /// Measured off Siri: its orb's centre stands about 76pt above the foot of an iPhone 14, so- /// this slot's foot sits half the slot below that.- static const double orbBottom = 76 - VoiceMicButton.extent / 2;-- /// How far Search sits from the terminal's TOP edge while the keyboard is up- /// — see [searchOnly].- ///- /// ⚠️ **Below the header's own height, not at the top of the box.** The- /// header floats over these same rows and slides away on a scroll; measured- /// from the box, Search sat under it whenever it was shown. Below it, the two- /// never meet — and the rows Search now covers are the OLDEST on screen,- /// which is the opposite end of the pane from the prompt being typed into.- /// That is the whole reason it moves rather than staying where it was.- static const double topInset = TerminalHeader.height + 8;-- @override- State<TerminalActionColumn> createState() => _TerminalActionColumnState();-}--class _TerminalActionColumnState extends State<TerminalActionColumn> {- /// Whether a hold has been dragged off the mic — [VoiceMicMode.holdToTalk]- /// only. The mic reports it; the capsule body is what says so, where the- /// thumb is not covering it.- final ValueNotifier<bool> _slipped = ValueNotifier(false);-- @override- void dispose() {- _slipped.dispose();- super.dispose();- }-- /// ⚠️ Guarded by [mounted]: the mic reports its last slip from a microtask- /// scheduled in its own `dispose`, which can land after this column is gone- /// as well.- void _onSlipChanged(bool value) {- if (mounted) _slipped.value = value;- }-@overrideWidget build(BuildContext context) {AppTheme.watch(context);- return _column(context, widget.session);- }-- Widget _column(BuildContext context, TerminalSession? session) {- // ⚠️ **Search floats here only while the keyboard is up.** With it down, Find is a swipe right- // or a tap on the agent's name; with the keyboard up, Find rides up here, top right.- if (widget.searchOnly) {- return _centred(- _withUnread(- TerminalRoundAction(- key: const ValueKey('terminal-search'),- icon: LucideIcons.search300,- label: 'Find an agent',- onTap: widget.onSearch,- ),- ),- );- }+ final session = this.session;// Still attaching: the mic in its place, dimmed and dead.if (session == null) {return const VoiceMicButton(face: VoiceMicFace.talk, onPressed: null);}- // The mic alone: what it is doing is said beside it — see `voice_bar_line.dart`.- return VoiceMicFab(- voice: widget.voice,- session: session,- onSlipChanged: _onSlipChanged,- working: widget.working,- );- }-- Widget _withUnread(Widget button) {- final unread = widget.unread;- if (unread == null) return button;- return UnreadCountBadge(unread: unread, child: button);- }-- Widget _centred(Widget child) => SizedBox(- width: TerminalActionColumn.width,- child: Center(child: child),- );-}--/// A round floating button in the mic's style, one size down.-///-/// ⚠️ Smaller than the mic, and that is the right way round: the mic is the-/// page's one action, and these are tapped once and rarely.-class TerminalRoundAction extends StatelessWidget {- const TerminalRoundAction({- super.key,- required this.icon,- required this.label,- required this.onTap,- });-- final IconData icon;-- /// For screen readers and the long-press tooltip.- final String label;-- /// Null draws the button dimmed and dead, the way the mic is.- final VoidCallback? onTap;-- /// The drawn circle.- static const double diameter = 42;-- /// What the finger may land on, spilling past the circle on every side.- static const double touchExtent = 50;-- static const double touchOverhang = (touchExtent - diameter) / 2;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final live = onTap != null;- return Semantics(- button: true,- enabled: live,- label: label,- child: Tooltip(- message: label,- child: SizedBox.square(- dimension: diameter,- child: OverflowBox(- maxWidth: touchExtent,- maxHeight: touchExtent,- child: GestureDetector(- // Opaque even when dead: a tap on a dimmed button must not fall- // through to the terminal and raise the keyboard.- behavior: HitTestBehavior.opaque,- onTap: onTap,- child: SizedBox.square(- dimension: touchExtent,- child: AnimatedOpacity(- // The mic's dimmed opacity, so they read alike.- duration: const Duration(milliseconds: 160),- opacity: live ? 1 : 0.4,- child: Center(- // The mic's resting look — see [FloatingGlass].- child: FloatingGlass(- child: Container(- width: diameter,- height: diameter,- decoration: BoxDecoration(- shape: BoxShape.circle,- color: floatingButtonFill,- border: Border.all(color: floatingButtonRim),- boxShadow: floatingButtonShadow,- ),- child: Icon(- icon,- size: 20,- color: AppPalette.textPrimary,- ),- ),- ),- ),- ),- ),- ),- ),- ),- ),- );+ return VoiceMicFab(voice: voice, session: session, working: working);}}diff --git a/mobile/lib/phone/terminal_header.dart b/mobile/lib/phone/terminal_header.dartdeleted file mode 100644index 6b705ffdf..000000000--- a/mobile/lib/phone/terminal_header.dart+++ /dev/null@@ -1,553 +0,0 @@-import 'dart:math' as math;--import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import 'package:harness_mobile/core/models.dart';-import 'package:harness_mobile/shared/theme/app_theme.dart';-import 'package:harness_mobile/widgets/engine_identity.dart';--import 'phone_status.dart';-import 'status_pill.dart';-import 'terminal_place_line.dart';--/// The terminal page's own header: whose terminal this is, in two lines, with-/// the page's controls at the right end.-///-/// ```-/// [mark●] Fix login redirect ⋯-/// ▭ MacBookPro2021.local ▢ autonomous-harness ⑂ main-/// ```-///-/// ⚠️ **The connection state is the dot on the engine mark, not a word.** It-/// rides the mark's bottom-right corner the way presence sits on an avatar in a-/// messenger: green while live, a spinner while attaching, the warning or error-/// colour when the stream is taken over or drops. The label is still there for-/// a screen reader and as the long-press tooltip — see [StatusDot]. While the-/// terminal is on its way back, the rule under the row sweeps as well — see-/// [TerminalHeaderRule].-///-/// ⚠️ **Search and New agent are not here.** They float over the terminal's-/// bottom-right corner with the mic — see `terminal_action_column.dart` — so-/// this row is identity plus `⋯`, and nothing competes with the names for width.-///-/// ⚠️ **It leaves on a scroll, and `⋯` leaves with it.** The page slides this-/// row away as the terminal is scrolled forward; nothing floats in its place.-/// Nothing here knows about that; the row is either laid out or it is not.-class TerminalHeader extends StatelessWidget {- const TerminalHeader({- super.key,- required this.agent,- required this.status,- this.machineName,- this.trailing = const [],- this.onFind,- });-- /// The agent this terminal belongs to. Null while it is still loading.- final Agent? agent;-- /// The machine it runs on, drawn first on the second line. Null while that- /// machine is not known yet.- final String? machineName;-- /// The session's state, drawn as the dot on the engine mark.- final PhoneSummary status;-- /// The page's controls, right of the names: `⋯`, and the reclaim button when- /// the stream is read-only.- final List<Widget> trailing;-- /// A tap on the mark or the names: Find, the list of agents. The name then wears a `⌄`, which is- /// how iOS says a title opens a list — the visible door to what a swipe right also opens. Null- /// leaves the names inert.- final VoidCallback? onFind;-- /// The row's height, not counting its insets.- ///- /// Two lines of type: 15pt name over 12.5pt folder, with the engine mark- /// centred against the pair.- ///- /// ONE line now — the agent's name — where it was two with the machine, folder and branch under- /// it. The header floats over the terminal's top rows, so every point it gives up is text; where- /// the agent runs is in the ⋮ sheet and on its row in Find.- static const double rowHeight = 28;-- static const double sideInset = 14;- static const double topInset = 4;- static const double bottomInset = 6;-- /// The whole header, insets and divider included — what floats over the- /// terminal's top rows while it is shown.- static const double height = topInset + rowHeight + bottomInset + 1;-- /// The engine mark's size. Big enough to carry the status dot on its corner- /// without the dot hiding it.- static const double markSize = 20;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final agent = this.agent;- return Padding(- padding: const EdgeInsets.fromLTRB(- sideInset,- topInset,- sideInset,- bottomInset,- ),- child: SizedBox(- height: rowHeight,- child: Row(- children: [- Expanded(- child: Semantics(- button: onFind != null,- label: onFind == null ? null : 'Find an agent',- child: GestureDetector(- key: const ValueKey('terminal-find'),- behavior: HitTestBehavior.opaque,- onTap: onFind,- child: Row(- children: [- BadgedEngineMark(- agent: agent,- status: status,- ring: AppPalette.windowBg,- ),- const SizedBox(width: 11),- Expanded(- child: _Identity(- agent: agent,- machineName: machineName,- opensFind: onFind != null,- ),- ),- ],- ),- ),- ),- ),- ...trailing,- ],- ),- ),- );- }-}--/// The engine mark with the session's state notched into its corner.-///-/// The header draws it beside the agent's name.-class BadgedEngineMark extends StatelessWidget {- const BadgedEngineMark({- super.key,- required this.agent,- required this.status,- required this.ring,- this.size = TerminalHeader.markSize,- });-- final Agent? agent;- final PhoneSummary status;-- /// The colour BEHIND the mark, cut out around the dot so it reads as notched- /// into the mark rather than stuck on it — see [StatusDot.ring].- final Color ring;-- final double size;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return SizedBox.square(- dimension: size,- child: Stack(- clipBehavior: Clip.none,- children: [- EngineMark(- engine: agent?.engine,- displayName: agent?.engineDisplayName,- size: size,- ),- // Bottom-right, hanging a little past the mark — the corner a- // messenger puts presence on an avatar.- Positioned(- right: -4,- bottom: -4,- child: StatusDot(- summary: status,- ring: ring,- // ⚠️ **The accent as a mark, not as a fill.** `accent` is the- // fill under white text, and as a 1.6pt ring on the dark ground- // it all but vanished — the one sign on the row that the- // terminal was on its way back went unseen. `accentOnSurface`- // is the palette's accent for a mark on a surface.- spinnerColor: AppPalette.accentOnSurface,- ),- ),- ],- ),- );- }-}--/// The hairline under the header, which carries a sweep while the terminal is-/// on its way back — attaching, resyncing, reconnecting.-///-/// ```-/// [mark◌] agent-3 ⋯-/// autonomous-harness ⑂ main-/// ──────────────━━━━━━━━──────────────────────────────── → left to right-/// ```-///-/// ⚠️ **The spinner on the mark cannot carry a wait on its own.** It is 10pt in-/// the corner of a 28pt mark, and a reconnect after the phone comes back from-/// the background runs for seconds: at that size it read as a status rather-/// than as progress, and the page looked stuck. The sweep crosses the whole-/// width, so the wait is seen wherever the eye is.-///-/// ⚠️ **Painted, not laid out.** The rule takes one pixel of layout whatever it-/// draws — [TerminalHeader.height] counts it as one — and the two-pixel glint-/// hangs half a pixel over each side of it. A taller rule would move everything-/// under the header each time a reconnect began and ended.-///-/// Still, not blank, when it cannot animate: with animations turned off the-/// whole rule is drawn in the glint's colour, so the state still shows. A page-/// parked beside the one on screen needs nothing — its ticker is muted, and the-/// glint picks up where it stopped when the page comes back.-class TerminalHeaderRule extends StatefulWidget {- const TerminalHeaderRule({super.key, required this.busy});-- /// The terminal is on its way back: attaching, resyncing or reconnecting.- final bool busy;-- @override- State<TerminalHeaderRule> createState() => _TerminalHeaderRuleState();-}--class _TerminalHeaderRuleState extends State<TerminalHeaderRule>- with SingleTickerProviderStateMixin {- /// One pass, left edge to right edge: quick enough to read as work going on,- /// slow enough not to flicker at the edge of the eye.- static const _period = Duration(milliseconds: 1150);-- late final AnimationController _sweep = AnimationController(- vsync: this,- duration: _period,- );-- /// Eased in and out on every pass, so the glint gathers at the left, crosses,- /// and trails off at the right rather than scrolling past at one speed.- late final Animation<double> _travel = CurvedAnimation(- parent: _sweep,- curve: Curves.fastOutSlowIn,- );-- /// False when the person has turned animations off.- bool _canAnimate = true;-- @override- void didChangeDependencies() {- super.didChangeDependencies();- _canAnimate = !MediaQuery.disableAnimationsOf(context);- _sync();- }-- @override- void didUpdateWidget(TerminalHeaderRule oldWidget) {- super.didUpdateWidget(oldWidget);- if (oldWidget.busy != widget.busy) _sync();- }-- /// Runs the sweep exactly while there is a wait to show and it may move.- void _sync() {- final run = widget.busy && _canAnimate;- if (run == _sweep.isAnimating) return;- if (run) {- _sweep.repeat();- } else {- _sweep.stop();- }- }-- @override- void dispose() {- _sweep.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return Stack(- clipBehavior: Clip.none,- children: [- Divider(height: 1, color: AppGlass.hair),- if (widget.busy)- Positioned(- left: 0,- right: 0,- top: -0.5,- height: 2,- // ⚠️ A boundary of its own: the glint repaints every frame, and- // without one each frame would repaint the header with it — the- // row, the names, the mark — for a two-pixel line.- child: RepaintBoundary(- child: CustomPaint(- painter: _GlintPainter(- travel: _travel,- color: AppPalette.accentOnSurface,- still: !_canAnimate,- ),- ),- ),- ),- ],- );- }-}--/// Paints [TerminalHeaderRule]'s glint: a short band of [color] that fades out-/// at both ends, carried across the rule by [travel].-class _GlintPainter extends CustomPainter {- _GlintPainter({- required this.travel,- required this.color,- required this.still,- }) : super(repaint: travel);-- /// 0 with the glint wholly off the left edge, 1 with it wholly off the right.- final Animation<double> travel;-- final Color color;-- /// Animations are off: the whole rule in [color], not a glint frozen- /// somewhere along it.- final bool still;-- /// The glint's length, as a fraction of the rule.- static const _length = 0.34;-- @override- void paint(Canvas canvas, Size size) {- final full = Offset.zero & size;- if (still) {- canvas.drawRect(full, Paint()..color = color.withValues(alpha: 0.5));- return;- }- final length = size.width * _length;- // Enters from past the left edge and leaves past the right, so each pass- // arrives and goes rather than appearing at one edge and vanishing at the- // other.- final left = -length + (size.width + length) * travel.value;- final glint = Rect.fromLTWH(left, 0, length, size.height);- canvas.save();- canvas.clipRect(full);- canvas.drawRect(- glint,- Paint()- ..shader = LinearGradient(- colors: [- color.withValues(alpha: 0),- color,- color.withValues(alpha: 0),- ],- ).createShader(glint),- );- canvas.restore();- }-- @override- bool shouldRepaint(_GlintPainter old) =>- old.color != color ||- old.still != still ||- !identical(old.travel, travel);-}--/// The two lines: *agent*, then *machine · folder ⑂ branch*.-///-/// ⚠️ **The desktop's pane header, word for word.** The name is-/// [Agent.displayName], then the machine it runs on — which the desktop leaves-/// out only for its own computer, and a phone is never that — the folder-/// [AgentProject.label], the repository rather than a worktree's made-up folder,-/// and the branch [AgentProject.shownBranch]. See [TerminalPlaceLine] for how-/// the three share the width.-class _Identity extends StatelessWidget {- const _Identity({- required this.agent,- required this.machineName,- this.opensFind = false,- });-- final Agent? agent;- final String? machineName;-- /// Whether a tap here opens Find — the name then wears a `⌄`.- final bool opensFind;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final agent = this.agent;- // The name alone, and the machine after it only in the faint face — one line. The folder and- // branch are in the ⋮ sheet.- final machineName = this.machineName;- return Row(- children: [- Flexible(- child: Text(- agent?.displayName ?? 'Harness',- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: AppPalette.textPrimary,- fontSize: 15,- fontWeight: FontWeight.w600,- height: 1.2,- ),- ),- ),- if (opensFind)- Padding(- padding: const EdgeInsets.only(left: 3),- child: Icon(- LucideIcons.chevronDown,- size: 15,- color: AppPalette.textSecondary,- ),- ),- if (machineName != null && machineName.isNotEmpty) ...[- const SizedBox(width: 8),- Flexible(- flex: 0,- child: Text(- machineName,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: _placeStyle,- ),- ),- ],- ],- );- }-- TextStyle get _placeStyle => TextStyle(- color: AppPalette.textSecondary,- fontSize: 12.5,- fontWeight: FontWeight.w500,- height: 1.2,- );-}--/// Where an agent runs, as the `⋯` sheet shows it under the agent's name, each-/// part behind its icon: the machine on a line of its own, then the folder with-/// its parent — `~/…/autonomous-harness/mobile` — and the branch side by side,-/// the pair the header draws together too.-///-/// The header has room for the folder's own name alone; the sheet is where the-/// rest of the path is read. The pair wraps rather than cutting either short: a-/// path or branch too long to share the line moves the branch to one of its own.-class AgentPlaceLines extends StatelessWidget {- const AgentPlaceLines({- super.key,- required this.machineName,- required this.project,- });-- /// Empty leaves the line out.- final String machineName;-- final AgentProject? project;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final project = this.project;- final branch = project?.branchLabel;- return Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- if (machineName.isNotEmpty)- _line(_part(LucideIcons.laptopMinimal300, machineName)),- if (project != null)- _line(- Wrap(- spacing: 14,- runSpacing: 2,- children: [- _part(LucideIcons.folder300, projectPathTrail(project.cwd)),- if (branch != null) _part(LucideIcons.gitBranch300, branch),- ],- ),- ),- ],- );- }-- Widget _line(Widget child) =>- Padding(padding: const EdgeInsets.only(top: 2), child: child);-- /// One part behind its icon, only as wide as its text — so the branch can sit- /// beside the folder — and wrapping to a second line, then cut with `…`, only- /// when it is longer than the line itself.- Widget _part(IconData icon, String text) => Row(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- // Nudged down to sit on the text's first line rather than its top.- Padding(- padding: const EdgeInsets.only(top: 2),- child: Icon(icon, size: 13, color: AppPalette.textFaint),- ),- const SizedBox(width: 6),- Flexible(- child: Text(- text,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: TextStyle(color: AppPalette.textSecondary, fontSize: 13),- ),- ),- ],- );-}--/// A folder with its parent, everything above them folded into `…` —-/// `~/…/autonomous-harness/mobile`.-///-/// Home is written `~` the way a shell prompt writes it; a path short enough to-/// need no fold is kept whole (`~/notes`, `/srv/app`).-String projectPathTrail(String cwd) {- const kept = 2;- final path = cwd.replaceAll('\\', '/');- final parts = path.split('/').where((part) => part.isNotEmpty).toList();- if (parts.isEmpty) return path.isEmpty ? '~' : '/';-- // `/Users/<name>/…` on a Mac, `/home/<name>/…` on Linux, `/root` for root.- var homeDepth = 0;- if (path.startsWith('/') && parts.length >= 2) {- if (parts[0] == 'Users' || parts[0] == 'home') homeDepth = 2;- }- if (path.startsWith('/') && parts[0] == 'root') homeDepth = 1;- if (path.startsWith('~')) homeDepth = 1;-- final String lead;- final List<String> below;- if (homeDepth > 0) {- lead = '~';- below = parts.sublist(math.min(homeDepth, parts.length));- } else {- // A Windows drive keeps its letter, anything else its root.- final drive = RegExp(r'^[A-Za-z]:$').hasMatch(parts.first);- lead = drive ? parts.first : '';- below = drive ? parts.sublist(1) : parts;- }- if (below.isEmpty) return lead.isEmpty ? '/' : lead;- final tail = below.length <= kept- ? below- : ['…', ...below.sublist(below.length - kept)];- return '$lead/${tail.join('/')}';-}diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dartindex 623c3f9e3..4ae5467c0 100644--- a/mobile/lib/phone/terminal_page.dart+++ b/mobile/lib/phone/terminal_page.dart@@ -42,7 +42,6 @@ import 'phone_status.dart';import 'settings_page.dart';import 'terminal_action_column.dart';import 'terminal_chrome_scroll.dart';-import 'terminal_header.dart';import 'terminal_input_dock.dart';import 'terminal_search.dart';import 'tty.dart';@@ -200,15 +199,6 @@ typedef _PageFacts = ({String? machineName,});-/// What a page has asked for back — see [_TerminalPageState._reclaiming].-enum _Reclaim {- /// The keyboard, off another app that holds the terminal or is driving it.- control,-- /// A dead stream, reopened.- reconnect,-}-class _TerminalPageState extends State<TerminalPage>with WidgetsBindingObserver, TickerProviderStateMixin {/// Whether this page's pane ever existed.@@ -451,39 +441,6 @@ class _TerminalPageState extends State<TerminalPage>/// compares the next tick against._PageFacts? _facts;- /// What THIS page has asked for back and not yet heard about: the keyboard off another app, or a- /// dead stream reopened. Null while it has asked for nothing.- ///- /// A take holds the banner up through the `opening` that answers it, so the banner can say so —- /// rather than blinking out and back as the status moves. A reconnect raises no banner: the- /// header draws it as the wait it is, the way it draws Attaching — see [phoneSessionSummary]'s- /// `reconnecting`.- ///- /// ⚠️ **Two kinds, because they read differently.** Both are the same call, and this used to be- /// one flag: pressing Reconnect raised a banner saying "Taking control…" over a stream nobody- /// else held.- ///- /// Taken back by [_onNotifier] once that open lands, and by [_takeControl] itself for a request- /// the notifier declined without ever changing a status.- _Reclaim? _reclaiming;-- /// The header's status as of its last build, for the mark on the actions sheet.- ///- /// The sheet is a route of its own, so this page's `setState` never reaches it: the mark there- /// listens to this instead, and shows the dot the header is showing for as long as the sheet is- /// up — a reconnect that starts under it included — rather than the moment it opened.- ///- /// ⚠️ Moved AFTER the frame, never during the build that works it out: the sheet listening to it- /// would otherwise be marked dirty in the middle of this page's build. See- /// [_publishActionsStatus].- final ValueNotifier<PhoneSummary> _actionsStatus = ValueNotifier((- label: '',- tone: PhoneTone.quiet,- ));-- /// The status the end of this frame hands to [_actionsStatus]; null while none is waiting.- PhoneSummary? _nextActionsStatus;-/// The skeleton's one identity across the two places the body draws it.////// ⚠️ **Two places, one skeleton.** It stands in for the panel while there is no session, and@@ -718,19 +675,7 @@ class _TerminalPageState extends State<TerminalPage>_acceptedInput = accepts;if (accepts) _raiseForQuestion();}- // ⚠️ Checked BEFORE the equality bail below, not after. A take that ends where it began —- // `takenOver` again, because the other app answered first — moves no fact this page reads, so- // the bail would keep the band saying "Taking control…" over a page that had already been- // told no. See [_takeControl].- final settled =- _reclaiming != null &&- facts.status != TerminalSessionStatus.opening &&- facts.status != null;- if (settled) _reclaiming = null;- if (facts == _facts) {- if (settled) setState(() {});- return;- }+ if (facts == _facts) return;setState(() => _facts = facts);}@@ -786,30 +731,10 @@ class _TerminalPageState extends State<TerminalPage>_searchHoldTimer?.cancel();_chrome.dispose();_searchOpen.dispose();- // A sheet still open over a page that is going keeps the last dot it was given; its listener- // comes off when it closes, which a disposed notifier allows.- _actionsStatus.dispose();WidgetsBinding.instance.removeObserver(this);super.dispose();}- /// Hands [status] to the actions sheet's mark once this frame is done — see [_actionsStatus].- ///- /// The last build of a frame is the one handed over, and nothing is scheduled while the status- /// stands still.- void _publishActionsStatus(PhoneSummary status) {- final waiting = _nextActionsStatus != null;- if (!waiting && status == _actionsStatus.value) return;- _nextActionsStatus = status;- if (waiting) return;- WidgetsBinding.instance.addPostFrameCallback((_) {- final next = _nextActionsStatus;- _nextActionsStatus = null;- if (!mounted || next == null) return;- _actionsStatus.value = next;- });- }-/// Harnesses other than this one that are asking something — the title's `api-fix asking`,/// or `2 asking` when there are several. Null when none are.String? _askingElsewhere() {@@ -1680,15 +1605,6 @@ class _TerminalPageState extends State<TerminalPage>machine.agentLoadStatus == AgentLoadStatus.loaded;// Captured while the agent is still listed, for the sentence above.if (agent != null) _cachedAgentName = agent.displayName;- // A dead stream already on its way back: its machine is redialling, or this page has just- // asked for it. The header draws that as the wait it is — spinner on the mark, sweep along the- // rule — rather than as Disconnected beside a button. See [phoneSessionSummary].- //- // Never for an agent that is gone: nothing will reopen its stream, however the socket is doing.- final reconnecting =- !agentGone &&- (_reclaiming == _Reclaim.reconnect ||- (machine != null && phoneMachineRedialling(machine)));// Read-only either way — the terminal was never this pane's (a watcher) or was taken from it.// `_AgentGone` owns the page when the agent itself is missing, so this stays out of its way.final blocked =@@ -1706,18 +1622,6 @@ class _TerminalPageState extends State<TerminalPage>final keyHints = agentGone || blocked || !(session?.acceptsInput ?? false)? const <KeyHint>[]: _questionWatcher?.hints ?? const <KeyHint>[];- final takerName = phoneTakerName(- session,- (id) => widget.notifier.stateOf(id)?.machine.displayName,- );- final headerStatus = phoneSessionSummary(- session,- takerName: takerName,- reconnecting: reconnecting,- );- // The actions sheet draws the same dot beside the agent's name, and is not rebuilt by this- // page — see [_actionsStatus].- _publishActionsStatus(headerStatus);// Read this page's own buffer for a dialog, and raise the keyboard when one// appears. Must run on every build: the session arrives a frame or two// after the page, and the engine with the agent.@@ -2109,7 +2013,6 @@ class _TerminalPageState extends State<TerminalPage>machineName:machine?.machine.displayName ?? '',agent: agent,- status: headerStatus,);},),@@ -2198,8 +2101,6 @@ class _TerminalPageState extends State<TerminalPage>child: TerminalActionColumn(voice: widget.voice,session: session,- onSearch: _openSearch,- unread: widget.notifier.agentNotices.unread,working: _agentWorking,),),@@ -2337,14 +2238,7 @@ class _TerminalPageState extends State<TerminalPage>});}- void _showActions({- required String machineName,- required Agent agent,- required PhoneSummary status,- }) {- // Set here, where no build is running, so the sheet opens on the dot the header shows now- // rather than on whatever the last frame handed over. See [_actionsStatus].- _actionsStatus.value = status;+ void _showActions({required String machineName, required Agent agent}) {final agentName = agent.displayName;showPhoneSheet(context,@@ -2354,28 +2248,6 @@ class _TerminalPageState extends State<TerminalPage>if (agent.project?.label case final folder?) ':$folder',].join(),titleBranch: agent.project?.shownBranch,- // The agent, then where it runs — the machine, then the folder with its parent beside the- // branch — each behind its icon. The header has no room for the path.- titleParts: [agentName],- // The engine mark carrying the header's own dot: the sheet's anchor, and the same picture of- // this agent the header draws above it. The ring is the sheet's ground, which the dot is- // notched out of.- titleLeading: ValueListenableBuilder<PhoneSummary>(- valueListenable: _actionsStatus,- builder: (context, status, _) {- AppTheme.watch(context);- return BadgedEngineMark(- agent: agent,- status: status,- ring: AppPalette.panelBg,- size: 40,- );- },- ),- titleDetail: AgentPlaceLines(- machineName: machineName,- project: agent.project,- ),// Three cards: what acts on THIS agent, the screens the app itself has, and — alone at the// end — the one act that cannot be undone. No caption over the first: the name above it// already says which harness its rows act on, which is also why they no longer repeat@@ -2533,39 +2405,14 @@ class _TerminalPageState extends State<TerminalPage>),);- /// Asks for the terminal this pane is only watching, or reopens the stream it lost — the band's- /// button, and the header's.- ///- /// Which of the two it is comes from the stream as it stands, not from the button: somebody else- /// holding or driving it makes this a take, and a dead one a reconnect. [_reclaiming] carries- /// that through the `opening` this starts, so a take reads as one action answering rather than- /// a band that vanished and came back, and a reconnect reads as the header's wait from the- /// moment it is pressed. `selectAgent` declines quietly when the pane cannot be attached at all- /// (its machine went offline meanwhile, the agent was withdrawn), and that leaves the status- /// where it was — so the flag is taken back here too, rather than left armed over a page- /// nothing is going to answer for.- Future<void> _takeControl() async {- final notifier = widget.notifier;- final before = notifier- .paneOfAgent(widget.machineId, widget.agentId)- ?.session;- final kind =- before != null &&- (before.watching ||- before.status == TerminalSessionStatus.takenOver)- ? _Reclaim.control- : _Reclaim.reconnect;- if (_reclaiming != kind) setState(() => _reclaiming = kind);- await notifier.selectAgent(widget.machineId, widget.agentId);- if (!mounted) return;- final session = notifier- .paneOfAgent(widget.machineId, widget.agentId)- ?.session;- if (_reclaiming != null &&- session?.status != TerminalSessionStatus.opening) {- setState(() => _reclaiming = null);- }- }+ /// Asks for the terminal this pane is only watching, or reopens the stream it lost — a tap or a+ /// scroll on a terminal held elsewhere.+ ///+ /// `selectAgent` works out which of the two it is from the stream as it stands, and declines+ /// quietly when the pane cannot be attached at all (its machine went offline meanwhile, the+ /// agent was withdrawn).+ Future<void> _takeControl() =>+ widget.notifier.selectAgent(widget.machineId, widget.agentId);/// Restarting is a round trip that can fail, and the phone has no status rail to fail into — so/// the answer lands as a snackbar, which is the one surface a pushed page here always has.@@ -3215,51 +3062,6 @@ class _SkeletonTurn {final double? meta;}-/// The longest agent name the header will print before it cuts.-///-/// An agent's name is usually a filename, and the header row has to hold three-/// controls beside it. Left to the width alone, a long name pushed right up-/// against `+` with no gap; cutting by COUNT keeps a fixed, predictable stretch-/// of chrome whatever the name and whatever the screen.-const int _titleMaxChars = 20;--/// The name as the header prints it: cut to [_titleMaxChars] with an ellipsis-/// when it is longer.-///-/// ⚠️ Counts runes, not code units. `String.length` counts UTF-16 units, so an-/// emoji or a decomposed Vietnamese vowel costs two and a name cuts early —-/// short of the 20 the design asks for, and at a different point per name.-///-/// ⚠️ The header's own width ellipsis stays as well. This one bounds the-/// string; that one still catches a 20-character name on a narrow screen, and-/// neither makes the other redundant.-///-/// ⚠️ **Nothing calls it** — [TerminalHeader] ellipses the name on width alone,-/// beside the machine. Kept because a count cut may be wanted there again, and-/// this is the rune-correct one it would want.-// ignore: unused_element-String _clipTitle(String name) {- final runes = name.runes.toList();- if (runes.length <= _titleMaxChars) return name;- // Trailing space before the ellipsis reads as a typo, so it goes.- return '${String.fromCharCodes(runes.take(_titleMaxChars)).trimRight()}…';-}--/// One of the header's trailing controls, padded so the three sit evenly.-///-/// ⚠️ The padding is what makes the row look right, and the reason is that-/// [AppIconButton] is a fixed 24px box for every glyph size. A 22px glyph fills-/// that box to its edges while a 20px one floats inside it, so equal gaps-/// BETWEEN the boxes read as unequal gaps between the marks. Giving every-/// action the same glyph size and the same padding puts the marks on an even-/// pitch.-///-/// ⚠️ It does NOT widen the tap target. [AppIconButton] takes its tap on a-/// 24px `GestureDetector` with no `HitTestBehavior.opaque`, so the padding is-/// dead space either side and the three stay 24px each — under the 44 iOS asks-/// for. Fixing that belongs in the shared button, where every screen's header-/// would get it, not in a wrapper one page defines.-/// tmux's copy-mode position — `[42/1380]` on tmux's yellow, top right — while the reader is up in/// the history: 42 lines above the end, of 1380. The view holds still as output arrives, and the/// first number counts it. One tap is back at the end, following the stream.diff --git a/mobile/lib/phone/terminal_place_line.dart b/mobile/lib/phone/terminal_place_line.dartdeleted file mode 100644index b5ac29fdd..000000000--- a/mobile/lib/phone/terminal_place_line.dart+++ /dev/null@@ -1,134 +0,0 @@-import 'dart:math' as math;--import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import 'package:harness_mobile/shared/theme/app_theme.dart';--/// The header's second line: *machine · folder ⑂ branch*, the desktop pane-/// header's order (`PromptContextView`), each behind its mark.-///-/// Each name is laid out at the width it asks for, and only the overflow is-/// shared out — see [placeWidths].-///-/// ⚠️ **A `flex` here would ellipsis a name with the room to spare beside it.**-/// `Flexible`s split the line in their own fixed ratio whatever they hold, so a-/// short folder hands its slack back to the empty end of the row rather than to-/// the branch, and `worktree-command-box` is cut next to a gap.-class TerminalPlaceLine extends StatelessWidget {- const TerminalPlaceLine({- super.key,- required this.machine,- required this.folder,- required this.branch,- required this.style,- });-- /// Null or empty leaves that part, and its mark, out.- final String? machine, folder, branch;-- final TextStyle style;-- static const double _markSize = 12;- static const double _gapAfterMark = 3;- static const double _gapBetween = 8;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final places = [- if (machine case final text? when text.isNotEmpty)- (icon: LucideIcons.monitor300, text: text, givesWay: 1),- if (folder case final text? when text.isNotEmpty)- (icon: LucideIcons.folder300, text: text, givesWay: 2),- if (branch case final text? when text.isNotEmpty)- (icon: LucideIcons.gitBranch300, text: text, givesWay: 0),- ];- if (places.isEmpty) return const SizedBox.shrink();- return LayoutBuilder(- builder: (context, constraints) {- final line = constraints.maxWidth;- // The marks and the gaps are spent before any name gets a say.- final free = math.max(- 0.0,- line -- places.length * (_markSize + _gapAfterMark) -- (places.length - 1) * _gapBetween,- );- final widths = placeWidths(- wanted: [- for (final place in places) _measure(context, place.text, line),- ],- givesWay: [for (final place in places) place.givesWay],- free: free,- );- return Row(- children: [- for (final (i, place) in places.indexed) ...[- if (i > 0) const SizedBox(width: _gapBetween),- Icon(place.icon, size: _markSize, color: AppPalette.textFaint),- const SizedBox(width: _gapAfterMark),- SizedBox(- width: widths[i],- child: Text(- place.text,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: style,- ),- ),- ],- ],- );- },- );- }-- /// How wide [text] wants to be on one line, capped at [limit] so a very long- /// name does not measure out to something the arithmetic cannot use.- double _measure(BuildContext context, String text, double limit) {- final painter = TextPainter(- text: TextSpan(text: text, style: style),- maxLines: 1,- textDirection: Directionality.of(context),- textScaler: MediaQuery.textScalerOf(context),- )..layout();- final width = painter.width;- painter.dispose();- return math.min(width, limit);- }-}--/// What a name is never cut below while another can still give, so it keeps-/// enough characters to be told from its neighbours rather than becoming `…`.-const double kPlaceFloor = 54;--/// The widths [wanted] get on a line with [free] room: whole where they fit,-/// and otherwise cut in [givesWay] order — lowest first — each down to-/// [kPlaceFloor] before the next is touched, and below the floors only once-/// every name is at its own.-///-/// ⚠️ **The branch gives way first, then the machine; the folder is the one-/// kept whole.** The folder is what tells two of an owner's agents apart; the-/// machine is one of a handful, recognisable from its first letters, and a-/// branch is read to its end least often of all.-List<double> placeWidths({- required List<double> wanted,- required List<int> givesWay,- required double free,-}) {- final widths = [...wanted];- var over = wanted.fold(0.0, (sum, width) => sum + width) - free;- final order = [for (var i = 0; i < wanted.length; i++) i]- ..sort((a, b) => givesWay[a].compareTo(givesWay[b]));- for (final floor in [kPlaceFloor, 0.0]) {- for (final i in order) {- if (over <= 0) return widths;- final give = math.min(over, widths[i] - math.min(floor, widths[i]));- if (give <= 0) continue;- widths[i] -= give;- over -= give;- }- }- return widths;-}diff --git a/mobile/lib/phone/tty_controls.dart b/mobile/lib/phone/tty_controls.dartindex e9f656e3e..0fcf4ea7f 100644--- a/mobile/lib/phone/tty_controls.dart+++ b/mobile/lib/phone/tty_controls.dart@@ -227,62 +227,6 @@ class TtyBackButton extends StatelessWidget {}}-/// A section's header: small, faint, upper case — `NEEDS YOU`, `RECENT`.-class TtySectionHeader extends StatelessWidget {- const TtySectionHeader(this.text, {super.key, this.color, this.trailing});-- final String text;- final Color? color;- final Widget? trailing;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Padding(- padding: const EdgeInsets.fromLTRB(Tty.origin, 20, Tty.origin, 6),- child: Row(- children: [- Expanded(- child: Text(- text.toUpperCase(),- maxLines: 1,- overflow: TextOverflow.clip,- softWrap: false,- style: tty- .style(- color: color ?? tty.faint,- size: TtySize.meta - 1,- weight: FontWeight.w600,- )- .copyWith(letterSpacing: 0.8),- ),- ),- ?trailing,- ],- ),- );- }-}--/// A 1px rule across the screen, inset like a grouped list's separator.-class TtyRule extends StatelessWidget {- const TtyRule({super.key, this.indent = 16});-- final double indent;-- @override- Widget build(BuildContext context) {- final tty = Tty.of(context);- return Padding(- padding: EdgeInsets.only(left: indent),- child: SizedBox(- height: 1,- child: ColoredBox(color: tty.dim.withValues(alpha: 0.6)),- ),- );- }-}-/// A form row: a faint label, its value, and `›` — tapped to change the value.class TtyFormRow extends StatelessWidget {const TtyFormRow({diff --git a/mobile/lib/phone/voice_mic_button.dart b/mobile/lib/phone/voice_mic_button.dartindex 9c665ffe2..3e714f71e 100644--- a/mobile/lib/phone/voice_mic_button.dart+++ b/mobile/lib/phone/voice_mic_button.dart@@ -34,7 +34,6 @@ class VoiceMicButton extends StatefulWidget {this.onLongPress,this.onHoldStart,this.onHoldFinish,- this.onSlipChanged,this.working = false,this.level,this.onSwipeDown,@@ -70,14 +69,6 @@ class VoiceMicButton extends StatefulWidget {/// first, which throws the take away instead of sending it.final void Function({required bool cancelled})? onHoldFinish;- /// The thumb crossed in or out of the button mid-hold, so the row beside it- /// can say what letting go will now do.- ///- /// The button's own face already turns to a `×`, but the thumb is ON the- /// button and covering most of it — the words to the left are what somebody- /// can actually read at that moment.- final ValueChanged<bool>? onSlipChanged;-/// The space this button asks of its parent's layout.////// ⚠️ **It no longer sets any row's height.** The mic floats over the terminal@@ -98,13 +89,6 @@ class VoiceMicButton extends StatefulWidget {/// prompt beside the mic must reach the terminal, not start a recording.static const double touchExtent = 80;- /// How far the hit area spills past its slot on each side.- ///- /// What anything placed beside or above this button has to clear: the- /// overhang is painted over its neighbour and would swallow the neighbour's- /// presses. See the gap above the mic in `voice_mic_fab.dart`.- static const double touchOverhang = (touchExtent - extent) / 2;-/// How far past [touchExtent] the thumb may stray and still count as "on" the/// button.///@@ -241,22 +225,14 @@ class _VoiceMicButtonState extends State<VoiceMicButton> {void dispose() {if (_holdPointer != null) {final finish = widget.onHoldFinish;- final slipChanged = _slippedOff ? widget.onSlipChanged : null;- scheduleMicrotask(() {- slipChanged?.call(false);- finish?.call(cancelled: true);- });+ scheduleMicrotask(() => finish?.call(cancelled: true));}super.dispose();}- /// ⚠️ Tells the row BEFORE rebuilding itself. The listener sits in an ancestor- /// that rebuilds this button, so calling it inside `setState` would report the- /// change from the middle of a build.void _setSlipped(bool value) {if (value == _slippedOff) return;_slippedOff = value;- widget.onSlipChanged?.call(value);if (mounted) setState(() {});}diff --git a/mobile/lib/phone/voice_mic_fab.dart b/mobile/lib/phone/voice_mic_fab.dartindex 52ebc909e..e043d8f80 100644--- a/mobile/lib/phone/voice_mic_fab.dart+++ b/mobile/lib/phone/voice_mic_fab.dart@@ -12,8 +12,7 @@ import 'voice_mic_button.dart';import 'voice_mic_face.dart';import 'voice_mic_mode.dart';-/// The mic, floating over the terminal's bottom right corner at the top of-/// [TerminalActionColumn].+/// The mic, floating over the terminal, in [TerminalActionColumn].////// ⚠️ **Floating rather than in a row.** A row under the terminal would take/// its height off the remote shell; floating, the button costs the terminal@@ -31,7 +30,6 @@ class VoiceMicFab extends StatefulWidget {super.key,required this.voice,required this.session,- this.onSlipChanged,this.working = false,});@@ -41,19 +39,6 @@ class VoiceMicFab extends StatefulWidget {/// The agent is working — see [VoiceMicCore.working].final bool working;- /// The thumb crossed in or out of the button mid-hold, in- /// [VoiceMicMode.holdToTalk]. Unused in the tap mode, which has no hold.- final ValueChanged<bool>? onSlipChanged;-- /// What the whole floating cluster asks of the corner it sits in.- ///- /// Bigger than [VoiceMicButton.extent] because the mic's hit area spills past- /// its slot: this is what the page keeps clear of anything else tappable.- static const double extent = VoiceMicButton.touchExtent;-- /// How far the cluster sits from the terminal's right and bottom edges.- static const double inset = 8;-/// How long a landed send wears its tick before the mic is back at rest.static const Duration sentHold = Duration(milliseconds: 900);@@ -153,7 +138,6 @@ class _VoiceMicFabState extends State<VoiceMicFab>: () => unawaited(showVoiceLanguagePicker(context)),onHoldStart: action.onHoldStart,onHoldFinish: action.onHoldFinish,- onSlipChanged: widget.onSlipChanged,working: widget.working,level: voice.level,onSwipeDown: voice.status == VoiceInputStatus.listeningdiff --git a/mobile/test/terminal_header_test.dart b/mobile/test/terminal_header_test.dartdeleted file mode 100644index 264753b3f..000000000--- a/mobile/test/terminal_header_test.dart+++ /dev/null@@ -1,117 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';-import 'package:harness_mobile/core/models.dart';-import 'package:harness_mobile/phone/phone_status.dart';-import 'package:harness_mobile/phone/status_pill.dart';-import 'package:harness_mobile/phone/terminal_header.dart';-import 'package:harness_mobile/phone/terminal_place_line.dart';--/// The terminal's top bar: *agent* over *folder ⑂ branch*, with the-/// connection state as a dot on the engine mark.-void main() {- group('the sheet names the folder with its parent, the rest folded', () {- for (final (cwd, label) in [- (- '/Users/dudu/Bitcoin_builder/Grid/autonomous-harness/mobile',- '~/…/autonomous-harness/mobile',- ),- ('/home/tony/work/harness', '~/work/harness'),- ('/Users/dudu/notes', '~/notes'),- ('/Users/dudu', '~'),- ('/root/a/b/c', '~/…/b/c'),- ('/srv/app', '/srv/app'),- ('/opt/tools/grid', '/…/tools/grid'),- (r'C:\Users\tony\code\harness', 'C:/…/code/harness'),- ('/', '/'),- ]) {- test('$cwd → $label', () => expect(projectPathTrail(cwd), label));- }- });-- Future<void> pumpHeader(WidgetTester tester, Map<String, dynamic> wire) =>- tester.pumpWidget(- MaterialApp(- home: Scaffold(- body: TerminalHeader(- agent: Agent.fromJson({'id': 'a', 'engine': 'claude', ...wire}),- status: (label: 'Live', tone: PhoneTone.good),- machineName: 'MacBookPro2021.local',- ),- ),- ),- );-- testWidgets(- 'one line: the name, then the machine, and the state on the mark',- (tester) async {- await pumpHeader(tester, {- 'name': 'api',- 'project': {- 'name': 'autonomous-harness',- 'cwd': '/srv/autonomous-harness',- 'branch': 'feat/mobile-ios-android',- },- });-- expect(find.text('api'), findsOneWidget);- expect(find.text('MacBookPro2021.local'), findsOneWidget);- // The folder and branch are in the ⋮ sheet: the header floats over the- // terminal, and every line it takes is a line of output.- expect(find.text('autonomous-harness'), findsNothing);- expect(find.text('feat/mobile-ios-android'), findsNothing);- // No word for the state — the dot says it, and its tooltip.- expect(find.text('Live'), findsNothing);- expect(find.byType(StatusDot), findsOneWidget);- expect(find.byTooltip('Live'), findsOneWidget);- },- );-- testWidgets('the name is the session\'s title when it has one', (- tester,- ) async {- await pumpHeader(tester, {- 'name': 'harness-3',- 'title': 'Worktree and branches organization',- 'project': {- 'name': 'autonomous-harness',- 'cwd': '/srv/worktrees/worktree-35ab',- 'root': '/srv/worktrees/worktree-35ab',- 'branch': 'harness/3',- 'branchPending': true,- },- });-- expect(find.text('Worktree and branches organization'), findsOneWidget);- });-- group('the second line shares out only what overruns it', () {- // Machine, folder, branch — the order they are drawn in, and the order each gives way in.- const givesWay = [1, 2, 0];-- test('everything whole where it fits', () {- expect(- placeWidths(wanted: [100, 90, 80], givesWay: givesWay, free: 300),- [100, 90, 80],- );- });-- test('the branch gives way first, then the machine; the folder last', () {- expect(- placeWidths(wanted: [100, 90, 80], givesWay: givesWay, free: 250),- [100, 90, 60],- );- expect(- placeWidths(wanted: [100, 90, 80], givesWay: givesWay, free: 200),- [56, 90, kPlaceFloor],- );- });-- test('below the floors only once every name is down to its own', () {- // Then in the same order: the branch first again.- expect(- placeWidths(wanted: [100, 90, 80], givesWay: givesWay, free: 150),- [kPlaceFloor, kPlaceFloor, 42],- );- });- });-}diff --git a/mobile/test/terminal_page_header_fold_test.dart b/mobile/test/terminal_page_header_fold_test.dartindex a14aac515..3c118cb76 100644--- a/mobile/test/terminal_page_header_fold_test.dart+++ b/mobile/test/terminal_page_header_fold_test.dart@@ -5,7 +5,7 @@ import 'package:harness_mobile/core/config.dart';import 'package:harness_mobile/phone/tty_controls.dart';import 'package:harness_mobile/phone/phone_search_results.dart';import 'package:harness_mobile/phone/terminal_action_column.dart';-import 'package:harness_mobile/phone/terminal_header.dart';+import 'package:harness_mobile/phone/terminal_title.dart';import 'package:harness_mobile/phone/terminal_key_bar.dart';import 'package:harness_mobile/phone/terminal_page.dart';import 'package:harness_mobile/phone/voice_input_controller.dart';@@ -83,6 +83,8 @@ void main() {await tester.pump(const Duration(milliseconds: 100));final before = tester.getSize(find.byType(TerminalView));resizes.clear();+ // The title over the terminal's top rows, where a tap lands on it.+ expect(find.byType(TerminalTitle).hitTestable(), findsOneWidget);// Back into the scrollback, then forward again: the forward push is what// sends the header away.@@ -94,7 +96,7 @@ void main() {await tester.pump(const Duration(milliseconds: 500));// Folded: the header is no longer where a tap would land on it.- expect(find.byType(TerminalHeader).hitTestable(), findsNothing);+ expect(find.byType(TerminalTitle).hitTestable(), findsNothing);expect(tester.getSize(find.byType(TerminalView)), before);// The slide is over; a resize owed to it would be on its way by now.await tester.pump(const Duration(seconds: 1));