Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(mobile): the tabs mark opens a panel of tabs and their agents

Dev jacobe5ba1520ecde
diff --git a/mobile/README.md b/mobile/README.md
index 515431c4f..a322b640d 100644
--- a/mobile/README.md
+++ b/mobile/README.md
@@ -54,12 +54,14 @@ and it is deliberately not the window's:
the tab the phone is in, and one deleted here leaves every tab that held it.
- Which tab is open, and where you were inside it, stay on the device — as they do per window.
-What the person sees of it is one mark beside `⋯` in the terminal's header, which unrolls the tabs
-as a rail under it (`lib/phone/desk_tab_strip.dart`), and a swipe that walks that tab's agents
-rather than the whole account (`lib/phone/desk_groups.dart`). **The terminal keeps the screen**: the
-rail is not drawn until the mark is pressed and goes away again the moment a tab is picked. A rail
-standing there permanently was tried and taken out — it cost a line and a half of somebody's
-session, all day, for a choice made a few times a day.
+What the person sees of it is one mark beside `⋯` in the terminal's header, which brings a panel up
+from the bottom (`lib/phone/desk_tabs_popup.dart`): the tabs as a row of names, and the agents of
+the one picked as cards under it. A name changes the cards and nothing else, so another tab can be
+read into without leaving the terminal you are in; a card is what opens one. The swipe then walks
+that tab's agents rather than the whole account (`lib/phone/desk_groups.dart`).
+
+**The terminal keeps the screen**: a rail of tabs standing across the top was tried and taken out —
+it cost a line and a half of somebody's session, all day, for a choice made a few times a day.
The tabs are re-read every 15s while the app is in the foreground (`PhoneDesk.pollInterval`), and
that is not belt-and-braces here: `desk_changed` reaches a phone only over a machine's relay socket,
diff --git a/mobile/RELEASE.md b/mobile/RELEASE.md
index a821c99c9..aae6316f5 100644
--- a/mobile/RELEASE.md
+++ b/mobile/RELEASE.md
@@ -72,8 +72,9 @@ icon size in thirty seconds instead of in an email twenty minutes later.
| `1.0.0 (21)` | 2026-09-21 | TestFlight. The account's tabs reach the phone: a swipe stays inside the tab you are in, the tabs themselves sit behind a mark beside `⋯`, and an agent started here joins that tab |
| `1.0.0 (22)` | 2026-09-21 | TestFlight. Named **Harness** on the home screen and in the app, with a new icon; the terminal runs to the bottom edge of the screen; only an explicit Take control press claims a terminal from the desktop |
| `1.0.0 (23)` | 2026-09-21 | TestFlight. The tabs mark unrolls the account's tabs as a rail of names under the header — the tab you are in wears a bar under its name — instead of opening a sheet; picking one switches and puts the rail away |
+| `1.0.0 (24)` | 2026-09-21 | TestFlight. The tabs mark brings a panel up from the bottom: the account's tabs as a row of names, and the agents of the one picked as cards beside each other. A name changes the cards alone — another tab can be read into without leaving the terminal you are in — and a card is what opens an agent |
-`pubspec.yaml` is therefore at `1.0.0+24`: the repo always holds the NEXT build number, so a release
+`pubspec.yaml` is therefore at `1.0.0+25`: the repo always holds the NEXT build number, so a release
runs clean without anyone having to remember the last one.
### Why the app is iPhone-only
diff --git a/mobile/lib/phone/agent_home.dart b/mobile/lib/phone/agent_home.dart
index 81c1652d8..56e9881a9 100644
--- a/mobile/lib/phone/agent_home.dart
+++ b/mobile/lib/phone/agent_home.dart
@@ -557,9 +557,8 @@ class _AgentHomeState extends State<AgentHome> {
_pagerGeneration++;
}
// What the phone is in, recorded for the paths that cannot derive it: an
- // agent created here joins this tab (`PhoneDesk.adopt`), and coming back
- // to a tab returns to the agent it was left on.
- widget.notifier.noteDeskTab(group.id, showing: chosen);
+ // agent created here joins this tab (`PhoneDesk.adopt`).
+ widget.notifier.noteDeskTab(group.id);
// A pager already up for this agent is LEFT ALONE — same key, same snapshot, so it keeps the
// page it is on, and [_showing] keeps naming whatever it has been swiped to. A pager is built
// here only when there is none, or when the one there opened on an agent that can no longer be
diff --git a/mobile/lib/phone/desk_tab_strip.dart b/mobile/lib/phone/desk_tab_strip.dart
index 3e8ba2155..84f492a13 100644
--- a/mobile/lib/phone/desk_tab_strip.dart
+++ b/mobile/lib/phone/desk_tab_strip.dart
@@ -2,36 +2,30 @@ import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
-import 'package:harness_mobile/state/app_state.dart';
import 'desk_groups.dart';
-import 'phone_navigation.dart';
-import 'terminal_header.dart';
-/// The account's tabs as a rail of names under the terminal's header — the
-/// browser's own tab strip, one name per tab with a bar under the one you are
-/// in.
+/// The account's tabs as a row of names, with a bar under the one being shown.
///
/// ```
/// Desktop Docker Other
/// ━━━━━━━
/// ```
///
-/// ⚠️ **It is not on screen by default, and that is what pays for it.** The
-/// terminal IS the screen here: every permanent line of chrome above it is a
-/// line of somebody's session that is not being shown, and the tab is chosen a
-/// few times a day. So the mark beside `⋯` opens the rail, the rail closes
-/// again the moment a tab is picked, and the terminal keeps its rows the rest
-/// of the time — see [TerminalPage].
+/// It lives at the top of the tabs popup — see [showDeskTabsPopup] — and picks
+/// which tab's agents the row under it lists. Nothing here opens an agent: the
+/// name changes what is offered, the card below is what is chosen.
///
-/// ⚠️ **A tab with nothing this phone can open is drawn, dimmed and inert.**
-/// Its agents are on a machine that is asleep or wants its password. Dropping
-/// it from the rail would read as a tab somebody deleted — see [DeskGroup].
+/// ⚠️ **A tab with nothing this phone can open is drawn dim, but still picked.**
+/// Its agents are on a machine that is asleep or wants its password. Dropping it
+/// from the row would read as a tab somebody deleted, and refusing the tap would
+/// leave the person tapping a name that never answers — picked, it says what is
+/// wrong in the space below, where there is room for the sentence.
class DeskTabStrip extends StatelessWidget {
const DeskTabStrip({
super.key,
required this.groups,
- required this.activeId,
+ required this.selectedId,
required this.onPick,
});
@@ -39,19 +33,22 @@ class DeskTabStrip extends StatelessWidget {
/// [deskGroups]. Never empty.
final List<DeskGroup> groups;
- /// [DeskGroup.id] of the tab the phone is in — see [activeDeskGroup]. Null is
- /// a real value: it is the leftover group, and it wears the bar like any
- /// other.
- final String? activeId;
+ /// [DeskGroup.id] of the tab whose agents are listed below. Null is a real
+ /// value: it is the leftover group, and it wears the bar like any other.
+ final String? selectedId;
final void Function(DeskGroup group) onPick;
- /// The rail's height, which is what the header's reveal animates open to.
+ /// The row's height, which the popup counts into its own.
///
- /// One 15pt line, the bar under it, and the air either side that keeps the
- /// names off the header above and the output below.
+ /// One 15pt line, the bar under it, and the air that keeps the names off the
+ /// drag handle above and the cards below.
static const double height = 40;
+ /// The popup's own side inset — the measure [showPhoneSheet] gives its rows,
+ /// so the first name starts on the same line as everything else in a sheet.
+ static const double sideInset = 20;
+
/// The gap between two names. Wide enough that two short tabs — `All`, `adu`
/// — read as two, narrow enough that four fit on a phone without scrolling.
static const double _gap = 22;
@@ -66,17 +63,15 @@ class DeskTabStrip extends StatelessWidget {
// which is what turns tab names into `Deskt…`, `Dock…`.
child: ListView.separated(
scrollDirection: Axis.horizontal,
- padding: const EdgeInsets.symmetric(
- horizontal: TerminalHeader.sideInset,
- ),
+ padding: const EdgeInsets.symmetric(horizontal: sideInset),
itemCount: groups.length,
separatorBuilder: (context, index) => const SizedBox(width: _gap),
itemBuilder: (context, index) {
final group = groups[index];
return _DeskTabName(
name: group.name,
- selected: group.id == activeId,
- enabled: !group.isEmpty,
+ selected: group.id == selectedId,
+ reachable: !group.isEmpty,
onTap: () => onPick(group),
);
},
@@ -85,7 +80,7 @@ class DeskTabStrip extends StatelessWidget {
}
}
-/// One name in the rail, with the bar under it while it is the tab you are in.
+/// One name in the row, with the bar under it while it is the tab being shown.
///
/// ⚠️ **The bar is drawn in a [Stack] rather than under the text in a column.**
/// It has to be exactly as wide as the name it belongs to, and a column in a
@@ -96,16 +91,16 @@ class _DeskTabName extends StatelessWidget {
const _DeskTabName({
required this.name,
required this.selected,
- required this.enabled,
+ required this.reachable,
required this.onTap,
});
final String name;
final bool selected;
- /// False for a tab whose agents are all out of reach: drawn dim, and it does
- /// not answer a tap.
- final bool enabled;
+ /// False for a tab whose agents are all out of reach — drawn dim, and still
+ /// pickable. See [DeskTabStrip].
+ final bool reachable;
final VoidCallback onTap;
@@ -115,16 +110,16 @@ class _DeskTabName extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
- final color = switch ((enabled, selected)) {
+ final color = switch ((reachable, selected)) {
(false, _) => AppPalette.textFaint,
(true, true) => AppPalette.textPrimary,
(true, false) => AppPalette.textSecondary,
};
return GestureDetector(
- // Opaque, so the whole height of the rail either side of the name takes
+ // Opaque, so the whole height of the row either side of the name takes
// the tap — a 15pt word is a small thing to hit with a thumb.
behavior: HitTestBehavior.opaque,
- onTap: enabled ? _tapped : null,
+ onTap: _tapped,
child: Center(
child: Stack(
children: [
@@ -137,7 +132,7 @@ class _DeskTabName extends StatelessWidget {
style: TextStyle(
color: color,
fontSize: 15,
- // The tab you are in is a weight heavier as well as darker,
+ // The tab being shown is a weight heavier as well as darker,
// which is what carries it to someone who cannot see the bar
// — the same pairing [PhoneTabBar] uses below.
fontWeight: selected ? FontWeight.w600 : FontWeight.w500,
@@ -153,6 +148,9 @@ class _DeskTabName extends StatelessWidget {
child: Container(
height: _barHeight,
decoration: BoxDecoration(
+ // The bar keeps the primary ink even under a dim name: it
+ // marks where you are, and a tab out of reach is still
+ // where you are while you are reading it.
color: AppPalette.textPrimary,
borderRadius: BorderRadius.circular(_barHeight / 2),
),
@@ -169,27 +167,3 @@ class _DeskTabName extends StatelessWidget {
onTap();
}
}
-
-/// Switch to [group]: the phone is in that tab from here, and the agent it
-/// opens is the one this phone was last on in it — its first, the first time.
-///
-/// ⚠️ The order matters. [AppNotifier.selectDeskTab] is what settles which tab
-/// an agent that sits on TWO of them belongs to (see [activeDeskGroup]); set
-/// after the open, it would be read a frame too late and the rail would bar the
-/// tab that was left.
-void openDeskGroup(
- BuildContext context,
- AppNotifier notifier,
- DeskGroup group,
-) {
- if (group.isEmpty) return;
- notifier.selectDeskTab(group.id);
- final remembered = notifier.deskLastAgentIn(group.id);
- final target = remembered != null && group.holds(remembered)
- ? remembered
- : (
- machineId: group.entries.first.machineId,
- agentId: group.entries.first.agent.id,
- );
- openAgent(context, notifier, target.machineId, target.agentId);
-}
diff --git a/mobile/lib/phone/desk_tabs_popup.dart b/mobile/lib/phone/desk_tabs_popup.dart
new file mode 100644
index 000000000..7d36bf33a
--- /dev/null
+++ b/mobile/lib/phone/desk_tabs_popup.dart
@@ -0,0 +1,251 @@
+import 'package:flutter/material.dart';
+
+import 'package:harness_mobile/core/last_opened_agent.dart' show AgentRef;
+import 'package:harness_mobile/shared/theme/app_theme.dart';
+import 'package:harness_mobile/state/app_state.dart';
+
+import 'agent_context_line.dart';
+import 'agent_index.dart';
+import 'desk_groups.dart';
+import 'desk_tab_strip.dart';
+import 'phone_card.dart';
+import 'phone_navigation.dart';
+import 'terminal_header.dart' show BadgedEngineMark;
+
+/// The account's tabs, and the agents inside the one being read, as a panel up
+/// from the bottom of the terminal.
+///
+/// ```
+/// ────────────────────────────────
+/// Desktop Docker Other
+/// ───────
+/// ┌────────┐┌────────┐┌───────
+/// │ ◆● ││ ◆● ││ ◆●
+/// │ api-3 ││ web ││ cli
+/// │ harness││ site ││ tools
+/// └────────┘└────────┘└───────
+/// ```
+///
+/// ⚠️ **Two moves, not one.** A tab name changes which agents the row below
+/// offers and nothing else; opening happens on a card. That is what lets
+/// somebody look into another tab — see what is running there — without losing
+/// the terminal they are in, which a sheet of tab names could not do.
+///
+/// ⚠️ **From the bottom, because that is where the thumb is.** The mark that
+/// opens it rides the header at the top of the phone, but the list it opens is
+/// a list to reach into, so it comes up from the bottom edge like every other
+/// phone sheet here.
+///
+/// [showing] is the agent on screen: it decides which tab the panel opens on
+/// (see [activeDeskGroup]), and its card is the one wearing the rim.
+Future<void> showDeskTabsPopup(
+ BuildContext context,
+ AppNotifier notifier, {
+ required AgentRef showing,
+}) {
+ final groups = deskGroups(notifier, visibleAgents(agentIndex(notifier)));
+ final active = activeDeskGroup(notifier, groups, showing);
+ return showModalBottomSheet<void>(
+ context: context,
+ useRootNavigator: true,
+ showDragHandle: true,
+ backgroundColor: AppPalette.panelBg,
+ builder: (sheetContext) => _DeskTabsPanel(
+ groups: groups,
+ initialId: active.id,
+ showing: showing,
+ // Close first, then open: the terminal this pushes must not arrive
+ // underneath a panel that is still animating out — the same order every
+ // row in [showPhoneSheet] takes.
+ onOpen: (group, entry) {
+ Navigator.of(sheetContext).pop();
+ openDeskAgent(context, notifier, group, entry);
+ },
+ ),
+ );
+}
+
+/// The panel itself: the tab names, and the cards of whichever tab is picked.
+class _DeskTabsPanel extends StatefulWidget {
+ const _DeskTabsPanel({
+ required this.groups,
+ required this.initialId,
+ required this.showing,
+ required this.onOpen,
+ });
+
+ final List<DeskGroup> groups;
+
+ /// The tab the panel opens on — the one the agent on screen belongs to.
+ final String? initialId;
+
+ final AgentRef showing;
+
+ final void Function(DeskGroup group, AgentEntry entry) onOpen;
+
+ @override
+ State<_DeskTabsPanel> createState() => _DeskTabsPanelState();
+}
+
+class _DeskTabsPanelState extends State<_DeskTabsPanel> {
+ late String? _selectedId = widget.initialId;
+
+ /// The tab being read. Falls back to the first, which is only reachable if
+ /// the desk dropped a tab while the panel was open.
+ DeskGroup get _group =>
+ widget.groups.where((group) => group.id == _selectedId).firstOrNull ??
+ widget.groups.first;
+
+ @override
+ Widget build(BuildContext context) {
+ AppTheme.watch(context);
+ final group = _group;
+ return SafeArea(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ DeskTabStrip(
+ groups: widget.groups,
+ selectedId: group.id,
+ onPick: (picked) => setState(() => _selectedId = picked.id),
+ ),
+ const SizedBox(height: 10),
+ SizedBox(
+ height: _cardHeight,
+ child: group.isEmpty
+ ? const _TabIsEmpty()
+ : ListView.separated(
+ scrollDirection: Axis.horizontal,
+ padding: const EdgeInsets.symmetric(
+ horizontal: DeskTabStrip.sideInset,
+ ),
+ itemCount: group.entries.length,
+ separatorBuilder: (context, index) =>
+ const SizedBox(width: kPhoneCardGap),
+ itemBuilder: (context, index) {
+ final entry = group.entries[index];
+ return SizedBox(
+ width: _cardWidth,
+ child: _AgentCard(
+ entry: entry,
+ showing:
+ entry.machineId == widget.showing.machineId &&
+ entry.agent.id == widget.showing.agentId,
+ onTap: () => widget.onOpen(group, entry),
+ ),
+ );
+ },
+ ),
+ ),
+ const SizedBox(height: 14),
+ ],
+ ),
+ );
+ }
+}
+
+/// A card's box. Three short lines of type, and wide enough that two and a bit
+/// of them show at once — the half card at the edge is what says the row
+/// scrolls, without a scrollbar on a phone that draws none.
+const double _cardHeight = 104;
+const double _cardWidth = 168;
+
+/// One agent in the row: its engine and state, its name, and where it runs.
+class _AgentCard extends StatelessWidget {
+ const _AgentCard({
+ required this.entry,
+ required this.showing,
+ required this.onTap,
+ });
+
+ final AgentEntry entry;
+
+ /// The agent whose terminal is already on screen. It keeps its card — it is
+ /// the one you came from, and the row would read as missing an agent without
+ /// it — and wears the accent rim instead.
+ final bool showing;
+
+ final VoidCallback onTap;
+
+ @override
+ Widget build(BuildContext context) {
+ AppTheme.watch(context);
+ return PhoneCard(
+ height: _cardHeight,
+ onTap: onTap,
+ border: showing
+ ? Border.all(color: AppPalette.accentOnSurface, width: 1.5)
+ : null,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ BadgedEngineMark(
+ agent: entry.agent,
+ status: entry.summary,
+ // The card's own fill, so the dot reads as notched into the mark.
+ ring: AppGlass.rowFill,
+ size: 26,
+ ),
+ const SizedBox(height: 8),
+ Text(
+ entry.agent.name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ color: AppPalette.textPrimary,
+ fontSize: 15,
+ fontWeight: FontWeight.w600,
+ height: 1.2,
+ ),
+ ),
+ const SizedBox(height: 3),
+ AgentContextLine(
+ project: entry.project,
+ machineName: entry.machineName,
+ ),
+ ],
+ ),
+ );
+ }
+}
+
+/// A tab whose agents are all out of reach — the machine they run on is asleep
+/// or wants its password. The tab is still listed and still opens to this,
+/// because a tab missing from the row reads as one somebody deleted.
+class _TabIsEmpty extends StatelessWidget {
+ const _TabIsEmpty();
+
+ @override
+ Widget build(BuildContext context) {
+ AppTheme.watch(context);
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: DeskTabStrip.sideInset),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ 'Nothing here this phone can open — the machine these agents run on '
+ 'is asleep or wants its password.',
+ style: TextStyle(color: AppPalette.textSecondary, fontSize: 13.5),
+ ),
+ ),
+ );
+ }
+}
+
+/// Open [entry] from [group]: the phone is in that tab from here.
+///
+/// ⚠️ The order matters. [AppNotifier.selectDeskTab] is what settles which tab
+/// an agent that sits on TWO of them belongs to (see [activeDeskGroup]); set
+/// after the open, it would be read a frame too late and the panel would come
+/// back barring the tab that was left.
+void openDeskAgent(
+ BuildContext context,
+ AppNotifier notifier,
+ DeskGroup group,
+ AgentEntry entry,
+) {
+ notifier.selectDeskTab(group.id);
+ openAgent(context, notifier, entry.machineId, entry.agent.id);
+}
diff --git a/mobile/lib/phone/terminal_header.dart b/mobile/lib/phone/terminal_header.dart
index 2c516d407..1b4e2283c 100644
--- a/mobile/lib/phone/terminal_header.dart
+++ b/mobile/lib/phone/terminal_header.dart
@@ -82,7 +82,11 @@ class TerminalHeader extends StatelessWidget {
height: rowHeight,
child: Row(
children: [
- _BadgedMark(agent: agent, status: status),
+ BadgedEngineMark(
+ agent: agent,
+ status: status,
+ ring: AppPalette.windowBg,
+ ),
const SizedBox(width: 11),
Expanded(
child: _Identity(agent: agent),
@@ -96,32 +100,46 @@ class TerminalHeader extends StatelessWidget {
}
/// The engine mark with the session's state notched into its corner.
-class _BadgedMark extends StatelessWidget {
- const _BadgedMark({required this.agent, required this.status});
+///
+/// The header draws it beside the agent's name, and the tabs popup on each of
+/// its cards — an agent reads the same wherever it is offered.
+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: TerminalHeader.markSize,
+ dimension: size,
child: Stack(
clipBehavior: Clip.none,
children: [
EngineMark(
engine: agent?.engine,
displayName: agent?.engineDisplayName,
- size: TerminalHeader.markSize,
+ size: size,
),
// Bottom-right, hanging a little past the mark — the corner a
- // messenger puts presence on an avatar. The ring is the header's own
- // colour, so the dot reads as cut into the mark rather than stuck on.
+ // messenger puts presence on an avatar.
Positioned(
right: -4,
bottom: -4,
- child: StatusDot(summary: status, ring: AppPalette.windowBg),
+ child: StatusDot(summary: status, ring: ring),
),
],
),
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index db0d9a665..44c8223af 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -20,12 +20,10 @@ import 'package:harness_mobile/terminal/terminal_session.dart';
import 'package:harness_mobile/widgets/rename_agent_dialog.dart';
import 'package:harness_mobile/widgets/terminal_panel.dart';
-import 'agent_index.dart';
import 'agents_list_page.dart';
import 'agents_page.dart' show openNewAgent;
import 'delete_agent.dart';
-import 'desk_groups.dart';
-import 'desk_tab_strip.dart';
+import 'desk_tabs_popup.dart';
import 'held_height.dart';
import 'machines_tab.dart';
import 'phone_navigation.dart' show phoneRoute;
@@ -170,7 +168,7 @@ typedef _PageFacts = ({
PhoneMachineStatus? machineStatus,
bool imagePaste,
String? machineName,
- String deskTabs,
+ bool deskTabs,
});
class _TerminalPageState extends State<TerminalPage>
@@ -421,13 +419,7 @@ class _TerminalPageState extends State<TerminalPage>
// only when one of these facts moves. Tabs arriving from another computer
// change nothing else about this agent, and the mark that opens them
// would not appear until something unrelated happened to redraw the page.
- //
- // ⚠️ Their NAMES, not just whether there are any: the rail under the
- // header draws the names, so a tab renamed on the desk has to reach a
- // page that is showing it — see [DeskTabStrip].
- deskTabs: [
- for (final tab in notifier.deskTabs) '${tab.id}\u0000${tab.name}',
- ].join('\u0001'),
+ deskTabs: notifier.deskTabs.isNotEmpty,
);
}
@@ -917,11 +909,7 @@ class _TerminalPageState extends State<TerminalPage>
session,
(id) => widget.notifier.stateOf(id)?.machine.displayName,
);
- final takeoverNotice = phoneTakeoverNotice(
- session,
- takerName,
- held: held,
- );
+ final takeoverNotice = phoneTakeoverNotice(session, takerName, held: held);
// Creating needs the machine to list its folders and name its engines,
// so one that is offline or still wants its password cannot host a new
// agent — the same gate the Agents tab puts on its fab.
@@ -1153,12 +1141,14 @@ class _TerminalPageState extends State<TerminalPage>
// older CLI never advertises the binary kind, so the
// upload would go nowhere silently. Null leaves the
// buttons undrawn rather than drawn dead.
- onPickImage: machine?.terminalImagePasteAvailable == true
+ onPickImage:
+ machine?.terminalImagePasteAvailable == true
? () => unawaited(
_sendImage(session, ImageSource.gallery),
)
: null,
- onTakePhoto: machine?.terminalImagePasteAvailable == true
+ onTakePhoto:
+ machine?.terminalImagePasteAvailable == true
? () => unawaited(
_sendImage(session, ImageSource.camera),
)
@@ -1235,23 +1225,30 @@ class _TerminalPageState extends State<TerminalPage>
// only way to another tab now that a swipe stays
// inside the one you are in.
//
- // ⚠️ **It opens the rail below rather than a
- // sheet**, and the rail is not on screen until it
- // does: the terminal is the screen, and chrome
- // above it is somebody's session not being shown.
- // See [DeskTabStrip].
+ // ⚠️ **A mark, not a rail of tabs across the top.**
+ // The terminal is the screen; chrome above it is
+ // somebody's session not being shown, and this is a
+ // choice made a few times a day. What it opens
+ // comes up from the bottom instead, where the thumb
+ // already is — see [showDeskTabsPopup].
//
// Undrawn for an account with no tabs at all: the
- // rail would carry one name over every agent on the
- // account, which is what a swipe already does.
+ // panel would hold one tab over every agent on the
+ // account, which is what a swipe already walks.
if (widget.notifier.deskTabs.isNotEmpty)
_HeaderAction(
icon: LucideIcons.layoutGrid300,
- // One name in both states, open and closed: it
- // is the mark for the tabs, and the rail below
- // is what says which of the two it is in.
tooltip: 'Tabs',
- onPressed: _toggleTabs,
+ onPressed: () => unawaited(
+ showDeskTabsPopup(
+ context,
+ widget.notifier,
+ showing: (
+ machineId: widget.machineId,
+ agentId: widget.agentId,
+ ),
+ ),
+ ),
),
// Null while the agent is not loaded: there is
// nothing to act on yet, and a menu of actions
@@ -1265,18 +1262,14 @@ class _TerminalPageState extends State<TerminalPage>
// the header's own right inset.
last: true,
onPressed: () => _showActions(
- machineName: machine?.machine.displayName ?? '',
+ machineName:
+ machine?.machine.displayName ?? '',
agentName: agent.name,
project: agent.project,
),
),
],
),
- // ⚠️ Above the divider, so the rail is part of the
- // bar rather than a row floating on the output: the
- // hairline stays the line where chrome ends and the
- // terminal begins, wherever the rail is.
- _tabStrip(),
Divider(height: 1, color: AppGlass.hair),
// ⚠️ Inside the header's own slide, not under it: the two are one bar as far
// as a scroll is concerned, and a band left behind while the header left
@@ -1372,60 +1365,6 @@ class _TerminalPageState extends State<TerminalPage>
});
}
- /// Whether the tab rail under the header is open.
- ///
- /// Closed on arrival, and closed again the moment a tab is picked: the rail
- /// is a question asked a few times a day, and the rest of the time its height
- /// belongs to the terminal — see [DeskTabStrip].
- bool _tabsOpen = false;
-
- void _toggleTabs() => setState(() => _tabsOpen = !_tabsOpen);
-
- /// A tab was tapped in the rail.
- ///
- /// [current] is the tab this page is already in, which closes the rail and
- /// does nothing else: opening it would re-attach the terminal already on
- /// screen, and a tap on the tab you are in reads as "yes, this one".
- void _pickDeskGroup(DeskGroup group, {required bool current}) {
- setState(() => _tabsOpen = false);
- if (current) return;
- openDeskGroup(context, widget.notifier, group);
- }
-
- /// The rail, open or closed, as the header's own column draws it.
- ///
- /// ⚠️ **The groups are built only while it is open.** [deskGroups] walks
- /// every agent on the account, and this page is rebuilt on any fact of its
- /// own moving — paying for that on every status tick, to lay out a rail
- /// nobody has asked for, is work for nothing.
- ///
- /// Closed it is a zero-height box rather than nothing at all, so
- /// [AnimatedSize] has a size on both sides of the change to run between.
- Widget _tabStrip() {
- final notifier = widget.notifier;
- Widget child = const SizedBox(width: double.infinity);
- if (_tabsOpen && notifier.deskTabs.isNotEmpty) {
- final groups = deskGroups(notifier, visibleAgents(agentIndex(notifier)));
- final activeId = activeDeskGroup(notifier, groups, (
- machineId: widget.machineId,
- agentId: widget.agentId,
- )).id;
- child = DeskTabStrip(
- groups: groups,
- activeId: activeId,
- onPick: (group) => _pickDeskGroup(group, current: group.id == activeId),
- );
- }
- return AnimatedSize(
- duration: const Duration(milliseconds: 180),
- curve: Curves.easeOutCubic,
- // From under the header: the rail unrolls downward over the terminal
- // rather than growing out of its own middle.
- alignment: Alignment.topCenter,
- child: child,
- );
- }
-
void _showActions({
required String machineName,
required String agentName,
diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dart
index cc70d97a8..5e22fd038 100644
--- a/mobile/lib/state/app_state.dart
+++ b/mobile/lib/state/app_state.dart
@@ -539,17 +539,12 @@ class AppNotifier extends ChangeNotifier {
/// The tab the phone is in, or null for the agents no tab holds.
String? get activeDeskTabId => _desk.activeTabId;
- /// A tab picked by hand, in the strip. The screen answers by opening an agent
- /// of that tab.
+ /// A tab picked by hand, in the tabs panel — set as the agent chosen there
+ /// is opened, so the swipe walks that tab from then on.
void selectDeskTab(String? tabId) => _desk.select(tabId);
- /// The tab the screen has worked out it is showing, and the agent of it on
- /// screen — see [PhoneDesk.note].
- void noteDeskTab(String? tabId, {AgentRef? showing}) =>
- _desk.note(tabId, showing: showing);
-
- /// Where this phone was in [tabId] last time it was in it.
- AgentRef? deskLastAgentIn(String? tabId) => _desk.lastAgentIn(tabId);
+ /// The tab the screen has worked out it is showing — see [PhoneDesk.note].
+ void noteDeskTab(String? tabId) => _desk.note(tabId);
/// Read the desk now, and wait for it — what a sign-in and the app coming
/// back to the foreground both start without waiting.
diff --git a/mobile/lib/state/phone_desk.dart b/mobile/lib/state/phone_desk.dart
index 3212029e9..9644065c9 100644
--- a/mobile/lib/state/phone_desk.dart
+++ b/mobile/lib/state/phone_desk.dart
@@ -90,22 +90,9 @@ class PhoneDesk {
onChanged();
}
- /// The screen worked out which tab it is showing, and which agent of it.
- /// Silent: this is called from a build, and it is a record of what is already
- /// drawn, not a change to draw.
- void note(String? tabId, {AgentRef? showing}) {
- _activeTabId = tabId;
- if (showing != null) _lastAgent[tabId] = showing;
- }
-
- /// The agent this phone last had on screen in [tabId], if it has been in it.
- ///
- /// What makes a tab switch feel like the desktop's: going back to a tab returns
- /// to where you were in it rather than to its first agent. Per device and never
- /// written down — a tab is a place you were, and only this phone was there.
- AgentRef? lastAgentIn(String? tabId) => _lastAgent[tabId];
-
- final Map<String?, AgentRef> _lastAgent = {};
+ /// The screen worked out which tab it is showing. Silent: this is called from
+ /// a build, and it is a record of what is already drawn, not a change to draw.
+ void note(String? tabId) => _activeTabId = tabId;
// ── reading ──────────────────────────────────────────────────────────────
@@ -326,7 +313,6 @@ class PhoneDesk {
pause();
_joining = null;
_activeTabId = null;
- _lastAgent.clear();
_state.reset();
}
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index 5b038fb25..ee9e9d55a 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -2,7 +2,7 @@ name: harness_mobile
description: "Harness viewer for iOS and Android."
publish_to: 'none'
-version: 1.0.0+24
+version: 1.0.0+25
environment:
sdk: ^3.13.0
diff --git a/mobile/test/phone_desk_tabs_test.dart b/mobile/test/phone_desk_tabs_test.dart
index 027cef535..56fd9b2e8 100644
--- a/mobile/test/phone_desk_tabs_test.dart
+++ b/mobile/test/phone_desk_tabs_test.dart
@@ -4,6 +4,7 @@ import 'package:harness_mobile/phone/agent_home.dart';
import 'package:harness_mobile/phone/agent_swipe.dart';
import 'package:harness_mobile/phone/desk_groups.dart';
import 'package:harness_mobile/phone/desk_tab_strip.dart';
+import 'package:harness_mobile/phone/phone_card.dart';
import 'package:harness_mobile/phone/terminal_header.dart';
import 'package:harness_mobile/phone/phone_shell_scope.dart';
import 'package:harness_mobile/state/app_state.dart';
@@ -13,7 +14,7 @@ import 'agent_pager_fixture.dart';
import 'desk_fixture.dart';
/// The home screen inside its tab: a swipe walks the tab the phone is in, and
-/// the mark beside `⋯` is how it gets to another one.
+/// the mark beside `⋯` opens the panel that reaches the others.
///
/// ⚠️ **The pager's `neighbours` is the assertion throughout, because it IS the
/// swipe.** [AgentSwipeHost] pages through exactly that list and nothing else,
@@ -21,7 +22,7 @@ import 'desk_fixture.dart';
/// which is the whole change, and it can be read without flinging anything.
void main() {
/// The home screen as the shell mounts it: an agent picked anywhere else —
- /// the tab rail included — arrives through [AgentHome.openAgent], and the
+ /// the tabs panel included — arrives through [AgentHome.openAgent], and the
/// shell is what carries it there.
Future<AppNotifier> pumpHome(
WidgetTester tester, {
@@ -53,34 +54,49 @@ void main() {
AgentSwipeHost pager(WidgetTester tester) =>
tester.widget<AgentSwipeHost>(find.byType(AgentSwipeHost));
- /// Open the rail from the mark in the header — see [DeskTabStrip].
+ /// Open the tabs panel from the mark in the header — see [showDeskTabsPopup].
///
/// ⚠️ **Timed pumps, never `pumpAndSettle`.** These pages have no terminal
/// behind them (see [deskApp]), so each one draws the "Attaching…" skeleton —
/// which breathes for ever, and `pumpAndSettle` waits for a still frame that
- /// never comes. The wait is the rail's own unroll.
- Future<void> openRail(WidgetTester tester) async {
+ /// never comes. The waits below are the panel's own open and dismiss
+ /// animations.
+ Future<void> openPanel(WidgetTester tester) async {
await tester.tap(find.byTooltip('Tabs'));
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
}
- /// Pick [tab] in the rail already open, which switches and closes at once.
- Future<void> pick(WidgetTester tester, String tab) async {
+ /// Tap a tab's name in the open panel, which changes the cards under it and
+ /// nothing else.
+ Future<void> showTab(WidgetTester tester, String tab) async {
await tester.tap(find.text(tab));
await tester.pump();
- await tester.pump(const Duration(milliseconds: 400));
}
- /// Open the rail and pick [tab] in it.
- Future<void> switchTo(WidgetTester tester, String tab) async {
- await openRail(tester);
- await pick(tester, tab);
+ /// Tap an agent's card, which opens it and takes the panel away.
+ Future<void> openCard(WidgetTester tester, String agent) async {
+ await tester.tap(
+ find.ancestor(of: find.text(agent), matching: find.byType(PhoneCard)),
+ );
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
}
- DeskTabStrip rail(WidgetTester tester) =>
+ DeskTabStrip strip(WidgetTester tester) =>
tester.widget<DeskTabStrip>(find.byType(DeskTabStrip));
+ /// The agents the panel is offering: one name per card.
+ ///
+ /// The name is the card's only plain [Text] — `AgentContextLine` draws the
+ /// line under it as a `Text.rich`, whose `data` is null.
+ List<String> cardsShown(WidgetTester tester) => [
+ for (final text in tester.widgetList<Text>(
+ find.descendant(of: find.byType(PhoneCard), matching: find.byType(Text)),
+ ))
+ if (text.data != null) text.data!,
+ ];
+
List<String> swipesOver(WidgetTester tester) => [
for (final entry in pager(tester).neighbours!.entries) entry.agent.id,
];
@@ -100,7 +116,29 @@ void main() {
expect(swipesOver(tester), ['a', 'b']);
});
- testWidgets('tapping a tab opens its first agent, and swipes inside it', (
+ testWidgets('the panel opens on the tab the agent on screen is in', (
+ tester,
+ ) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ deskTab('t2', 'Docker', ['c']),
+ ],
+ );
+
+ await openPanel(tester);
+
+ expect(strip(tester).selectedId, 't1');
+ expect(cardsShown(tester), ['a', 'b']);
+ expect(strip(tester).groups.map((group) => group.name), [
+ 'Desktop',
+ 'Docker',
+ kUntabbedGroupName,
+ ]);
+ });
+
+ testWidgets('a tab name changes the cards and leaves the terminal alone', (
tester,
) async {
await pumpHome(
@@ -111,9 +149,34 @@ void main() {
],
);
- await switchTo(tester, 'Docker');
+ await openPanel(tester);
+ await showTab(tester, 'Docker');
- expect(pager(tester).agentId, 'c');
+ // The other tab's agents are on offer...
+ expect(strip(tester).selectedId, 't2');
+ expect(cardsShown(tester), ['c', 'd']);
+ // ...and the phone is still in the tab it was in, on the agent it was on.
+ // Looking into another tab is not leaving this one.
+ expect(pager(tester).agentId, 'a');
+ expect(swipesOver(tester), ['a', 'b']);
+ });
+
+ testWidgets('a card opens its agent, and the swipe walks that tab', (
+ tester,
+ ) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ deskTab('t2', 'Docker', ['c', 'd']),
+ ],
+ );
+
+ await openPanel(tester);
+ await showTab(tester, 'Docker');
+ await openCard(tester, 'd');
+
+ expect(pager(tester).agentId, 'd');
expect(swipesOver(tester), ['c', 'd']);
});
@@ -126,36 +189,58 @@ void main() {
],
);
- await switchTo(tester, kUntabbedGroupName);
+ await openPanel(tester);
+ await showTab(tester, kUntabbedGroupName);
+
+ expect(cardsShown(tester), ['c', 'd']);
+
+ await openCard(tester, 'c');
expect(pager(tester).agentId, 'c');
expect(swipesOver(tester), ['c', 'd']);
});
- testWidgets('coming back to a tab returns to the agent it was left on', (
+ testWidgets('the agent on screen keeps its card, and wears the rim', (
tester,
) async {
- final app = await pumpHome(
+ await pumpHome(
tester,
tabs: [
deskTab('t1', 'Desktop', ['a', 'b']),
- deskTab('t2', 'Docker', ['c', 'd']),
+ deskTab('t2', 'Docker', ['c']),
],
);
- await switchTo(tester, 'Docker');
- expect(pager(tester).agentId, 'c');
- // Desktop was left on `b` — what a swipe inside that tab records, and what
- // the home screen writes down on every build it draws (`noteDeskTab`).
- app.noteDeskTab('t1', showing: (machineId: 'm', agentId: 'b'));
+ await openPanel(tester);
- await switchTo(tester, 'Desktop');
+ PhoneCard cardOf(String agent) => tester.widget<PhoneCard>(
+ find.ancestor(of: find.text(agent), matching: find.byType(PhoneCard)),
+ );
+ expect(cardOf('a').border, isNotNull, reason: 'the agent on screen');
+ expect(cardOf('b').border, isNull);
+ });
- expect(pager(tester).agentId, 'b');
+ testWidgets('a tab this phone cannot reach is listed, and says why', (
+ tester,
+ ) async {
+ await pumpHome(
+ tester,
+ tabs: [
+ deskTab('t1', 'Desktop', ['a', 'b']),
+ // A tab of agents no machine here is listing — one asleep, in life.
+ deskTab('t2', 'Away', ['gone']),
+ ],
+ );
+
+ await openPanel(tester);
+ await showTab(tester, 'Away');
+
+ expect(cardsShown(tester), isEmpty);
+ expect(find.textContaining('asleep'), findsOneWidget);
});
testWidgets('an account with no tabs is offered none', (tester) async {
- // Nothing on the desk: the rail would carry one name over every agent on
+ // Nothing on the desk: the panel would hold one tab over every agent on
// the account, which is what a swipe already walks. So no mark at all, and
// the header is the row it has always been.
await pumpHome(tester, tabs: []);
@@ -210,69 +295,4 @@ void main() {
expect(pager(tester).agentId, 'a');
expect(swipesOver(tester), ['a', 'b']);
});
-
- testWidgets('the rail is drawn only while the mark is on', (tester) async {
- await pumpHome(
- tester,
- tabs: [
- deskTab('t1', 'Desktop', ['a', 'b']),
- deskTab('t2', 'Docker', ['c']),
- ],
- );
-
- // The terminal keeps its rows until somebody asks for the tabs.
- expect(find.byType(DeskTabStrip), findsNothing);
-
- await openRail(tester);
- expect(rail(tester).groups.map((group) => group.name), [
- 'Desktop',
- 'Docker',
- kUntabbedGroupName,
- ]);
-
- // The same mark puts it away again.
- await openRail(tester);
- expect(find.byType(DeskTabStrip), findsNothing);
- });
-
- testWidgets('the rail bars the tab the agent on screen is in', (
- tester,
- ) async {
- await pumpHome(
- tester,
- tabs: [
- deskTab('t1', 'Desktop', ['a', 'b']),
- deskTab('t2', 'Docker', ['c']),
- ],
- );
-
- await openRail(tester);
- expect(rail(tester).activeId, 't1');
-
- // The rail is already open, so this is the pick alone — opening it again
- // here would put it away.
- await pick(tester, 'Docker');
- await openRail(tester);
- expect(rail(tester).activeId, 't2');
- });
-
- testWidgets('picking the tab you are in only closes the rail', (
- tester,
- ) async {
- await pumpHome(
- tester,
- tabs: [
- deskTab('t1', 'Desktop', ['a', 'b']),
- deskTab('t2', 'Docker', ['c']),
- ],
- );
-
- await switchTo(tester, 'Desktop');
-
- // Still on `a`, and the rail is away: re-opening the tab already on screen
- // would re-attach the terminal under it for nothing.
- expect(pager(tester).agentId, 'a');
- expect(swipesOver(tester), ['a', 'b']);
- expect(find.byType(DeskTabStrip), findsNothing);
- });
}
diff --git a/mobile/test/phone_desk_test.dart b/mobile/test/phone_desk_test.dart
index f72ac04ae..98aa7cf39 100644
--- a/mobile/test/phone_desk_test.dart
+++ b/mobile/test/phone_desk_test.dart
@@ -271,21 +271,20 @@ void main() {
expect(desk.tabs, hasLength(3));
});
- test(
- 'a tab picked by hand is remembered, with where the phone was in it',
- () async {
- await join();
+ test('a tab picked by hand is remembered', () async {
+ await join();
- desk.select('t2');
- expect(desk.activeTabId, 't2');
- expect(changes, greaterThan(0));
+ desk.select('t2');
+ expect(desk.activeTabId, 't2');
+ expect(changes, greaterThan(0));
- desk.note('t2', showing: (machineId: 'm', agentId: 'c'));
- desk.note('t1', showing: (machineId: 'm', agentId: 'b'));
- expect(desk.lastAgentIn('t2'), (machineId: 'm', agentId: 'c'));
- expect(desk.lastAgentIn('t1'), (machineId: 'm', agentId: 'b'));
- },
- );
+ // And the screen's own reading of which tab it ended up in overwrites it,
+ // without asking for a redraw of what is already drawn.
+ final drawn = changes;
+ desk.note('t1');
+ expect(desk.activeTabId, 't1');
+ expect(changes, drawn);
+ });
test(
'signing out takes the tabs, the tab you were in, and the unsent writes',
@@ -301,7 +300,6 @@ void main() {
expect(desk.enabled, isFalse);
expect(desk.tabs, isEmpty);
expect(desk.activeTabId, isNull);
- expect(desk.lastAgentIn('t1'), isNull);
// The write belonged to the account that left: the next one must not send it.
backend.offline = false;