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
Simplify Machines rows and reveal setup instructions (#302)
Dee0e1c8671d03d
diff --git a/.github/assets/machines-panel/list.png b/.github/assets/machines-panel/list.pngnew file mode 100644index 000000000..7775b733cBinary files /dev/null and b/.github/assets/machines-panel/list.png differdiff --git a/.github/assets/machines-panel/setup.png b/.github/assets/machines-panel/setup.pngnew file mode 100644index 000000000..bcfbd94bfBinary files /dev/null and b/.github/assets/machines-panel/setup.png differdiff --git a/desktop/lib/widgets/machines_panel.dart b/desktop/lib/widgets/machines_panel.dartindex a685b092b..f141c9f5f 100644--- a/desktop/lib/widgets/machines_panel.dart+++ b/desktop/lib/widgets/machines_panel.dart@@ -1,6 +1,7 @@import 'dart:async';import 'package:flutter/material.dart';+import 'package:flutter/semantics.dart' show CustomSemanticsAction;import 'package:flutter/services.dart';import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:url_launcher/url_launcher.dart';@@ -174,6 +175,8 @@ class _MachinesPanelState extends State<_MachinesPanel>with WidgetsBindingObserver {AppNotifier get app => widget.notifier;final _panelFocus = FocusNode(debugLabel: 'Machines');+ final _setupKey = GlobalKey();+ final _serverSetupKey = GlobalKey();bool _showSetup = false, _server = false, _signingIn = false;bool _downloadFailed = false;String? _expandedMachine;@@ -387,11 +390,13 @@ class _MachinesPanelState extends State<_MachinesPanel>/// Put the keyboard back on the list once something it opened is gone, so the/// arrows and Escape work again without a click. A menu that closed BY- /// choosing an action leaves a sheet behind it; that sheet keeps the- /// keyboard.+ /// choosing an action may focus an inline field or open a sheet; either+ /// keeps the keyboard.void _restoreFocus() {WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted && !_modalOpen) _panelFocus.requestFocus();+ if (mounted && !_modalOpen && !_panelFocus.hasFocus) {+ _panelFocus.requestFocus();+ }});}@@ -517,68 +522,50 @@ class _MachinesPanelState extends State<_MachinesPanel>);}- Widget _actions(MachineState machine) {- final label = 'Options for ${machine.machine.displayName}';+ Widget _actions(+ MachineState machine, {+ required Widget child,+ VoidCallback? onEditPassword,+ }) {final controller = _rowMenu(machine.machine.machineId);- // `AppMenuItem` does not dismiss its anchor (the other menus in the app- // close theirs by hand too), and a menu left open would swallow the Escape- // that should close the panel.void choose(String action) {controller.close();unawaited(_modal(() => _machineAction(action, machine)));}- return SizedBox(- width: 32,- height: 32,- // ⚠️ A `MenuAnchor`, not a `PopupMenuButton`. A popup menu is a Navigator- // ROUTE, and this panel is an overlay entry the app inserted on top of- // the navigator — so the menu opened UNDER the list, which is why it used- // to hide the whole panel to show three items. Hiding is what a person- // saw as their machines vanishing the moment they clicked "…". A- // MenuAnchor renders through an `OverlayPortal` above its own anchor, so- // the list stays where it is and the menu sits over it, styled like every- // other menu in the app.- child: MenuAnchor(- controller: controller,- // Clear of the button it hangs from; Flutter keeps the rest on screen.- alignmentOffset: const Offset(0, 4),- onOpen: () => _openRowMenu = controller,- onClose: () {- if (identical(_openRowMenu, controller)) _openRowMenu = null;- _restoreFocus();- },- menuChildren: [- AppMenuItem(label: 'Rename', onPressed: () => choose('rename')),- if (!machine.isLocalMachine)- AppMenuItem(- label: 'Remove from account…',- onPressed: () => choose('delete'),- ),- if (machine.isLocalMachine)- AppMenuItem(- label: 'Connection settings…',- onPressed: () => choose('advanced'),- ),- ],- builder: (context, _, _) => Tooltip(- message: label,- child: IconButton(- padding: EdgeInsets.zero,- // An IconButton asks for a 48px tap target by default, which this- // 32px row slot would silently shrink; state the box it has.- constraints: const BoxConstraints.tightFor(width: 32, height: 32),- onPressed: () =>- controller.isOpen ? controller.close() : controller.open(),- icon: Icon(- LucideIcons.ellipsis,- semanticLabel: label,- size: 16,- color: grid.AppPalette.textFaint,- ),+ // Anchor the context menu inside this overlay so it stays above the list.+ return MenuAnchor(+ controller: controller,+ onOpen: () {+ if (!identical(_openRowMenu, controller)) _openRowMenu?.close();+ _openRowMenu = controller;+ },+ onClose: () {+ if (identical(_openRowMenu, controller)) _openRowMenu = null;+ _restoreFocus();+ },+ menuChildren: [+ if (onEditPassword != null)+ AppMenuItem(+ label: 'Change password',+ onPressed: () {+ controller.close();+ onEditPassword();+ },),- ),- ),+ AppMenuItem(label: 'Rename', onPressed: () => choose('rename')),+ if (!machine.isLocalMachine)+ AppMenuItem(+ label: 'Remove from account…',+ onPressed: () => choose('delete'),+ ),+ if (machine.isLocalMachine)+ AppMenuItem(+ label: 'Connection settings…',+ onPressed: () => choose('advanced'),+ ),+ ],+ child: child,);}@@ -626,15 +613,16 @@ class _MachinesPanelState extends State<_MachinesPanel>const SizedBox(height: 6),const _Detail('Back here, click Connect and enter that password.'),const SizedBox(height: 12),- _button(- _server ? 'Hide server setup' : 'Set up a server…',- () => setState(() => _server = !_server),- ),+ _button(_server ? 'Hide server setup' : 'Set up a server…', () {+ setState(() => _server = !_server);+ if (_server) _revealSetup(_serverSetupKey);+ }),if (_server) ...[const SizedBox(height: 6),const _Detail('Run these on your server over SSH:'),const SizedBox(height: 8),Container(+ key: _serverSetupKey,padding: const EdgeInsets.fromLTRB(12, 4, 12, 12),decoration: BoxDecoration(color: grid.AppPalette.textPrimary.withValues(alpha: .05),@@ -691,7 +679,7 @@ class _MachinesPanelState extends State<_MachinesPanel>: connected? 'Connected': 'Connecting…';- final options = machine.machine.isShared ? null : _actions(machine);+ Widget menu(Widget child) => _actions(machine, child: child);if (!offline &&(machine.needsLink || linking) &&_expandedMachine == id &&@@ -700,7 +688,7 @@ class _MachinesPanelState extends State<_MachinesPanel>key: ValueKey('connect-password-$id'),app: app,machine: machine,- options: options,+ menuBuilder: (child, _) => menu(child),autofocus: _focusMachine == id,onLinked: _onboardingConnect == id ? () => widget.onOpen(id) : null,resources: _resources[id],@@ -715,42 +703,25 @@ class _MachinesPanelState extends State<_MachinesPanel>return _MachineRow(key: ValueKey('machine-$id'),name: name,- annotation: offline- ? 'Offline'- : linking || !connected && !machine.needsLink- ? 'Connecting…'- : machine.machine.isShared- ? 'Shared with you'- : null,+ annotation: machine.machine.isShared ? 'Shared with you' : null,onTap: !offline && ready? () => widget.onOpen(id): canConnect? connect: null,- subtitle: Tooltip(- message: offline ? 'Open Harness on $name to bring it online.' : status,- child: _MachineDetails(machine: machine, resources: _resources[id]),- ),- action:- !offline &&- ready &&- machine.agents.isEmpty &&- !machine.machine.isShared- ? _button(- 'New harness',- () => widget.onOpen(id),- key: ValueKey('open-machine-$id'),- primary: true,- )- : canConnect+ subtitle: _machineDetails(machine, _resources[id]),+ hint: offline ? 'Open Harness on $name to bring it online.' : status,+ action: canConnect? _button('Connect',connect,key: ValueKey('connect-machine-$id'),primary: true,+ width: 120,): null,- options: options,+ menuBuilder: machine.machine.isShared ? null : menu,+ offline: offline,);}@@ -764,7 +735,9 @@ class _MachinesPanelState extends State<_MachinesPanel>machine: machine,resources: _resources[machine.machine.machineId],setupRequest: _setupRequest,- options: _actions(machine),+ menuBuilder: (child, editPassword) =>+ _actions(machine, child: child, onEditPassword: editPassword),+ onOpen: () => widget.onOpen(machine.machine.machineId),onClose: widget.onClose,);}@@ -784,9 +757,29 @@ class _MachinesPanelState extends State<_MachinesPanel>);}+ void _revealSetup(GlobalKey key) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ final target = key.currentContext;+ if (!mounted || target == null) return;+ unawaited(+ Scrollable.ensureVisible(+ target,+ alignment: 0,+ duration: const Duration(milliseconds: 180),+ curve: Curves.easeOut,+ ),+ );+ });+ }+Widget _addMachine(bool empty) {- void toggle() => setState(() => _showSetup = !_showSetup);+ void toggle() {+ setState(() => _showSetup = !_showSetup);+ if (_showSetup) _revealSetup(_setupKey);+ }+return Column(+ key: _setupKey,crossAxisAlignment: CrossAxisAlignment.stretch,children: [_MachineRow(@@ -986,21 +979,26 @@ class _MachineRow extends StatelessWidget {this.icon = LucideIcons.monitor,this.subtitle,this.action,- this.options,+ this.menuBuilder,+ this.offline = false,this.onTap,+ this.hint,});final String name;final bool local;final String? annotation;String? get _annotation => annotation ?? (local ? 'This computer' : null);final IconData icon;- final Widget? subtitle, action, options;+ final Widget? subtitle, action;+ final Widget Function(Widget child)? menuBuilder;+ final bool offline;final VoidCallback? onTap;+ final String? hint;@overrideWidget build(BuildContext context) {final row = Padding(- padding: const EdgeInsets.fromLTRB(12, 12, 4, 12),+ padding: const EdgeInsets.fromLTRB(12, 10, 4, 10),child: LayoutBuilder(builder: (context, constraints) {// At larger text sizes, keep the details legible instead of squeezing@@ -1015,7 +1013,14 @@ class _MachineRow extends StatelessWidget {children: [Row(children: [- Icon(icon, size: 22, color: grid.AppPalette.textSecondary),+ Icon(+ offline ? LucideIcons.monitorOff : icon,+ size: 22,+ semanticLabel: offline ? '$name: Offline' : null,+ color: offline+ ? grid.AppPalette.textFaint+ : grid.AppPalette.textSecondary,+ ),const SizedBox(width: 12),Expanded(child: Column(@@ -1060,13 +1065,11 @@ class _MachineRow extends StatelessWidget {const SizedBox(width: 12),action!,],- const SizedBox(width: 4),- options ?? const SizedBox(width: 32),],),if (stacked)Padding(- padding: const EdgeInsets.only(top: 10, right: 36),+ padding: const EdgeInsets.only(top: 10),child: Align(alignment: Alignment.centerRight, child: action),),],@@ -1074,19 +1077,50 @@ class _MachineRow extends StatelessWidget {},),);+ final content = Builder(+ builder: (context) {+ final menu = menuBuilder == null+ ? null+ : MenuController.maybeOf(context);+ void openMenu([Offset? position]) => menu?.open(position: position);+ final tile = onTap == null && menu == null+ ? row+ : Focus(+ skipTraversal: true,+ onKeyEvent: (_, event) {+ if (menu != null &&+ event is KeyDownEvent &&+ (event.logicalKey == LogicalKeyboardKey.contextMenu ||+ event.logicalKey == LogicalKeyboardKey.f10 &&+ HardwareKeyboard.instance.isShiftPressed)) {+ openMenu();+ return KeyEventResult.handled;+ }+ return KeyEventResult.ignored;+ },+ child: InkWell(+ onTap: onTap,+ onSecondaryTapDown: menu == null+ ? null+ : (details) => openMenu(details.localPosition),+ onLongPress: menu == null ? null : openMenu,+ borderRadius: BorderRadius.circular(8),+ child: row,+ ),+ );+ return Semantics(+ container: true,+ explicitChildNodes: true,+ customSemanticsActions: menu == null+ ? null+ : {CustomSemanticsAction(label: 'Options for $name'): openMenu},+ child: hint == null ? tile : Tooltip(message: hint!, child: tile),+ );+ },+ );return Padding(padding: const EdgeInsets.symmetric(vertical: 1),- child: Semantics(- container: true,- explicitChildNodes: true,- child: onTap == null- ? row- : InkWell(- onTap: onTap,- borderRadius: BorderRadius.circular(8),- child: row,- ),- ),+ child: menuBuilder?.call(content) ?? content,);}}@@ -1105,45 +1139,46 @@ class _MachineStatus extends StatelessWidget {);}-class _MachineDetails extends StatelessWidget {- const _MachineDetails({required this.machine, this.resources});- final MachineState machine;- final MachineResources? resources;-- String _gb(double bytes) {+Widget? _machineDetails(MachineState machine, MachineResources? resources) {+ String gb(double bytes) {final gb = bytes / (1024 * 1024 * 1024);return gb.toStringAsFixed(gb < 10 ? 1 : 0).replaceFirst(RegExp(r'\.0$'), '');}- @override- Widget build(BuildContext context) {- final reachable =- machine.nodeOnline != false &&- !machine.needsLink &&- machine.connectionStatus == ConnectionStatus.connected;+ final String details;+ if (machine.nodeOnline == false) {+ return null;+ } else if (machine.needsLink) {+ return null;+ } else if (machine.connectionStatus != ConnectionStatus.connected) {+ details = 'Connecting…';+ } else {final count =- reachable &&- (machine.agentLoadStatus == AgentLoadStatus.loaded ||- machine.agents.isNotEmpty)+ machine.agentLoadStatus == AgentLoadStatus.loaded ||+ machine.agents.isNotEmpty? machine.agents.length: null;- final stats = reachable ? resources : null;- final cpu = stats?.cpuPercent?.round();- final used = stats?.memoryUsedBytes, total = stats?.memoryTotalBytes;- final memory = used == null || total == null- ? '—'- : '${_gb(used)}/${_gb(total)} GB';- return Text(- '${count ?? '—'} ${count == 1 ? 'harness' : 'harnesses'} · CPU ${cpu == null ? '—' : '$cpu%'} · RAM $memory',- key: ValueKey('machine-stats-${machine.machine.machineId}'),- style: grid.AppType.monoMeta(- height: 1.3,- color: grid.AppPalette.textSecondary,- ),- );+ final cpu = resources?.cpuPercent?.round();+ final used = resources?.memoryUsedBytes,+ total = resources?.memoryTotalBytes;+ final values = [+ if (count != null) '$count ${count == 1 ? 'harness' : 'harnesses'}',+ if (cpu != null) 'CPU $cpu%',+ if (used != null && total != null) 'RAM ${gb(used)}/${gb(total)} GB',+ ];+ if (values.isEmpty) return null;+ details = values.join(' · ');}+ return Text(+ details,+ key: ValueKey('machine-stats-${machine.machine.machineId}'),+ style: grid.AppType.monoMeta(+ height: 1.3,+ color: grid.AppPalette.textSecondary,+ ),+ );}/// The same small, inline form for incoming passwords and outgoing links.@@ -1154,7 +1189,8 @@ class _MachinePassword extends StatefulWidget {required this.app,required this.machine,required this.onClose,- this.options,+ this.menuBuilder,+ this.onOpen,this.resources,this.autofocus = false,this.setupRequest = 0,@@ -1163,7 +1199,9 @@ class _MachinePassword extends StatefulWidget {final AppNotifier app;final MachineState machine;final VoidCallback onClose;- final Widget? options;+ final Widget Function(Widget child, VoidCallback? onEditPassword)?+ menuBuilder;+ final VoidCallback? onOpen;final MachineResources? resources;String? get machineId =>machine.isLocalMachine ? null : machine.machine.machineId;@@ -1335,15 +1373,26 @@ class _MachinePasswordState extends State<_MachinePassword> {});}- Widget _row({required Widget subtitle, Widget? action, String? annotation}) =>+ Widget _row({Widget? subtitle, Widget? action, VoidCallback? onTap}) =>_MachineRow(key: ValueKey('machine-${widget.machine.machine.machineId}'),name: widget.machine.machine.displayName,local: _local,- annotation: annotation,subtitle: subtitle,action: action,- options: widget.options,+ onTap: onTap,+ menuBuilder: widget.menuBuilder == null+ ? null+ : (child) => widget.menuBuilder!(+ child,+ _local &&+ !_loading &&+ !_busy &&+ !_editing &&+ _status?.hasPassword == true+ ? _editPassword+ : null,+ ),);@override@@ -1365,16 +1414,11 @@ class _MachinePasswordState extends State<_MachinePassword> {if (_local && !_editing) {final available = _status!.hasPassword;return _row(- annotation: available ? 'This computer · Available' : null,- subtitle: _MachineDetails(- machine: widget.machine,- resources: widget.resources,- ),- action: _button(- available ? 'Change password' : 'Set password',- _editPassword,- primary: true,- ),+ subtitle: _machineDetails(widget.machine, widget.resources),+ onTap: widget.onOpen,+ action: available+ ? null+ : _button('Set password', _editPassword, primary: true, width: 120),);}final form = Column(@@ -1532,18 +1576,22 @@ class _MachinePasswordState extends State<_MachinePassword> {),],);- return TerminalPromptKeys(- inputFocus: _input,- composing: () => _composing,- cancel: widget.onClose,- accept: () {- if (_input.hasFocus) {- _submit();- } else {- activatePromptControl();- }- },- child: _row(subtitle: form),+ return _row(+ // Keep form shortcuts inside the row's MenuAnchor, so its traversal+ // shortcuts cannot intercept Escape or remapped password controls.+ subtitle: TerminalPromptKeys(+ inputFocus: _input,+ composing: () => _composing,+ cancel: widget.onClose,+ accept: () {+ if (_input.hasFocus) {+ _submit();+ } else {+ activatePromptControl();+ }+ },+ child: form,+ ),);}}@@ -1553,6 +1601,7 @@ Widget _button(VoidCallback? onPressed, {Key? key,bool primary = false,+ double width = 140,}) {final button = TextButton(key: key,@@ -1574,7 +1623,7 @@ Widget _button(if (!primary) return button;return Builder(builder: (context) => SizedBox(- width: MediaQuery.textScalerOf(context).scale(140),+ width: MediaQuery.textScalerOf(context).scale(width),child: button,),);diff --git a/desktop/test/machines_manager_test.dart b/desktop/test/machines_manager_test.dartindex 20c95b946..2ef267d15 100644--- a/desktop/test/machines_manager_test.dart+++ b/desktop/test/machines_manager_test.dart@@ -1,3 +1,4 @@+import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';@@ -375,7 +376,7 @@ void main() {await mount(tester, app);await tester.tap(find.byKey(const ValueKey('swarm-machines-button')));await tester.pumpAndSettle();- await tester.tap(find.text('New harness'));+ await tester.tap(find.byKey(const ValueKey('machine-fresh')));await tester.pumpAndSettle();final box = tester.widget<NewHarnessForm>(find.byType(NewHarnessForm));expect(box.controller.machineId, 'fresh');@@ -418,7 +419,10 @@ void main() {await tester.pumpAndSettle();await opened;expect(find.text('Machines'), findsOneWidget);- await tester.tap(find.byTooltip('Options for Test host'));+ await tester.tap(+ find.byKey(const ValueKey('machine-m')),+ buttons: kSecondaryMouseButton,+ );await tester.pumpAndSettle();await tester.tap(find.text('Rename'));await tester.pumpAndSettle();diff --git a/desktop/test/machines_panel_test.dart b/desktop/test/machines_panel_test.dartindex 9994b8ded..91aec31d6 100644--- a/desktop/test/machines_panel_test.dart+++ b/desktop/test/machines_panel_test.dart@@ -2,6 +2,7 @@ import 'dart:async';import 'dart:io';import 'dart:ui' as ui;+import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';@@ -21,6 +22,7 @@ import 'package:harness/state/workspace_onboarding.dart';import 'package:harness/widgets/machines_panel.dart';import 'package:harness/widgets/toolbar_icon.dart';import 'package:harness/widgets/workspace_welcome.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';import 'keymap_host_test.dart' show MemoryKeymap, key;import 'support/password_cli.dart';@@ -236,14 +238,35 @@ void main() {await tester.pumpAndSettle();}- Future<void> capture(WidgetTester tester, String name) async {+ Future<void> options(WidgetTester tester, String id) async {+ final row = find.byKey(ValueKey('machine-$id'));+ await tester.ensureVisible(row);+ await tester.tap(row, buttons: kSecondaryMouseButton);+ await tester.pumpAndSettle();+ }++ Future<void> changePassword(WidgetTester tester) async {+ await options(tester, 'local');+ await tap(tester, find.text('Change password'));+ }++ Future<void> capture(+ WidgetTester tester,+ String name, {+ bool panelOnly = false,+ }) async {final dir = Platform.environment['HARNESS_MACHINES_CAPTURE_DIR'];if (dir == null) return;await tester.runAsync(() async {- final image =- await (captureKey.currentContext!.findRenderObject()- as RenderRepaintBoundary)- .toImage(pixelRatio: 2);+ final boundary =+ captureKey.currentContext!.findRenderObject()+ as RenderRepaintBoundary;+ final image = panelOnly+ ? await (boundary.debugLayer! as OffsetLayer).toImage(+ tester.getRect(find.byKey(const ValueKey('machines-panel'))),+ pixelRatio: 2,+ )+ : await boundary.toImage(pixelRatio: 2);final bytes = await image.toByteData(format: ui.ImageByteFormat.png);Directory(dir).createSync(recursive: true);File('$dir/$name.png').writeAsBytesSync(bytes!.buffer.asUint8List());@@ -256,6 +279,85 @@ void main() {const ValueKey('connect-password-remote-input'),);+ testWidgets('a full machine list stays quiet and reveals all setup steps', (+ tester,+ ) async {+ cli.status = const RemotePasswordStatus(hasPassword: true);+ app.add('rig', '2x 4090 Rig');+ app.add('empty', '1x 4090 Rig', linked: true);+ app.add('home', 'iMac – Home', linked: true);+ app.add('office', 'iMac – Office', linked: true);+ app.add('laptop', 'MacBook Pro', online: false);+ app.add('server', 'Build server', online: false);+ for (final (id, count, cpu, memory) in [+ ('local', 159, 18.0, 57.0),+ ('home', 68, 9.0, 54.0),+ ('office', 67, 11.0, 56.0),+ ]) {+ app.stateOf(id)!.agents = [+ for (var i = 0; i < count; i++) Agent(id: '$id-$i', name: 'Work $i'),+ ];+ app.resourceValues[id] = MachineResources(+ cpuPercent: cpu,+ memoryUsedBytes: memory * 1024 * 1024 * 1024,+ memoryTotalBytes: 64 * 1024 * 1024 * 1024,+ );+ }+ await mount(tester, size: const Size(1000, 760));+ expect(find.text('Change password'), findsNothing);+ expect(find.text('New harness'), findsNothing);+ expect(find.textContaining('Available'), findsNothing);+ expect(find.text('Offline'), findsNothing);+ expect(find.textContaining('—'), findsNothing);+ expect(find.byIcon(LucideIcons.ellipsis), findsNothing);+ expect(find.byIcon(LucideIcons.monitorOff), findsNWidgets(2));+ expect(find.text('Connect'), findsOneWidget);+ expect(find.byKey(const ValueKey('machine-stats-rig')), findsNothing);+ expect(find.text('0 harnesses'), findsOneWidget);+ await capture(tester, 'machines-clean-list', panelOnly: true);++ await tap(tester, find.byKey(const ValueKey('add-machine')));+ final panel = find.byKey(const ValueKey('machines-panel'));+ void visible(Finder target) {+ expect(target.hitTestable(), findsOneWidget);+ final bounds = tester.getRect(target);+ expect(bounds.top, greaterThan(tester.getRect(panel).top + 50));+ expect(bounds.bottom, lessThan(tester.getRect(panel).bottom));+ }++ visible(find.text('1. Open Harness on your other computer.'));+ visible(find.text('Download Harness'));+ visible(find.text('2. Open Machines and choose Set password.'));+ visible(find.text('Set up a server…'));+ await capture(tester, 'machines-clean-setup', panelOnly: true);++ await tap(tester, find.text('Set up a server…'));+ visible(find.byTooltip('Copy commands'));+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ });++ testWidgets(+ 'keyboard opens the context menu and the local row opens its harnesses',+ (tester) async {+ cli.status = const RemotePasswordStatus(hasPassword: true);+ await mount(tester);+ Focus.of(tester.element(find.text('M2'))).requestFocus();+ await tester.pump();+ await key(tester, LogicalKeyboardKey.f10, shift: true);+ await tester.pumpAndSettle();+ expect(find.text('Change password'), findsOneWidget);+ expect(opened, isNull);+ await tap(tester, find.text('Change password'));+ expect(tester.widget<TextField>(localInput).focusNode!.hasFocus, isTrue);+ await tap(tester, find.text('Cancel'));+ await tap(tester, find.text('M2'));+ expect(opened, 'local');+ expect(find.byKey(const ValueKey('machines-panel')), findsNothing);+ await tester.pumpWidget(const SizedBox());+ },+ );+testWidgets('toolbar panel is anchored, resizes, and closes outside without dimming work',(tester) async {@@ -405,10 +507,11 @@ void main() {await key(tester, LogicalKeyboardKey.enter);await tester.pumpAndSettle();expect(cli.passwords, ['fixture reusable password']);- expect(find.textContaining('This computer · Available'), findsOneWidget);+ expect(cli.status.hasPassword, isTrue);+ expect(find.textContaining('Available'), findsNothing);expect(localInput, findsNothing);await capture(tester, 'available-machine');- await tap(tester, find.text('Change password'));+ await changePassword(tester);expect(tester.widget<TextField>(localInput).controller!.text, isEmpty);await tester.pumpWidget(const SizedBox());},@@ -457,7 +560,7 @@ void main() {tester.widget<Text>(find.byKey(const ValueKey('machine-stats-remote'))).data,- '0 harnesses · CPU — · RAM —',+ '0 harnesses',);expect(cli.connections, [('remote', 'fixture wrong password'),@@ -469,7 +572,7 @@ void main() {reason: 'Connecting out never requires setting a local password',);await capture(tester, 'connected-machine');- await tap(tester, find.text('New harness'));+ await tap(tester, find.byKey(const ValueKey('machine-remote')));expect(opened, 'remote');expect(find.text('Machines'), findsNothing);await tester.pumpWidget(const SizedBox());@@ -492,7 +595,8 @@ void main() {expect(find.text('Saving password…'), findsOneWidget);cli.setReply!.complete(const RemotePasswordSetResult());await tester.pumpAndSettle();- expect(find.textContaining('This computer · Available'), findsOneWidget);+ expect(cli.status.hasPassword, isTrue);+ expect(find.textContaining('Available'), findsNothing);expect(cli.passwords, hasLength(1));await tester.pumpWidget(const SizedBox());},@@ -550,7 +654,7 @@ void main() {tester.widget<Text>(find.byKey(const ValueKey('machine-stats-remote'))).data,- '0 harnesses · CPU — · RAM —',+ '0 harnesses',);expect(cli.connections, hasLength(1));await tester.pumpWidget(const SizedBox());@@ -592,7 +696,8 @@ void main() {(tester) async {app.add('remote', 'Mac mini', online: false);await mount(tester);- expect(find.textContaining('Offline'), findsOneWidget);+ expect(find.textContaining('Offline'), findsNothing);+ expect(find.byIcon(LucideIcons.monitorOff), findsOneWidget);expect(find.byTooltip('Open Harness on Mac mini to bring it online.'),findsOneWidget,@@ -694,12 +799,14 @@ void main() {.complete(const MachineResources(cpuPercent: 92));await tester.pumpAndSettle();final stats = find.byKey(const ValueKey('machine-stats-remote'));- expect(tester.widget<Text>(stats).data, '— harnesses · CPU — · RAM —');+ expect(stats, findsNothing);+ expect(find.byIcon(LucideIcons.monitorOff), findsOneWidget);+ expect(find.text('Offline'), findsNothing);app.resourceValues['remote'] = const MachineResources(cpuPercent: 7);app.stateOf('remote')!.nodeOnline = true;app.notifyListeners();await tester.pumpAndSettle();- expect(tester.widget<Text>(stats).data, '0 harnesses · CPU 7% · RAM —');+ expect(tester.widget<Text>(stats).data, '0 harnesses · CPU 7%');final reads = app.resourceReadIds.length;await key(tester, LogicalKeyboardKey.escape);await tester.pumpAndSettle();@@ -717,7 +824,7 @@ void main() {(tester) async {await mount(tester);final reads = app.resourceReadIds.length;- await tap(tester, find.byTooltip('Options for M2'));+ await options(tester, 'local');await tap(tester, find.text('Connection settings…'));await tester.pump(const Duration(minutes: 1));expect(app.resourceReadIds, hasLength(reads));@@ -743,7 +850,7 @@ void main() {oldReply.complete(const MachineResources(cpuPercent: 99));await tester.pumpAndSettle();final stats = find.byKey(const ValueKey('machine-stats-remote'));- expect(tester.widget<Text>(stats).data, '0 harnesses · CPU 7% · RAM —');+ expect(tester.widget<Text>(stats).data, '0 harnesses · CPU 7%');expect(app.resourceReadIds.where((id) => id == 'remote'), hasLength(2));await tester.pumpWidget(const SizedBox());},@@ -809,12 +916,11 @@ void main() {testWidgets('the row menu opens OVER the list, never instead of it', (tester,) async {- // The menu used to be a Navigator route, which an overlay panel sits above,- // so the panel hid itself to let three items show — and a person saw their- // machines vanish the moment they clicked "…".+ // A secondary click opens the context menu above the anchored panel.+ // It must not navigate to the machine or hide the rest of the list.app.add('remote', 'Mac mini');await mount(tester);- await tap(tester, find.byTooltip('Options for Mac mini'));+ await options(tester, 'remote');expect(find.text('Rename'), findsOneWidget);expect(find.byKey(const ValueKey('machines-panel')),@@ -841,16 +947,16 @@ void main() {(tester) async {app.add('remote', 'Mac mini');await mount(tester);- await tap(tester, find.byTooltip('Options for Mac mini'));+ await options(tester, 'remote');await key(tester, LogicalKeyboardKey.escape);await tester.pumpAndSettle();expect(find.text('Mac mini'), findsOneWidget);- await tap(tester, find.byTooltip('Options for Mac mini'));+ await options(tester, 'remote');await tap(tester, find.text('Remove from account…'));expect(app.deletes, isEmpty);await tap(tester, find.text('Cancel'));expect(find.text('Mac mini'), findsOneWidget);- await tap(tester, find.byTooltip('Options for Mac mini'));+ await options(tester, 'remote');await tap(tester, find.text('Remove from account…'));await tap(tester, find.byKey(const Key('machine-delete-confirm')));expect(app.deletes, ['remote']);@@ -865,7 +971,7 @@ void main() {(tester) async {cli.status = const RemotePasswordStatus(hasPassword: true);await mount(tester);- await tap(tester, find.text('Change password'));+ await changePassword(tester);await key(tester, LogicalKeyboardKey.enter);await tester.pumpAndSettle();expect(find.text('Enter a password.'), findsOneWidget);@@ -899,7 +1005,7 @@ void main() {expect(find.text('Use a password on one line.'), findsNothing);await tap(tester, find.text('Cancel'));expect(localInput, findsNothing);- await tap(tester, find.text('Change password'));+ await changePassword(tester);expect(tester.widget<TextField>(localInput).controller!.text, isEmpty);// The platform's Done action uses the same validation and submission.await tester.enterText(localInput, 'fixture replacement');@@ -918,7 +1024,7 @@ void main() {expect(find.text('Status unavailable'), findsOneWidget);cli.status = const RemotePasswordStatus(hasPassword: true);await tap(tester, find.text('Try again'));- await tap(tester, find.text('Change password'));+ await changePassword(tester);cli.setReply = Completer<RemotePasswordSetResult>();await tester.enterText(localInput, 'fixture replacement');await tap(tester, find.text('Save'));@@ -933,6 +1039,8 @@ void main() {expect(find.text('Save unavailable'), findsOneWidget);expect(localInput, findsOneWidget);await tap(tester, find.text('Cancel'));+ expect(find.text('Change password'), findsNothing);+ await options(tester, 'local');expect(find.text('Change password'), findsOneWidget);expect(cli.passwords, ['fixture replacement']);await tester.pumpWidget(const SizedBox());@@ -1070,7 +1178,7 @@ void main() {app.resourceValues.clear();await tester.pump(const Duration(seconds: 5));await tester.pump();- expect(find.text('0 harnesses · CPU — · RAM —'), findsOneWidget);+ expect(find.text('0 harnesses'), findsOneWidget);final reads = app.resourceReadIds.length;for (var i = 0; i < 5; i++) {await tester.pump(const Duration(seconds: 5));diff --git a/desktop/test/toolbar_onboarding_test.dart b/desktop/test/toolbar_onboarding_test.dartindex 4e3fc3c09..3a5db6a28 100644--- a/desktop/test/toolbar_onboarding_test.dart+++ b/desktop/test/toolbar_onboarding_test.dart@@ -408,7 +408,11 @@ void main() {await tap(tester, find.text('Save'));}expect(app.password, '123456');- expect(find.text('Change password'), findsOneWidget);+ expect(find.text('Set password'), findsNothing);+ expect(+ find.byKey(const ValueKey('make-available-password')),+ findsNothing,+ );expect(journey.completed(OnboardingStep.machines), isFalse);await tester.pumpWidget(const SizedBox());},