Skip to content

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

Match Machines screen to agreed mockups (#3423)

harness-for-autonomous[bot]921634e72d17
diff --git a/desktop/lib/shared/theme/machines_style.dart b/desktop/lib/shared/theme/machines_style.dart
new file mode 100644
index 000000000..a24386e60
--- /dev/null
+++ b/desktop/lib/shared/theme/machines_style.dart
@@ -0,0 +1,77 @@
+import 'package:flutter/material.dart';
+
+import 'app_theme.dart' as grid;
+
+/// Scholes's agreed Machines palette and geometry. Scoped to this screen so
+/// matching its mockup does not recolor the rest of the workspace.
+abstract final class MachinesStyle {
+ static const onAccent = Color(0xffffffff);
+ static Color get background =>
+ grid.AppTheme.pick(const Color(0xffffffff), const Color(0xff141416));
+ static Color get field =>
+ grid.AppTheme.pick(const Color(0xfff6f6f7), const Color(0xff1b1b1e));
+ static Color get line =>
+ grid.AppTheme.pick(const Color(0xffe6e6e9), const Color(0xff2b2b30));
+ static Color get ink =>
+ grid.AppTheme.pick(const Color(0xff17171a), const Color(0xfff2f2f4));
+ static Color get metadata =>
+ grid.AppTheme.pick(const Color(0xff6b6b73), const Color(0xffa3a3ac));
+ static Color get label =>
+ grid.AppTheme.pick(const Color(0xff9a9aa3), const Color(0xff75757e));
+ static Color get accent =>
+ grid.AppTheme.pick(const Color(0xff1a73e8), const Color(0xff6aa4f8));
+ static Color get online =>
+ grid.AppTheme.pick(const Color(0xff1e9e5a), const Color(0xff43c882));
+ static Color get asleep =>
+ grid.AppTheme.pick(const Color(0xffc98a13), const Color(0xffe0a83c));
+ static Color get offline =>
+ grid.AppTheme.pick(const Color(0xffb3b3bb), const Color(0xff5c5c65));
+ static Color get selected =>
+ grid.AppTheme.pick(const Color(0xffeaf2fe), const Color(0xff1c2b40));
+ static Color get selectedInk =>
+ grid.AppTheme.pick(const Color(0xff14498f), const Color(0xffb8d4ff));
+ static Color get chip =>
+ grid.AppTheme.pick(const Color(0xffeef0f3), const Color(0xff27272b));
+ static const side = EdgeInsets.symmetric(horizontal: 24);
+ static const rowInset = EdgeInsets.symmetric(horizontal: 12);
+ static const toolbarInset = EdgeInsets.symmetric(
+ horizontal: 24,
+ vertical: 12,
+ );
+ static const filterInset = EdgeInsets.fromLTRB(24, 8, 24, 0);
+ static const headerInset = EdgeInsets.all(24);
+ static const groupInset = EdgeInsets.only(top: 24, bottom: 8);
+ static const badgeInset = EdgeInsets.symmetric(horizontal: 4);
+ static const chipInset = EdgeInsets.symmetric(horizontal: 8, vertical: 4);
+ static const radius = BorderRadius.all(Radius.circular(8));
+ static const pillRadius = BorderRadius.all(Radius.circular(20));
+ static const fieldPadding = EdgeInsets.symmetric(horizontal: 12, vertical: 8);
+ static TextStyle title() => grid.AppType.body().copyWith(
+ fontSize: 22,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -.44,
+ color: ink,
+ );
+ static TextStyle name({bool own = false}) => grid.AppType.body().copyWith(
+ fontSize: 15,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -.15,
+ height: 1.3,
+ color: own ? selectedInk : ink,
+ );
+ static TextStyle body({Color? color}) => grid.AppType.body().copyWith(
+ fontSize: 13,
+ height: 1.3,
+ color: color ?? metadata,
+ );
+ static TextStyle small({Color? color, bool heading = false}) =>
+ grid.AppType.body().copyWith(
+ fontSize: 11,
+ height: 1.3,
+ color: color ?? label,
+ letterSpacing: heading ? .66 : 0,
+ );
+ static TextStyle identity() =>
+ grid.AppType.mono().copyWith(fontSize: 13, height: 1.3, color: metadata);
+ static const tabular = [FontFeature.tabularFigures()];
+}
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index 2dde28752..cc4d3d1aa 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -13,6 +13,7 @@ import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/status_line_style.dart';
+import '../shared/theme/machines_style.dart';
import '../shared/widgets/app_dialog.dart';
import '../shared/widgets/app_icon_button.dart';
import '../shared/widgets/app_menu.dart';
@@ -52,6 +53,8 @@ import '../widgets/laid_out_list.dart';
export 'machine_status.dart';
+part 'machines_manage.dart';
+
/// The backend's upper bound. A machine's own total RAM may set a lower one.
const _agentSlotsMin = 1;
const _agentSlotsMax = 1024;
@@ -84,9 +87,6 @@ int? _maxAgentSlots(MachineResources? resources) {
int? _suggestedAgentSlots(MachineResources? resources) =>
superTabSuggestedAgentSlots(resources);
-/// Where a machine's row starts in Manage, so its mark sits under the heading.
-const _manageRowStart = 12.0;
-
class SuperTabMachines extends StatefulWidget {
const SuperTabMachines({
super.key,
@@ -819,6 +819,11 @@ Future<void> _machineSettingsDialog(
class _SuperTabMachinesState extends State<SuperTabMachines> {
final _samples = <String, (MachineResources, DateTime)>{};
String? _selectedMachineId;
+ String? _focusedMachineId;
+ String _machineSearch = '';
+ String _machineFilter = 'all';
+ Object? _manageLayoutDrawn;
+ Map<String, String> _manageNames = const {};
/// Samples from before foreground return stay cached, but their readings are
/// hidden behind the refreshing state until the next read answers.
@@ -947,10 +952,12 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
if (!mounted || c.snapshot == null || c.accessRevoked) return;
final views = _sortedViews();
final groups = [
- for (final (key, _, group) in _groups())
+ for (final (key, _, group) in _groups(views))
for (final v in group) '$key/${v.id}',
];
- if (c.backendUnreachable || !listEquals(_groupsDrawn, groups)) {
+ if (c.backendUnreachable ||
+ (widget.manage && _manageLayoutDrawn != _machineLayout(views)) ||
+ !listEquals(_groupsDrawn, groups)) {
_changed();
return;
}
@@ -975,6 +982,13 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
view.problem,
view.subscriptionsAside,
view.agents.length,
+ if (widget.manage) ...[
+ view.resources?.diskTotalBytes,
+ view.resources?.diskFreeBytes,
+ view.resources?.projectDiskTotalBytes,
+ view.resources?.projectDiskFreeBytes,
+ Object.hashAll(view.crew.map((a) => (a.id, a.crewAsleep, a.crewMoving))),
+ ],
]);
/// Reads why this Mac's Team account has not joined, only while its
@@ -2010,8 +2024,23 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
active: true,
child: _RowHoverRegion(
child: Material(
- color: selected ? grid.AppSurface.selectedFill : Colors.transparent,
- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ key: widget.manage ? ValueKey('machines-surface-${view.id}') : null,
+ shape: widget.manage
+ ? RoundedRectangleBorder(
+ borderRadius: MachinesStyle.radius,
+ side: _focusedMachineId == view.id
+ ? BorderSide(color: MachinesStyle.accent, width: 2)
+ : BorderSide.none,
+ )
+ : null,
+ color: widget.manage && view.owner?.id == c.accountId
+ ? MachinesStyle.selected
+ : selected
+ ? grid.AppSurface.selectedFill
+ : Colors.transparent,
+ borderRadius: widget.manage
+ ? null
+ : BorderRadius.circular(DesktopChrome.rowRadius),
clipBehavior: Clip.antiAlias,
// No chevron (Dee, 2026-10-27): a click expands the machine, and its
// details are in the right-click menu, or a long press on a touch screen.
@@ -2040,6 +2069,16 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
focusColor: grid.AppSurface.hoverFill,
borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
onFocusChange: (focused) {
+ if (widget.manage) {
+ if (focused &&
+ FocusManager.instance.highlightMode ==
+ FocusHighlightMode.traditional) {
+ _focusedMachineId = view.id;
+ } else if (_focusedMachineId == view.id) {
+ _focusedMachineId = null;
+ }
+ _rowBeats[view.id]?.value++;
+ }
if (focused &&
FocusManager.instance.highlightMode ==
FocusHighlightMode.traditional) {
@@ -2050,19 +2089,36 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
},
child: Semantics(
expanded: expanded,
- child: _MachineLine(
- view: view,
- words: widget.manage,
- onMore: BrowserMenuGuard.inBrowser
- ? (at) => _menu(view, at)
- : null,
- onRetryJoin: view.retryJoin
- ? () async {
- await widget.app!.retryTeamJoin();
- await _readTeamJoin();
- }
- : null,
- ),
+ child: widget.manage
+ ? _ManageMachineLine(
+ view: view,
+ name:
+ _manageNames[view.id] ??
+ superTabMachineName(view.name),
+ own: view.owner?.id == c.accountId,
+ local:
+ widget.app?.stateOf(view.id)?.isLocalMachine ==
+ true,
+ now: widget.now(),
+ port: widget.app
+ ?.stateOf(view.id)
+ ?.localEndpoint
+ ?.wsUri
+ .port,
+ onMore: (at) => _menu(view, at),
+ )
+ : _MachineLine(
+ view: view,
+ onMore: BrowserMenuGuard.inBrowser
+ ? (at) => _menu(view, at)
+ : null,
+ onRetryJoin: view.retryJoin
+ ? () async {
+ await widget.app!.retryTeamJoin();
+ await _readTeamJoin();
+ }
+ : null,
+ ),
),
),
),
@@ -2084,6 +2140,9 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
superTabMachineName(view.name),
view.cleaning
? 'Cleaning up'
+ : widget.manage
+ ? _machineStatusGroup(view)
+ .replaceAll('unknown', 'status unknown')
: superTabMachineStateLabel(view.status),
?view.history,
?view.crewLine,
@@ -2432,17 +2491,22 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
/// Status first (Scholes, task #3801): the reader's own machines pinned in Yours, then Online, Status unknown and
/// Offline, each under a heading with its count. A group with no machine has no heading.
- List<(String, String, List<_MachineView>)> _groups() {
- final views = _sortedViews();
+ List<(String, String, List<_MachineView>)> _groups([
+ List<_MachineView>? sorted,
+ ]) {
+ final views = sorted ?? _sortedViews();
final yours = <_MachineView>[];
final online = <_MachineView>[];
+ final asleep = <_MachineView>[];
final unknown = <_MachineView>[];
final offline = <_MachineView>[];
for (final view in views) {
+ if (widget.manage && !_matchesMachine(view)) continue;
if (view.owner?.id != null && view.owner?.id == c.accountId) {
yours.add(view);
} else {
(switch (view.status) {
+ SuperTabMachineStatus.late when widget.manage => asleep,
SuperTabMachineStatus.unknown => unknown,
SuperTabMachineStatus.offline => offline,
_ => online,
@@ -2452,6 +2516,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
return [
('yours', 'Yours', yours),
('online', 'Online', online),
+ ('asleep', 'Asleep', asleep),
('unknown', 'Status unknown', unknown),
('offline', 'Offline', offline),
].where((g) => g.$3.isNotEmpty).toList();
@@ -2463,17 +2528,25 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
header: true,
container: true,
child: Padding(
- padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.controlGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.listRowGap,
- ),
+ padding: widget.manage
+ ? MachinesStyle.groupInset
+ : const EdgeInsets.fromLTRB(
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.listRowGap,
+ ),
child: Text(
- '$label · $count',
- style: DesktopChrome.metadata().copyWith(
- fontWeight: grid.AppFont.semibold,
- ),
+ widget.manage
+ ? (key == 'yours'
+ ? 'YOUR MACHINE'
+ : '${label.toUpperCase()} · $count')
+ : '$label · $count',
+ style: widget.manage
+ ? MachinesStyle.small(heading: true)
+ : DesktopChrome.metadata().copyWith(
+ fontWeight: grid.AppFont.semibold,
+ ),
),
),
);
@@ -2505,9 +2578,19 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
);
}
if (c.snapshot == null) {
- return const SkeletonList(
- key: ValueKey('super-machines-loading'),
+ return SkeletonList(
+ key: const ValueKey('super-machines-loading'),
rows: 3,
+ itemBuilder: widget.manage
+ ? (_, i) => SizedBox(
+ key: ValueKey('machines-loading-row-$i'),
+ height: 56,
+ child: const SkeletonListTile(
+ leading: 8,
+ padding: MachinesStyle.rowInset,
+ ),
+ )
+ : null,
);
}
return Padding(
@@ -2520,8 +2603,8 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
}
/// One row each, redrawn on its own ([_redrawMoved]), under its group's heading.
- List<Widget> _machines() {
- final groups = _groups();
+ List<Widget> _machines([List<_MachineView>? sorted]) {
+ final groups = _groups(sorted);
_orderDrawn = [
for (final (_, _, views) in groups)
for (final v in views) v.id,
@@ -2565,45 +2648,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
),
)
: null;
- if (widget.manage) {
- return LaidOutListView(
- // A row's mark starts under Manage's heading, its words end at the
- // page's edge (Swarm's and Models' 24).
- padding: const EdgeInsets.fromLTRB(
- _manageRowStart,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.groupGap,
- grid.AppDesktop.controlGap,
- ),
- children: [
- // Only a Swarm that can't be read is news, as under the old heading.
- if (c.backendUnreachable)
- Align(
- alignment: Alignment.centerLeft,
- child: SuperTabMachinesPill(
- connecting: c.stillConnecting,
- reconnectingFor: failingSince == null
- ? Duration.zero
- : widget.now().difference(failingSince),
- ),
- ),
- ?_stateNote(const EdgeInsets.all(grid.AppDesktop.controlGap)),
- if (_ids.isNotEmpty) ..._machines(),
- const SizedBox(height: 8),
- Align(
- alignment: Alignment.centerRight,
- child: Padding(
- padding: const EdgeInsets.only(right: grid.AppDesktop.controlGap),
- child: TextButton(
- key: const ValueKey('super-manage-add-machine'),
- onPressed: add,
- child: const Text('Add machine'),
- ),
- ),
- ),
- ],
- );
- }
+ if (widget.manage) return _manageScreen(add);
final children = [
SuperTabSectionHeading(
'Machines',
@@ -3039,8 +3084,9 @@ class _MachineProjectsSettingState extends State<_MachineProjectsSetting> {
final pool = snapshot?.machines
.where((m) => m['machineId'] == widget.machineId)
.firstOrNull;
- if (snapshot == null || pool == null || pool['hostMachineId'] is String)
+ if (snapshot == null || pool == null || pool['hostMachineId'] is String) {
return const SizedBox.shrink();
+ }
final kept = pool['projects'] is List
? [
for (final id in pool['projects'] as List)
@@ -3065,18 +3111,10 @@ class _MachineProjectsSettingState extends State<_MachineProjectsSetting> {
}
class _MachineLine extends StatelessWidget {
- const _MachineLine({
- required this.view,
- this.onRetryJoin,
- this.onMore,
- this.words = false,
- });
+ const _MachineLine({required this.view, this.onRetryJoin, this.onMore});
final _MachineView view;
- /// Its owner and status in words (Manage), not their marks.
- final bool words;
-
/// In a browser, opens the machine's menu at a point until it closes: the ⋯ that needs no right-click.
final Future<void> Function(Offset at)? onMore;
@@ -3195,29 +3233,7 @@ class _MachineLine extends StatelessWidget {
),
),
),
- if (words) ...[
- if (owner != null)
- Padding(
- padding: const EdgeInsets.only(
- left: grid.AppDesktop.controlGap,
- ),
- child: Text(
- owner.shownName,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
- ),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.controlGap,
- ),
- child: Text(switch (view.status) {
- SuperTabMachineStatus.live => 'online',
- final status => superTabMachineStateLabel(status).toLowerCase(),
- }, style: DesktopChrome.metadata()),
- ),
- ] else if (owner != null)
+ if (owner != null)
Padding(
padding: const EdgeInsets.only(left: 6),
child: Tooltip(
@@ -3235,22 +3251,21 @@ class _MachineLine extends StatelessWidget {
key: ValueKey('super-machine-more-${view.id}'),
onOpen: open,
),
- if (!words)
- SizedBox(
- width: 32,
- child: Center(
- child: KeyedSubtree(
- key: ValueKey(
- 'super-machine-state-${view.id}-${view.status.name}',
- ),
- child: SuperTabMachineDot(
- status: view.status,
- readingAt: view.readingAt,
- arrived: view.arrived,
- ),
+ SizedBox(
+ width: 32,
+ child: Center(
+ child: KeyedSubtree(
+ key: ValueKey(
+ 'super-machine-state-${view.id}-${view.status.name}',
+ ),
+ child: SuperTabMachineDot(
+ status: view.status,
+ readingAt: view.readingAt,
+ arrived: view.arrived,
),
),
),
+ ),
],
),
);
diff --git a/desktop/lib/super_tabs/machines_manage.dart b/desktop/lib/super_tabs/machines_manage.dart
new file mode 100644
index 000000000..d0b3928d4
--- /dev/null
+++ b/desktop/lib/super_tabs/machines_manage.dart
@@ -0,0 +1,563 @@
+part of 'machines.dart';
+
+String _machineStatusGroup(_MachineView view) => switch (view.status) {
+ SuperTabMachineStatus.live => 'online',
+ SuperTabMachineStatus.late => 'asleep',
+ SuperTabMachineStatus.offline => 'offline',
+ _ => 'unknown',
+};
+
+Object _machineLayout(List<_MachineView> views) {
+ final counts = <String, int>{};
+ for (final view in views) {
+ final group = _machineStatusGroup(view);
+ counts.update(group, (value) => value + 1, ifAbsent: () => 1);
+ }
+ return (
+ counts['online'] ?? 0,
+ counts['asleep'] ?? 0,
+ counts['offline'] ?? 0,
+ counts['unknown'] ?? 0,
+ Object.hashAll(views.map((v) => (v.name, v.owner?.shownName))),
+ );
+}
+
+extension _ManageMachines on _SuperTabMachinesState {
+ bool _matchesMachine(_MachineView view) =>
+ (_machineFilter == 'all' ||
+ _machineStatusGroup(view) == _machineFilter) &&
+ '${view.name} ${view.owner?.shownName ?? ''} ${view.id}'
+ .toLowerCase()
+ .contains(_machineSearch.trim().toLowerCase());
+
+ Widget _manageScreen(VoidCallback? add) {
+ grid.AppTheme.watch(context);
+ final views = _sortedViews();
+ _manageLayoutDrawn = _machineLayout(views);
+ final names = <String, int>{};
+ for (final view in views) {
+ names.update(
+ superTabMachineName(view.name),
+ (n) => n + 1,
+ ifAbsent: () => 1,
+ );
+ }
+ _manageNames = {
+ for (final view in views)
+ view.id: names[superTabMachineName(view.name)]! > 1
+ ? '${superTabMachineName(view.name)} · ${view.owner?.shownName ?? view.id}'
+ : superTabMachineName(view.name),
+ };
+ int count(String group) =>
+ views.where((v) => _machineStatusGroup(v) == group).length;
+ final summary =
+ '${count('online')} online · ${count('asleep')} asleep · ${count('offline')} offline';
+ final machines = _machines(views);
+ return ColoredBox(
+ color: MachinesStyle.background,
+ child: LayoutBuilder(
+ builder: (context, page) => Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ // In a short window or at a large text size the header scrolls on its own within half the page, so the
+ // machines below it always keep room.
+ ConstrainedBox(
+ constraints: BoxConstraints(maxHeight: page.maxHeight / 2),
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: MachinesStyle.toolbarInset,
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ // A larger text size needs the room sooner: search and Add machine go under the title.
+ final narrow =
+ constraints.maxWidth <
+ MediaQuery.textScalerOf(context).scale(760);
+ final title = Wrap(
+ spacing: 12,
+ crossAxisAlignment: WrapCrossAlignment.center,
+ children: [
+ Text('Machines', style: MachinesStyle.title()),
+ Text(summary, style: MachinesStyle.body()),
+ ],
+ );
+ final actions = SizedBox(
+ height: 36,
+ child: Row(
+ children: [
+ Expanded(
+ child: TextField(
+ key: const ValueKey('machines-search'),
+ onChanged: (value) {
+ _machineSearch = value;
+ _changed();
+ },
+ style: MachinesStyle.body(
+ color: MachinesStyle.ink,
+ ),
+ decoration: InputDecoration(
+ hintText: 'Search machines',
+ hintStyle: MachinesStyle.body(
+ color: MachinesStyle.label,
+ ),
+ prefixIcon: Icon(
+ AppIcons.search,
+ size: 16,
+ color: MachinesStyle.label,
+ ),
+ filled: true,
+ fillColor: MachinesStyle.field,
+ isDense: true,
+ contentPadding:
+ MachinesStyle.fieldPadding,
+ enabledBorder: OutlineInputBorder(
+ borderRadius: MachinesStyle.radius,
+ borderSide: BorderSide(
+ color: MachinesStyle.line,
+ ),
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderRadius: MachinesStyle.radius,
+ borderSide: BorderSide(
+ color: MachinesStyle.accent,
+ width: 2,
+ ),
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ FilledButton(
+ key: const ValueKey(
+ 'super-manage-add-machine',
+ ),
+ onPressed: add,
+ style: FilledButton.styleFrom(
+ backgroundColor: MachinesStyle.accent,
+ foregroundColor: MachinesStyle.onAccent,
+ textStyle: MachinesStyle.body(),
+ shape: const RoundedRectangleBorder(
+ borderRadius: MachinesStyle.radius,
+ ),
+ ),
+ child: const Text('Add machine'),
+ ),
+ ],
+ ),
+ );
+ return narrow
+ ? Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ title,
+ const SizedBox(height: 16),
+ actions,
+ ],
+ )
+ : Row(
+ children: [
+ Expanded(child: title),
+ const SizedBox(width: 16),
+ SizedBox(width: 320, child: actions),
+ ],
+ );
+ },
+ ),
+ ),
+ Divider(height: 1, color: MachinesStyle.line),
+ Padding(
+ padding: MachinesStyle.filterInset,
+ child: Wrap(
+ alignment: WrapAlignment.spaceBetween,
+ runSpacing: 8,
+ crossAxisAlignment: WrapCrossAlignment.center,
+ children: [
+ Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ children: [
+ for (final (id, label, total) in [
+ ('all', 'All', views.length),
+ ('online', 'Online', count('online')),
+ ('asleep', 'Asleep', count('asleep')),
+ ('offline', 'Offline', count('offline')),
+ if (count('unknown') > 0)
+ (
+ 'unknown',
+ 'Status unknown',
+ count('unknown'),
+ ),
+ ])
+ ChoiceChip(
+ key: ValueKey('machines-filter-$id'),
+ label: Text('$label $total'),
+ selected: _machineFilter == id,
+ showCheckmark: false,
+ materialTapTargetSize:
+ MaterialTapTargetSize.shrinkWrap,
+ visualDensity: VisualDensity.compact,
+ padding: EdgeInsets.zero,
+ onSelected: (_) {
+ _machineFilter = id;
+ _changed();
+ },
+ labelStyle: MachinesStyle.small(
+ color: _machineFilter == id
+ ? MachinesStyle.background
+ : MachinesStyle.metadata,
+ ),
+ selectedColor: MachinesStyle.ink,
+ backgroundColor: MachinesStyle.background,
+ side: BorderSide(color: MachinesStyle.line),
+ shape: const RoundedRectangleBorder(
+ borderRadius: MachinesStyle.pillRadius,
+ ),
+ ),
+ ],
+ ),
+ Text(
+ 'Sorted by status, then name',
+ style: MachinesStyle.small(),
+ ),
+ ],
+ ),
+ ),
+ if (c.backendUnreachable)
+ Padding(
+ padding: MachinesStyle.side,
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ "Couldn't refresh machines. Showing last known readings.",
+ style: MachinesStyle.body(),
+ ),
+ ),
+ TextButton(
+ onPressed: () => unawaited(c.refresh()),
+ child: const Text('Retry'),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ Expanded(
+ child: LaidOutListView(
+ padding: MachinesStyle.side,
+ children: [
+ if (_ids.isEmpty)
+ _stateNote(MachinesStyle.headerInset)!
+ else if (machines.isEmpty)
+ Padding(
+ padding: MachinesStyle.headerInset,
+ child: Text(
+ 'No machines match your search and filter.',
+ style: MachinesStyle.body(),
+ ),
+ )
+ else
+ ...machines,
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+/// Fixed columns in Manage; the compact sidebar keeps its separate row anatomy.
+class _ManageMachineLine extends StatelessWidget {
+ const _ManageMachineLine({
+ required this.view,
+ required this.name,
+ required this.own,
+ required this.local,
+ required this.now,
+ this.port,
+ required this.onMore,
+ });
+ final _MachineView view;
+ final String name;
+ final bool own, local;
+ final DateTime now;
+ final int? port;
+ final Future<void> Function(Offset) onMore;
+
+ @override
+ Widget build(BuildContext context) {
+ final group = _machineStatusGroup(view);
+ final color = switch (group) {
+ 'online' => MachinesStyle.online,
+ 'asleep' => MachinesStyle.asleep,
+ _ => MachinesStyle.offline,
+ };
+ final crew = view.crew;
+ final awake = crew.where((a) => !a.crewAsleep && !a.crewMoving).length;
+ final age = view.readingAt == null ? null : now.difference(view.readingAt!);
+ final metadata = [
+ local ? 'This machine' : view.owner?.shownName ?? 'Owner unavailable',
+ if (view.problem != null)
+ view.problem!
+ else if (group != 'online')
+ 'last seen ${age == null ? 'unknown' : superTabAgo(age)}'
+ else if (crew.isNotEmpty)
+ '${crew.length} crew · $awake online',
+ ].join(' · ');
+ return Container(
+ key: ValueKey('machines-line-${view.id}'),
+ // 56pt at the normal text size; a larger text size grows the row with its two lines.
+ height: MediaQuery.textScalerOf(context).scale(56),
+ padding: MachinesStyle.rowInset,
+ decoration: BoxDecoration(
+ border: own
+ ? null
+ : Border(bottom: BorderSide(color: MachinesStyle.line)),
+ borderRadius: MachinesStyle.radius,
+ ),
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ final narrow = constraints.maxWidth < 640;
+ return Row(
+ children: [
+ SizedBox(
+ width: 20,
+ child: Center(
+ child: Container(
+ key: ValueKey('machines-dot-${view.id}'),
+ width: 8,
+ height: 8,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: color,
+ boxShadow: group == 'online'
+ ? [
+ BoxShadow(
+ color: color.withValues(alpha: .18),
+ spreadRadius: 3,
+ ),
+ ]
+ : null,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ flex: 5,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Flexible(
+ child: Tooltip(
+ message: view.name,
+ child: Text(
+ name,
+ key: ValueKey('super-machine-name-${view.id}'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: MachinesStyle.name(own: own),
+ ),
+ ),
+ ),
+ if (own) ...[
+ const SizedBox(width: 4),
+ Container(
+ padding: MachinesStyle.badgeInset,
+ decoration: BoxDecoration(
+ color: MachinesStyle.accent.withValues(
+ alpha: .15,
+ ),
+ borderRadius: MachinesStyle.radius,
+ ),
+ child: Text(
+ 'OWNER',
+ style: MachinesStyle.small(
+ color: MachinesStyle.selectedInk,
+ heading: true,
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ Text.rich(
+ TextSpan(
+ text: local ? 'This machine' : metadata,
+ children: local
+ ? [
+ TextSpan(
+ text:
+ ' · ${view.id.length > 8 ? view.id.substring(0, 8) : view.id}${port == null ? '' : ' · port $port'}',
+ style: MachinesStyle.identity(),
+ ),
+ if (view.problem != null || group != 'online')
+ TextSpan(
+ text: metadata.substring(
+ 'This machine'.length,
+ ),
+ ),
+ ]
+ : null,
+ ),
+ key: ValueKey('machines-metadata-${view.id}'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: MachinesStyle.body(),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ flex: narrow ? 2 : 5,
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (!narrow &&
+ group == 'online' &&
+ view.owner != null) ...[
+ Container(
+ width: 20,
+ height: 20,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: MachinesStyle.chip,
+ ),
+ child: Text(
+ view.owner!.shownName.trim().isEmpty
+ ? '?'
+ : view.owner!.shownName
+ .trim()
+ .characters
+ .first
+ .toUpperCase(),
+ style: MachinesStyle.small(
+ color: MachinesStyle.metadata,
+ ),
+ ),
+ ),
+ if (crew.length > 1)
+ Container(
+ width: 20,
+ height: 20,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: MachinesStyle.chip,
+ ),
+ child: Text(
+ '+${crew.length - 1}',
+ style: MachinesStyle.small(
+ color: MachinesStyle.metadata,
+ ),
+ ),
+ ),
+ const SizedBox(width: 8),
+ ],
+ Flexible(
+ child: Container(
+ key: ValueKey('machines-crew-${view.id}'),
+ padding: MachinesStyle.chipInset,
+ decoration: BoxDecoration(
+ color: group == 'asleep'
+ ? MachinesStyle.asleep.withValues(alpha: .12)
+ : MachinesStyle.chip,
+ borderRadius: MachinesStyle.radius,
+ ),
+ child: Text(
+ group == 'asleep' && crew.isNotEmpty
+ ? '${crew.length} asleep'
+ : '${crew.length} crew',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: MachinesStyle.small(
+ color: group == 'asleep'
+ ? MachinesStyle.asleep
+ : MachinesStyle.metadata,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ SizedBox(
+ width: narrow ? 112 : 150,
+ child: _MachineDisk(view: view),
+ ),
+ const SizedBox(width: 12),
+ // Reserve the column even when the menu is hidden so hover never moves disk values.
+ SizedBox(width: 32, child: _MachineMore(onOpen: onMore)),
+ ],
+ );
+ },
+ ),
+ );
+ }
+}
+
+class _MachineDisk extends StatelessWidget {
+ const _MachineDisk({required this.view});
+ final _MachineView view;
+
+ @override
+ Widget build(BuildContext context) {
+ final resources = view.resources;
+ final total = resources?.projectDiskTotalBytes ?? resources?.diskTotalBytes;
+ final free = resources?.projectDiskTotalBytes == null
+ ? resources?.diskFreeBytes
+ : resources?.projectDiskFreeBytes;
+ final fraction = total != null && total > 0 && free != null
+ ? (free / total).clamp(0.0, 1.0)
+ : null;
+ return Column(
+ key: ValueKey('machines-disk-${view.id}'),
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.end,
+ children: [
+ Text(
+ free == null ? 'Disk unavailable' : '${resourceBytes(free)} free',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: MachinesStyle.body(color: MachinesStyle.ink)
+ .copyWith(fontFeatures: MachinesStyle.tabular),
+ ),
+ Text(
+ total == null
+ ? 'No reading'
+ : 'of ${total >= 1000000000000 ? '${(total / 1000000000000).toStringAsFixed(total % 1000000000000 == 0 ? 0 : 1)} TB' : resourceBytes(total)}',
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: MachinesStyle.small().copyWith(
+ fontFeatures: MachinesStyle.tabular,
+ ),
+ ),
+ const SizedBox(height: 4),
+ if (fraction != null)
+ LinearProgressIndicator(
+ key: ValueKey('machines-disk-bar-${view.id}'),
+ value: fraction,
+ minHeight: 3,
+ borderRadius: MachinesStyle.radius,
+ color: fraction < .25 ? MachinesStyle.asleep : MachinesStyle.online,
+ backgroundColor: MachinesStyle.chip,
+ ),
+ ],
+ );
+ }
+}
diff --git a/desktop/test/super_tab_machine_crew_test.dart b/desktop/test/super_tab_machine_crew_test.dart
index 285a9ed10..3b56ab34d 100644
--- a/desktop/test/super_tab_machine_crew_test.dart
+++ b/desktop/test/super_tab_machine_crew_test.dart
@@ -1,7 +1,7 @@
// Machine rows show crew sessions, free disk and idle hours (#3412, anh Dee 11-05). Everything is in the Swarm state
// already (#3398 plan, Decisions): the crew are the agents on the machine with a crew record; asleep is the agent's
// asleep record, idle hours run from its `since`; moving is its movedTo; free disk is the machine's own reading. The
-// row says "3 crew · 1 asleep · 42 GB free" under its name; its details list each member. Memory store, no sign-in.
+// Manage separates crew chips and disk columns; its details list each member. Memory store, no sign-in.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/super_tabs/machines.dart';
@@ -129,10 +129,10 @@ void main() {
'a machine row shows its crew sessions, how many are asleep and its free disk',
(tester) async {
final c = await _mount(tester, _pool(), _crew());
- expect(
- _text(tester, 'super-machine-crew-m'),
- '4 crew · 2 asleep · 42 GB free',
- );
+ expect(find.text('4 crew'), findsOneWidget);
+ expect(find.text('42 GB free'), findsOneWidget);
+ await _expand(tester);
+ expect(find.textContaining('asleep · idle'), findsNWidgets(2));
await _unmount(tester, c);
},
);
@@ -178,21 +178,26 @@ void main() {
final c = await _mount(tester, _pool(), [
_agent('a5', 'Engineer 9', crew: false),
]);
- expect(_text(tester, 'super-machine-crew-m'), isNull);
+ expect(find.text('0 crew'), findsOneWidget);
await _expand(tester);
expect(find.textContaining('Crew'), findsNothing);
await _unmount(tester, c);
});
testWidgets(
- 'an offline machine keeps its crew count but drops its old free disk figure',
+ 'an offline Manage machine keeps crew and stale disk with last-seen age',
(tester) async {
final c = await _mount(
tester,
_pool(observedAt: DateTime.now().subtract(const Duration(hours: 3))),
_crew(),
);
- expect(_text(tester, 'super-machine-crew-m'), '4 crew · 2 asleep');
+ expect(find.text('4 crew'), findsOneWidget);
+ expect(find.text('42 GB free'), findsOneWidget);
+ expect(
+ find.textContaining('last seen', findRichText: true),
+ findsOneWidget,
+ );
await _unmount(tester, c);
},
);
@@ -201,13 +206,22 @@ void main() {
"free disk is the project's disk when the machine reports one, and a crew line with no reading says no disk",
(tester) async {
var c = await _mount(tester, _pool(projectDiskFree: 18e9), _crew());
+ expect(find.text('4 crew'), findsOneWidget);
+ expect(find.text('18 GB free'), findsOneWidget);
+ expect(find.text('42 GB free'), findsNothing);
expect(
- _text(tester, 'super-machine-crew-m'),
- '4 crew · 2 asleep · 18 GB free',
+ tester
+ .widget<LinearProgressIndicator>(
+ find.byKey(const ValueKey('machines-disk-bar-m')),
+ )
+ .value,
+ .09,
);
await _unmount(tester, c);
c = await _mount(tester, _pool(diskFree: null), [_agent('a2', 'Keeper')]);
- expect(_text(tester, 'super-machine-crew-m'), '1 crew');
+ expect(find.text('1 crew'), findsOneWidget);
+ expect(find.text('Disk unavailable'), findsOneWidget);
+ expect(find.byKey(const ValueKey('machines-disk-bar-m')), findsNothing);
await _unmount(tester, c);
},
);
diff --git a/desktop/test/super_tab_machines_mockups_test.dart b/desktop/test/super_tab_machines_mockups_test.dart
new file mode 100644
index 000000000..cc5845499
--- /dev/null
+++ b/desktop/test/super_tab_machines_mockups_test.dart
@@ -0,0 +1,282 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/machines.dart';
+
+import 'support/super_tab_fixture.dart';
+
+Finder key(String name) => find.byKey(ValueKey(name));
+
+Map<String, dynamic> machine(String id, String name, String owner, int age) => {
+ 'machineId': id,
+ 'name': name,
+ 'contributorId': owner,
+ 'observation': {
+ 'receivedAt': DateTime.now().millisecondsSinceEpoch - age * 1000,
+ 'resources': {
+ 'cpuPercent': 5,
+ 'diskTotalBytes': 1000000000000,
+ 'diskFreeBytes': 200000000000,
+ },
+ },
+};
+
+Future<SuperTabController> mount(
+ WidgetTester tester, {
+ ConversationServer? fixture,
+ double width = 1200,
+}) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = Size(width, 900);
+ addTearDown(tester.view.reset);
+ final server = fixture ?? ConversationServer();
+ server.state['machines'] = [
+ machine(
+ 'mine',
+ width < 500
+ ? 'A very long machine hostname that must truncate without increasing the row height'
+ : 'My Mac',
+ 'owner',
+ 0,
+ ),
+ machine('build', 'Build Box', 'peer', 0),
+ machine('sleep', 'Sleeping Mac', 'peer', 25),
+ machine('old', 'Old Linux', 'peer', 7200),
+ ];
+ server.state['agents'] = [
+ {
+ 'id': 'crew-one',
+ 'name': 'Builder',
+ 'machineId': 'mine',
+ 'harnessId': 'native-one',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ 'crew': {'role': 'Engineer', 'lane': 'desktop'},
+ },
+ ];
+ final c = server.controller();
+ await c.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(
+ body: ListenableBuilder(
+ listenable: c,
+ builder: (context, _) => SuperTabMachines(
+ controller: c,
+ onAddAgent: (_) {},
+ manage: true,
+ ticks: false,
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ addTearDown(c.dispose);
+ return c;
+}
+
+void main() {
+ testWidgets('Manage has title, counted filters and status groups', (
+ tester,
+ ) async {
+ await mount(tester);
+ expect(find.text('Machines'), findsOneWidget);
+ expect(key('machines-search'), findsOneWidget);
+ expect(find.text('All 4'), findsOneWidget);
+ expect(find.text('Online 2'), findsOneWidget);
+ expect(find.text('Asleep 1'), findsOneWidget);
+ expect(find.text('Offline 1'), findsOneWidget);
+ expect(find.text('YOUR MACHINE'), findsOneWidget);
+ expect(find.text('ONLINE · 1'), findsOneWidget);
+ expect(find.text('ASLEEP · 1'), findsOneWidget);
+ expect(find.text('OFFLINE · 1'), findsOneWidget);
+ expect(find.text('Sorted by status, then name'), findsOneWidget);
+ expect(
+ tester.getTopLeft(key('machines-line-mine')).dy,
+ lessThanOrEqualTo(160),
+ );
+ });
+
+ testWidgets(
+ 'Manage rows have leading dots, owner badge and aligned disk bars',
+ (tester) async {
+ await mount(tester);
+ expect(find.text('OWNER'), findsOneWidget);
+ for (final id in ['mine', 'build', 'sleep', 'old']) {
+ expect(tester.getSize(key('machines-line-$id')).height, 56);
+ expect(key('machines-crew-$id'), findsOneWidget);
+ expect(key('machines-disk-$id'), findsOneWidget);
+ expect(
+ tester.getTopLeft(key('machines-dot-$id')).dx,
+ lessThan(tester.getTopLeft(key('super-machine-name-$id')).dx),
+ );
+ }
+ expect(
+ tester.getTopLeft(key('machines-disk-mine')).dx,
+ tester.getTopLeft(key('machines-disk-build')).dx,
+ );
+ expect(find.text('200 GB free'), findsNWidgets(4));
+ expect(find.textContaining('last seen'), findsWidgets);
+ },
+ );
+
+ testWidgets(
+ 'search combines with status filters and recovers from no matches',
+ (tester) async {
+ await mount(tester);
+ await tester.tap(key('machines-filter-offline'));
+ await tester.pump();
+ expect(key('super-machine-row-old'), findsOneWidget);
+ expect(key('super-machine-row-mine'), findsNothing);
+ await tester.enterText(key('machines-search'), 'BUILD');
+ await tester.pump();
+ expect(
+ find.text('No machines match your search and filter.'),
+ findsOneWidget,
+ );
+ await tester.tap(key('machines-filter-all'));
+ await tester.pump();
+ expect(key('super-machine-row-build'), findsOneWidget);
+ expect(key('super-machine-row-old'), findsNothing);
+ await tester.enterText(key('machines-search'), '');
+ await tester.pump();
+ expect(key('super-machine-row-mine'), findsOneWidget);
+ },
+ );
+ testWidgets('pinned machine status updates summary and filter counts', (
+ tester,
+ ) async {
+ final server = ConversationServer();
+ final c = await mount(tester, fixture: server);
+ (server.state['machines'] as List)[0] = machine(
+ 'mine',
+ 'My Mac',
+ 'owner',
+ 25,
+ );
+ server.revision++;
+ await tester.runAsync(c.refresh);
+ await tester.pump();
+ expect(find.text('Online 1'), findsOneWidget);
+ expect(find.text('Asleep 2'), findsOneWidget);
+ expect(find.text('1 online · 2 asleep · 1 offline'), findsOneWidget);
+ });
+
+ testWidgets('crew chip expands the existing machine details', (tester) async {
+ final c = await mount(tester);
+ expect(find.text('1 crew'), findsOneWidget);
+ await tester.tap(key('machines-crew-mine'));
+ await tester.pump();
+ expect(c.isMachineExpanded('mine'), isTrue);
+ expect(key('super-machine-crew-member-mine-0'), findsOneWidget);
+ await c.flush();
+ });
+
+ testWidgets(
+ 'long names at narrow desktop width keep 56pt rows without overflow',
+ (tester) async {
+ await mount(tester, width: 420);
+ expect(tester.takeException(), isNull);
+ expect(tester.getSize(key('machines-line-mine')).height, 56);
+ },
+ );
+ testWidgets('disk total changes redraw the aligned value and bar', (
+ tester,
+ ) async {
+ final server = ConversationServer();
+ final c = await mount(tester, fixture: server);
+ final resources =
+ (server.state['machines'] as List)[1]['observation']['resources']
+ as Map;
+ resources['diskTotalBytes'] = 2000000000000;
+ server.revision++;
+ await tester.runAsync(c.refresh);
+ await tester.pump();
+ expect(
+ find.descendant(
+ of: key('machines-disk-build'),
+ matching: find.text('of 2 TB'),
+ ),
+ findsOneWidget,
+ );
+ final bar = tester.widget<LinearProgressIndicator>(
+ key('machines-disk-bar-build'),
+ );
+ expect(bar.value, .1);
+ });
+ testWidgets('duplicate hostnames include their owners', (tester) async {
+ final server = ConversationServer();
+ final c = await mount(tester, fixture: server);
+ (server.state['people'] as List).addAll([
+ {
+ 'id': 'peer',
+ 'email': '[email protected]',
+ 'username': 'dee',
+ 'role': 'collaborator',
+ },
+ {
+ 'id': 'peer-two',
+ 'email': '[email protected]',
+ 'username': 'diego',
+ 'role': 'collaborator',
+ },
+ ]);
+ final machines = server.state['machines'] as List;
+ machines[1] = machine('build', 'MacBooks-MacBook-Pro', 'peer', 0);
+ machines[2] = machine('sleep', 'MacBooks-MacBook-Pro', 'peer-two', 25);
+ server.revision++;
+ await tester.runAsync(c.refresh);
+ await tester.pump();
+ expect(
+ tester.widget<Text>(key('super-machine-name-build')).data,
+ 'MacBooks-MacBook-Pro · dee',
+ );
+ expect(find.text('MacBooks-MacBook-Pro · diego'), findsOneWidget);
+ });
+ testWidgets('loading uses the real 56pt machine row height', (tester) async {
+ final c = ConversationServer().controller();
+ addTearDown(c.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SuperTabMachines(
+ controller: c,
+ onAddAgent: (_) {},
+ manage: true,
+ ticks: false,
+ ),
+ ),
+ ),
+ );
+ expect(tester.getSize(key('machines-loading-row-0')).height, 56);
+ });
+
+ testWidgets(
+ 'keyboard reaches a machine with a visible focus ring and expands it',
+ (tester) async {
+ final c = await mount(tester);
+ var reached = false;
+ for (var i = 0; i < 16; i++) {
+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);
+ await tester.pump();
+ final target = FocusManager.instance.primaryFocus?.context
+ ?.findAncestorWidgetOfExactType<InkWell>();
+ if (target?.key == const ValueKey('super-machine-mine')) {
+ reached = true;
+ break;
+ }
+ }
+ expect(reached, isTrue);
+ final material = tester.widget<Material>(key('machines-surface-mine'));
+ expect((material.shape as RoundedRectangleBorder).side.width, 2);
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(c.isMachineExpanded('mine'), isTrue);
+ await c.flush();
+ },
+ );
+}
diff --git a/desktop/test/super_tab_machines_standard_shots_test.dart b/desktop/test/super_tab_machines_standard_shots_test.dart
index 2d0118c12..2e9c1daf0 100644
--- a/desktop/test/super_tab_machines_standard_shots_test.dart
+++ b/desktop/test/super_tab_machines_standard_shots_test.dart
@@ -3,12 +3,15 @@
import 'dart:io';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/machines.dart';
+import 'package:harness/ws/local_cli_discovery.dart';
import 'support/capture.dart';
import 'support/super_tab_fixture.dart';
+import 'super_tab_launch_test.dart' show SuperTabLaunchFixture;
final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
@@ -34,7 +37,16 @@ Map<String, dynamic> _machine(
};
void main() {
- setUpAll(() => loadCaptureFonts(shots));
+ setUpAll(() async {
+ await loadCaptureFonts(shots);
+ const mono = '/System/Library/Fonts/SFNSMono.ttf';
+ if (shots != null && Platform.isMacOS && File(mono).existsSync()) {
+ final bytes = ByteData.sublistView(await File(mono).readAsBytes());
+ await (FontLoader(
+ grid.AppType.monoFamily,
+ )..addFont(Future.value(bytes))).load();
+ }
+ });
for (final brightness in Brightness.values) {
testWidgets('Machines grouped in ${brightness.name}', (tester) async {
@@ -43,36 +55,87 @@ void main() {
grid.AppTheme.brightness.value = brightness;
addTearDown(() => grid.AppTheme.brightness.value = previous);
tester.view.devicePixelRatio = 2;
- tester.view.physicalSize = const Size(840, 1000);
+ tester.view.physicalSize = const Size(1920, 1640);
addTearDown(tester.view.reset);
+ final fixture = SuperTabLaunchFixture();
+ fixture.app.machineStates['mine'] = fixture.app.machineStates['m']!;
+ fixture.app.machineStates['mine']!.localEndpoint = LocalCliEndpoint(
+ computerId: 'capture-machine',
+ wsUri: Uri.parse('ws://127.0.0.1:18473'),
+ protocolVersion: 1,
+ terminalProtocolVersion: 1,
+ );
+ fixture.app.machineStates['mine']!.machine = fixture
+ .app
+ .machineStates['mine']!
+ .machine
+ .copyWith(name: 'scholes-mbp-14');
final server = ConversationServer();
(server.state['people'] as List).add({
'id': 'peer',
'email': '[email protected]',
+ 'username': 'dee',
'role': 'collaborator',
});
+ (server.state['people'] as List).first['username'] = 'scholes';
server.state['machines'] = [
- _machine('mine', 'My MacBook Pro', 'owner', Duration.zero),
- _machine('build', 'Build Box', 'peer', Duration.zero),
- _machine('studio', 'Studio Mac', 'peer', const Duration(seconds: 5)),
- _machine('old', 'Old Linux', 'peer', const Duration(hours: 3)),
+ _machine('mine', 'scholes-mbp-14', 'owner', Duration.zero),
+ _machine('leo', 'Leo-MacBook-Pro', 'peer', Duration.zero),
+ _machine('build', 'Mac 3', 'peer', Duration.zero),
+ _machine('darren', 'Darren-MacBook', 'peer', Duration.zero),
+ _machine('td', 'MacBook-Pro-TD', 'peer', Duration.zero),
+ _machine('huy', 'MacBookPro2021', 'peer', Duration.zero),
+ _machine('vie', 'vie-macbook-air', 'peer', Duration.zero),
+ _machine('gray', 'Gray-MacBook-Air', 'peer', Duration.zero),
+ _machine('old', "Diego's Mac", 'peer', const Duration(seconds: 25)),
+ ];
+ server.state['agents'] = [
+ for (final (id, count) in [
+ ('mine', 1),
+ ('leo', 3),
+ ('build', 17),
+ ('darren', 1),
+ ('td', 1),
+ ('huy', 1),
+ ('vie', 1),
+ ('gray', 1),
+ ('old', 1),
+ ])
+ for (var i = 0; i < count; i++)
+ {
+ 'id': '$id-$i',
+ 'name': 'Engineer $i',
+ 'machineId': id,
+ 'harnessId': 'native-$id-$i',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ 'crew': {'role': 'Engineer', 'lane': 'desktop'},
+ },
];
final c = server.controller();
await tester.runAsync(c.refresh);
addTearDown(() async {
- await tester.pumpWidget(const SizedBox());
c.dispose();
});
await tester.pumpWidget(
MaterialApp(
theme: grid.buildAppTheme(brightness: brightness),
+ debugShowCheckedModeBanner: false,
home: Scaffold(
- body: SuperTabMachines(controller: c, onAddAgent: (_) {}),
+ body: SuperTabMachines(
+ controller: c,
+ app: fixture.app,
+ onAddAgent: (_) {},
+ manage: true,
+ ticks: false,
+ ),
),
),
);
await tester.pump(const Duration(milliseconds: 100));
await captureWindow(tester, shots, 'machines-grouped-${brightness.name}');
+ await tester.pumpWidget(const SizedBox());
+ fixture.dispose();
});
}
}
diff --git a/desktop/test/super_tab_manage_page_test.dart b/desktop/test/super_tab_manage_page_test.dart
index 7d43cf637..43931c5ac 100644
--- a/desktop/test/super_tab_manage_page_test.dart
+++ b/desktop/test/super_tab_manage_page_test.dart
@@ -93,7 +93,14 @@ void main() {
'Swarm',
'Backlog',
]) {
- expect(find.text(label), findsOneWidget, reason: label);
+ expect(
+ find.descendant(
+ of: find.byType(SuperTabManageTabs),
+ matching: find.text(label),
+ ),
+ findsOneWidget,
+ reason: label,
+ );
}
await tester.tap(find.text('Swarm'));
await tester.pump();
@@ -106,7 +113,7 @@ void main() {
});
group('Machines', () {
- testWidgets('one line each: name, owner, status', (tester) async {
+ testWidgets('56pt rows name their status accessibly', (tester) async {
await show(tester);
final row = find.byKey(const ValueKey('super-machine-entry-m1'));
expect(
@@ -114,24 +121,20 @@ void main() {
findsOneWidget,
);
expect(
- find.descendant(of: row, matching: find.text('online')),
+ find.bySemanticsLabel(RegExp('Mac Studio, online')),
findsOneWidget,
);
+ expect(find.bySemanticsLabel(RegExp('Old Mac, offline')), findsOneWidget);
expect(
- find.descendant(
- of: find.byKey(const ValueKey('super-machine-entry-m2')),
- matching: find.text('offline'),
- ),
- findsOneWidget,
+ tester.getSize(find.byKey(const ValueKey('machines-line-m1'))).height,
+ 56,
);
- expect(tester.getSize(row).height, lessThanOrEqualTo(44));
});
- testWidgets('has Add machine, and no Machines heading of its own', (
- tester,
- ) async {
+ testWidgets('has Add machine and its screen title', (tester) async {
await show(tester);
expect(find.text('Add machine'), findsOneWidget);
+ expect(find.text('Machines'), findsNWidgets(2));
expect(find.byTooltip('Add machine'), findsNothing);
});
});
diff --git a/desktop/test/super_tab_quiet_polish_test.dart b/desktop/test/super_tab_quiet_polish_test.dart
index bcd68cc9d..b8bd96f09 100644
--- a/desktop/test/super_tab_quiet_polish_test.dart
+++ b/desktop/test/super_tab_quiet_polish_test.dart
@@ -343,7 +343,12 @@ void main() {
await tester.tap(_key('super-manage'));
await tester.pumpAndSettle();
final heading = tester.getTopLeft(find.text('Manage').last).dx;
- expect(tester.getTopLeft(find.text('Machines')).dx, heading);
+ // The Machines screen has its own title too; this is the tab's.
+ final machinesTab = find.descendant(
+ of: _key('super-manage-tab-machines'),
+ matching: find.text('Machines'),
+ );
+ expect(tester.getTopLeft(machinesTab).dx, heading);
await tester.tap(_key('super-manage-tab-swarm'));
await tester.pumpAndSettle();
expect(tester.getTopLeft(find.text('Name')).dx, heading);
diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dart
index bef1c1d8e..e59a780de 100644
--- a/desktop/test/super_tab_sidebar_test.dart
+++ b/desktop/test/super_tab_sidebar_test.dart
@@ -586,18 +586,17 @@ void main() {
await tester.pump();
await tester.pump();
final entry = find.byKey(const ValueKey('super-machine-entry-m'));
- expect(
- find.descendant(of: entry, matching: find.text('offline')),
- findsNothing,
+ // Manage's row says when a machine that is not online was last seen (task #3974's mockup).
+ final lastSeen = find.descendant(
+ of: entry,
+ matching: find.textContaining('last seen', findRichText: true),
);
+ expect(lastSeen, findsNothing);
await app.handleEventForTest('m', {'type': 'node_status', 'online': false});
await tester.pump();
expect(find.byKey(const ValueKey('super-machine-m')), findsOneWidget);
- expect(
- find.descendant(of: entry, matching: find.text('offline')),
- findsOneWidget,
- );
+ expect(lastSeen, findsOneWidget);
await disposeSidebar(tester, controller);
});
diff --git a/desktop/test/super_tab_team_machine_test.dart b/desktop/test/super_tab_team_machine_test.dart
index 11c5b3bb8..a4b142fe7 100644
--- a/desktop/test/super_tab_team_machine_test.dart
+++ b/desktop/test/super_tab_team_machine_test.dart
@@ -5,9 +5,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/super_tabs/agent_details.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/machines.dart';
+import 'package:harness/ws/local_cli_discovery.dart';
import 'support/super_tab_fixture.dart';
+import 'swarm_state_test.dart' show createApp;
const _offlineAge = 10 * 60 * 1000;
@@ -92,6 +95,50 @@ String? _problemText(WidgetTester tester, String id) =>
tester.widget<Text>(_problem(id)).data;
void main() {
+ testWidgets('Manage names this computer by its local port, in mono', (
+ tester,
+ ) async {
+ final app = createApp(connected: true);
+ addTearDown(app.dispose);
+ app.machineStates['m']!.localOnly = true;
+ app.machineStates['m']!.localEndpoint = LocalCliEndpoint(
+ computerId: 'test-computer',
+ wsUri: Uri.parse('ws://127.0.0.1:18473'),
+ protocolVersion: 1,
+ terminalProtocolVersion: 1,
+ );
+ final server = _swarm();
+ server.state['machines'] = [_pool('m', contributor: 'owner')];
+ final c = server.controller();
+ await c.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SuperTabMachines(
+ controller: c,
+ app: app,
+ manage: true,
+ ticks: false,
+ onAddAgent: (_) {},
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ final metadata = tester.widget<Text>(
+ find.byKey(const ValueKey('machines-metadata-m')),
+ );
+ expect(
+ metadata.textSpan!.toPlainText(),
+ contains('This machine · m · port 18473'),
+ );
+ final identity = (metadata.textSpan! as TextSpan).children!
+ .whereType<TextSpan>()
+ .first;
+ expect(identity.style!.fontFamily, grid.AppType.monoFamily);
+ await _unmount(tester, c);
+ });
+
testWidgets(
'a Mac and its Harness Team account are one row, with every agent of both under it',
(tester) async {
diff --git a/docs/plans/2026-11-06-machines-mockups-plan.md b/docs/plans/2026-11-06-machines-mockups-plan.md
new file mode 100644
index 000000000..b0460d7ae
--- /dev/null
+++ b/docs/plans/2026-11-06-machines-mockups-plan.md
@@ -0,0 +1,69 @@
+# Machines mockup alignment implementation plan
+
+> Implement natively, task by task, with failing tests committed before implementation and one independent PR review.
+
+**Goal:** Match the agreed Machines light/dark mockups without changing global navigation.
+**Architecture:** Keep the existing Machines controller, row subscriptions, menus and expansion. Give Manage its own full-width presentation, with search and status filters applied locally. Put the screen's design roles in a theme file; leave compact embedded rows intact.
+**Tech Stack:** Flutter / Dart, flutter_test, existing in-memory ConversationServer.
+**Spec:** Task #3974 attachments: machines_light.png, machines_dark.png, harness-design-standard.md.
+
+## Global Constraints
+
+- Desktop Machines only; preserve current navigation and Backlog removal.
+- 56pt rows; status, name, crew, disk and menu share aligned columns.
+- Light and dark use the same widgets with theme tokens.
+- No real account sign-in or persistence in tests.
+- No data contract changes. Design: growth, locking, migration, audience and identity N/A because only local presentation changes; reads reuse the existing machine subscriptions. Platforms: macOS, Linux, Windows, shared web rendering.
+
+## Review Focus
+
+- Long names and narrow content truncate without overflow.
+- Search combines with status filters; empty matches remain recoverable.
+- Offline/stale readings stay visible and carry their age.
+- Crew expansion and keyboard/context menus remain reachable.
+- Live status changes update filter counts and grouping.
+
+## Task 1: Full-width Machines presentation
+
+**Files:** Modify `desktop/lib/super_tabs/machines.dart`; create `desktop/lib/super_tabs/machines_manage.dart` and `desktop/lib/shared/theme/machines_style.dart`; test `desktop/test/super_tab_machines_mockups_test.dart`.
+**Interfaces:** Consume existing `_MachineView`, `_groups`, `_machine`, `toggleMachineExpanded`, `_menu`; produce Manage-only screen, toolbar and fixed-height row widgets. No public API changes.
+
+- [x] Write and commit widget tests for title/search/filter counts, leading dots, owner badge, crew chips, 56pt rows and aligned disk bars, including stale readings and long names.
+- [x] Run the new test file and record expected failures.
+- [x] Implement theme roles and Manage presentation; preserve existing compact presentation and expansion/menu behavior.
+- [x] Run new tests plus existing Machines tests and analyze changed Dart files; record red/green evidence.
+- [x] Commit implementation and push.
+
+## Task 2: Visual evidence and interaction coverage
+
+**Files:** Modify `desktop/test/super_tab_machines_standard_shots_test.dart` and `desktop/test/super_tab_machines_mockups_test.dart`.
+**Interfaces:** Capture the Manage screen using the existing screenshot helper with fake state; no production interface changes.
+
+- [x] Add failing interaction assertions for combined search/filter, no matches, crew expansion and changing live status counts.
+- [x] Run and record red; implement any remaining presentation behavior and run green.
+- [x] Capture light/dark screens with realistic fixtures, compare side by side to attachments, and check the UI style gate.
+- [x] Push final evidence, mark ready, hand off independent review/test through the Integrator.
+
+## Validation
+
+Affected widget files on macOS with Flutter 3.47.9; changed-file analysis; `python3 scripts/check-ui-style.py --only desktop/lib/super_tabs --against origin/main`; light/dark screenshots. Linux component suite comes from PR CI. Native Windows and Linux windows are not available on this Mac and must be reported as unverified.
+
+
+## Results
+
+Implemented the Manage-only presentation and regression coverage. Targeted macOS widget checks passed: 29 across mockups, standard, screenshots and Manage navigation; 81 existing Machines tests (110 total). Changed-file Flutter analysis, UI style gate and diff whitespace checks passed. Red tests were committed before implementation; replay against the original presentation produced the expected failures.
+
+Light/dark captures and side-by-side reference comparisons are attached to task #3974. Fixture values and alphabetical ordering differ from the reference. Native Windows/Linux windows and OS accessibility/theme switching remain unverified.
+
+Same 16-machine debug/offscreen redraw workload (100 updates): base median 2840µs / p95 4595µs; current median 3098µs / p95 4533µs. Reusing sorted views removed a repeated grouping pass. This is a widget microbenchmark, not native production latency; median increased 258µs while p95 decreased 62µs.
+
+Final delivery goes through independent Integrator review/test and ready-PR Linux CI; no release is part of this task.
+
+
+## Independent review fixes
+
+- Restored local Team Set up / Restart / Retry in Manage's contextual menu (8a17a35e1, 85a42644e). Dropped at the main merge for Swarm v3 (#4188): v3 removes Team accounts, so Manage offers no Team setup; the compact row keeps main's.
+- Added the local endpoint port and monospace machine ID/port; b7b9ce375 failed before the implementation in 4b0b1ad74.
+- Updated legacy Manage crew-line assertions to inspect crew chips, expanded asleep states and disk columns. Project-disk priority, missing-reading behavior and stale-reading age remain covered. Three legacy expectations were observed failing before adjustment.
+- After these fixes: 33 passed across crew, Team machine, mockup and screenshot files; earlier affected Machines and account-move checks passed (81 + 6). Changed-file analysis and UI style gate passed. Regenerated light/dark captures include port 18473.
+- The reported ci/required failure was the old draft run explicitly deferring validation until ready_for_review. No manual rerun was started; the final fix push uses automatic CI.