Skip to content

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

feat: enhance swarm resource preview and workspace welcome with new actions and settings integration

Dev jacobbd70906348da
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index 1492e724a..63a6e2ece 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -146,6 +146,19 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
widget.onRefocus();
}
+ bool _isOnline(MachineState machine) =>
+ machine.nodeOnline != false &&
+ !machine.needsLink &&
+ machine.connectionStatus == ConnectionStatus.connected;
+
+ /// Scope the picker to this machine's harnesses — the same list Enter on
+ /// a project/machine group opens, so Rename/Delete are not the only doors.
+ void _viewMachine() {
+ final selected = row;
+ if (selected == null || !widget.search.scopeToGroup(selected.id)) return;
+ widget.onRefocus();
+ }
+
void _focusActions({bool last = false}) {
final selectedId = row?.id;
if (selectedId == null) return;
@@ -435,6 +448,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
title:
{
'picker.resource_toggle',
+ 'picker.resource_view',
'picker.resource_rename',
'picker.resource_settings',
'picker.resource_remove',
@@ -829,6 +843,12 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
if (machine == null) return [];
final secondary = _secondaryActions();
return [
+ if (_isOnline(machine))
+ _ResourceAction(
+ 'View',
+ _viewMachine,
+ command: 'picker.resource_view',
+ ),
...secondary.where((a) => a.command == 'picker.resource_connect'),
...secondary.where((a) => a.command == 'picker.resource_settings'),
if (!machine.machine.isShared)
@@ -1278,11 +1298,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
Widget _machinePreview() {
final machine = app.stateOf(row!.machineId!);
if (machine == null) return _details([row!.title, 'Unavailable']);
- final online =
- machine.nodeOnline != false &&
- !machine.needsLink &&
- machine.connectionStatus == ConnectionStatus.connected;
- final resources = online
+ final resources = _isOnline(machine)
? widget.search.machineResources[row!.machineId]
: null;
final status = machine.nodeOnline == false
diff --git a/desktop/lib/widgets/workspace_welcome.dart b/desktop/lib/widgets/workspace_welcome.dart
index 36bbb60e9..3d595f5c0 100644
--- a/desktop/lib/widgets/workspace_welcome.dart
+++ b/desktop/lib/widgets/workspace_welcome.dart
@@ -1,5 +1,6 @@
import 'dart:async';
+import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
@@ -149,6 +150,8 @@ class _WorkspaceWelcomeState extends State<WorkspaceWelcome> {
('models.list', 'Deploy a local model'),
('machines.list', 'Manage all your machines'),
('app.store', 'Build beyond code'),
+ // Desktop reaches Settings from the native app menu; the browser has none.
+ if (kIsWeb) ('app.settings', 'Open settings'),
];
@override
diff --git a/desktop/test/resource_picker_test.dart b/desktop/test/resource_picker_test.dart
index 456a535a6..730182da4 100644
--- a/desktop/test/resource_picker_test.dart
+++ b/desktop/test/resource_picker_test.dart
@@ -421,29 +421,36 @@ void main() {
matching: find.byType(TextButton),
),
);
- expect(button('picker.resource_settings').focusNode!.hasFocus, isTrue);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
await key(tester, LogicalKeyboardKey.arrowRight);
- expect(button('picker.resource_rename').focusNode!.hasFocus, isTrue);
- await key(tester, LogicalKeyboardKey.arrowLeft);
expect(button('picker.resource_settings').focusNode!.hasFocus, isTrue);
+ await key(tester, LogicalKeyboardKey.arrowLeft);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
await key(tester, LogicalKeyboardKey.arrowDown);
- expect(button('picker.resource_rename').focusNode!.hasFocus, isTrue);
- await key(tester, LogicalKeyboardKey.arrowUp);
expect(button('picker.resource_settings').focusNode!.hasFocus, isTrue);
+ await key(tester, LogicalKeyboardKey.arrowUp);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
await key(tester, LogicalKeyboardKey.keyJ, ctrl: true);
- expect(button('picker.resource_rename').focusNode!.hasFocus, isTrue);
- await key(tester, LogicalKeyboardKey.keyK, ctrl: true);
expect(button('picker.resource_settings').focusNode!.hasFocus, isTrue);
+ await key(tester, LogicalKeyboardKey.keyK, ctrl: true);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
expect(controller.selected!.id, selectedId);
expect(controller.managing, isTrue);
await key(tester, LogicalKeyboardKey.tab);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
await key(tester, LogicalKeyboardKey.tab, shift: true);
- expect(button('picker.resource_settings').focusNode!.hasFocus, isTrue);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
await key(tester, LogicalKeyboardKey.escape);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
expect(controller.selected!.id, selectedId);
await capture(tester, 'machine-controls');
+ await key(tester, LogicalKeyboardKey.enter);
+ expect(button('picker.resource_view').focusNode!.hasFocus, isTrue);
+ await key(tester, LogicalKeyboardKey.enter);
+ expect(controller.canGoBack, isTrue);
+ expect(controller.title, startsWith('Harnesses · '));
+ expect(controller.managing, isFalse);
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
await tester.enterText(field, ':Qwen3.8-27B');
await tester.pumpAndSettle();
diff --git a/desktop/test/toolbar_onboarding_test.dart b/desktop/test/toolbar_onboarding_test.dart
index 73e3f686f..c935c2a10 100644
--- a/desktop/test/toolbar_onboarding_test.dart
+++ b/desktop/test/toolbar_onboarding_test.dart
@@ -458,8 +458,11 @@ void main() {
await tester.pumpAndSettle();
expect(app.connections, ['source']);
expect(resourceScope('@'), findsOneWidget);
+ // Connect hands focus to View, which lists that machine's harnesses.
await key(tester, LogicalKeyboardKey.enter);
- expect(resourceScope('@'), findsOneWidget);
+ expect(resourceScope('@'), findsNothing);
+ expect(find.text('Existing work'), findsWidgets);
+ expect(find.text('Work on this computer'), findsNothing);
expect(app.panes, isEmpty);
await tester.enterText(resourceField, 'Existing work');
await tester.pumpAndSettle();
@@ -469,6 +472,8 @@ void main() {
expect(app.panes.single.agentId, 'existing');
expect(journey.completed(OnboardingStep.machines), isFalse);
expect(tester.takeException(), isNull);
+ // Flush the scoped list's session-preview repaint debounce.
+ await tester.pump(const Duration(milliseconds: 100));
await tester.pumpWidget(const SizedBox());
},
);
diff --git a/desktop/test/web/browser_workspace_test.dart b/desktop/test/web/browser_workspace_test.dart
index 44b5e7237..93f468c8b 100644
--- a/desktop/test/web/browser_workspace_test.dart
+++ b/desktop/test/web/browser_workspace_test.dart
@@ -13,6 +13,7 @@ import 'package:harness/core/test_run.dart';
import 'package:harness/core/viewer_mode.dart';
import 'package:harness/screens/swarm_screen.dart';
import 'package:harness/screens/login_screen.dart';
+import 'package:harness/settings/settings_screen.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
import 'package:harness/state/grid_pictures.dart';
@@ -290,6 +291,36 @@ void main() {
app.dispose();
});
+ testWidgets('the welcome page offers Settings on Alt+comma', (tester) async {
+ final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession())
+ ..newSwarm(newTabPage: true);
+ tester.view.physicalSize = const Size(1280, 800);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: SwarmScreen(notifier: app),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 200));
+ final row = find.byKey(const ValueKey('welcome-app.settings'));
+ expect(row, findsOneWidget);
+ expect(
+ find.descendant(of: row, matching: find.textContaining('Alt+,')),
+ findsOneWidget,
+ );
+ expect(find.byType(SettingsScreen), findsNothing);
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.altLeft);
+ await tester.sendKeyEvent(LogicalKeyboardKey.comma);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(find.byType(SettingsScreen), findsOneWidget);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox.shrink());
+ app.dispose();
+ });
+
testWidgets(
'machine commands and link requests use the same browser picker',
(tester) async {