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
Web UX: a finger's target for every phone control (hit sizes, Take control, Settings, search, New Harness, Super Tab header) (#1740)
Jacob Pham27f827f9c767
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex ff05e1762..cb270e1b0 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -34,6 +34,7 @@ import '../models/models_panel.dart';import '../models/model_search_catalog.dart';import '../widgets/resting_section.dart'show confirmStopInUse, confirmSwitchAnyway;+import '../widgets/finger_target.dart';import '../widgets/session_close_dialog.dart';import '../super_tabs/lead_guard.dart';import '../notify/system_notifications.dart';@@ -3913,6 +3914,7 @@ class _SwarmScreenState extends State<SwarmScreen> {app,machineId,source: 'swarm',+ chrome: widget.chrome,initialFolder: folder,initialProjectFolder: projectFolder,initialPermissionMode: permissionMode,@@ -8227,9 +8229,13 @@ class _SwarmScreenState extends State<SwarmScreen> {),if (_projects.error == null &&app.lastErrorRetryable)- TextButton(- onPressed: app.retryMachines,- child: const Text('Retry'),+ // A phone's Retry is a finger's size.+ fingerTarget(+ enabled: _compact(context),+ TextButton(+ onPressed: app.retryMachines,+ child: const Text('Retry'),+ ),),IconButton(onPressed: _projects.error != null@@ -9365,35 +9371,44 @@ class _SwarmScreenState extends State<SwarmScreen> {);/// A compact host uses a tab switcher instead of the tab list.- Widget _compactTabStrip(WorkspaceChrome chrome, TerminalTheme theme) =>- Builder(- builder: (context) {- final cell = workspaceBarCellSizeOf(context);- return Material(- key: const ValueKey('workspace-tab-bar'),- color: grid.AppPalette.swarmTabBar,- child: SizedBox(- height: math.max(_tabBarHeight, cell.height * 2),- child: Row(- children: [- SizedBox(width: cell.width),- SizedBox(- width: chrome.leadingWidth(context),- child: chrome.leading(context, _workspaceCommands),- ),- Expanded(- child: chrome.compactTabs!(context, _workspaceCommands),- ),- _searchButton(theme),- _notificationsButton(theme),- if (kIsWeb && _slotShown) _daemonTabButton(),- SizedBox(width: cell.width),- ],+ Widget _compactTabStrip(+ WorkspaceChrome chrome,+ TerminalTheme theme,+ ) => Builder(+ builder: (context) {+ final cell = workspaceBarCellSizeOf(context);+ return Material(+ key: const ValueKey('workspace-tab-bar'),+ color: grid.AppPalette.swarmTabBar,+ // A phone's bar: every control a finger's size, its icon as it+ // was, so the bar is at least that tall too.+ child: SizedBox(+ height: math.max(+ kFingerTarget,+ math.max(_tabBarHeight, cell.height * 2),+ ),+ child: Row(+ children: [+ SizedBox(width: cell.width),+ SizedBox(+ width: math.max(chrome.leadingWidth(context), kFingerTarget),+ child: fingerTarget(+ enabled: true,+ chrome.leading(context, _workspaceCommands),+ ),),- ),- );- },+ Expanded(child: chrome.compactTabs!(context, _workspaceCommands)),+ fingerTarget(enabled: true, _searchButton(theme)),+ fingerTarget(enabled: true, _notificationsButton(theme)),+ if (kIsWeb && _slotShown)+ fingerTarget(enabled: true, _daemonTabButton()),+ SizedBox(width: cell.width),+ ],+ ),+ ),);+ },+ );Widget _statusToolIcon(String id,diff --git a/desktop/lib/settings/sections/alerts_card.dart b/desktop/lib/settings/sections/alerts_card.dartindex 4aa20021b..3e87307b9 100644--- a/desktop/lib/settings/sections/alerts_card.dart+++ b/desktop/lib/settings/sections/alerts_card.dart@@ -2,6 +2,7 @@ library;import 'dart:async';+import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import '../../notify/alert_sounds.dart';@@ -9,6 +10,12 @@ import '../../notify/system_notifications.dart';import '../../shared/theme/app_theme.dart' as grid;import '../../shared/widgets/setting_row.dart';+/// A phone's or tablet's browser, where the banner is tapped, not clicked.+/// Desktop runs on neither.+bool get _touch =>+ defaultTargetPlatform == TargetPlatform.iOS ||+ defaultTargetPlatform == TargetPlatform.android;+/// Settings ▸ Notifications: how an agent gets your attention.////// One switch per CHANNEL, because people differ about them — a banner is@@ -46,7 +53,8 @@ class AlertsCard extends StatelessWidget {controlSemanticLabel: 'On-screen alerts',detail:'Show a banner when an agent finishes, or stops to ask you '- 'something. Click it to go to that harness.',+ 'something. ${_touch ? 'Tap' : 'Click'} it to go to that '+ 'harness.',control: Align(alignment: Alignment.centerLeft,child: Switch(diff --git a/desktop/lib/settings/settings_compact.dart b/desktop/lib/settings/settings_compact.dartindex 5c0b111b1..79aaf6454 100644--- a/desktop/lib/settings/settings_compact.dart+++ b/desktop/lib/settings/settings_compact.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';@@ -50,11 +52,49 @@ class SettingsCompactSection extends StatelessWidget {),),),- Expanded(child: child),+ Expanded(child: _FingerButtons(child: child)),],);}+/// A phone's section: its buttons a finger tall, and as wide as they were.+class _FingerButtons extends StatelessWidget {+ const _FingerButtons({required this.child});++ final Widget child;++ static ButtonStyle _tall(ButtonStyle? style) {+ final least = style?.minimumSize?.resolve(const {}) ?? Size.zero;+ return (style ?? const ButtonStyle()).copyWith(+ minimumSize: WidgetStatePropertyAll(+ Size(+ math.max(least.width, kFingerTarget),+ math.max(least.height, kFingerTarget),+ ),+ ),+ );+ }++ @override+ Widget build(BuildContext context) {+ final theme = Theme.of(context);+ return Theme(+ data: theme.copyWith(+ filledButtonTheme: FilledButtonThemeData(+ style: _tall(theme.filledButtonTheme.style),+ ),+ outlinedButtonTheme: OutlinedButtonThemeData(+ style: _tall(theme.outlinedButtonTheme.style),+ ),+ textButtonTheme: TextButtonThemeData(+ style: _tall(theme.textButtonTheme.style),+ ),+ ),+ child: child,+ );+ }+}+/// Settings on a phone: the list of sections, or one open section. The/// browser's (or Android's) Back leaves the section before it leaves Settings,/// as the on-screen way back does.diff --git a/desktop/lib/settings/settings_nav.dart b/desktop/lib/settings/settings_nav.dartindex f1a687bf6..287fc9261 100644--- a/desktop/lib/settings/settings_nav.dart+++ b/desktop/lib/settings/settings_nav.dart@@ -202,11 +202,15 @@ class _SettingsNavState extends State<SettingsNav> {else if (group != visible.first)const SizedBox(height: 8),for (final target in group.sections)- SidebarItem(- icon: target.icon,- label: target.label,- selected: target == widget.section,- onTap: () => widget.onSelect(target),+ // On a phone a row is a finger's height; a mouse keeps 38.+ fingerTarget(+ enabled: widget.compact,+ SidebarItem(+ icon: target.icon,+ label: target.label,+ selected: target == widget.section,+ onTap: () => widget.onSelect(target),+ ),),],],diff --git a/desktop/lib/super_tabs/attachment_chips.dart b/desktop/lib/super_tabs/attachment_chips.dartindex a61ab10f0..4242f4e4a 100644--- a/desktop/lib/super_tabs/attachment_chips.dart+++ b/desktop/lib/super_tabs/attachment_chips.dart@@ -4,6 +4,7 @@ import '../core/open_in_browser.dart';import '../shared/theme/file_type_icon.dart';import '../shared/widgets/app_dialog.dart';import '../widgets/desktop_chrome.dart';+import '../widgets/finger_target.dart';import '../widgets/update_notice.dart' show formatDownloadSize;import 'attachment_upload.dart';import 'attachment_viewer.dart';@@ -70,7 +71,11 @@ class _AttachmentChip extends StatelessWidget {child: Container(constraints: const BoxConstraints(maxWidth: 280),padding: const EdgeInsets.symmetric(horizontal: 10),- height: DesktopChrome.compactControlHeight,+ // A phone's chip is a finger tall.+ height: fingerHeight(+ DesktopChrome.compactControlHeight,+ enabled: workspaceIsCompact(context),+ ),child: Row(mainAxisSize: MainAxisSize.min,children: [diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dartindex d67654749..9632395f5 100644--- a/desktop/lib/super_tabs/message_row.dart+++ b/desktop/lib/super_tabs/message_row.dart@@ -6,6 +6,7 @@ import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_icon_button.dart';import '../widgets/desktop_chrome.dart';import '../widgets/engine_identity.dart';+import '../widgets/finger_target.dart';import 'attachment_chips.dart';import 'identity.dart';import 'message_text.dart';@@ -145,8 +146,14 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {final active = _hovered || _focused;final authorStyle = DesktopChrome.text(medium: true).copyWith(fontWeight: FontWeight.w600);+ // A phone's author is a finger tall, 44 over its 20 px line. The gap+ // above the row gives up the half that would push the name down and the+ // avatar moves down with it, so both stay where they were.+ final phone = workspaceIsCompact(context);+ final finger = phone && !widget.grouped;+ final slack = finger ? 12.0 : 0.0;return Padding(- padding: EdgeInsets.only(top: widget.grouped ? 0 : 12),+ padding: EdgeInsets.only(top: widget.grouped ? 0 : 12 - slack),child: MouseRegion(onEnter: (_) => setState(() => _hovered = true),onExit: (_) => setState(() => _hovered = false),@@ -200,8 +207,9 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {child: Row(crossAxisAlignment: CrossAxisAlignment.start,children: [- SizedBox(+ Container(width: SuperTabMessageRow.avatarSize,+ padding: EdgeInsets.only(top: slack),child: widget.grouped? null: ExcludeSemantics(@@ -236,9 +244,17 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {children: [InkWell(onTap: widget.onOpenAgent,- child: Text(- widget.author,- style: authorStyle,+ child: fingerTarget(+ enabled: finger,+ Align(+ alignment: Alignment.centerLeft,+ widthFactor: 1,+ heightFactor: 1,+ child: Text(+ widget.author,+ style: authorStyle,+ ),+ ),),),if (message.fromAgent)@@ -330,19 +346,26 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {),side: BorderSide(color: DesktopChrome.rim),),+ // A phone's actions are a finger's size each.child: Row(mainAxisSize: MainAxisSize.min,children: [if (widget.onReply != null)+ fingerTarget(+ enabled: phone,+ AppIconButton(+ icon: AppIcons.reply,+ tooltip: 'Reply',+ onPressed: widget.onReply,+ ),+ ),+ fingerTarget(+ enabled: phone,AppIconButton(- icon: AppIcons.reply,- tooltip: 'Reply',- onPressed: widget.onReply,+ icon: AppIcons.copy,+ tooltip: 'Copy message',+ onPressed: _copy,),- AppIconButton(- icon: AppIcons.copy,- tooltip: 'Copy message',- onPressed: _copy,),],),diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dartindex 20ac27783..710b4bf09 100644--- a/desktop/lib/super_tabs/roster.dart+++ b/desktop/lib/super_tabs/roster.dart@@ -11,6 +11,7 @@ import '../terminal/terminal_theme.dart';import '../terminal/terminal_theme_store.dart';import '../widgets/desktop_chrome.dart';import '../widgets/engine_identity.dart';+import '../widgets/finger_target.dart';import '../widgets/harness_activity_mark.dart';import 'agent_details.dart';import 'controller.dart';@@ -400,6 +401,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {final agents = members.where((a) => !state!.isLead(a.id)).toList();final people = state?.people ?? const <SuperTabPerson>[];final shownPeople = _allPeople ? people : people.take(_peopleShown);+ final compact = workspaceIsCompact(context);return [SuperTabSectionHeading('Humans',@@ -410,7 +412,8 @@ class _SuperTabRosterState extends State<SuperTabRoster> {ListTile(key: ValueKey('super-person-${person.id}'),dense: true,- minTileHeight: 36,+ // A phone's row is a finger's height; a mouse keeps 36.+ minTileHeight: fingerHeight(36, enabled: compact),minVerticalPadding: 6,minLeadingWidth: 24,contentPadding: const EdgeInsets.symmetric(horizontal: 16),@@ -453,7 +456,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {if (people.length > _peopleShown)ListTile(dense: true,- minTileHeight: 36,+ minTileHeight: fingerHeight(36, enabled: compact),contentPadding: const EdgeInsets.symmetric(horizontal: 16),title: Text(_allPeoplediff --git a/desktop/lib/super_tabs/route_row.dart b/desktop/lib/super_tabs/route_row.dartindex 4718ad6e8..198c8a69b 100644--- a/desktop/lib/super_tabs/route_row.dart+++ b/desktop/lib/super_tabs/route_row.dart@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_dialog.dart';import '../widgets/desktop_chrome.dart';+import '../widgets/finger_target.dart';import 'controller.dart';import 'dialog_scope.dart';import 'message_row.dart';@@ -86,7 +87,10 @@ class _SuperTabRouteRowState extends State<SuperTabRouteRow> {foregroundColor: Theme.of(context).colorScheme.onSurfaceVariant,backgroundColor: Colors.transparent,side: BorderSide.none,- minimumSize: const Size(0, 28),+ // A phone's action is a finger's size.+ minimumSize: workspaceIsCompact(context)+ ? const Size.square(kFingerTarget)+ : const Size(0, 28),padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),tapTargetSize: MaterialTapTargetSize.shrinkWrap,textStyle: DesktopChrome.metadata(),diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dartindex 406f41eec..129ea94d0 100644--- a/desktop/lib/super_tabs/section_heading.dart+++ b/desktop/lib/super_tabs/section_heading.dart@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';import '../shared/theme/app_icons.dart';import '../shared/widgets/app_icon_button.dart';import '../widgets/desktop_chrome.dart';+import '../widgets/finger_target.dart';/// Keeps resource headings aligned whether their add action is available or not.class SuperTabSectionHeading extends StatelessWidget {@@ -61,6 +62,9 @@ class SuperTabSectionHeading extends StatelessWidget {@overrideWidget build(BuildContext context) {final collapsible = onToggleCollapsed != null;+ // A phone's add action is a finger's size.+ final phone = workspaceIsCompact(context);+ final addWidth = phone ? kFingerTarget : actionWidth;return Padding(padding: EdgeInsets.fromLTRB(collapsible ? _leadingInset : 16,@@ -91,7 +95,7 @@ class SuperTabSectionHeading extends StatelessWidget {? 0.0: (constraints.maxWidth -actions.length * actionWidth -- (onAdd != null ? actionWidth : 0) -+ (onAdd != null ? addWidth : 0) -_trailingGap -titleWidth).clamp(0.0, double.infinity);@@ -152,10 +156,13 @@ class SuperTabSectionHeading extends StatelessWidget {],...actions,if (onAdd != null)- AppIconButton(- icon: AppIcons.plus,- tooltip: addTooltip ?? title,- onPressed: onAdd,+ fingerTarget(+ enabled: phone,+ AppIconButton(+ icon: AppIcons.plus,+ tooltip: addTooltip ?? title,+ onPressed: onAdd,+ ),),],);diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex c6b9ccfc2..8b214d3be 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -8,6 +8,7 @@ import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_icon_button.dart';import '../widgets/desktop_chrome.dart';+import '../widgets/finger_target.dart';import '../widgets/new_harness_attachments.dart';import '../widgets/new_harness_paste.dart';import '../state/app_state.dart';@@ -881,145 +882,222 @@ class _SuperTabViewState extends State<SuperTabView>style: DesktopChrome.text(medium: true),);- Widget _header(SuperTabConversation? group, bool narrow, bool showRoster) =>- Container(- constraints: const BoxConstraints(minHeight: 52),- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),- decoration: BoxDecoration(- border: Border(bottom: BorderSide(color: DesktopChrome.rim)),+ /// On a phone the header's bar holds Chat and ⋮, each a finger's size, and+ /// ⋮ names the rest (terminals, pull requests, people) instead of five bare+ /// icons. Desktop, which sets no [WorkspaceChrome.compactBelow], never.+ bool get _phone => workspaceIsCompact(context);++ /// Whether ⋮ carries the views a wider header draws as icons.+ bool get _menuNamesViews =>+ _phone && !_devicesVisible && !_notificationsVisible;++ /// Opens the group's terminals beside the chat; null when it has none this+ /// reader may open (a read-only viewer's terminal reads are refused).+ VoidCallback? _openTerminals(SuperTabConversation group) =>+ group.agentIds.isNotEmpty && c.canWrite+ ? () {+ setState(() => _showPullRequests = false);+ widget.onOpenGroupTerminals?.call();+ }+ : null;++ void _openPullRequests() {+ widget.onCloseTerminal?.call();+ setState(() => _showPullRequests = true);+ }++ void _toggleRoster() => setState(() => _rosterOpen = !_rosterOpen);++ /// On a phone, the view ⋮ opened in place of the chat, which the bar has no+ /// icon to mark as selected; null while the chat is the view.+ String? get _openViewName => !_menuNamesViews+ ? null+ : _terminalsVisible+ ? 'Group terminals'+ : _showPullRequests+ ? 'Pull requests'+ : null;++ /// The line under the header's title: on a phone the open view, then the+ /// group's review line.+ Widget? _subtitle(SuperTabConversation? group) {+ final line = c.reviewLine(group);+ final review = line == null+ ? null+ : Text(+ line,+ key: const ValueKey('super-review-line'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(),+ );+ final view = _openViewName;+ if (view == null) return review;+ return Row(+ children: [+ Flexible(+ child: Text(+ view,+ key: const ValueKey('super-open-view'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(color: DesktopChrome.foreground),+ ),),- child: Row(- children: [- if (narrow)- AppIconButton(- icon: AppIcons.columns2,- tooltip: 'Conversations',- onPressed: () => setState(() => _sidebarOpen = !_sidebarOpen),- ),- Expanded(- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisSize: MainAxisSize.min,- children: [- // A view saved on this device, until the first read- // replaces it ([SuperTabReading.drawsSaved]).- if (c.showingSaved)- Row(- children: [- Flexible(child: _title(group)),- const SizedBox(width: 8),- // Where the copy is; how long it stays and where- // it is cleared, a hover or a long press away.- Flexible(- child: Tooltip(- message:- 'This browser keeps a copy of the Super '- 'Tabs you open until you sign out. '- 'Settings ▸ Account clears it now.',- child: Text(- 'Saved in this browser · Updating…',- key: const ValueKey('super-updating'),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.metadata(),- ),- ),+ if (review != null) ...[+ Text(' · ', style: DesktopChrome.metadata()),+ Flexible(child: review),+ ],+ ],+ );+ }++ Widget _header(+ SuperTabConversation? group,+ bool narrow,+ bool showRoster,+ ) => Container(+ constraints: const BoxConstraints(minHeight: 52),+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),+ decoration: BoxDecoration(+ border: Border(bottom: BorderSide(color: DesktopChrome.rim)),+ ),+ child: Row(+ children: [+ if (narrow)+ fingerTarget(+ enabled: _phone,+ AppIconButton(+ icon: AppIcons.columns2,+ tooltip: 'Conversations',+ onPressed: () => setState(() => _sidebarOpen = !_sidebarOpen),+ ),+ ),+ Expanded(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ mainAxisSize: MainAxisSize.min,+ children: [+ // A view saved on this device, until the first read+ // replaces it ([SuperTabReading.drawsSaved]).+ if (c.showingSaved)+ Row(+ children: [+ Flexible(child: _title(group)),+ const SizedBox(width: 8),+ // Where the copy is; how long it stays and where+ // it is cleared, a hover or a long press away.+ Flexible(+ child: Tooltip(+ message:+ 'This browser keeps a copy of the Super '+ 'Tabs you open until you sign out. '+ 'Settings ▸ Account clears it now.',+ child: Text(+ 'Saved in this browser · Updating…',+ key: const ValueKey('super-updating'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(),),- ],- )- else- _title(group),- if (!_devicesVisible && !_notificationsVisible)- if (c.reviewLine(group) case final line?)- Text(- line,- key: const ValueKey('super-review-line'),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.metadata(),),- ],- ),- ),+ ),+ ],+ )+ else+ _title(group),+ if (!_devicesVisible && !_notificationsVisible)+ ?_subtitle(group),+ ],),- if (group != null &&- !_devicesVisible &&- !_notificationsVisible) ...[- AppIconButton(- key: const ValueKey('super-chat'),- icon: AppIcons.messageSquare,- size: AppIcons.inlineSize,- tooltip: 'Chat',- selected: !_terminalsVisible && !_showPullRequests,- color: !_terminalsVisible && !_showPullRequests- ? DesktopChrome.foreground- : DesktopChrome.muted,- onPressed: () {- setState(() => _showPullRequests = false);- widget.onCloseTerminal?.call();- _readVisibleTailAfterFrame();- WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted) _focus.requestFocus();- });- },- ),- const SizedBox(width: 4),- AppIconButton(- key: const ValueKey('super-terminals'),- icon: AppIcons.terminal,- size: AppIcons.inlineSize,- tooltip: 'Group terminals (${group.agentIds.length})',- selected: _terminalsVisible,- color: _terminalsVisible- ? DesktopChrome.foreground- : DesktopChrome.muted,- // A read-only viewer's terminal reads are refused.- onPressed: group.agentIds.isNotEmpty && c.canWrite- ? () {- setState(() => _showPullRequests = false);- widget.onOpenGroupTerminals?.call();- }- : null,- ),- const SizedBox(width: 4),- AppIconButton(- key: const ValueKey('super-pull-requests'),- focusNode: _pullRequestsFocus,- icon: AppIcons.gitPullRequest,- size: AppIcons.inlineSize,- tooltip: 'Pull requests',- selected: !_terminalsVisible && _showPullRequests,- color: !_terminalsVisible && _showPullRequests- ? DesktopChrome.foreground- : DesktopChrome.muted,- onPressed: () {- widget.onCloseTerminal?.call();- setState(() => _showPullRequests = true);- },- ),- // Not a workgroup: nothing to rename, archive or detail.- if (group.id != c.snapshot!.leadsConversationId) _options(group),- ],- if (!showRoster)- AppIconButton(- icon: AppIcons.users,- tooltip: 'Members and machines',- selected: _rosterOpen,- onPressed: () => setState(() => _rosterOpen = !_rosterOpen),- ),- ],+ ),),- );+ if (group != null && !_devicesVisible && !_notificationsVisible) ...[+ fingerTarget(+ enabled: _phone,+ AppIconButton(+ key: const ValueKey('super-chat'),+ icon: AppIcons.messageSquare,+ size: AppIcons.inlineSize,+ tooltip: 'Chat',+ selected: !_terminalsVisible && !_showPullRequests,+ color: !_terminalsVisible && !_showPullRequests+ ? DesktopChrome.foreground+ : DesktopChrome.muted,+ onPressed: () {+ setState(() => _showPullRequests = false);+ widget.onCloseTerminal?.call();+ _readVisibleTailAfterFrame();+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) _focus.requestFocus();+ });+ },+ ),+ ),+ if (!_menuNamesViews) ...[+ const SizedBox(width: 4),+ AppIconButton(+ key: const ValueKey('super-terminals'),+ icon: AppIcons.terminal,+ size: AppIcons.inlineSize,+ tooltip: 'Group terminals (${group.agentIds.length})',+ selected: _terminalsVisible,+ color: _terminalsVisible+ ? DesktopChrome.foreground+ : DesktopChrome.muted,+ onPressed: _openTerminals(group),+ ),+ const SizedBox(width: 4),+ AppIconButton(+ key: const ValueKey('super-pull-requests'),+ focusNode: _pullRequestsFocus,+ icon: AppIcons.gitPullRequest,+ size: AppIcons.inlineSize,+ tooltip: 'Pull requests',+ selected: !_terminalsVisible && _showPullRequests,+ color: !_terminalsVisible && _showPullRequests+ ? DesktopChrome.foreground+ : DesktopChrome.muted,+ onPressed: _openPullRequests,+ ),+ ],+ // Not a workgroup: nothing to rename, archive or detail — but+ // on a phone ⋮ still carries the views the bar leaves out.+ if (_menuNamesViews || group.id != c.snapshot!.leadsConversationId)+ fingerTarget(+ enabled: _phone,+ _options(group, views: _menuNamesViews),+ ),+ ],+ if (!showRoster)+ fingerTarget(+ enabled: _phone,+ AppIconButton(+ icon: AppIcons.users,+ tooltip: 'Members and machines',+ selected: _rosterOpen,+ onPressed: _toggleRoster,+ ),+ ),+ ],+ ),+ );- Widget _options(SuperTabConversation group) {+ /// The group's ⋮ menu. With [views] (a phone) it opens on the views the+ /// header has no room for — the group's terminals and its pull requests —+ /// each a finger's height.+ Widget _options(SuperTabConversation group, {bool views = false}) {final project = c.snapshot?.projectFor(group.id);final isProject = c.snapshot?.isProjectLead(group.id) == true;+ final isLeads = group.id == c.snapshot?.leadsConversationId;final editable = c.canWrite && !c.saving && !c.hasPendingAction;Widget item(String label, VoidCallback? action) => MenuItemButton(- style: const ButtonStyle(- minimumSize: WidgetStatePropertyAll(Size(208, 32)),+ style: ButtonStyle(+ minimumSize: WidgetStatePropertyAll(+ Size(208, views ? kFingerTarget : 32),+ ),side: WidgetStatePropertyAll(BorderSide.none),padding: WidgetStatePropertyAll(EdgeInsets.symmetric(horizontal: 12)),alignment: Alignment.centerLeft,@@ -1034,7 +1112,19 @@ class _SuperTabViewState extends State<SuperTabView>padding: WidgetStatePropertyAll(EdgeInsets.all(6)),),menuChildren: [- if (isProject) ...[+ if (views) ...[+ item(+ 'Group terminals (${group.agentIds.length})',+ _openTerminals(group),+ ),+ item('Pull requests', _openPullRequests),+ if (!isLeads) const Divider(height: 9),+ ],+ // The leads' conversation is no workgroup: nothing to rename, archive+ // or detail.+ if (isLeads)+ ...const <Widget>[]+ else if (isProject) ...[if (editable && project?.ownerId == c.accountId)item('Rename project', () => _groupAction('rename', group)),item('Project details', () => _groupAction('details', group)),@@ -1485,11 +1575,14 @@ class _SuperTabViewState extends State<SuperTabView>text: reply.text,),),- AppIconButton(- icon: AppIcons.close,- tooltip: 'Cancel reply',- onPressed: () =>- setState(() => _replies.remove(c.selectedId)),+ fingerTarget(+ enabled: _phone,+ AppIconButton(+ icon: AppIcons.close,+ tooltip: 'Cancel reply',+ onPressed: () =>+ setState(() => _replies.remove(c.selectedId)),+ ),),],),@@ -1760,27 +1853,35 @@ class _SuperTabViewState extends State<SuperTabView>),),),- NewHarnessAttachButton(- attachments: _files,- enabled: writable && !busy,+ fingerTarget(+ enabled: _phone,+ NewHarnessAttachButton(+ attachments: _files,+ enabled: writable && !busy,+ ),),ListenableBuilder(listenable: Listenable.merge([_composer,_files,]),- builder: (context, _) => AppIconButton(- icon: AppIcons.arrowUp,- tooltip: 'Send message',- color: DesktopChrome.accent,- onPressed:- writable &&- !busy &&- !c.hasPendingAction &&- (_composer.text.trim().isNotEmpty ||- !_files.isEmpty)- ? () => unawaited(_send())- : null,+ builder: (context, _) => fingerTarget(+ enabled: _phone,+ AppIconButton(+ icon: AppIcons.arrowUp,+ tooltip: 'Send message',+ color: DesktopChrome.accent,+ onPressed:+ writable &&+ !busy &&+ !c.hasPendingAction &&+ (_composer.text+ .trim()+ .isNotEmpty ||+ !_files.isEmpty)+ ? () => unawaited(_send())+ : null,+ ),),),],diff --git a/desktop/lib/web/footer/web_footer_bar.dart b/desktop/lib/web/footer/web_footer_bar.dartindex 0ef8d6993..68a4affd5 100644--- a/desktop/lib/web/footer/web_footer_bar.dart+++ b/desktop/lib/web/footer/web_footer_bar.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+import 'package:flutter/material.dart';import '../../shared/theme/app_icons.dart';@@ -35,8 +37,12 @@ class WebFooterBar extends StatelessWidget {child: Material(key: const ValueKey('workspace-status-bar'),type: MaterialType.transparency,+ // Each control a finger's size, so the bar is at least that tall.child: SizedBox(- height: workspaceBarControlHeight(context) + kWorkspaceInset,+ height: math.max(+ kFingerTarget,+ workspaceBarControlHeight(context) + kWorkspaceInset,+ ),child: Padding(padding: EdgeInsets.symmetric(horizontal: workspaceBarCellSizeOf(context).width,@@ -47,12 +53,15 @@ class WebFooterBar extends StatelessWidget {child: Align(alignment: Alignment.centerLeft,child: Builder(- builder: (context) => WebDropdownControl(- key: const ValueKey('web-footer-menu-button'),- label: footer.summary,- tooltip: 'Status',- color: foreground,- onPressed: () => _open(context),+ builder: (context) => fingerTarget(+ enabled: true,+ WebDropdownControl(+ key: const ValueKey('web-footer-menu-button'),+ label: footer.summary,+ tooltip: 'Status',+ color: foreground,+ onPressed: () => _open(context),+ ),),),),@@ -60,10 +69,16 @@ class WebFooterBar extends StatelessWidget {// One filled action in the bar: Share when it is on. A phone's// download is the store bar's.if (!browserHasAppStore())- WebDownloadButton(prominent: share == null),+ fingerTarget(+ enabled: true,+ WebDownloadButton(prominent: share == null),+ ),if (share != null) ...[SizedBox(width: workspaceBarCellSizeOf(context).width),- _WebShareIconButton(share: share),+ fingerTarget(+ enabled: true,+ _WebShareIconButton(share: share),+ ),],],),diff --git a/desktop/lib/web/tabs/web_tab_switcher.dart b/desktop/lib/web/tabs/web_tab_switcher.dartindex 42d2bbffd..2b778b50d 100644--- a/desktop/lib/web/tabs/web_tab_switcher.dart+++ b/desktop/lib/web/tabs/web_tab_switcher.dart@@ -11,6 +11,7 @@ import '../../state/workspace_chrome.dart';import '../../state/workspace_status.dart';import '../../terminal/terminal_theme.dart';import '../../terminal/terminal_theme_store.dart';+import '../../widgets/finger_target.dart';import '../../widgets/pane_menu.dart';import '../../widgets/pane_grid.dart' show soloPaneId;import '../shell/web_dropdown_control.dart';@@ -50,8 +51,13 @@ class WebTabSwitcher extends StatelessWidget {].join(' ');return Row(children: [- Flexible(child: _switcher(context, label, enabled, theme)),- _newTabButton(context, enabled, theme),+ Flexible(+ child: fingerTarget(+ enabled: true,+ _switcher(context, label, enabled, theme),+ ),+ ),+ fingerTarget(enabled: true, _newTabButton(context, enabled, theme)),],);}diff --git a/desktop/lib/widgets/desktop_search_panel.dart b/desktop/lib/widgets/desktop_search_panel.dartindex dcc8321da..68a0c97da 100644--- a/desktop/lib/widgets/desktop_search_panel.dart+++ b/desktop/lib/widgets/desktop_search_panel.dart@@ -9,6 +9,7 @@ import '../shortcuts/keymap.dart';import '../state/swarm_navigation.dart';import '../state/swarm_search.dart';import 'desktop_chrome.dart';+import 'finger_target.dart';import 'box_chrome.dart' show ReadlineKeys;import 'swarm_switcher.dart';import 'swarm_search_input.dart';@@ -93,6 +94,8 @@ class DesktopSearchPanel extends StatelessWidget {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);+ // A phone's buttons are a finger's size; a mouse keeps 32.+ final button = workspaceIsCompact(context) ? kFingerTarget : 32.0;return DesktopChrome(child: Align(alignment: Alignment.topCenter,@@ -175,7 +178,7 @@ class DesktopSearchPanel extends StatelessWidget {ValueListenableBuilder<TextEditingValue>(valueListenable: editing,builder: (context, value, _) => value.text.isEmpty- ? const SizedBox(width: 32, height: 32)+ ? SizedBox.square(dimension: button): _toolbarButton(context,key: const ValueKey('search-clear-query'),@@ -378,14 +381,15 @@ class DesktopSearchPanel extends StatelessWidget {}) {final parent = KeymapRegion.of(context);void activate() => onPressed?.call();+ final side = workspaceIsCompact(context) ? kFingerTarget : 32.0;final button = SizedBox.square(- dimension: 32,+ dimension: side,child: IconButton(key: key,tooltip: tooltip,onPressed: onPressed,isSelected: isSelected,- constraints: const BoxConstraints.tightFor(width: 32, height: 32),+ constraints: BoxConstraints.tightFor(width: side, height: side),padding: const EdgeInsets.all(7),visualDensity: VisualDensity.standard,mouseCursor: onPressed == null@@ -568,22 +572,26 @@ class _SearchScopesState extends State<_SearchScopes> {builder: (segmentContext) {final selected = widget.selected == prefix;if (selected) _selectedContext = segmentContext;- return DesktopPill(- key: ValueKey('search-category-$label'),- label: label,- capsule: true,- selected: selected,- highlightFocus: selected && _focused,- foregroundColor: selected- ? DesktopChrome.foreground- : DesktopChrome.muted,- tooltip: prefix.isEmpty- ? 'Search harnesses'- : 'Type $prefix to search ${label.toLowerCase()}',- onPressed: () {- widget.onChanged(prefix);- widget.onRefocus();- },+ // A phone's chip is a finger tall.+ return fingerTarget(+ enabled: workspaceIsCompact(context),+ DesktopPill(+ key: ValueKey('search-category-$label'),+ label: label,+ capsule: true,+ selected: selected,+ highlightFocus: selected && _focused,+ foregroundColor: selected+ ? DesktopChrome.foreground+ : DesktopChrome.muted,+ tooltip: prefix.isEmpty+ ? 'Search harnesses'+ : 'Type $prefix to search ${label.toLowerCase()}',+ onPressed: () {+ widget.onChanged(prefix);+ widget.onRefocus();+ },+ ),);},),diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dartindex 58c74625f..42598cafe 100644--- a/desktop/lib/widgets/new_agent_dialog.dart+++ b/desktop/lib/widgets/new_agent_dialog.dart@@ -1,4 +1,9 @@import 'dart:async';++import 'key_hints.dart';+import 'finger_target.dart';+import '../state/workspace_chrome.dart';+import 'dart:math' as math;import 'package:harness/shared/theme/app_icons.dart';@@ -74,6 +79,10 @@ Future<NewAgentDialogResult?> showNewAgentDialog(/// The harness's first message, sent as it starts — the store's "Try this prompt".String? initialPrompt,++ /// The workspace's chrome, for a caller above its [WorkspaceChromeScope]+ /// (the workspace itself); others' is read from [context].+ WorkspaceChrome? chrome,}) {if (initialDraft != null) {machineId = initialDraft.machineId;@@ -98,6 +107,9 @@ Future<NewAgentDialogResult?> showNewAgentDialog(// This dialog uses a separate route. Carry the live picker bindings with// it; showGeneralDialog does not capture inherited themes for us.final activeKeymap = keymap ?? KeymapTheme.of(context, listen: false);+ // The workspace's chrome too: the web's hidden key hints and its phone+ // width ([WorkspaceChrome.compactBelow]) hold in this route as well.+ chrome ??= WorkspaceChromeScope.maybeOf(context);return showAppDialog<NewAgentDialogResult>(context: context,transitionDuration: Duration.zero,@@ -121,9 +133,15 @@ Future<NewAgentDialogResult?> showNewAgentDialog(offerFindExisting: offerFindExisting,offerBackToSearch: offerBackToSearch,);- return activeKeymap == null+ final scoped = chrome == null? dialog- : KeymapProvider(keymap: activeKeymap, child: dialog);+ : WorkspaceChromeScope(+ chrome: chrome,+ child: KeyHints(visible: chrome.showsKeyHints, child: dialog),+ );+ return activeKeymap == null+ ? scoped+ : KeymapProvider(keymap: activeKeymap, child: scoped);},);}@@ -996,6 +1014,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {minHeight: _tileHeight(MediaQuery.textScalerOf(context),compactHeight: compactHeight,+ finger: _finger,),),],@@ -1065,13 +1084,14 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {: () => Navigator.of(context).pop(),style: TextButton.styleFrom(foregroundColor: grid.AppPalette.textSecondary,- ),+ ).merge(_fingerButton),child: Text(widget.onBack == null ? 'Close' : 'Back'),),if (widget.offerFindExisting &&_confirmationPending &&(!_submitting || _checkingCreation))TextButton.icon(+ style: _fingerButton,onPressed: _submitting? null: () =>@@ -1083,6 +1103,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {if (_creation?.canCancelPending == true)TextButton(key: const ValueKey('cancel-pending-creation'),+ style: _fingerButton,onPressed: _submitting ? null : _cancelPending,child: const Text('Cancel request'),),@@ -1091,7 +1112,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {focusNode: _actionFocus,onPressed: canCreate ? _submit : null,style: FilledButton.styleFrom(- minimumSize: const Size(0, 32),+ minimumSize: Size(0, _finger ? kFingerTarget : 32),maximumSize: const Size(420, double.infinity),padding: const EdgeInsets.symmetric(horizontal: 12,@@ -1181,29 +1202,33 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {mainAxisSize: MainAxisSize.min,children: [controls,- const SizedBox(height: 8),- DefaultTextStyle(- style: boxMonoStyle(),- child: BoxHintStrip(- hints: [- BoxHint(- Theme.of(context).platform == TargetPlatform.macOS- ? 'cmd-enter'- : 'ctrl-enter',- _confirmationPending ? 'check status' : 'create',- onTap: canCreate ? _submit : null,- ),- const BoxHint('tab / shift-tab', 'fields'),- BoxHint(- 'esc',- widget.onBack == null ? 'close' : 'back',- onTap: _submitting- ? null- : () => Navigator.of(context).maybePop(),- ),- ],+ // Keys where the host shows them; the web's buttons say+ // the same with a click (audit S8).+ if (KeyHints.visibleOf(context)) ...[+ const SizedBox(height: 8),+ DefaultTextStyle(+ style: boxMonoStyle(),+ child: BoxHintStrip(+ hints: [+ BoxHint(+ Theme.of(context).platform == TargetPlatform.macOS+ ? 'cmd-enter'+ : 'ctrl-enter',+ _confirmationPending ? 'check status' : 'create',+ onTap: canCreate ? _submit : null,+ ),+ const BoxHint('tab / shift-tab', 'fields'),+ BoxHint(+ 'esc',+ widget.onBack == null ? 'close' : 'back',+ onTap: _submitting+ ? null+ : () => Navigator.of(context).maybePop(),+ ),+ ],+ ),),- ),+ ],],);},@@ -1256,10 +1281,27 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {/// A tile's height, which depends on the text size and the window's height/// but never on its width — so the task field, laid out outside the tiles'/// LayoutBuilder, can be the same height as they are.- static double _tileHeight(TextScaler scaler, {required bool compactHeight}) {- return math.max(32, scaler.scale(grid.AppType.monoSize) * 1.35 + 14);+ static double _tileHeight(+ TextScaler scaler, {+ required bool compactHeight,+ bool finger = false,+ }) {+ return math.max(+ finger ? kFingerTarget : 32,+ scaler.scale(grid.AppType.monoSize) * 1.35 + 14,+ );}+ /// On a phone every control here is a finger's size ([kFingerTarget]).+ bool get _finger => workspaceIsCompact(context);++ /// A text button's style on a phone: a finger's size; null elsewhere.+ ButtonStyle? get _fingerButton => _finger+ ? TextButton.styleFrom(+ minimumSize: const Size(kFingerTarget, kFingerTarget),+ )+ : null;+Widget _choices() => LayoutBuilder(builder: (context, constraints) {final scaler = MediaQuery.textScalerOf(context);@@ -1269,7 +1311,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {// Their shared full width also makes keyboard focus easy to follow.final tileSize = Size(constraints.maxWidth,- _tileHeight(scaler, compactHeight: compactHeight),+ _tileHeight(scaler, compactHeight: compactHeight, finger: _finger),);return Column(mainAxisSize: MainAxisSize.min,@@ -1328,6 +1370,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {onChanged: _chooseHarness,),TextButton(+ style: _fingerButton,onPressed: _choicesLocked? null: () {@@ -1438,6 +1481,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {const SizedBox(width: 12),TextButton(key: const Key('new-agent-retry-check'),+ style: _fingerButton,onPressed: _checkingEngines ? null : _retryEngineCheck,child: Text(_checkingEngines ? 'Checking…' : 'Retry'),),@@ -1667,7 +1711,9 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {style: TextButton.styleFrom(foregroundColor: grid.AppPalette.textSecondary,textStyle: boxMonoStyle(),- minimumSize: const Size(28, 28),+ minimumSize: _finger+ ? const Size(kFingerTarget, kFingerTarget)+ : const Size(28, 28),padding: const EdgeInsets.all(6),),child: Text(_advancedOpen ? '[-] Advanced' : '[+] Advanced'),diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dartindex 1bfafc856..46fd0ae10 100644--- a/desktop/lib/widgets/new_harness_form.dart+++ b/desktop/lib/widgets/new_harness_form.dart@@ -22,6 +22,7 @@ import '../super_tabs/project_visibility.dart';import 'box_chrome.dart' show kTerminalCornerRadius, terminalPaneBorder;import 'dsh_install_panel.dart' show describeInstallFailure;import 'desktop_chrome.dart';+import 'finger_target.dart';import 'new_harness_attachments.dart';import 'new_harness_paste.dart';import 'engine_identity.dart';@@ -1800,105 +1801,114 @@ class NewHarnessFormState extends State<NewHarnessForm> {lastPart ??box.project.repository?.name ??'Choose repo';+ // A phone has room for neither the capsules side by side nor a mouse's+ // target: there each is a line of its own, a finger tall.+ final phone = workspaceIsCompact(context);+ Widget fields(List<Widget> children) => phone+ ? Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ spacing: 8,+ children: children,+ )+ : Wrap(spacing: 8, runSpacing: 8, children: children);return Row(crossAxisAlignment: CrossAxisAlignment.start,children: [Expanded(- child: Wrap(- spacing: 8,- runSpacing: 8,- children: [+ child: fields([+ _desktopField(+ order: 1,+ finger: phone,+ anchor: _desktopAnchors[_Row.agent]!,+ child: _desktopChoiceButton(+ _Row.agent,+ AppIcons.code,+ capsule: true,+ ),+ ),+ // A cloud agent runs in its maker's cloud, never on a computer:+ // the place is said where the computer is, and does not change.+ if (box.isCloud)_desktopField(- order: 1,- anchor: _desktopAnchors[_Row.agent]!,- child: _desktopChoiceButton(- _Row.agent,- AppIcons.code,+ order: 2,+ finger: phone,+ anchor: _headerMachineAnchor,+ child: DesktopPill(+ key: const ValueKey('new-harness-field-machine'),+ focusNode: _headerMachineFocus,+ label: cloudPlaceOf(box.engine),+ semanticLabel: 'Runs in ${cloudPlaceOf(box.engine)}',+ icon: AppIcons.monitor,capsule: true,+ tooltip: '${box.agentLabel} runs on its maker\'s servers',+ textSize: 13,+ surfaceColor: DesktopChrome.surface,+ onPressed: null,),- ),- // A cloud agent runs in its maker's cloud, never on a computer:- // the place is said where the computer is, and does not change.- if (box.isCloud)- _desktopField(- order: 2,- anchor: _headerMachineAnchor,+ )+ else+ _desktopField(+ order: 2,+ finger: phone,+ anchor: _headerMachineAnchor,+ child: _desktopMachineAnchor(child: DesktopPill(key: const ValueKey('new-harness-field-machine'),focusNode: _headerMachineFocus,- label: cloudPlaceOf(box.engine),- semanticLabel: 'Runs in ${cloudPlaceOf(box.engine)}',- icon: AppIcons.monitor,+ label: _repoMachineLabel(box.machineId),+ semanticLabel:+ 'Computer, ${_repoMachineLabel(box.machineId)}',+ icon: box.app.stateOf(box.machineId)?.isLocalMachine == true+ ? AppIcons.laptop+ : AppIcons.monitor,+ menu: true,capsule: true,- tooltip: '${box.agentLabel} runs on its maker\'s servers',+ tooltip: 'Choose computer',textSize: 13,surfaceColor: DesktopChrome.surface,- onPressed: null,- ),- )- else- _desktopField(- order: 2,- anchor: _headerMachineAnchor,- child: _desktopMachineAnchor(- child: DesktopPill(- key: const ValueKey('new-harness-field-machine'),- focusNode: _headerMachineFocus,- label: _repoMachineLabel(box.machineId),- semanticLabel:- 'Computer, ${_repoMachineLabel(box.machineId)}',- icon:- box.app.stateOf(box.machineId)?.isLocalMachine == true- ? AppIcons.laptop- : AppIcons.monitor,- menu: true,- capsule: true,- tooltip: 'Choose computer',- textSize: 13,- surfaceColor: DesktopChrome.surface,- onPressed: box.locked- ? null- : () => _headerMachineMenu.isOpen- ? _headerMachineMenu.close()- : _headerMachineMenu.open(),- ),+ onPressed: box.locked+ ? null+ : () => _headerMachineMenu.isOpen+ ? _headerMachineMenu.close()+ : _headerMachineMenu.open(),),),- // Fo takes no repository; a cloud coding agent works on the chosen- // repository's GitHub copy, never on this computer's folder.- if ((!box.isCloud || cloudAgentTakesRepository(box.engine)) &&- (!box.asGuest ||- box.fields.contains(NewHarnessField.projectMenu)))- _desktopField(- order: 3,- anchor: _desktopAnchors[_Row.project]!,- maxWidth: 340,- child: Tooltip(- message: box.isCloud- ? (box.cloudRepository == null- ? 'Choose a repository on GitHub, or a folder whose remote is on GitHub'- : 'Works on ${box.cloudRepository}. Changes not pushed stay on this computer.')- : '',- child: _desktopChoiceButton(- _Row.project,- AppIcons.folder,- label: box.isCloud- ? box.cloudRepository- ?.replaceFirst(- RegExp(- r'^(https://github\.com/|git@github\.com:)',- ),- '',- )- .replaceFirst(RegExp(r'\.git$'), '') ??- projectName- : projectName,- capsule: true,- ),+ ),+ // Fo takes no repository; a cloud coding agent works on the chosen+ // repository's GitHub copy, never on this computer's folder.+ if ((!box.isCloud || cloudAgentTakesRepository(box.engine)) &&+ (!box.asGuest ||+ box.fields.contains(NewHarnessField.projectMenu)))+ _desktopField(+ order: 3,+ finger: phone,+ anchor: _desktopAnchors[_Row.project]!,+ maxWidth: 340,+ child: Tooltip(+ message: box.isCloud+ ? (box.cloudRepository == null+ ? 'Choose a repository on GitHub, or a folder whose remote is on GitHub'+ : 'Works on ${box.cloudRepository}. Changes not pushed stay on this computer.')+ : '',+ child: _desktopChoiceButton(+ _Row.project,+ AppIcons.folder,+ label: box.isCloud+ ? box.cloudRepository+ ?.replaceFirst(+ RegExp(+ r'^(https://github\.com/|git@github\.com:)',+ ),+ '',+ )+ .replaceFirst(RegExp(r'\.git$'), '') ??+ projectName+ : projectName,+ capsule: true,),),- ],- ),+ ),+ ]),),if (!widget.embedded) ...[const SizedBox(width: 8),@@ -2192,17 +2202,22 @@ class NewHarnessFormState extends State<NewHarnessForm> {},);+ /// One control of the box. With [finger] (a phone) it takes its line's+ /// whole width and a finger's height.Widget _desktopField({required double order,required GlobalKey anchor,required Widget child,double maxWidth = 280,+ bool finger = false,}) => FocusTraversalOrder(order: NumericFocusOrder(order),child: ConstrainedBox(key: anchor,- constraints: BoxConstraints(maxWidth: maxWidth),- child: child,+ constraints: BoxConstraints(+ maxWidth: finger ? double.infinity : maxWidth,+ ),+ child: fingerTarget(enabled: finger, child),),);diff --git a/desktop/lib/widgets/new_harness_help.dart b/desktop/lib/widgets/new_harness_help.dartindex 915aeea77..93ab120bb 100644--- a/desktop/lib/widgets/new_harness_help.dart+++ b/desktop/lib/widgets/new_harness_help.dart@@ -1,4 +1,7 @@import 'package:harness/shared/theme/app_icons.dart';++import 'finger_target.dart';+import 'package:flutter/material.dart';import '../shared/theme/app_theme.dart';@@ -51,7 +54,11 @@ class _HarnessHelpLinkState extends State<HarnessHelpLink> {style:TextButton.styleFrom(foregroundColor: AppPalette.textSecondary,- minimumSize: const Size(0, 32),+ // A phone's link is a finger tall.+ minimumSize: Size(+ 0,+ workspaceIsCompact(context) ? kFingerTarget : 32,+ ),padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),textStyle: widget.textStyle ?? AppType.body(height: 1.4),side: BorderSide.none,diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex fd4e04577..0b17ffa3e 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -1,6 +1,7 @@import 'dart:async';import 'dart:math' as math;+import 'finger_target.dart';import 'swarm_search_field.dart';import 'package:harness/shared/theme/app_icons.dart';@@ -978,6 +979,11 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {scale.scale(13) * 1.4 + scale.scale(12) * 1.4 + 26,);}+ // A phone's row is a finger tall, one line or two: its slot also+ // holds the 2 px either side of a desktop row's fill.+ if (workspaceIsCompact(context)) {+ _rowHeight = math.max(_rowHeight, kFingerTarget + 4);+ }_desktopRows = desktop;_modelHeadingHeight = swarmRows? scale.scale(12) * 1.4 + 26diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex 3476fdd1f..ac9e093c0 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -3927,16 +3927,24 @@ class _ControlBanner extends StatelessWidget {? 'Another app took control of this terminal': '$takerName took control of this terminal';- String? get detail {+ /// What the band says under its title. Without key hints (the web) it+ /// names the gesture: a tap on a phone's or tablet's browser, a click on a+ /// computer's. Audit S8.+ String? detailFor(TargetPlatform platform) {if (notice != null) return notice!.detail;if (busy) return null;+ final touch =+ platform == TargetPlatform.iOS || platform == TargetPlatform.android;+ final press = touch ? 'tap' : 'click';if (nudged) {return keyHints? 'Keys are ignored — press ⏎ to take control.'- : 'Keys are ignored — click here to take control.';+ : 'Keys are ignored — $press here to take control.';}return keyHints? 'Typing is paused. Click here or press ⏎ to take control.'+ : touch+ ? 'Typing is paused. Tap here to take control.': 'Typing is paused. Click here to take control.';}@@ -3948,7 +3956,9 @@ class _ControlBanner extends StatelessWidget {final ink = notice != null && notice!.icon == AppIcons.circleAlert? AppColors.danger: AppColors.warning;- final detail = this.detail;+ final detail = detailFor(defaultTargetPlatform);+ // A phone's band is pressed with a finger: its buttons are that tall.+ final finger = workspaceIsCompact(context);final reduceMotion = MediaQuery.disableAnimationsOf(context);// Composited over the pane's own ground, as [UpdateNotice] is over the// window's: the terminal theme behind this band may be any colour, and a@@ -4051,12 +4061,14 @@ class _ControlBanner extends StatelessWidget {label: notice!.actionLabel!,onPressed: notice!.onAction,showReturnKey: false,+ finger: finger,)): busy? null: _ControlBannerButton(onPressed: onTakeControl,showReturnKey: keyHints,+ finger: finger,);final secondary = notice?.secondaryLabel;final button = secondary == null@@ -4069,9 +4081,11 @@ class _ControlBanner extends StatelessWidget {TextButton(onPressed: notice!.onSecondary,style: TextButton.styleFrom(- minimumSize: const Size(0, 28),+ minimumSize: Size(0, finger ? kFingerTarget : 28),tapTargetSize: MaterialTapTargetSize.shrinkWrap,- visualDensity: VisualDensity.compact,+ visualDensity: finger+ ? VisualDensity.standard+ : VisualDensity.compact,),child: Text(secondary,@@ -4121,10 +4135,14 @@ class _ControlBannerButton extends StatelessWidget {/// ⏎ is drawn only where the key really does this — taking the stream back/// (`_onTerminalKey`). A notice's action has no chord behind it.final bool showReturnKey;++ /// A finger's height ([kFingerTarget]) on a phone; a mouse's elsewhere.+ final bool finger;const _ControlBannerButton({required this.onPressed,this.label = 'Take control',this.showReturnKey = true,+ this.finger = false,});@override@@ -4140,10 +4158,10 @@ class _ControlBannerButton extends StatelessWidget {),foregroundColor: scheme.onSurface,side: BorderSide(color: scheme.onSurface.withValues(alpha: .14)),- minimumSize: const Size(0, 28),+ minimumSize: Size(0, finger ? kFingerTarget : 28),padding: const EdgeInsets.fromLTRB(12, 0, 8, 0),tapTargetSize: MaterialTapTargetSize.shrinkWrap,- visualDensity: VisualDensity.compact,+ visualDensity: finger ? VisualDensity.standard : VisualDensity.compact,),child: Row(mainAxisSize: MainAxisSize.min,diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dartindex d49069a55..fa3aaffc8 100644--- a/desktop/lib/widgets/workspace_welcome.dart+++ b/desktop/lib/widgets/workspace_welcome.dart@@ -12,6 +12,7 @@ import '../state/welcome_sessions.dart';import '../state/workspace_chrome.dart';import '../state/session_activity.dart';import 'engine_identity.dart';+import 'finger_target.dart';import 'new_tab_actions.dart';import 'desktop_chrome.dart';import 'session_activity_label.dart';@@ -386,11 +387,14 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {Positioned(right: 20,bottom: 16,- child: TerminalTextAction(- key: const ValueKey('welcome-customize'),- onPressed: () => onCommand('app.customize'),- label: 'Appearance',- overArtwork: hasArtwork,+ child: fingerTarget(+ enabled: workspaceIsCompact(context),+ TerminalTextAction(+ key: const ValueKey('welcome-customize'),+ onPressed: () => onCommand('app.customize'),+ label: 'Appearance',+ overArtwork: hasArtwork,+ ),),),],@@ -628,6 +632,10 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {);}+ /// A row's least size: a finger's height on a phone, its text's elsewhere.+ Size get _rowMinimum =>+ workspaceIsCompact(context) ? const Size(0, kFingerTarget) : Size.zero;+/// The commands, each with its shortcut: the whole page before there is/// anything to pick up, and the column beside the list after.Widget _commands(@@ -650,7 +658,7 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {foregroundColor: ink,textStyle: style,padding: const EdgeInsets.symmetric(vertical: 2),- minimumSize: Size.zero,+ minimumSize: _rowMinimum,tapTargetSize: MaterialTapTargetSize.shrinkWrap,shape: const RoundedRectangleBorder(),),@@ -681,7 +689,7 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {foregroundColor: ink,textStyle: style,padding: const EdgeInsets.symmetric(vertical: 2),- minimumSize: Size.zero,+ minimumSize: _rowMinimum,tapTargetSize: MaterialTapTargetSize.shrinkWrap,shape: const RoundedRectangleBorder(),),@@ -777,7 +785,7 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {: Colors.transparent,textStyle: style,padding: const EdgeInsets.symmetric(vertical: 2),- minimumSize: Size.zero,+ minimumSize: _rowMinimum,tapTargetSize: MaterialTapTargetSize.shrinkWrap,shape: const RoundedRectangleBorder(),),diff --git a/desktop/test/new_agent_dialog_phone_test.dart b/desktop/test/new_agent_dialog_phone_test.dartnew file mode 100644index 000000000..a6c96c21f--- /dev/null+++ b/desktop/test/new_agent_dialog_phone_test.dart@@ -0,0 +1,148 @@+// The full New Harness dialog (Split pane's) on a phone: every control a+// finger presses is 44x44 at least (audit finding S1), measured as the+// web_ux tap-size check measures it, on the accessibility tree. The dialog+// is its own route, so it carries the workspace's chrome to know it is on a+// phone; a computer's browser keeps the mouse's sizes.++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/state/workspace_chrome.dart';+import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/web/shell/web_chrome.dart';+import 'package:harness/widgets/new_agent_dialog.dart';++import '../tool/web_ux_seed.dart';++import 'support/mixed_agents.dart';+import 'swarm_state_test.dart' show createApp;++Future<void> _open(WidgetTester tester, Size size) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ final app = createApp();+ seedMixedAgents(app);+ addTearDown(app.dispose);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: WorkspaceChromeScope(+ chrome: WorkspaceChrome(+ leadingWidth: (_) => 0,+ leading: (_, _) => const SizedBox.shrink(),+ compactBelow: 720,+ showsKeyHints: false,+ ),+ child: Builder(+ builder: (context) => Scaffold(+ body: TextButton(+ onPressed: () =>+ showNewAgentDialog(context, app, 'm', source: 'test'),+ child: const Text('open'),+ ),+ ),+ ),+ ),+ ),+ );+ await tester.tap(find.text('open'));+ await tester.pumpAndSettle();+}++/// Each pressable node on screen, by its label, with its size on screen.+List<(String, Size)> _pressable(WidgetTester tester) {+ final root = tester+ .binding+ .renderViews+ .first+ .owner!+ .semanticsOwner!+ .rootSemanticsNode!;+ final screen = Offset.zero & tester.view.physicalSize;+ final out = <(String, Size)>[];+ void visit(SemanticsNode node, Matrix4 parent) {+ final transform = node.transform == null+ ? parent+ : (parent.clone()..multiply(node.transform!));+ final rect = MatrixUtils.transformRect(transform, node.rect);+ final data = node.getSemanticsData();+ // A row partly scrolled out of its list is measured by what shows of it;+ // its size is the one it has when scrolled in.+ final clip = node.parentPaintClipRect;+ final clipped =+ clip != null &&+ (node.rect.top <= clip.top + .5 ||+ node.rect.bottom >= clip.bottom - .5);+ if (data.hasAction(SemanticsAction.tap) &&+ !node.isInvisible &&+ !clipped &&+ rect.overlaps(screen)) {+ out.add((data.label.isEmpty ? data.tooltip : data.label, rect.size));+ }+ node.visitChildren((child) {+ visit(child, transform);+ return true;+ });+ }++ visit(root, Matrix4.identity());+ return out;+}++void main() {+ testWidgets('a phone\'s dialog is pressed with a finger', (tester) async {+ await _open(tester, const Size(390, 844));+ final small = [+ for (final (label, size) in _pressable(tester))+ if (label != 'open' && (size.width < 44 || size.height < 44))+ '$label ${size.width.round()}x${size.height.round()}',+ ];+ expect(small, isEmpty);+ });++ testWidgets('a phone\'s dialog names no keys', (tester) async {+ await _open(tester, const Size(390, 844));+ expect(find.textContaining('ctrl-enter', findRichText: true), findsNothing);+ expect(find.textContaining('shift-tab', findRichText: true), findsNothing);+ });++ testWidgets(+ 'Split pane from the web workspace\'s menu opens it phone-sized',+ (tester) async {+ final app = withPanes(signedIn(), 2);+ addTearDown(app.dispose);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(390, 844);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: SwarmScreen(+ notifier: app,+ nativeTabs: false,+ chrome: webWorkspaceChrome(app),+ ),+ ),+ );+ await tester.pump(const Duration(milliseconds: 200));+ await tester.tap(find.byKey(const ValueKey('web-app-menu-button')));+ await tester.pump(const Duration(milliseconds: 300));+ await tester.tap(find.byKey(const ValueKey('web-menu:pane.split_right')));+ await tester.pump(const Duration(milliseconds: 500));++ expect(find.byKey(const Key('create-agent-submit')), findsOneWidget);+ expect(+ find.textContaining('ctrl-enter', findRichText: true),+ findsNothing,+ );+ expect(+ tester.getSize(find.byKey(const Key('create-agent-submit'))).height,+ greaterThanOrEqualTo(44),+ );+ await tester.pumpWidget(const SizedBox.shrink());+ await tester.pump(const Duration(seconds: 1));+ },+ );+}diff --git a/desktop/test/new_harness_phone_test.dart b/desktop/test/new_harness_phone_test.dartnew file mode 100644index 000000000..bae1b15a1--- /dev/null+++ b/desktop/test/new_harness_phone_test.dart@@ -0,0 +1,85 @@+// The New Harness box on a phone (the web below compactBelow): the agent,+// computer and folder are one field a line, each a finger tall. A wider+// window, and Desktop, keep the row of capsules.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/state/new_harness.dart';+import 'package:harness/state/workspace_chrome.dart';+import 'package:harness/widgets/new_harness_form.dart';++import 'support/mixed_agents.dart';+import 'swarm_state_test.dart' show createApp;++const _fields = [+ 'new-harness-field-agent',+ 'new-harness-field-machine',+ 'new-harness-field-project',+];++Future<void> _mount(WidgetTester tester, Size size) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ final app = createApp();+ seedMixedAgents(app);+ final box = NewHarnessController(+ app,+ machineId: 'm',+ folder: '/work/harness-app-landing-page',+ );+ addTearDown(app.dispose);+ addTearDown(box.dispose);+ await tester.pumpWidget(+ MaterialApp(+ theme: ThemeData.dark(),+ home: WorkspaceChromeScope(+ chrome: WorkspaceChrome(+ leadingWidth: (_) => 0,+ leading: (_, _) => const SizedBox.shrink(),+ compactBelow: 720,+ ),+ child: Scaffold(+ body: NewHarnessForm(+ controller: box,+ desktop: true,+ onClose: () {},+ onCreated: () {},+ ),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+}++List<Rect> _rects(WidgetTester tester) => [+ for (final key in _fields) tester.getRect(find.byKey(ValueKey(key))),+];++void main() {+ testWidgets('a phone puts each field on its own line, a finger tall', (+ tester,+ ) async {+ await _mount(tester, const Size(390, 844));+ final rects = _rects(tester);+ for (final (i, rect) in rects.indexed) {+ final size = tester.getSize(find.byKey(ValueKey(_fields[i])));+ expect(size.height, greaterThanOrEqualTo(44), reason: _fields[i]);+ if (i > 0) {+ expect(rect.top, greaterThanOrEqualTo(rects[i - 1].bottom));+ expect(rect.left, rects[0].left, reason: _fields[i]);+ }+ }+ expect(tester.takeException(), isNull);+ });++ testWidgets('a wide window keeps the fields in one row', (tester) async {+ await _mount(tester, const Size(1280, 800));+ final rects = _rects(tester);+ expect(rects[1].top, rects[0].top);+ for (final rect in rects) {+ expect(rect.height, lessThan(44));+ }+ });+}diff --git a/desktop/test/settings_compact_test.dart b/desktop/test/settings_compact_test.dartindex 646073001..65c349461 100644--- a/desktop/test/settings_compact_test.dart+++ b/desktop/test/settings_compact_test.dart@@ -8,6 +8,7 @@ import 'package:harness/auth/auth_session.dart';import 'package:harness/core/config.dart';import 'package:harness/settings/settings_screen.dart';import 'package:harness/settings/settings_section.dart';+import 'package:harness/shared/layouts/widgets/sidebar_item.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';@@ -24,6 +25,7 @@ void main() {WidgetTester tester,Size size, {SettingsSection? initialSection,+ bool desktop = false,}) async {final notifier = AppNotifier(config: AppConfig.dev,@@ -43,13 +45,21 @@ void main() {builder: (context) => Scaffold(body: TextButton(key: settingsButton,- onPressed: () => showSettingsScreen(- context,- notifier,- initialSection: initialSection,- source: 'test',- compactBelow: 720,- ),+ // Desktop passes no compactBelow.+ onPressed: () => desktop+ ? showSettingsScreen(+ context,+ notifier,+ initialSection: initialSection,+ source: 'test',+ )+ : showSettingsScreen(+ context,+ notifier,+ initialSection: initialSection,+ source: 'test',+ compactBelow: 720,+ ),child: const Text('Settings'),),),@@ -119,6 +129,67 @@ void main() {expect(find.byType(SettingsScreen), findsNothing);});+ /// The rail's rows for the sections, without Back and the search field.+ Iterable<double> rowHeights(WidgetTester tester) => [+ for (final section in [+ SettingsSection.notifications,+ SettingsSection.connectors,+ ])+ tester+ .getSize(+ find.ancestor(+ of: find.text(section.label),+ matching: find.byType(SidebarItem),+ ),+ )+ .height,+ ];++ testWidgets('a phone\'s rows are a finger tall', (tester) async {+ await mount(tester, const Size(390, 844));+ for (final height in rowHeights(tester)) {+ expect(height, greaterThanOrEqualTo(44));+ }+ });++ // Desktop sets no compactBelow: a narrow window is no phone.+ testWidgets('Desktop at 600 keeps the mouse-sized rows', (tester) async {+ await mount(tester, const Size(600, 800), desktop: true);+ for (final height in rowHeights(tester)) {+ expect(height, 38);+ }+ });++ final signOut = find.byKey(const Key('settings-sign-out-button'));++ testWidgets('a phone\'s section buttons are a finger tall', (tester) async {+ await mount(+ tester,+ const Size(390, 844),+ initialSection: SettingsSection.account,+ );+ expect(tester.getSize(signOut).height, greaterThanOrEqualTo(44));+ });++ testWidgets('Desktop at 600 keeps the mouse-sized section buttons', (+ tester,+ ) async {+ await mount(+ tester,+ const Size(600, 800),+ initialSection: SettingsSection.account,+ desktop: true,+ );+ expect(tester.getSize(signOut).height, 32);+ });++ testWidgets('a wide window keeps the mouse-sized rows', (tester) async {+ await mount(tester, const Size(1280, 800));+ for (final height in rowHeights(tester)) {+ expect(height, 38);+ }+ });+testWidgets('a wide window keeps the list beside the section', (tester,) async {diff --git a/desktop/test/super_tab_phone_header_test.dart b/desktop/test/super_tab_phone_header_test.dartnew file mode 100644index 000000000..d3212069c--- /dev/null+++ b/desktop/test/super_tab_phone_header_test.dart@@ -0,0 +1,129 @@+// The Super Tab's header on a phone (the web below compactBelow): Chat, the+// people and machines and the ⋮ menu stay in the bar, a finger's size each,+// and the menu names what the bar drew as bare icons — the group's terminals+// and its pull requests — while the header says which of them is open. A+// wider window keeps the icons.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/widgets/app_icon_button.dart';+import 'package:harness/super_tabs/roster.dart';++import 'support/super_tab_phone.dart';++final _options = find.byKey(const ValueKey('super-group-options'));+final _people = find.byTooltip('Members and machines');+final _openView = find.byKey(const ValueKey('super-open-view'));++void main() {+ testWidgets('a phone keeps Chat and the menu in the bar, a finger each', (+ tester,+ ) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ );+ expect(find.byKey(const ValueKey('super-terminals')), findsNothing);+ expect(find.byKey(const ValueKey('super-pull-requests')), findsNothing);+ for (final control in [+ find.byTooltip('Conversations'),+ find.byKey(const ValueKey('super-chat')),+ _people,+ _options,+ ]) {+ expect(control, findsOneWidget);+ final size = tester.getSize(control);+ expect(size.width, greaterThanOrEqualTo(44));+ expect(size.height, greaterThanOrEqualTo(44));+ }+ expect(tester.takeException(), isNull);+ await unmountPhoneSuperTab(tester, controller);+ });++ testWidgets('the phone menu names terminals and pull requests', (+ tester,+ ) async {+ var terminals = 0;+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ onOpenGroupTerminals: () => terminals++,+ );+ Future<void> choose(String label) async {+ await tester.tap(_options);+ await tester.pumpAndSettle();+ final row = find.widgetWithText(MenuItemButton, label);+ expect(tester.getSize(row).height, greaterThanOrEqualTo(44));+ await tester.tap(row);+ await tester.pumpAndSettle();+ }++ await choose('Group terminals (1)');+ expect(terminals, 1);++ await choose('Pull requests');+ // Chat is no longer the view: the pull requests are.+ expect(+ tester+ .widget<AppIconButton>(find.byKey(const ValueKey('super-chat')))+ .selected,+ isFalse,+ );+ expect(tester.takeException(), isNull);+ await unmountPhoneSuperTab(tester, controller);+ });++ testWidgets('a wide window keeps the icons in the header', (tester) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(1280, 800),+ );+ expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);+ expect(find.byKey(const ValueKey('super-pull-requests')), findsOneWidget);+ await tester.tap(_options);+ await tester.pumpAndSettle();+ expect(find.text('Pull requests'), findsNothing);+ expect(find.text('Members and machines'), findsNothing);+ await unmountPhoneSuperTab(tester, controller);+ });++ testWidgets('a phone opens the people and machines in one tap', (+ tester,+ ) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ );+ await tester.tap(_people);+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsOneWidget);+ final row = find.byKey(const ValueKey('super-person-owner'));+ expect(tester.getSize(row).height, greaterThanOrEqualTo(44));+ final invite = tester.getSize(find.byTooltip('Invite people'));+ expect(invite.width, greaterThanOrEqualTo(44));+ expect(invite.height, greaterThanOrEqualTo(44));+ await tester.tapAt(const Offset(40, 400));+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabRoster), findsNothing);+ await unmountPhoneSuperTab(tester, controller);+ });++ testWidgets('a phone header says which view is open', (tester) async {+ final (_, chat) = await mountPhoneSuperTab(tester, const Size(390, 844));+ expect(_openView, findsNothing, reason: 'the chat is the default view');+ await tester.tap(_options);+ await tester.pumpAndSettle();+ await tester.tap(find.widgetWithText(MenuItemButton, 'Pull requests'));+ await tester.pumpAndSettle();+ expect(tester.widget<Text>(_openView).data, 'Pull requests');+ await unmountPhoneSuperTab(tester, chat);++ final (_, terminals) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ terminalsVisible: true,+ );+ expect(tester.widget<Text>(_openView).data, 'Group terminals');+ await unmountPhoneSuperTab(tester, terminals);+ });+}diff --git a/desktop/test/super_tab_phone_targets_test.dart b/desktop/test/super_tab_phone_targets_test.dartnew file mode 100644index 000000000..6cba3941b--- /dev/null+++ b/desktop/test/super_tab_phone_targets_test.dart@@ -0,0 +1,177 @@+// The Super Tab's conversation on a phone (the web below compactBelow): every+// control a finger presses in it — a message's author, Reply and Copy, its+// files, a routing note's Details, the composer's Attach and Send and a+// reply's Cancel — is 44x44 at least. Desktop, which sets no compactBelow,+// keeps the mouse's sizes at any width.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/super_tabs/identity.dart';+import 'package:harness/super_tabs/message_row.dart';++import 'support/super_tab_fixture.dart';+import 'support/super_tab_phone.dart';++const _agent = {'kind': 'agent', 'id': 'builder', 'name': 'Builder'};++/// An agent's message with a file, and its routing note.+void _agentMessages(ConversationServer server) {+ (server.state['agents'] as List).add({+ 'id': 'builder',+ 'name': 'Builder',+ 'displayName': 'Lark',+ 'machineId': 'm',+ 'harnessId': 'native-builder',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude'},+ });+ server.append(+ 'The header is done.',+ attachments: [+ {+ 'id': 'a1',+ 'name': 'fixture-375.png',+ 'mime': 'image/png',+ 'size': 2048,+ 'url': 'https://cdn.harness.autonomous.ai/a1/fixture-375.png',+ },+ ],+ );+ server.messages.last['author'] = _agent;+ server.append('Routed to Lark');+ server.messages.last+ ..['author'] = _agent+ ..['source'] = {+ 'kind': 'route',+ 'decisionId': 'd1',+ 'via': 'order',+ 'p': null,+ 'belowFloor': false,+ 'why': 'phone hit sizes',+ 'pick': {'id': 'c0', 'title': 'Lark · Claude opus high · Test Mac'},+ 'alternatives': const <Object>[],+ };+}++/// The conversation's controls, by what they are called.+Map<String, Finder> _controls() => {+ 'Reply': find.byTooltip('Reply'),+ 'Copy message': find.byTooltip('Copy message'),+ 'Attach files': find.byTooltip('Attach files'),+ 'Send message': find.byTooltip('Send message'),+ 'author': find.descendant(+ of: find.byType(SuperTabMessageRow),+ matching: find.widgetWithText(InkWell, 'Lark'),+ ),+ 'file': find.byKey(const ValueKey('super-attachment:a1')),+ 'Details': find.widgetWithText(TextButton, 'Details'),+};++/// The size of every control [finder] finds.+Iterable<Size> _sizes(WidgetTester tester, Finder finder, String label) {+ expect(finder, findsWidgets, reason: label);+ return [+ for (var i = 0; i < finder.evaluate().length; i++)+ tester.getSize(finder.at(i)),+ ];+}++Future<void> _openReply(WidgetTester tester) async {+ await tester.tap(find.byTooltip('Reply').first, warnIfMissed: false);+ await tester.pumpAndSettle();+}++void main() {+ testWidgets('a phone\'s conversation controls are a finger each', (+ tester,+ ) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ seed: _agentMessages,+ );+ final controls = {+ ..._controls(),+ 'Cancel reply': find.byTooltip('Cancel reply'),+ };+ await _openReply(tester);+ for (final MapEntry(key: label, value: control) in controls.entries) {+ for (final size in _sizes(tester, control, label)) {+ expect(size.width, greaterThanOrEqualTo(44), reason: label);+ expect(size.height, greaterThanOrEqualTo(44), reason: label);+ }+ }+ expect(tester.takeException(), isNull);+ await unmountPhoneSuperTab(tester, controller);+ });++ testWidgets('a phone\'s taller author keeps the name and avatar in place', (+ tester,+ ) async {+ Future<(double, double)> tops({required bool desktop}) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(390, 844),+ desktop: desktop,+ seed: _agentMessages,+ );+ final row = find.ancestor(+ of: find.text('The header is done.'),+ matching: find.byType(SuperTabMessageRow),+ );+ // From the row's own top: the rows above it are taller on a phone.+ double top(Finder f) =>+ tester.getTopLeft(find.descendant(of: row, matching: f)).dy -+ tester.getTopLeft(row).dy;+ final result = (top(find.text('Lark')), top(find.byType(SuperTabAvatar)));+ await unmountPhoneSuperTab(tester, controller);+ return result;+ }++ expect(await tops(desktop: false), await tops(desktop: true));+ });++ // Desktop sets no compactBelow: a narrow window is no phone.+ testWidgets('Desktop at 600 keeps the bar, the controls and the rows', (+ tester,+ ) async {+ final (_, controller) = await mountPhoneSuperTab(+ tester,+ const Size(600, 800),+ desktop: true,+ seed: _agentMessages,+ );+ expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);+ expect(find.byKey(const ValueKey('super-pull-requests')), findsOneWidget);+ const mouse = {+ 'Reply': Size(32, 32),+ 'Copy message': Size(32, 32),+ 'Attach files': Size(32, 32),+ 'Send message': Size(32, 32),+ };+ for (final MapEntry(key: label, value: size) in mouse.entries) {+ expect(_sizes(tester, _controls()[label]!, label), everyElement(size));+ }+ for (final label in ['file', 'Details']) {+ expect(+ _sizes(tester, _controls()[label]!, label).map((s) => s.height),+ everyElement(28),+ reason: label,+ );+ }+ expect(+ _sizes(tester, _controls()['author']!, 'author').single.height,+ lessThan(28),+ );+ await _openReply(tester);+ expect(tester.getSize(find.byTooltip('Cancel reply')), const Size(32, 32));+ await tester.tap(find.byTooltip('Members and machines'));+ await tester.pumpAndSettle();+ expect(+ tester.getSize(find.byKey(const ValueKey('super-person-owner'))).height,+ 36,+ );+ expect(tester.getSize(find.byTooltip('Invite people')), const Size(32, 32));+ await unmountPhoneSuperTab(tester, controller);+ });+}diff --git a/desktop/test/support/super_tab_phone.dart b/desktop/test/support/super_tab_phone.dartnew file mode 100644index 000000000..a793e5f82--- /dev/null+++ b/desktop/test/support/super_tab_phone.dart@@ -0,0 +1,66 @@+// A Super Tab mounted the way a phone's browser (below the web chrome's+// compactBelow) or Desktop (no chrome at all) mounts it.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/state/workspace_chrome.dart';+import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/view.dart';++import 'super_tab_fixture.dart';++final _phoneChrome = WorkspaceChrome(+ leadingWidth: (_) => 0,+ leading: (_, _) => const SizedBox.shrink(),+ compactBelow: 720,+);++/// The lead conversation, with one message from its owner and [seed]'s, in a+/// [size] window. [desktop] mounts it without chrome, as Desktop does.+Future<(ConversationServer, SuperTabController)> mountPhoneSuperTab(+ WidgetTester tester,+ Size size, {+ VoidCallback? onOpenGroupTerminals,+ bool terminalsVisible = false,+ bool desktop = false,+ void Function(ConversationServer server)? seed,+}) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ final server = ConversationServer()..append('Ship the phone header.');+ final lead = (server.state['conversations'] as List).first as Map;+ lead['agentIds'] = ['builder'];+ seed?.call(server);+ final controller = server.controller();+ await controller.refresh();+ final view = Scaffold(+ body: SuperTabView(+ controller: controller,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onOpenGroupTerminals: onOpenGroupTerminals,+ terminalsVisible: terminalsVisible,+ machineName: (_) => 'Test Mac',+ ),+ );+ await tester.pumpWidget(+ MaterialApp(+ home: desktop+ ? view+ : WorkspaceChromeScope(chrome: _phoneChrome, child: view),+ ),+ );+ await tester.pumpAndSettle();+ return (server, controller);+}++Future<void> unmountPhoneSuperTab(+ WidgetTester tester,+ SuperTabController controller,+) async {+ await tester.pumpWidget(const SizedBox());+ await controller.flush();+ controller.dispose();+}diff --git a/desktop/test/support/web_ux_app.dart b/desktop/test/support/web_ux_app.dartindex bb2521696..99ac5cbd0 100644--- a/desktop/test/support/web_ux_app.dart+++ b/desktop/test/support/web_ux_app.dart@@ -7,12 +7,14 @@library;import 'dart:async';+import 'dart:convert';import 'package:harness/auth/auth_session.dart';import 'package:harness/auth/sign_in_provider.dart';import 'package:harness/core/config.dart';import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';+import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/terminal/terminal_session.dart';/// Nothing listens on port 9 (discard), so a stray request fails fast.@@ -20,11 +22,7 @@ const webUxConfig = AppConfig(apiBaseUrl: 'http://127.0.0.1:9');class WebUxApp extends AppNotifier {WebUxApp()- : super(- config: webUxConfig,- authSession: AuthSession(),- configStore: null,- );+ : super(config: webUxConfig, authSession: AuthSession(), configStore: null);/// Whether the first machine list has answered.bool inventoryLoaded = true;@@ -109,14 +107,38 @@ class WebUxApp extends AppNotifier {TerminalSessionStatus status = TerminalSessionStatus.controlling,bool readOnly = false,}) {- final session =+ late final TerminalSession session;+ var keyframes = 0;+ session =TerminalSession(machineId: machineId,agentId: agent.id,agentName: agent.name,engineId: agent.engine,readOnly: readOnly,- send: (_, _) async => true,+ // The computer owns the grid: it answers a resize with a keyframe,+ // the screen drawn at the size asked for, which replaces the+ // pane's grid. Without it, a pane kept the 80x24 the screen was+ // written at: off the right edge of a phone, and scrolled under+ // its header on a tablet whose pane is shorter than 24 rows.+ send: (type, payload) async {+ if (type == 'terminal_resize' && screen.isNotEmpty) {+ // Its answer arrives after the resize, never inside it.+ await Future<void>.delayed(Duration.zero);+ await session.handleBinary(+ TerminalBinaryFrame(+ kind: TerminalBinaryKind.keyframe,+ streamId: session.streamId!,+ seq: ++keyframes,+ bytes: utf8.encode(screen),+ compressed: false,+ cols: payload['cols'] as int,+ rows: payload['rows'] as int,+ ),+ );+ }+ return true;+ },sendBinary: (_) async => true,)..status = statusdiff --git a/desktop/test/system_notifications_test.dart b/desktop/test/system_notifications_test.dartindex ca9b8af51..014be547a 100644--- a/desktop/test/system_notifications_test.dart+++ b/desktop/test/system_notifications_test.dart@@ -845,6 +845,31 @@ void main() {expect(MacSystemNotifier().deniedAdvice, contains('System Settings'));});+ testWidgets('on-screen alerts are clicked on a computer', (tester) async {+ await pump(+ tester,+ SystemNotifications(store: store(), notifier: _Recorder()),+ );+ expect(find.textContaining('Click it to go to that harness.'), findsOne);+ expect(find.textContaining('Tap it'), findsNothing);+ }, variant: TargetPlatformVariant.desktop());++ testWidgets(+ 'on-screen alerts are tapped on a phone or tablet',+ (tester) async {+ await pump(+ tester,+ SystemNotifications(store: store(), notifier: _Recorder()),+ );+ expect(find.textContaining('Tap it to go to that harness.'), findsOne);+ expect(find.textContaining('Click it'), findsNothing);+ },+ variant: TargetPlatformVariant({+ TargetPlatform.android,+ TargetPlatform.iOS,+ }),+ );+testWidgets('no row where there is no notifier to switch', (tester) async {await pump(tester,diff --git a/desktop/test/terminal_control_banner_hints_test.dart b/desktop/test/terminal_control_banner_hints_test.dartindex 2cea6b2f5..1193136dd 100644--- a/desktop/test/terminal_control_banner_hints_test.dart+++ b/desktop/test/terminal_control_banner_hints_test.dart@@ -19,7 +19,13 @@ final _button = find.widgetWithText(FilledButton, 'Take control');Future<(AppNotifier, TerminalSession)> _takenOver(WidgetTester tester, {required bool web,+ Size? window,}) async {+ if (window != null) {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = window;+ addTearDown(tester.view.reset);+ }final app = createApp();app.stateOf('m')!..nodeOnline = true@@ -46,7 +52,7 @@ Future<(AppNotifier, TerminalSession)> _takenOver(MaterialApp(home: Scaffold(body: SizedBox(- width: 900,+ width: window?.width ?? 900,height: 400,child: web? WorkspaceChromeScope(@@ -74,6 +80,16 @@ Future<void> _finish(WidgetTester tester, AppNotifier app) async {app.dispose();}+/// A computer's browser, and Desktop's own platforms.+final _mouse = TargetPlatformVariant.only(TargetPlatform.macOS);+final _desktopPlatforms = TargetPlatformVariant.desktop();++/// A phone's or tablet's browser.+final _touch = TargetPlatformVariant({+ TargetPlatform.android,+ TargetPlatform.iOS,+});+void main() {testWidgets('on the web the band asks for a click and draws no key', (tester,@@ -93,7 +109,7 @@ void main() {findsNothing,);await _finish(tester, app);- });+ }, variant: _mouse);testWidgets('on the web a stray key is answered without naming a key', (tester,@@ -109,7 +125,55 @@ void main() {);expect(find.textContaining('⏎'), findsNothing);await _finish(tester, app);- });+ }, variant: _mouse);++ testWidgets('a touch screen is asked for a tap, its stray key too', (+ tester,+ ) async {+ final (app, _) = await _takenOver(tester, web: true);++ expect(+ find.text('Typing is paused. Tap here to take control.'),+ findsOneWidget,+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.keyA);+ await tester.pump();+ expect(+ find.text('Keys are ignored — tap here to take control.'),+ findsOneWidget,+ );+ await _finish(tester, app);+ }, variant: _touch);++ testWidgets('on a phone Take control is a finger tall', (tester) async {+ final (app, _) = await _takenOver(+ tester,+ web: true,+ window: const Size(390, 844),+ );++ expect(tester.getSize(_button).height, greaterThanOrEqualTo(44));+ await _finish(tester, app);+ }, variant: _touch);++ testWidgets('a wide web window keeps the mouse-sized button', (tester) async {+ final (app, _) = await _takenOver(tester, web: true);++ expect(tester.getSize(_button).height, lessThan(44));+ await _finish(tester, app);+ }, variant: _mouse);++ // Desktop sets no compactBelow: a narrow window is no phone.+ testWidgets('Desktop at 600 keeps the mouse-sized button', (tester) async {+ final (app, _) = await _takenOver(+ tester,+ web: false,+ window: const Size(600, 800),+ );++ expect(tester.getSize(_button).height, lessThan(44));+ await _finish(tester, app);+ }, variant: _desktopPlatforms);testWidgets('Desktop keeps ⏎ on the band and on its button', (tester) async {final (app, _) = await _takenOver(tester, web: false);@@ -126,5 +190,5 @@ void main() {findsOneWidget,);await _finish(tester, app);- });+ }, variant: _desktopPlatforms);}diff --git a/desktop/test/web_phone_targets_test.dart b/desktop/test/web_phone_targets_test.dartnew file mode 100644index 000000000..e725ca5a6--- /dev/null+++ b/desktop/test/web_phone_targets_test.dart@@ -0,0 +1,174 @@+// The web workspace on a phone: the controls a finger presses below the tab+// bar — the footer's Status menu and its actions, and the error band's Retry+// — are 44x44 at least (audit finding S1).+// A computer's browser keeps the mouse's sizes.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/web/shell/web_chrome.dart';++import '../tool/web_ux_seed.dart';+import 'support/real_fonts.dart';+import 'support/web_ux_app.dart';++Future<WebUxApp> _mount(+ WidgetTester tester,+ Size size,+ WebUxApp Function() seed, {+ bool desktop = false,+}) async {+ final app = seed();+ addTearDown(app.dispose);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: SwarmScreen(+ notifier: app,+ nativeTabs: false,+ // Desktop sets no chrome.+ chrome: desktop ? null : webWorkspaceChrome(app),+ ),+ ),+ );+ await tester.pump(const Duration(milliseconds: 200));+ return app;+}++Future<void> _unmount(WidgetTester tester) async {+ await tester.pumpWidget(const SizedBox.shrink());+ await tester.pump(const Duration(seconds: 1));+}++/// The box the accessibility tree gives [control], which is what the web_ux+/// tap-size check measures: a Material button's padded hit area is not in it.+Size _target(WidgetTester tester, Finder control) =>+ tester.getSemantics(control).rect.size;++Matcher get _finger => predicate<Size>(+ (size) => size.width >= 44 && size.height >= 44,+ 'at least 44x44',+);++/// The New tab page's rows (its recent harnesses, its commands and the+/// phone's) and its Appearance, each at least once.+Iterable<double> _newTabRowHeights(WidgetTester tester) {+ final rows = find.byWidgetPredicate(+ (w) =>+ w is TextButton &&+ w.key is ValueKey<String> &&+ (w.key! as ValueKey<String>).value.startsWith('welcome-'),+ );+ final appearance = find.byKey(const ValueKey('welcome-customize'));+ expect(rows, findsWidgets);+ expect(appearance, findsOneWidget);+ return [+ for (var i = 0; i < rows.evaluate().length; i++)+ tester.getSize(rows.at(i)).height,+ tester.getSize(appearance).height,+ ];+}++WebUxApp _withError() => withPanes(signedIn(), 2)+ ..error = 'Could not start Claude Code on Studio Mac: the folder is gone.';++void main() {+ setUpAll(loadRealFonts);++ testWidgets('a phone footer is a finger tall at its Status menu', (+ tester,+ ) async {+ await _mount(tester, const Size(360, 740), () => withPanes(signedIn(), 2));+ final status = find.byKey(const ValueKey('web-footer-menu-button'));+ expect(tester.getSize(status), _finger);+ final bar = tester.getRect(+ find.byKey(const ValueKey('workspace-status-bar')),+ );+ expect(bar.contains(tester.getRect(status).topLeft), isTrue);+ await _unmount(tester);+ });++ testWidgets('a narrow computer browser\'s Download app in the footer too', (+ tester,+ ) async {+ await _mount(tester, const Size(600, 800), () => withPanes(signedIn(), 2));+ expect(+ tester.getSize(find.widgetWithText(Semantics, 'Download app').first),+ _finger,+ );+ await _unmount(tester);+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));++ testWidgets('the error band\'s Retry is a finger\'s size on a phone', (+ tester,+ ) async {+ await _mount(tester, const Size(360, 740), _withError);+ expect(_target(tester, find.widgetWithText(TextButton, 'Retry')), _finger);+ await _unmount(tester);+ });++ // Desktop sets no compactBelow: a narrow window is no phone.+ testWidgets('Desktop at 600 keeps the bar\'s mouse sizes', (tester) async {+ Future<List<Size>> bar(Size window) async {+ await _mount(+ tester,+ window,+ () => withPanes(signedIn(), 2),+ desktop: true,+ );+ final sizes = [+ for (final key in [+ 'swarm-search-button',+ 'workspace-notifications-button',+ ])+ tester.getSize(find.byKey(ValueKey(key))),+ ];+ await _unmount(tester);+ return sizes;+ }++ final narrow = await bar(const Size(600, 800));+ for (final size in narrow) {+ expect(size.height, lessThan(44));+ }+ expect(narrow, await bar(const Size(1280, 800)));+ });++ testWidgets('a phone\'s New tab page rows are a finger tall', (tester) async {+ await _mount(tester, const Size(360, 740), () => withPanes(signedIn(), 3));+ await tester.tap(find.byKey(const ValueKey('web-new-tab-button')));+ await tester.pump(const Duration(milliseconds: 500));+ for (final height in _newTabRowHeights(tester)) {+ expect(height, greaterThanOrEqualTo(44));+ }+ expect(tester.takeException(), isNull);+ await _unmount(tester);+ });++ // Desktop sets no compactBelow: a narrow window is no phone.+ testWidgets('Desktop at 600 keeps the New tab page\'s rows', (tester) async {+ await _mount(+ tester,+ const Size(600, 800),+ () => withPanes(signedIn(), 3)..newSwarm(newTabPage: true),+ desktop: true,+ );+ for (final height in _newTabRowHeights(tester)) {+ expect(height, lessThan(44));+ }+ await _unmount(tester);+ });++ testWidgets('a wide window keeps the mouse-sized Retry', (tester) async {+ await _mount(tester, const Size(1280, 800), _withError);+ expect(+ tester.getSize(find.widgetWithText(TextButton, 'Retry')).height,+ lessThan(44),+ );+ await _unmount(tester);+ });+}diff --git a/desktop/test/web_search_phone_test.dart b/desktop/test/web_search_phone_test.dartnew file mode 100644index 000000000..12ffc68ed--- /dev/null+++ b/desktop/test/web_search_phone_test.dart@@ -0,0 +1,78 @@+// The search overlay on a phone (the web below compactBelow): its Close and+// preview buttons, its scope chips and its command rows are a finger's size+// (audit finding S1). A wide window keeps the mouse's 32 px.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/web/shell/web_chrome.dart';++import '../tool/web_ux_seed.dart';+import 'support/real_fonts.dart';++Future<void> _openSearch(WidgetTester tester, Size size) async {+ final app = withPanes(signedIn(), 2);+ addTearDown(app.dispose);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: SwarmScreen(+ notifier: app,+ nativeTabs: false,+ chrome: webWorkspaceChrome(app),+ ),+ ),+ );+ await tester.pump(const Duration(milliseconds: 200));+ await tester.tap(find.byKey(const ValueKey('swarm-search-button')));+ await tester.pump(const Duration(milliseconds: 300));+}++Future<void> _close(WidgetTester tester) async {+ await tester.pumpWidget(const SizedBox.shrink());+ await tester.pump(const Duration(seconds: 1));+}++const _controls = [+ 'search-close',+ 'search-toggle-preview',+ 'search-category-Harnesses',+ 'search-category-Commands',+];++void main() {+ setUpAll(loadRealFonts);++ testWidgets('a phone\'s search is pressed with a finger', (tester) async {+ await _openSearch(tester, const Size(390, 844));+ for (final key in _controls) {+ final size = tester.getSize(find.byKey(ValueKey(key)));+ expect(size.width, greaterThanOrEqualTo(44), reason: key);+ expect(size.height, greaterThanOrEqualTo(44), reason: key);+ }++ // The commands: one line a row.+ await tester.enterText(+ find.byKey(const ValueKey('swarm-search-input')),+ '>',+ );+ await tester.pump(const Duration(milliseconds: 300));+ final row = find.byType(ListTile);+ expect(tester.getSize(row.first).height, greaterThanOrEqualTo(44));+ await _close(tester);+ });++ testWidgets('a wide window keeps the mouse-sized search controls', (+ tester,+ ) async {+ await _openSearch(tester, const Size(1280, 800));+ for (final key in _controls) {+ expect(tester.getSize(find.byKey(ValueKey(key))).height, lessThan(44));+ }+ await _close(tester);+ });+}diff --git a/desktop/test/web_tab_switcher_test.dart b/desktop/test/web_tab_switcher_test.dartindex e3081f06d..a054c3a46 100644--- a/desktop/test/web_tab_switcher_test.dart+++ b/desktop/test/web_tab_switcher_test.dart@@ -235,6 +235,58 @@ void main() {},);+ const barControls = [+ 'web-app-menu-button',+ 'web-tab-switcher',+ 'web-new-tab-button',+ 'swarm-search-button',+ 'workspace-notifications-button',+ ];++ testWidgets('a phone bar is a finger wide at every control, its icons not', (+ tester,+ ) async {+ final app = await mount(tester, const Size(360, 740));+ final bar = tester.getRect(find.byKey(const ValueKey('workspace-tab-bar')));+ final rects = <Rect>[];+ for (final key in barControls) {+ final control = find.byKey(ValueKey(key));+ final rect = tester.getRect(control);+ expect(rect.width, greaterThanOrEqualTo(44), reason: key);+ expect(rect.height, greaterThanOrEqualTo(44), reason: key);+ // Inside the bar: a bigger target never reaches into the pane below.+ expect(bar.contains(rect.topLeft), isTrue, reason: key);+ expect(bar.contains(rect.bottomRight - const Offset(1, 1)), isTrue);+ for (final other in rects) {+ expect(rect.overlaps(other), isFalse, reason: key);+ }+ rects.add(rect);+ }+ for (final key in ['web-app-menu-button', 'swarm-search-button']) {+ final icon = tester.widget<Icon>(+ find.descendant(+ of: find.byKey(ValueKey(key)),+ matching: find.byType(Icon),+ ),+ );+ expect(icon.size, 16, reason: key);+ }+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox.shrink());+ app.dispose();+ });++ testWidgets('a wide window keeps the mouse-sized bar controls', (+ tester,+ ) async {+ final app = await mount(tester, const Size(1280, 800));+ for (final key in ['web-app-menu-button', 'swarm-search-button']) {+ expect(tester.getSize(find.byKey(ValueKey(key))).height, 28);+ }+ await tester.pumpWidget(const SizedBox.shrink());+ app.dispose();+ });+testWidgets('a wide window keeps the grid of harnesses', (tester) async {final app = await mount(tester, const Size(1280, 800), harnesses: 3);expect(find.text('Agent 0').hitTestable(), findsOneWidget);diff --git a/desktop/test/web_tablet_terminal_test.dart b/desktop/test/web_tablet_terminal_test.dartnew file mode 100644index 000000000..e832e974f--- /dev/null+++ b/desktop/test/web_tablet_terminal_test.dart@@ -0,0 +1,94 @@+// A tablet's two-column workspace (the web at 768), and a phone's one pane:+// each pane's first terminal row sits whole under its header. The review fixture's computer+// answers a resize as a real one does, with the screen at the pane's size, so+// a pane shorter than the 24 rows a screen starts at is not scrolled to its+// end with the first row half under the header.++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/web/shell/web_chrome.dart';+import 'package:xterm/xterm.dart';++import '../tool/web_ux_seed.dart';+import 'support/real_fonts.dart';++void main() {+ setUpAll(loadRealFonts);++ /// [size]'s workspace, with every drawn pane's terminal scroll position.+ Future<List<double>> scrolls(+ WidgetTester tester,+ Size size, {+ double settlesShorterBy = 0,+ Size? startsAt,+ }) async {+ final app = withPanes(signedIn(), 3);+ addTearDown(app.dispose);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = startsAt ?? size;+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: SwarmScreen(+ notifier: app,+ nativeTabs: false,+ chrome: webWorkspaceChrome(app),+ ),+ ),+ );+ await tester.pump(const Duration(milliseconds: 200));+ await tester.pump(const Duration(milliseconds: 200));+ if (startsAt != null) {+ tester.view.physicalSize = size;+ await tester.pump(const Duration(milliseconds: 200));+ await tester.pump(const Duration(milliseconds: 200));+ }+ if (settlesShorterBy > 0) {+ // A phone's browser: the store bar over the page, and its own bars,+ // arrive after the first layout and take height from every pane.+ tester.view.physicalSize = Size(+ size.width,+ size.height - settlesShorterBy,+ );+ await tester.pump(const Duration(milliseconds: 200));+ await tester.pump(const Duration(milliseconds: 200));+ }+ final out = [+ for (final view in find.byType(TerminalView).evaluate())+ tester+ .state<ScrollableState>(+ find+ .descendant(+ of: find.byWidget(view.widget),+ matching: find.byType(Scrollable),+ )+ .first,+ )+ .position+ .pixels,+ ];+ await tester.pumpWidget(const SizedBox.shrink());+ await tester.pump(const Duration(seconds: 1));+ return out;+ }++ testWidgets('at 768 every pane shows its first row whole', (tester) async {+ // An iPad mini's 1024 less the store bar over the page and the browser's+ // own bars: panes shorter than the 24 rows a screen starts at.+ final positions = await scrolls(tester, const Size(768, 900));+ // Not scrolled at all: the first row is at the top of each pane.+ expect(positions, [0, 0, 0]);+ });++ testWidgets('at 360 the phone\'s one pane shows its first row whole', (+ tester,+ ) async {+ expect(await scrolls(tester, const Size(360, 740)), [0]);+ expect(await scrolls(tester, const Size(360, 740), settlesShorterBy: 200), [+ 0,+ ]);+ });+}diff --git a/desktop/test/web_ux_app_test.dart b/desktop/test/web_ux_app_test.dartindex 5df4c458d..f6bc91898 100644--- a/desktop/test/web_ux_app_test.dart+++ b/desktop/test/web_ux_app_test.dart@@ -77,4 +77,45 @@ void main() {expect(app.lastError, 'Could not start Claude Code.');expect(app.sessionExpired, isTrue);});++ /// The rows of [session]'s screen, as drawn.+ List<String> rows(TerminalSession session) => [+ for (final line in session.terminal.buffer.lines.toList())+ line.toString().trimRight(),+ ];++ test('a resize is answered with the screen redrawn at that size, as a computer does', () async {+ final app = WebUxApp()..addMachine('m1', 'Studio Mac');+ addTearDown(app.dispose);+ final session = app.openTerminal(+ 'm1',+ _agent,+ screen: '${'x' * 60}\r\nend',+ );++ // A pane narrower and shorter than the 80x24 the screen was written at+ // reports its size, as the view does: it never resizes the grid itself.+ session.terminal.onResize!(45, 20, 0, 0);+ await pumpEventQueue();++ expect((session.terminal.viewWidth, session.terminal.viewHeight), (45, 20));+ expect(rows(session).take(3), ['x' * 45, 'x' * 15, 'end']);+ });++ test('a view-only terminal keeps the grid another app drew', () async {+ final app = WebUxApp()..addMachine('m1', 'Studio Mac');+ addTearDown(app.dispose);+ final session = app.openTerminal(+ 'm1',+ _agent,+ screen: '${'x' * 60}\r\nend',+ readOnly: true,+ );++ session.terminal.onResize!(45, 20, 0, 0);+ await pumpEventQueue();++ // No input, so no resize reaches the computer: its grid stays.+ expect((session.terminal.viewWidth, session.terminal.viewHeight), (80, 24));+ });}diff --git a/desktop/tool/super_tab_mobile_fixture.dart b/desktop/tool/super_tab_mobile_fixture.dartindex c7fc5839b..16b5c4cd0 100644--- a/desktop/tool/super_tab_mobile_fixture.dart+++ b/desktop/tool/super_tab_mobile_fixture.dart@@ -15,6 +15,7 @@ import 'package:harness/shared/theme/color_palette.dart';import 'package:harness/state/workspace_chrome.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/view.dart';+import 'package:harness/web/shell/web_layout.dart';import '../test/support/super_tab_fixture.dart';@@ -71,11 +72,13 @@ class _FixtureState extends State<_Fixture> {@override// Under the switch the web workspace turns on for the Swarm tab- // (`webWorkspaceChrome`), and with New project as the workspace passes it.+ // (`webWorkspaceChrome`), and with New project as the workspace passes it;+ // a phone below the web's compact width, as the workspace does.Widget build(BuildContext context) => WorkspaceChromeScope(chrome: WorkspaceChrome(leadingWidth: (_) => 0,leading: (_, _) => const SizedBox.shrink(),+ compactBelow: kWebCompactBelow,superTabRecovers: true,),child: Scaffold(diff --git a/desktop/tool/web_ux/checks.mjs b/desktop/tool/web_ux/checks.mjsindex 364d90f9f..e2e4db22c 100644--- a/desktop/tool/web_ux/checks.mjs+++ b/desktop/tool/web_ux/checks.mjs@@ -9,7 +9,8 @@// 3. Hover and focus: a control's pixels with and without the mouse over it,// and the page after Tab presses, to see whether a focus ring shows.// Results go to <out-dir>/checks.json, with before/after images under-// <out-dir>/checks/.+// <out-dir>/checks/. FIXTURE=super-tab measures the tap targets of every+// Super Tab flow on a build of tool/super_tab_mobile_fixture.dart instead.import { chromium } from './playwright.mjs';import { createHash } from 'node:crypto';import { mkdirSync, writeFileSync } from 'node:fs';@@ -18,17 +19,20 @@ import { loadFlows } from './load-flows.mjs';import { VIEWPORTS, answerApi, contextFor, runStep, settle, urlFor } from './capture.mjs';import { serve } from './serve.mjs';-const FLOWS = await loadFlows();+const FIXTURE = process.env.FIXTURE ?? 'app';+const FLOWS = await loadFlows(FIXTURE);const flow = (name) => FLOWS.find((f) => f.name === name);const PHONES = VIEWPORTS.filter((v) => v.width < 720);const COMPUTER = VIEWPORTS.find((v) => v.name === '1440');-// Flows whose controls are measured for tap size on phones.-const TAP_FLOWS = [+// Flows whose controls are measured for tap size on phones: on the Super Tab+// fixture, all of them.+const TAP_FLOWS = FIXTURE !== 'app' ? FLOWS.map((f) => f.name) : ['signin', 'first-machine', 'computers', 'workspace', 'app-menu', 'tab-switcher','footer-menu', 'notifications', 'open-harness', 'machines', 'all-commands','appearance', 'split-pane', 'store', 'settings', 'settings-notifications','settings-keyboard-shortcuts', 'new-tab', 'error-banner', 'new-device', 'link-password',+ 'taken-over', 'view-only','shared-link', 'shared-link-private', 'shared-link-refused', 'shared-link-offline','shared-link-failed', 'settings-account',];@@ -230,14 +234,14 @@ async function main() {const server = await serve(buildDir);const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH });const blocked = new Set();- const results = {- tapTargets: await tapTargets(browser, server.origin, blocked),- wheel: await wheels(browser, server.origin, blocked, dir),- swipe: await swipes(browser, server.origin, blocked, dir),- hover: await hovers(browser, server.origin, blocked, dir),- focus: await focus(browser, server.origin, blocked, dir),- blocked: [...blocked],- };+ const results = { tapTargets: await tapTargets(browser, server.origin, blocked) };+ if (FIXTURE === 'app') {+ results.wheel = await wheels(browser, server.origin, blocked, dir);+ results.swipe = await swipes(browser, server.origin, blocked, dir);+ results.hover = await hovers(browser, server.origin, blocked, dir);+ results.focus = await focus(browser, server.origin, blocked, dir);+ }+ results.blocked = [...blocked];writeFileSync(join(outDir, 'checks.json'), JSON.stringify(results, null, 2));await browser.close();server.close();diff --git a/desktop/tool/web_ux/flows/states.mjs b/desktop/tool/web_ux/flows/states.mjsindex 3966c8dd1..c939a94d6 100644--- a/desktop/tool/web_ux/flows/states.mjs+++ b/desktop/tool/web_ux/flows/states.mjs@@ -23,8 +23,17 @@ export const FLOWS = [superTab('super-tab-empty', 'empty'),superTab('super-tab-viewer', 'viewer'),superTab('super-tab-offline', 'offline'),+ // People stay in a phone's header bar: one tap, as on a computer.superTab('super-tab-roster', 'rich', { steps: [['click', 'Members and machines']] }),superTab('super-tab-conversations', 'rich', { only: 'compact', steps: [['click', 'Conversations']] }),- superTab('super-tab-terminals', 'rich', { steps: [['click', 'Group terminals']] }),- superTab('super-tab-pull-requests', 'rich', { steps: [['click', 'Pull requests']] }),+ // On a phone these views are in the header's ⋮ menu, by name.+ superTab('super-tab-terminals', 'rich', {+ steps: [['click', 'Group terminals']],+ compact: [['click', ' options'], ['click', 'Group terminals']],+ }),+ superTab('super-tab-pull-requests', 'rich', {+ steps: [['click', 'Pull requests']],+ compact: [['click', ' options'], ['click', 'Pull requests']],+ }),+ superTab('super-tab-menu', 'rich', { only: 'compact', steps: [['click', ' options']] }),];