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.

Desktop: Sign in in the tab row, and a sign-in page as onboarding's last step (#1188)

Deee30a9e8c4ad1
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index ff82bf467..f1685b4ba 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -58,6 +58,16 @@ FLUTTER_TEST=1 flutter test -d macos --no-pub integration_test/native_terminal_e
FLUTTER_TEST=1 flutter test -d macos --no-pub integration_test/native_workspace_e2e_test.dart
```
+`integration_test/sign_in_native_test.dart` walks a new computer from the tour to the sign-in page
+and on to the workspace, in the real window. AppKit draws the tab row, so no Flutter test can see
+or press it: run `python3 tool/native_driver.py <dir> <shots> &` beside it and pass
+`HARNESS_NATIVE_DRIVER_DIR=<dir> HARNESS_NATIVE_SHOTS_DIR=<shots>`, and the driver reads and
+presses the real title-bar controls through accessibility and photographs that one window (the
+terminal needs Accessibility and Screen Recording). Without it, or with the screen locked, the
+same presses arrive as the row's channel actions. ⚠️ The row is in the window only after
+`invokeMethod('configure')` on `harness/swarm_tabs`, as `configureDesktopWindow` does at launch; a
+native test that skips it has a plain title bar.
+
Both use in-memory state and fake terminal traffic; the workspace fixture also simulates agent
creation and machine-link responses. They refuse to run without `FLUTTER_TEST=1`, which disables
production-only pollers and persistence. The workspace fixture exercises the native macOS titlebar; its injected
@@ -183,6 +193,19 @@ The native desktop target uses the CLI for cloud access and SSO tokens:
client it was issued to, so the session keeps the client the backend's exchange REPORTS — never
the one it asked for, since an older backend exchanges as its configured client and names none
— and every refresh names it again (`AuthSession.ssoClientId`, the CLI's `session.json`).
+ **A computer new to Harness is asked once to sign in, between setup and its first workspace**
+ (`widgets/sign_in_step.dart`, `AppNotifier.signInStepShowing`; design
+ `../docs/research/2026-10-08-onboarding-redesign/index.html` 1b, owner 2026-10-11): what an
+ account adds in four lines, Continue with Google and Continue with Apple, and under them Skip
+ and Continue with email (no provider: the sign-in page's own chooser). It follows the setup
+ tour — or the setup screen, where there was no tour — only when setup installed the CLI on a
+ computer that never had it and nobody is signed in; the first workspace keeps building behind
+ it. ⚠️ The page does not change while the browser is open, so its controls stay live
+ (`signInFromStep`): the same one again reopens its page, another one cancels and switches.
+ Afterwards the same sign-in is the tab row's last control: **Sign in** as a guest, the account's
+ initial once signed in, whose menu is `widgets/account_menu.dart`
+ (`design/workspace-status-bar.md`). The sign-in sheet carries Continue with email too, except
+ in a short window, where one more row pushes the expired-session line off screen.
Sign-out owns its CLI process, checks its exit, and terminates it on timeout. `AppNotifier` joins
repeated sign-out requests and blocks another sign-in until credential and connection cleanup
finish; failure offers keyboard-focused Retry sign out. Development fixture disconnects never
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 01514a163..aba55066a 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -10,7 +10,7 @@ Follow the [desktop design system](desktop-design-system.md) and
illustrate data and interaction rules, not the current tab geometry.
```text
-api ? web ⠹ blender ✓ + Search Bell (✿ Harness Store)
+api ? web ⠹ blender ✓ + Search Bell Devices Store (Sign in)
panes
@@ -18,6 +18,22 @@ Harnesses 118 Machines 3 Models 4 [Claude icon] 68% [Codex icon] 18%
M2 > project > branch > #439
```
+The top row's right end reads like a browser's toolbar (owner, 2026-10-11):
+Search, the bell (where this app draws the row; on a Mac it is in the menu
+bar), Devices and Harness Store are icons side by side, each named by its
+tooltip, and the row's last control is the account's. While this computer
+holds no account that is **Sign in**, the only control in the row with a word
+and a fill; it opens the sign-in over the workspace. Signed in, the same place
+is the account's initial in a circle, and a click opens a short menu: who is
+signed in, then Add Phone (until the account has a phone), Customize Harness,
+Notifications, Settings and Sign out, each opening what the app already has.
+Nothing is drawn between the icons and the account control; `controlGap`
+separates them. A narrow window drops Devices first; the account control
+always stays. A viewer build (the browser) draws none of this. Flutter draws it
+with `WorkspaceStoreButton`, `WorkspaceSignInButton` and `WorkspaceAvatarButton`,
+AppKit with `SwarmStoreButton` and `SwarmAccountButton`; the menu is
+`widgets/account_menu.dart` on both. Run `workspace_account_test.dart`.
+
The context follows the focused pane. The branch stays clickable in the
footer; pane headers do not repeat it. An empty New Tab and the first welcome
screen keep the footer visible, including zero counts, so Machines and Models
diff --git a/desktop/integration_test/sign_in_native_test.dart b/desktop/integration_test/sign_in_native_test.dart
new file mode 100644
index 000000000..35e89b77b
--- /dev/null
+++ b/desktop/integration_test/sign_in_native_test.dart
@@ -0,0 +1,613 @@
+import 'dart:async';
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:integration_test/integration_test.dart';
+import 'package:window_manager/window_manager.dart';
+
+import 'package:harness/api/api_client.dart';
+import 'package:harness/app_shell.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/auth/cli_login.dart';
+import 'package:harness/auth/sign_in_provider.dart';
+import 'package:harness/bootstrap/environment_provisioner.dart';
+import 'package:harness/core/config.dart';
+import 'package:harness/core/test_run.dart';
+import 'package:harness/screens/login_screen.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/settings/settings_screen.dart';
+import 'package:harness/settings/settings_section.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/swarm_catalog.dart';
+import 'package:harness/widgets/setup_tour.dart';
+import 'package:harness/widgets/sign_in_step.dart';
+
+import '../test/support/capture.dart';
+import '../test/support/guest_app.dart';
+import '../test/swarm_state_test.dart' show MemoryStore;
+
+/// The sign-in step and the tab row's account control in the real macOS
+/// window: a computer new to Harness goes from the tour to the sign-in page,
+/// and from there — by Skip, or by an account — to a workspace whose native
+/// title bar ends in Sign in or in the account's initial.
+///
+/// Run with FLUTTER_TEST=1 (`--no-enable-impeller` on Intel). Setup, the CLI's
+/// sign-in and the account are fixtures: nothing is installed, no browser
+/// opens, and no real Harness home or daemon is read.
+///
+/// AppKit draws the tab row, so nothing here can see or press it. With
+/// `HARNESS_NATIVE_DRIVER_DIR` set, a driver outside the app
+/// (`tool/native_driver.py`) reads and presses the native controls through
+/// accessibility and photographs this window, and this asks it to. Without
+/// one — or with the screen locked, when macOS shows a driver neither the
+/// controls nor the window — a press arrives as the action AppKit's row sends
+/// for it, so everything on this side of the channel is still exercised, and
+/// the row's own checks are `tool/check_swarm_titlebar.sh`'s.
+/// `HARNESS_NATIVE_SHOTS_DIR` is where a picture goes when the window cannot
+/// be photographed.
+final _driverDir = Platform.environment['HARNESS_NATIVE_DRIVER_DIR'] ?? '';
+final _shotsDir = Platform.environment['HARNESS_NATIVE_SHOTS_DIR'];
+bool get _driven => _driverDir.isNotEmpty;
+var _requests = 0;
+
+/// One request to the driver, pumping frames while it works: a native press
+/// comes back to this app as an event it has to be awake for.
+Future<Map<String, dynamic>> _native(
+ WidgetTester tester,
+ String command, [
+ String argument = '',
+]) async {
+ final id = (_requests++).toString().padLeft(3, '0');
+ File('$_driverDir/req-$id.tmp')
+ .writeAsStringSync(jsonEncode({'cmd': command, 'arg': argument}));
+ File('$_driverDir/req-$id.tmp').renameSync('$_driverDir/req-$id.json');
+ final answer = File('$_driverDir/res-$id.json');
+ for (var i = 0; i < 400; i++) {
+ await tester.pump(const Duration(milliseconds: 50));
+ if (answer.existsSync()) {
+ return jsonDecode(answer.readAsStringSync()) as Map<String, dynamic>;
+ }
+ }
+ fail('The native driver did not answer "$command $argument".');
+}
+
+Future<void> _shot(WidgetTester tester, String name) async {
+ if (!_driven) return;
+ // What is on screen now, not a frame behind it.
+ await tester.pump(const Duration(milliseconds: 250));
+ final answer = await _native(tester, 'shot', name);
+ if (answer['ok'] == true) return;
+ // A locked or sleeping screen: macOS photographs no window then. A picture
+ // is an aid, not a check, so what this app itself drew is saved instead —
+ // without AppKit's title bar, which only the window's own picture has.
+ debugPrint('No window screenshot for $name: $answer');
+ await captureWindow(tester, _shotsDir, '$name-flutter-only');
+}
+
+/// The native buttons of this window by name, as accessibility reports them.
+Future<Map<String, Map<String, dynamic>>> _nativeButtons(
+ WidgetTester tester,
+) async {
+ final answer = await _native(tester, 'list');
+ return {
+ for (final button in (answer['buttons'] as List).cast<Map>())
+ if ((button['label'] as String).isNotEmpty)
+ button['label'] as String: {
+ ...Map<String, dynamic>.from(button),
+ 'window': answer['window'],
+ },
+ };
+}
+
+/// Whether AppKit's row can be read and pressed from outside right now: a
+/// driver is answering and the screen is not locked.
+Future<bool> _rowReachable(WidgetTester tester) async {
+ if (!_driven) return false;
+ final answer = await _native(tester, 'locked');
+ if (answer['locked'] == true) {
+ debugPrint(
+ 'The screen is locked: the native row is pressed through its channel, '
+ 'and its geometry is not read.',
+ );
+ return false;
+ }
+ return true;
+}
+
+/// A press on [label] in AppKit's row: the real control, through
+/// accessibility, when it can be reached; else [action], which is what that
+/// control sends this app when it is pressed.
+Future<void> _press(
+ WidgetTester tester, {
+ required bool reachable,
+ required String label,
+ required String action,
+}) async {
+ if (reachable) {
+ final pressed = await _native(tester, 'press', label);
+ expect(pressed['pressed'], isTrue, reason: '$pressed');
+ return;
+ }
+ await tester.binding.defaultBinaryMessenger.handlePlatformMessage(
+ 'harness/swarm_tabs',
+ const StandardMethodCodec().encodeMethodCall(MethodCall(action)),
+ (_) {},
+ );
+}
+
+/// A native control's own left and right edge. Accessibility reports each
+/// frame a point larger on every side than the view's.
+double _left(Map button) => (button['x'] as num) + 1.0;
+double _right(Map button) => (button['x'] as num) + (button['w'] as num) - 1.0;
+double _width(Map button) => _right(button) - _left(button);
+
+/// Within a point: those frames land on half points.
+Matcher _about(num value) => moreOrLessEquals(value.toDouble(), epsilon: 1);
+
+Future<void> _until(
+ WidgetTester tester,
+ bool Function() ready, {
+ required String reason,
+ Duration limit = const Duration(seconds: 15),
+}) async {
+ final end = DateTime.now().add(limit);
+ while (!ready() && DateTime.now().isBefore(end)) {
+ await tester.pump(const Duration(milliseconds: 50));
+ }
+ expect(ready(), isTrue, reason: reason);
+}
+
+class _Login extends CliLogin {
+ bool loggedIn = false;
+ final started = <SignInProvider?>[];
+ var cancels = 0;
+ Completer<void>? pending;
+
+ @override
+ Future<CliAuthStatus> checkStatus() async =>
+ CliAuthStatus(loggedIn: loggedIn);
+
+ @override
+ Future<void> logout() async => loggedIn = false;
+
+ @override
+ void cancel() => cancels++;
+
+ /// Waits like a browser that is open. It never names a page to open: this
+ /// fixture must not start the computer's own browser.
+ @override
+ Future<void> login({
+ required void Function(String) onAuthorizeUrl,
+ SignInProvider? provider,
+ }) async {
+ started.add(provider);
+ final wait = pending = Completer<void>();
+ await wait.future;
+ loggedIn = true;
+ }
+}
+
+class _Api extends ApiClient {
+ _Api()
+ : super(
+ config: AppConfig.dev,
+ session: AuthSession(storage: MemoryStore()),
+ );
+
+ @override
+ Future<Map<String, dynamic>?> me() async => {
+ 'user': {
+ 'id': 'fixture',
+ 'name': 'Dee Example',
+ 'email': '[email protected]',
+ },
+ };
+
+ @override
+ Future<Map<String, dynamic>?> desk() async => null;
+}
+
+/// A computer whose probe finds no Harness CLI, and whose install puts it in.
+class _Setup extends EnvironmentProvisioner {
+ _Setup() : super(isMacOS: true);
+
+ @override
+ Future<EnvironmentReadiness> ensureReady({
+ required void Function(EnvironmentReadiness value) onProgress,
+ EnvironmentReadiness? resumeFrom,
+ bool install = true,
+ EnvironmentSetupMode? mode,
+ }) async {
+ final result = install
+ ? EnvironmentReadiness(
+ steps: {
+ for (final step in EnvironmentStep.values)
+ step: EnvironmentStepStatus.ready,
+ },
+ phase: EnvironmentSetupPhase.ready,
+ mode: EnvironmentSetupMode.automatic,
+ )
+ : EnvironmentReadiness(
+ steps: {
+ EnvironmentStep.harness: EnvironmentStepStatus.failed,
+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,
+ },
+ phase: EnvironmentSetupPhase.review,
+ plan: [EnvironmentPlanItem.harnessCli],
+ );
+ onProgress(result);
+ return result;
+ }
+}
+
+({GuestTestApp app, _Login cli}) _newComputer() {
+ final cli = _Login();
+ final app = GuestTestApp(
+ config: AppConfig.dev,
+ authSession: AuthSession(storage: MemoryStore()),
+ configStore: null,
+ cliLogin: cli,
+ environmentProvisioner: _Setup(),
+ )..api = _Api();
+ return (app: app, cli: cli);
+}
+
+Future<void> _mount(WidgetTester tester, AppNotifier app) async {
+ final projects = SwarmProjectStore();
+ addTearDown(projects.dispose);
+ await tester.pumpWidget(
+ ProviderScope(
+ overrides: [appStateProvider.overrideWithValue(app)],
+ child: HarnessApp(
+ authenticatedScreen: (app) => SwarmScreen(
+ notifier: app,
+ nativeTabs: true,
+ projectStore: projects,
+ ),
+ ),
+ ),
+ );
+}
+
+final _skip = find.byKey(const Key('sign-in-step-skip'));
+final _email = find.byKey(const Key('sign-in-step-email'));
+final _google = find.byKey(const Key('login-continue-google'));
+final _apple = find.byKey(const Key('login-continue-apple'));
+final _menu = find.byKey(const ValueKey('account-menu'));
+
+void main() {
+ if (!kUnderTest) {
+ throw StateError('Native sign-in fixtures require FLUTTER_TEST=1');
+ }
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
+
+ setUpAll(() async {
+ await windowManager.ensureInitialized();
+ // As the app does at launch (`configureDesktopWindow`): this is what puts
+ // AppKit's tab row in the title bar. Without it the window keeps a plain
+ // title bar and the row is drawn nowhere.
+ await const MethodChannel('harness/swarm_tabs').invokeMethod('configure', {
+ 'palette': grid.AppTheme.palette.value.nativeColors,
+ });
+ await windowManager.setSize(const Size(1280, 800));
+ if (_driven) File('$_driverDir/pid').writeAsStringSync('$pid');
+ });
+ setUp(() async {
+ await windowManager.show();
+ await windowManager.focus();
+ });
+ tearDownAll(() {
+ if (_driven) File('$_driverDir/done').writeAsStringSync('');
+ });
+
+ testWidgets('native: a new computer goes from the tour to the sign-in page, and Skip '
+ 'opens a workspace whose title bar ends in Sign in', (tester) async {
+ final (:app, :cli) = _newComputer();
+ addTearDown(app.dispose);
+ await _mount(tester, app);
+ await app.bootstrap();
+ await tester.pump();
+
+ // The tour, its install line finished, promising the step and not Harness.
+ expect(find.byType(SetupTour), findsOneWidget);
+ final line = find.byKey(const ValueKey('tour-install-line'));
+ await _until(
+ tester,
+ () => tester.widget<Text>(line).data == setupTourReadyLine,
+ reason: 'the tour says Harness is ready',
+ );
+ await _shot(tester, '1-tour-ready');
+
+ // At the end of the slide on screen, the sign-in page — not the workspace.
+ await _until(
+ tester,
+ () => find.byType(SignInStep).evaluate().isNotEmpty,
+ reason: 'the sign-in step follows the tour',
+ limit: tourSlideDuration + const Duration(seconds: 6),
+ );
+ expect(find.byType(SetupTour), findsNothing);
+ expect(find.byType(SwarmScreen), findsNothing);
+ expect(find.text(signInStepTitle), findsOneWidget);
+ for (final benefit in signInStepBenefits) {
+ expect(find.text(benefit.line), findsOneWidget);
+ }
+ expect(find.text('Harness is ready.'), findsOneWidget);
+ // In this window's own type: Skip starts where the buttons start, and
+ // Continue with email ends where they end, under the card.
+ final google = tester.getRect(_google);
+ expect(tester.getRect(_apple).left, google.left);
+ expect(
+ tester.getRect(find.text('Skip')).left,
+ moreOrLessEquals(google.left, epsilon: 0.5),
+ );
+ expect(
+ tester.getRect(find.text('Continue with email')).right,
+ moreOrLessEquals(google.right, epsilon: 0.5),
+ );
+ expect(
+ tester.getRect(find.text('Skip')).top,
+ greaterThan(tester.getRect(_apple).bottom + 20),
+ );
+ expect(tester.takeException(), isNull);
+ await _shot(tester, '2-sign-in-page');
+
+ // It waits for the person.
+ await tester.pump(const Duration(seconds: 3));
+ expect(find.byType(SignInStep), findsOneWidget);
+
+ // Continue with Google: its words stay, and every way in stays live.
+ await tester.tap(_google);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(cli.started, [SignInProvider.google]);
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.textContaining('Waiting'), findsNothing);
+ await _shot(tester, '3-sign-in-page-browser-open');
+ await tester.tap(_google);
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(cli.started, [SignInProvider.google], reason: 'not a second one');
+ await tester.tap(_email);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(cli.started, [SignInProvider.google, null]);
+ expect(cli.cancels, 1);
+ expect(find.byType(SignInStep), findsOneWidget);
+
+ // Skip: the workspace, without an account, and the waiting sign-in ended.
+ await tester.tap(_skip);
+ await _until(
+ tester,
+ () => find.byType(SwarmScreen).evaluate().isNotEmpty,
+ reason: 'Skip opens the workspace',
+ );
+ expect(find.byType(SignInStep), findsNothing);
+ expect(app.isGuest, isTrue);
+ expect(app.signingIn, isFalse);
+ expect(cli.cancels, 2);
+ await tester.pump(const Duration(milliseconds: 600));
+
+ final reachable = await _rowReachable(tester);
+ await _shot(tester, '4-workspace-not-signed-in');
+ if (reachable) {
+ // AppKit's row, as accessibility reads it: three icons, then Sign in.
+ final buttons = await _nativeButtons(tester);
+ expect(
+ buttons.keys,
+ containsAll(['Open Harness', 'Devices', 'Harness Store', 'Sign in']),
+ );
+ expect(buttons.containsKey('Account'), isFalse);
+ final search = buttons['Open Harness']!;
+ final devices = buttons['Devices']!;
+ final store = buttons['Harness Store']!;
+ final signIn = buttons['Sign in']!;
+ final window = signIn['window'] as Map;
+ final edge = (window['x'] as num) + (window['w'] as num) - 12;
+ for (final icon in [search, devices, store]) {
+ expect(_width(icon), _about(32), reason: "an icon's slot: $icon");
+ expect(icon['enabled'], isTrue);
+ }
+ expect(_right(search), _about(_left(devices)), reason: 'side by side');
+ expect(_right(devices), _about(_left(store)), reason: 'side by side');
+ expect(
+ _left(signIn) - _right(store),
+ _about(8),
+ reason: 'one gap, no line',
+ );
+ expect(_right(signIn), _about(edge), reason: 'Sign in ends the row');
+ // A word and its padding: wider than any icon.
+ expect(_width(signIn), greaterThan(56));
+ expect(signIn['enabled'], isTrue);
+ expect(signIn['help'], 'Sign in to Harness');
+ }
+
+ // A real press on the native button opens the sign-in over the desk.
+ await _press(
+ tester,
+ reachable: reachable,
+ label: 'Sign in',
+ action: 'signIn',
+ );
+ await _until(
+ tester,
+ () => find.byType(LoginScreen).evaluate().isNotEmpty,
+ reason: 'the native Sign in opens the sign-in',
+ );
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.byKey(const Key('login-continue-email')), findsOneWidget);
+ await _shot(tester, '5-sign-in-from-the-title-bar');
+ await tester.tap(find.byKey(const Key('login-close-button')));
+ await _until(
+ tester,
+ () => find.byType(LoginScreen).evaluate().isEmpty,
+ reason: 'the sign-in closes back to the desk',
+ );
+ expect(find.byType(SwarmScreen), findsOneWidget);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ }, timeout: const Timeout(Duration(minutes: 3)));
+
+ testWidgets(
+ 'native: signing in on the page opens the workspace signed in, and the '
+ 'avatar in the title bar opens its menu',
+ (tester) async {
+ final (:app, :cli) = _newComputer();
+ addTearDown(app.dispose);
+ await _mount(tester, app);
+ await app.bootstrap();
+ await tester.pump();
+ // The slide's own six seconds are the first journey's.
+ app.finishSetupTour();
+ await _until(
+ tester,
+ () => find.byType(SignInStep).evaluate().isNotEmpty,
+ reason: 'the sign-in step',
+ );
+
+ await tester.tap(_apple);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(cli.started, [SignInProvider.apple]);
+ expect(find.byType(SignInStep), findsOneWidget);
+
+ // The browser comes back with the account.
+ cli.pending!.complete();
+ await _until(
+ tester,
+ () => find.byType(SwarmScreen).evaluate().isNotEmpty,
+ reason: 'the account opens the workspace',
+ );
+ expect(find.byType(SignInStep), findsNothing);
+ expect(app.signedIn, isTrue);
+ await _until(
+ tester,
+ () => app.currentUser?.email == '[email protected]',
+ reason: 'the profile is read',
+ );
+ await tester.pump(const Duration(milliseconds: 600));
+ expect(tester.takeException(), isNull);
+
+ final reachable = await _rowReachable(tester);
+ await _shot(tester, '6-workspace-signed-in');
+ if (reachable) {
+ final buttons = await _nativeButtons(tester);
+ expect(buttons.containsKey('Sign in'), isFalse);
+ final account = buttons['Account']!;
+ final store = buttons['Harness Store']!;
+ final window = account['window'] as Map;
+ expect(_width(account), _about(32));
+ expect(account['enabled'], isTrue);
+ expect(account['help'], 'Dee Example · [email protected]');
+ expect(_left(account) - _right(store), _about(8));
+ expect(
+ _right(account),
+ _about((window['x'] as num) + (window['w'] as num) - 12),
+ );
+ }
+
+ // A real press on the avatar: its menu, under the row, at the right.
+ Future<void> openMenu() async {
+ await _press(
+ tester,
+ reachable: reachable,
+ label: 'Account',
+ action: 'account',
+ );
+ await _until(
+ tester,
+ () => _menu.evaluate().isNotEmpty,
+ reason: 'the avatar opens its menu',
+ );
+ }
+
+ await openMenu();
+ expect(
+ find.descendant(of: _menu, matching: find.text('Dee Example')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: _menu, matching: find.text('[email protected]')),
+ findsOneWidget,
+ );
+ for (final row in const [
+ 'Add Phone',
+ 'Customize Harness',
+ 'Notifications',
+ 'Settings',
+ 'Sign out',
+ ]) {
+ // In the menu: the workspace behind it has words of its own.
+ expect(
+ find.descendant(of: _menu, matching: find.text(row)),
+ findsOneWidget,
+ reason: row,
+ );
+ }
+ final menu = tester.getRect(_menu);
+ final view = tester.view.physicalSize / tester.view.devicePixelRatio;
+ expect(menu.right, greaterThan(view.width - 16));
+ expect(menu.top, lessThan(24), reason: 'directly under the title bar');
+ await _shot(tester, '7-account-menu');
+
+ // Escape puts it away and opens nothing.
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await _until(tester, () => _menu.evaluate().isEmpty, reason: 'Escape');
+ expect(find.byType(SettingsScreen), findsNothing);
+
+ // Notifications: Settings, on that page.
+ await openMenu();
+ await tester.tap(
+ find.byKey(const ValueKey('account-menu-notifications')),
+ );
+ await _until(
+ tester,
+ () => find.byType(SettingsScreen).evaluate().isNotEmpty,
+ reason: 'Notifications opens Settings',
+ );
+ expect(_menu, findsNothing);
+ expect(
+ tester
+ .widget<SettingsScreen>(find.byType(SettingsScreen))
+ .initialSection,
+ SettingsSection.notifications,
+ );
+ await _shot(tester, '8-notifications-from-the-menu');
+ Navigator.of(tester.element(find.byType(SettingsScreen))).pop();
+ await _until(
+ tester,
+ () => find.byType(SettingsScreen).evaluate().isEmpty,
+ reason: 'Settings closes',
+ );
+
+ // Sign out: this computer is without an account again, and its row
+ // ends in Sign in again.
+ await openMenu();
+ await tester.tap(find.byKey(const ValueKey('account-menu-signOut')));
+ await _until(
+ tester,
+ () => app.isGuest && !app.signingOut,
+ reason: 'Sign out signs out',
+ limit: const Duration(seconds: 20),
+ );
+ await _until(
+ tester,
+ () => find.byType(SwarmScreen).evaluate().isNotEmpty,
+ reason: 'the desk stays, as a guest',
+ );
+ await tester.pump(const Duration(milliseconds: 600));
+ if (reachable) {
+ final after = await _nativeButtons(tester);
+ expect(after.containsKey('Sign in'), isTrue, reason: '${after.keys}');
+ expect(after.containsKey('Account'), isFalse);
+ }
+ // The page that asked once does not come back.
+ expect(find.byType(SignInStep), findsNothing);
+ await _shot(tester, '9-after-sign-out');
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ },
+ timeout: const Timeout(Duration(minutes: 3)),
+ );
+}
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index 22cde6a8c..26bd2237a 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -29,6 +29,7 @@ import 'widgets/export_logs_dialog.dart';
import 'widgets/flash_firmware_dialog.dart';
import 'widgets/linux_menu_bar.dart';
import 'widgets/setup_tour.dart';
+import 'widgets/sign_in_step.dart';
import 'core/startup.dart';
import 'logging/app_log.dart';
import 'logging/install.dart';
@@ -366,6 +367,10 @@ class _RootShellState extends ConsumerState<RootShell>
// whatever the status says meanwhile, until the tour opens Harness.
final touring = app.setupTourShowing;
if (touring) screen = SetupTourScreen(app: app);
+ // Then, once: a computer new to Harness with no account is offered one
+ // before its first workspace.
+ final signInStep = !touring && app.signInStepShowing;
+ if (signInStep) screen = SignInStepScreen(app: app);
// Preserve the fragment pin while dialogs navigate; an OAuth callback can restore it later.
if (kIsWeb) _sharedLocation ??= SharedAgentLocation.parse(Uri.base);
final shared = _sharedLocation;
@@ -376,7 +381,8 @@ class _RootShellState extends ConsumerState<RootShell>
// clearance (the rail's head). Every other screen fills the window
// with a centred card, so the strip goes over it here, once, instead
// of inside each of them.
- final home = app.status == AppStatus.authenticated && !touring;
+ final home =
+ app.status == AppStatus.authenticated && !touring && !signInStep;
final framed = home ? screen : FullWindowScreen(child: screen);
// The band takes a row of its own rather than floating over one. As an
// overlay it landed on the rail's head — covering the wordmark and the
@@ -391,6 +397,7 @@ class _RootShellState extends ConsumerState<RootShell>
LinuxMenuBar(onAction: runAppMenuAction),
if (app.hasAvailableUpdate &&
!touring &&
+ !signInStep &&
app.status != AppStatus.bootstrapping &&
app.status != AppStatus.checkingEnvironment &&
app.status != AppStatus.preparingEnvironment)
diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dart
index 5a88a07f4..0378712c4 100644
--- a/desktop/lib/screens/login_screen.dart
+++ b/desktop/lib/screens/login_screen.dart
@@ -12,6 +12,7 @@ import '../state/app_state.dart';
import '../widgets/login_fleet_map.dart';
import '../widgets/login_relay_diagram.dart';
import '../widgets/or_divider.dart';
+import '../widgets/quiet_link.dart';
import '../widgets/sign_in_provider_button.dart';
import '../widgets/web_download_button.dart';
@@ -450,6 +451,22 @@ class _ActionState extends State<_Action> {
label: const Text('Scan with your phone'),
),
],
+ // The quiet way in: the sign-in page's own chooser, which takes
+ // an email and the code sent to it. Small on purpose — waiting
+ // for a code is slower, and most people use Google or Apple
+ // (owner, 2026-10-11). Not in a browser, whose page is as it
+ // was; and not in a short window, where a row more would push
+ // the line that explains an expired session off the screen.
+ // Words, not a box, and not stretched to the buttons' width:
+ // a text button here drew as one more of them.
+ if (!kIsWeb && !widget.compact)
+ Center(
+ child: QuietLink(
+ key: const Key('login-continue-email'),
+ label: 'Continue with email',
+ onPressed: () => unawaited(notifier.login()),
+ ),
+ ),
],
),
const SizedBox(height: 12),
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 76c01f59c..5f7f66ced 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -35,6 +35,7 @@ import '../notify/system_notifications.dart';
import '../settings/sections/account_device_detail.dart';
import '../settings/settings_screen.dart';
import '../settings/settings_section.dart';
+import 'login_screen.dart' show showSignInSheet;
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/workspace_bar_style.dart';
import '../sharing/share_harness_dialog.dart';
@@ -55,6 +56,7 @@ import '../state/notification_inbox.dart';
import '../state/status_menu.dart';
import '../widgets/linux_menu_bar.dart'
show LinuxTitleBar, linuxTitleBarActions;
+import '../widgets/account_menu.dart';
import '../widgets/notification_inbox.dart';
import '../widgets/workspace_notifications_button.dart';
import '../state/harness_sessions.dart';
@@ -92,6 +94,7 @@ import '../widgets/workspace_tab_scroller.dart';
import '../widgets/session_work_dialog.dart';
import '../widgets/web_download_button.dart';
import '../widgets/workspace_share_button.dart';
+import '../widgets/workspace_account_button.dart';
import '../widgets/workspace_store_button.dart';
import '../widgets/grid_model_picker.dart';
import '../widgets/workspace_subscription_usage.dart';
@@ -1816,6 +1819,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
'searchTooltip': _commandTooltip('Open Harness', 'harnesses.list'),
'storeTooltip': _commandTooltip('Explore Harness Store', 'app.store'),
'devicesVisible': app.devicesEnabled,
+ // The row's last control: Sign in, or whose account this is.
+ 'account': ?_accountPayload,
// Native accessibility explains that ⏎ enters the selected tab.
'tabsFocused': app.tabStripFocused && _tabStripFocus.hasPrimaryFocus,
// Only once the slot is shown: until then (and whenever daemons are
@@ -2346,6 +2351,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
_openStore();
case 'devices':
_openDevices();
+ case 'signIn':
+ unawaited(_signIn());
+ case 'account':
+ unawaited(_showAccountMenu());
case 'new':
_newTab();
case 'reopen':
@@ -2892,6 +2901,122 @@ class _SwarmScreenState extends State<SwarmScreen> {
Future<void> _customize() => _dialog(_showCustomizePane);
+ // --- The tab row's last control: Sign in, or the account ----------------
+ // Like a browser's toolbar (owner, 2026-10-11): everything before it is an
+ // icon, and this is Sign in while this computer holds no account, and whose
+ // account it is afterwards. A viewer build's bar is as it was: it has no
+ // guest, and its own ways to its account.
+ bool get _accountControlShown => app.viewer == null;
+
+ /// What the native tab row draws for it. Absent, it draws nothing.
+ Map<String, Object?>? get _accountPayload => !_accountControlShown
+ ? null
+ : app.isGuest
+ ? {'kind': 'signIn', 'tooltip': WorkspaceSignInButton.tooltip}
+ : {
+ 'kind': 'avatar',
+ 'initial': _accountInitial,
+ 'tooltip': _accountTooltip,
+ };
+
+ String get _accountInitial =>
+ accountInitial(app.currentUser?.name, app.currentUser?.email);
+
+ String get _accountTooltip {
+ final user = app.currentUser;
+ if (user == null) return 'Account';
+ return [?user.name, user.email].join(' · ');
+ }
+
+ /// The control and the gap before it, for a row this app draws.
+ List<Widget> _accountControl() => !_accountControlShown
+ ? const []
+ : [
+ const SizedBox(width: DesktopChrome.controlGap),
+ if (app.isGuest)
+ WorkspaceSignInButton(
+ key: const ValueKey('swarm-sign-in-button'),
+ onPressed: _shortcutsEnabled ? () => unawaited(_signIn()) : null,
+ )
+ else
+ WorkspaceAvatarButton(
+ key: const ValueKey('swarm-account-button'),
+ initial: _accountInitial,
+ tooltip: _accountTooltip,
+ onPressed: _shortcutsEnabled
+ ? () => unawaited(_showAccountMenu())
+ : null,
+ ),
+ ];
+
+ double _accountControlWidth(BuildContext context) => !_accountControlShown
+ ? 0
+ : DesktopChrome.controlGap +
+ (app.isGuest
+ ? WorkspaceSignInButton.widthOf(context)
+ : WorkspaceAvatarButton.widthOf(context));
+
+ /// Sign in: the sign-in screen, over the desk (`showSignInSheet`).
+ Future<void> _signIn() => _dialog(() => showSignInSheet(context, app));
+
+ /// Whether the account has a phone already, as last read: Add Phone leaves
+ /// the menu then. Unknown shows it.
+ bool? _accountHasPhone;
+ String? _accountPhoneOwner;
+
+ Future<void> _readAccountPhone() async {
+ // No daemon to ask under test, and a request that never ends.
+ if (kUnderTest || app.isGuest) return;
+ final owner = app.currentUser?.email;
+ try {
+ final devices = await app.loadDevices();
+ if (!mounted || devices == null) return;
+ _accountHasPhone = devices.devices.any(
+ (device) => !device.isMachine && !device.self,
+ );
+ _accountPhoneOwner = owner;
+ } catch (_) {
+ // Unread, the row stays: it costs nothing to offer.
+ }
+ }
+
+ /// The avatar's menu (`widgets/account_menu.dart`). Its rows open what the
+ /// app already has, once the menu itself has closed: a [_dialog] made from
+ /// inside one is refused.
+ Future<void> _showAccountMenu() async {
+ final user = app.currentUser;
+ final hasPhone =
+ _accountPhoneOwner == user?.email && _accountHasPhone == true;
+ // For the next opening: this one must not change under the pointer.
+ unawaited(_readAccountPhone());
+ AccountMenuChoice? choice;
+ await _dialog(() async {
+ choice = await showAccountMenu(
+ context,
+ name: user?.name ?? '',
+ email: user?.email ?? '',
+ showAddPhone: !hasPhone,
+ topInset: _native ? 0 : _tabBarHeight,
+ );
+ });
+ if (!mounted) return;
+ switch (choice) {
+ case AccountMenuChoice.addPhone:
+ await _addPhone();
+ unawaited(_readAccountPhone());
+ case AccountMenuChoice.customize:
+ await _customize();
+ case AccountMenuChoice.notifications:
+ await _settings(SettingsSection.notifications);
+ case AccountMenuChoice.settings:
+ await _settings();
+ case AccountMenuChoice.signOut:
+ unawaited(app.logout());
+ case null:
+ break;
+ }
+ }
+
Future<void> _settings([SettingsSection? section]) => _dialog(
() => showSettingsScreen(
context,
@@ -6902,17 +7027,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
children: [
_searchButton(theme),
_notificationsButton(theme),
- const SizedBox(width: DesktopChrome.controlGap),
- if (app.devicesEnabled) ...[
- _devicesButton(context),
- const SizedBox(width: DesktopChrome.controlGap),
- ],
+ if (app.devicesEnabled) _devicesButton(context),
WorkspaceStoreButton(
key: const ValueKey('swarm-store-button'),
width: WorkspaceStoreButton.widthOf(context),
tooltip: _commandTooltip('Explore Harness Store', 'app.store'),
onPressed: _shortcutsEnabled ? _openStore : null,
),
+ ..._accountControl(),
],
);
}
@@ -7735,23 +7857,23 @@ class _SwarmScreenState extends State<SwarmScreen> {
WorkspaceStoreButton.widthOf(context),
math.max(0.0, constraints.maxWidth - cell.width * 22),
);
+ // Sign in or the avatar always stays; see [_accountControl].
+ final accountWidth = _accountControlWidth(context);
// Devices only where Store keeps its full width beside it. A narrow
// window drops it from the bar first; Harness Store still opens it.
- final devicesWidth =
- WorkspaceStoreButton.widthOf(context, devices: true) +
- DesktopChrome.controlGap;
+ final devicesWidth = WorkspaceStoreButton.widthOf(context, devices: true);
final showDevices =
app.devicesEnabled &&
- constraints.maxWidth - cell.width * 22 >=
+ constraints.maxWidth - cell.width * 22 - accountWidth >=
WorkspaceStoreButton.widthOf(context) + devicesWidth;
- // Store, search and notifications — none of it here when the title bar
- // holds them.
+ // Search, notifications, Devices, Store and the account — none of it
+ // here when the title bar holds them.
final actionsWidth = _titleBarActions
? 0.0
: storeWidth +
cell.width * 8 +
- DesktopChrome.controlGap +
- (showDevices ? devicesWidth : 0);
+ (showDevices ? devicesWidth : 0) +
+ accountWidth;
final leadingWidth = chrome?.leadingWidth(context) ?? 0.0;
final tabBudget = math.max(
0.0,
@@ -7948,11 +8070,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (!_titleBarActions) ...[
_searchButton(theme),
_notificationsButton(theme),
- const SizedBox(width: DesktopChrome.controlGap),
- if (showDevices) ...[
- _devicesButton(context),
- const SizedBox(width: DesktopChrome.controlGap),
- ],
+ if (showDevices) _devicesButton(context),
WorkspaceStoreButton(
key: const ValueKey('swarm-store-button'),
width: storeWidth,
@@ -7962,6 +8080,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
onPressed: _shortcutsEnabled ? _openStore : null,
),
+ ..._accountControl(),
],
if (kIsWeb && _slotShown) _daemonTabButton(),
const SizedBox(width: grid.AppDesktop.tabBarTrailingInset),
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 8bf5cd831..63e985be1 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1113,7 +1113,8 @@ class AppNotifier extends ChangeNotifier {
void _firstArrivalBehindTour() {
if (!firstArrivalBehindTour ||
viewer != null ||
- !_setupTour ||
+ // Behind the sign-in step as well: it stands where the tour stood.
+ !(_setupTour || _signInStep) ||
status != AppStatus.authenticated ||
!firstArrival.pending) {
return;
@@ -1128,6 +1129,71 @@ class AppNotifier extends ChangeNotifier {
notifyListeners();
}
+ // --- Sign-in step (2026-10-11) ------------------------------------------
+ // A computer new to Harness is asked once, after setup and before its first
+ // workspace, whether to sign in (`widgets/sign_in_step.dart`): what an
+ // account adds, Google or Apple, and Skip. Everything on this computer works
+ // without one, so the page never blocks; afterwards the same sign-in is the
+ // button at the right end of the tab row. Design:
+ // `docs/research/2026-10-08-onboarding-redesign/index.html`, section 1b.
+ bool _signInStep = false;
+
+ /// Whether the sign-in step comes after setup: this computer is new to
+ /// Harness and holds no account. Only meaningful once [status] has left
+ /// setup — [signedIn] is presumed true until the CLI has been asked.
+ bool get signInStepNext => _signInStep && viewer == null && !signedIn;
+
+ /// Whether RootShell shows the sign-in step in place of the workspace: from
+ /// the moment setup (and its tour) hands over, until an account arrives or
+ /// the person skips.
+ bool get signInStepShowing {
+ if (!_signInStep || viewer != null || setupTourShowing) return false;
+ final signingInHere = status == AppStatus.bootstrapping && signingIn;
+ if (status != AppStatus.authenticated && !signingInHere) return false;
+ // An account, from this page or from a terminal meanwhile: nothing to ask.
+ // Held while the sign-in is still seating the desk, so the page does not
+ // give way to a bare spinner for that moment.
+ if (signedIn && !signingIn) {
+ _signInStep = false;
+ return false;
+ }
+ return true;
+ }
+
+ /// Skip on the sign-in step: on to the workspace without an account.
+ void skipSignInStep() {
+ if (!_signInStep) return;
+ _signInStep = false;
+ appLog.info('onboarding', 'sign-in step: skipped');
+ // A sign-in left waiting on the browser ends with the page that began it.
+ if (canCancelLogin) {
+ cancelLogin();
+ } else {
+ notifyListeners();
+ }
+ }
+
+ /// The sign-in step's buttons. Unlike the sign-in sheet, the page does not
+ /// change while the browser is open, so every way in stays live: pressing
+ /// one again opens the browser again, and another one switches to it.
+ /// No [provider] is the sign-in page's own chooser — Continue with email.
+ Future<void> signInFromStep([SignInProvider? provider]) async {
+ if (signingIn) {
+ // The same way in, pressed again: its page again, not a second sign-in
+ // (the first one's browser tab would land on a listener that is gone).
+ if (signInProvider == provider) {
+ if (pendingAuthorizeUrl != null && !_loginAuthorized) {
+ await openLoginBrowser();
+ }
+ return;
+ }
+ // Already approved in the browser: let it finish.
+ if (!canCancelLogin) return;
+ cancelLogin();
+ }
+ await login(provider);
+ }
+
/// What is still downloading beside setup (see [SetupDownloads]). The tour
/// opens Harness only once this says done as well as setup. The agent
/// downloads set `.value` here; nothing pending is the default, so a
@@ -4426,6 +4492,8 @@ class AppNotifier extends ChangeNotifier {
if (firstHarness) {
agentPrefetch?.setupRunning = true;
agentPrefetch?.start();
+ // Asked once, after setup: see [signInStepShowing].
+ _signInStep = true;
}
if (!result.isReady && _canInstallUnattended(result, mode: null)) {
if (firstHarness) {
diff --git a/desktop/lib/widgets/account_menu.dart b/desktop/lib/widgets/account_menu.dart
new file mode 100644
index 000000000..4e07b9036
--- /dev/null
+++ b/desktop/lib/widgets/account_menu.dart
@@ -0,0 +1,233 @@
+import 'dart:math' as math;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+
+import '../shared/theme/app_icons.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../shared/widgets/app_dialog.dart';
+import '../shared/widgets/app_menu.dart';
+import 'desktop_chrome.dart';
+import 'workspace_account_button.dart';
+
+/// What the account menu was asked for.
+enum AccountMenuChoice { addPhone, customize, notifications, settings, signOut }
+
+/// The menu under the avatar: who is signed in, then Add Phone, Customize
+/// Harness, Notifications, Settings and Sign out. Each opens something the app
+/// already has; the caller does that once this has closed, so the two never
+/// stand on screen together. Kept to these five (owner, 2026-10-11).
+///
+/// Drawn here rather than as a native menu, so the Mac — whose tab row is
+/// native — and Linux get the same one. It hangs from the window's top-right
+/// corner, under the row the avatar is in; [topInset] is that row's height
+/// where this app draws it.
+Future<AccountMenuChoice?> showAccountMenu(
+ BuildContext context, {
+ required String name,
+ required String email,
+ bool showAddPhone = true,
+ double topInset = 0,
+}) => showAppDialog<AccountMenuChoice>(
+ context: context,
+ veilTint: Colors.transparent,
+ builder: (_) => AccountMenu(
+ name: name,
+ email: email,
+ showAddPhone: showAddPhone,
+ topInset: topInset,
+ ),
+);
+
+class AccountMenu extends StatefulWidget {
+ const AccountMenu({
+ super.key,
+ required this.name,
+ required this.email,
+ this.showAddPhone = true,
+ this.topInset = 0,
+ });
+
+ /// As the account gives it; empty when it has only an email.
+ final String name;
+ final String email;
+
+ /// Whether Add Phone is offered: not once the account has a phone.
+ final bool showAddPhone;
+ final double topInset;
+
+ static const width = 264.0;
+
+ @override
+ State<AccountMenu> createState() => _AccountMenuState();
+}
+
+class _AccountMenuState extends State<AccountMenu> {
+ final _focus = FocusNode(debugLabel: 'Account menu');
+
+ late final _rows = [
+ if (widget.showAddPhone)
+ (AccountMenuChoice.addPhone, AppIcons.smartphone, 'Add Phone'),
+ (AccountMenuChoice.customize, AppIcons.palette, 'Customize Harness'),
+ (AccountMenuChoice.notifications, AppIcons.bell, 'Notifications'),
+ (AccountMenuChoice.settings, AppIcons.settings, 'Settings'),
+ (AccountMenuChoice.signOut, AppIcons.logOut, 'Sign out'),
+ ];
+ late final _rowFocus = [
+ for (final (choice, _, _) in _rows)
+ FocusNode(debugLabel: 'Account menu: ${choice.name}'),
+ ];
+
+ @override
+ void initState() {
+ super.initState();
+ // The keys are the menu's from the frame it appears: `autofocus` alone
+ // loses to the route's own first focus.
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted) _focus.requestFocus();
+ });
+ }
+
+ @override
+ void dispose() {
+ _focus.dispose();
+ for (final node in _rowFocus) {
+ node.dispose();
+ }
+ super.dispose();
+ }
+
+ void _choose(AccountMenuChoice choice) => Navigator.of(context).pop(choice);
+
+ /// Up and Down walk the rows, round and round. Opened, no row is lit — as a
+ /// menu a pointer opened is — so the first Down lands on the first and the
+ /// first Up on the last.
+ KeyEventResult _onKey(FocusNode node, KeyEvent event) {
+ if (event is KeyUpEvent) return KeyEventResult.ignored;
+ final delta = switch (event.logicalKey) {
+ LogicalKeyboardKey.arrowDown => 1,
+ LogicalKeyboardKey.arrowUp => -1,
+ _ => 0,
+ };
+ if (delta == 0) return KeyEventResult.ignored;
+ final current = _rowFocus.indexWhere((row) => row.hasPrimaryFocus);
+ final next = current < 0
+ ? (delta > 0 ? 0 : _rowFocus.length - 1)
+ : (current + delta) % _rowFocus.length;
+ _rowFocus[next].requestFocus();
+ return KeyEventResult.handled;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final name = widget.name;
+ final email = widget.email;
+ final title = name.isEmpty ? email : name;
+ return DesktopChrome(
+ child: CallbackShortcuts(
+ bindings: {
+ const SingleActivator(LogicalKeyboardKey.escape): () =>
+ Navigator.of(context).pop(),
+ },
+ child: LayoutBuilder(
+ builder: (context, constraints) => Dialog(
+ alignment: Alignment.topRight,
+ insetPadding: EdgeInsets.fromLTRB(8, widget.topInset + 6, 8, 8),
+ backgroundColor: Colors.transparent,
+ surfaceTintColor: Colors.transparent,
+ elevation: 0,
+ constraints: BoxConstraints(
+ maxWidth: math.min(
+ AccountMenu.width,
+ math.max(0, constraints.maxWidth - 16),
+ ),
+ ),
+ child: DesktopDialogSurface(
+ key: const ValueKey('account-menu'),
+ radius: 12,
+ elevation: 12,
+ child: Semantics(
+ scopesRoute: true,
+ namesRoute: true,
+ explicitChildNodes: true,
+ label: 'Account',
+ child: Focus(
+ focusNode: _focus,
+ autofocus: true,
+ onKeyEvent: _onKey,
+ child: SingleChildScrollView(
+ padding: const EdgeInsets.symmetric(vertical: 6),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(15, 8, 15, 10),
+ child: Row(
+ children: [
+ ExcludeSemantics(
+ child: AccountAvatar(
+ initial: accountInitial(name, email),
+ diameter: 34,
+ accent: grid.AppPalette.swarmAccent,
+ ),
+ ),
+ const SizedBox(width: 11),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ title,
+ key: const ValueKey('account-menu-name'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(
+ medium: true,
+ ),
+ ),
+ // An account with no name says its email
+ // once, not twice.
+ if (name.isNotEmpty && email.isNotEmpty)
+ Text(
+ email,
+ key: const ValueKey(
+ 'account-menu-email',
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ const AppMenuDivider(),
+ for (final (index, (choice, icon, label))
+ in _rows.indexed) ...[
+ // Sign out stands apart from what opens something.
+ if (choice == AccountMenuChoice.signOut)
+ const AppMenuDivider(),
+ AppMenuItem(
+ key: ValueKey('account-menu-${choice.name}'),
+ focusNode: _rowFocus[index],
+ icon: icon,
+ label: label,
+ onPressed: () => _choose(choice),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/lib/widgets/quiet_link.dart b/desktop/lib/widgets/quiet_link.dart
new file mode 100644
index 000000000..9ef1ca903
--- /dev/null
+++ b/desktop/lib/widgets/quiet_link.dart
@@ -0,0 +1,70 @@
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_theme.dart' as grid;
+
+/// A way on that is words, not a box: Skip and Continue with email on the
+/// sign-in step, and Continue with email on the sign-in screen, where the
+/// buttons above it are the ones the screen is asking for.
+///
+/// Not a [TextButton]: the theme gives those a rim and a fill of their own,
+/// which made the quiet way in read as one more button (seen in the real
+/// window, 2026-10-11). It has no padding at its sides, so a caller can set it
+/// on another control's edge. Hover and the keyboard light the words; the
+/// keyboard underlines them too, having no pointer to show where it is.
+class QuietLink extends StatefulWidget {
+ const QuietLink({super.key, required this.label, required this.onPressed});
+
+ final String label;
+ final VoidCallback? onPressed;
+
+ @override
+ State<QuietLink> createState() => _QuietLinkState();
+}
+
+class _QuietLinkState extends State<QuietLink> {
+ var _hovered = false;
+ var _focused = false;
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final enabled = widget.onPressed != null;
+ final active = enabled && (_hovered || _focused);
+ return Semantics(
+ button: true,
+ enabled: enabled,
+ child: InkWell(
+ onTap: widget.onPressed,
+ onHover: (hovered) => setState(() => _hovered = hovered),
+ onFocusChange: (focused) => setState(() => _focused = focused),
+ mouseCursor: enabled
+ ? SystemMouseCursors.click
+ : SystemMouseCursors.basic,
+ borderRadius: BorderRadius.circular(4),
+ hoverColor: Colors.transparent,
+ focusColor: Colors.transparent,
+ highlightColor: Colors.transparent,
+ splashFactory: NoSplash.splashFactory,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8),
+ child: Text(
+ widget.label,
+ maxLines: 1,
+ softWrap: false,
+ overflow: TextOverflow.ellipsis,
+ style:
+ grid.AppType.label(
+ color: active
+ ? grid.AppPalette.textPrimary
+ : grid.AppPalette.textSecondary,
+ ).copyWith(
+ decoration: enabled && _focused
+ ? TextDecoration.underline
+ : null,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/lib/widgets/setup_tour.dart b/desktop/lib/widgets/setup_tour.dart
index dae5369d7..37e1026d9 100644
--- a/desktop/lib/widgets/setup_tour.dart
+++ b/desktop/lib/widgets/setup_tour.dart
@@ -62,6 +62,12 @@ String get tourComputerNoun => _onMac ? 'Mac' : 'computer';
String get setupTourInstallLine =>
'Setting up Harness on this $tourComputerNoun';
+/// The install line once everything is in place and Harness opens next.
+const setupTourOpeningLine = 'Harness is ready. Opening…';
+
+/// The same, when the sign-in step comes next instead of Harness itself.
+const setupTourReadyLine = 'Harness is ready.';
+
/// The keycaps for the Cmd-P search, from the live default keymap, so Linux
/// (Alt, where the Mac takes ⌘) reads its own chord.
List<String> get tourSearchKeys {
@@ -177,6 +183,7 @@ class SetupTour extends StatefulWidget {
this.onManual,
this.details,
this.onClose,
+ this.doneLine = setupTourOpeningLine,
this.slideDuration = tourSlideDuration,
});
@@ -204,6 +211,9 @@ class SetupTour extends StatefulWidget {
/// Shows a close button and lets Escape close the tour.
final VoidCallback? onClose;
+ /// What the install line says once [progress] is done.
+ final String doneLine;
+
final Duration slideDuration;
@override
@@ -322,6 +332,7 @@ class _SetupTourState extends State<SetupTour> {
onRetry: widget.onRetry,
onManual: widget.onManual,
details: widget.details,
+ doneLine: widget.doneLine,
),
),
],
@@ -424,7 +435,7 @@ class _SetupTourState extends State<SetupTour> {
);
return Stack(
children: [
- const Positioned.fill(child: _Glow()),
+ const Positioned.fill(child: TourGlow()),
Positioned.fill(
child: Padding(
// Top: clear of the traffic lights' band. Right: room for the
@@ -490,9 +501,9 @@ class _SetupTourState extends State<SetupTour> {
}
/// The stage's two soft glows, amber up right and gold down left, as in the
-/// render.
-class _Glow extends StatelessWidget {
- const _Glow();
+/// render. The sign-in step (`sign_in_step.dart`) stands on the same stage.
+class TourGlow extends StatelessWidget {
+ const TourGlow({super.key});
@override
Widget build(BuildContext context) {
@@ -643,6 +654,7 @@ class _InstallBar extends StatelessWidget {
required this.onRetry,
required this.onManual,
required this.details,
+ required this.doneLine,
});
final SetupProgress progress;
@@ -653,6 +665,7 @@ class _InstallBar extends StatelessWidget {
final VoidCallback? onRetry;
final VoidCallback? onManual;
final Widget? details;
+ final String doneLine;
@override
Widget build(BuildContext context) {
@@ -666,7 +679,7 @@ class _InstallBar extends StatelessWidget {
? danger
: grid.AppPalette.onboardingAccent;
final line = done
- ? 'Harness is ready. Opening…'
+ ? doneLine
: failed
? progress.failure ?? 'Setup could not finish'
: setupTourInstallLine;
@@ -848,6 +861,10 @@ class _SetupTourScreenState extends State<SetupTourScreen> {
builder: (context, _) => SetupTour(
progress: _progress,
onOpen: app.finishSetupTour,
+ // Not signed in, the sign-in step comes next, not Harness itself.
+ doneLine: app.signInStepNext
+ ? setupTourReadyLine
+ : setupTourOpeningLine,
// As the setup screen's own Retry: resume the install it asked for.
onRetry: app.environmentSetupInFlight
? null
diff --git a/desktop/lib/widgets/sign_in_step.dart b/desktop/lib/widgets/sign_in_step.dart
new file mode 100644
index 000000000..7b835182c
--- /dev/null
+++ b/desktop/lib/widgets/sign_in_step.dart
@@ -0,0 +1,408 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+
+import '../auth/sign_in_provider.dart';
+import '../logging/app_log.dart';
+import '../shared/theme/app_icons.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../state/app_state.dart';
+import 'quiet_link.dart';
+import 'setup_tour.dart';
+import 'sign_in_provider_button.dart';
+import 'window_chrome.dart';
+
+/// The sign-in step: the welcome's last page on a computer new to Harness that
+/// holds no account ([AppNotifier.signInStepShowing]).
+///
+/// It stands where the tour stood and looks like its last slide: what an
+/// account adds on the left, one line each, and Continue with Google and
+/// Continue with Apple on the right. Under them, Skip and Continue with email.
+/// Nothing else is on the page, and nothing on it changes while the browser is
+/// open — every way in stays live instead (owner, 2026-10-11).
+/// Design: `docs/research/2026-10-08-onboarding-redesign/index.html`, 1b.
+
+/// The page's two lines of title.
+const signInStepTitle = 'Sign in to take\nHarness everywhere.';
+
+/// What an account adds, one line each.
+const signInStepBenefits = [
+ (icon: AppIcons.monitor, line: 'All your machines, one window'),
+ (icon: AppIcons.smartphone, line: 'Your agents on your phone'),
+ (icon: AppIcons.globe, line: 'Harness in any browser'),
+ (icon: AppIcons.panelsTopLeft, line: 'Same tabs on every computer'),
+];
+
+/// The page itself, apart from the app: what it says and its five controls.
+class SignInStep extends StatelessWidget {
+ const SignInStep({
+ super.key,
+ required this.onSignIn,
+ required this.onSkip,
+ this.starting = false,
+ this.startingProvider,
+ this.finishing = false,
+ this.error,
+ });
+
+ /// Continue with Google, Continue with Apple, or — with no provider —
+ /// Continue with email, which is the sign-in page's own chooser.
+ final ValueChanged<SignInProvider?> onSignIn;
+ final VoidCallback onSkip;
+
+ /// A sign-in was pressed and its browser has not opened yet. The control
+ /// that began it ([startingProvider]; none is email) steps back for that
+ /// moment so the press reads as taken. Its words do not change.
+ final bool starting;
+ final SignInProvider? startingProvider;
+
+ /// The browser has approved and the account is being seated.
+ final bool finishing;
+
+ /// Why the last sign-in did not finish.
+ final String? error;
+
+ /// The card's padding: the row under it starts and ends where the buttons
+ /// inside it do.
+ static const _cardPadding = 24.0;
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ return Material(
+ key: const Key('sign-in-step'),
+ color: grid.AppPalette.windowBg,
+ child: LayoutBuilder(
+ builder: (context, constraints) {
+ // The tour's own margins: 5% of the window's width.
+ final gutter = (constraints.maxWidth * 0.05).clamp(28.0, 72.0);
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Expanded(child: _stage(context, gutter)),
+ _ReadyBar(
+ gutter: gutter,
+ line: finishing ? 'Signing in…' : 'Harness is ready.',
+ ),
+ ],
+ );
+ },
+ ),
+ );
+ }
+
+ Widget _stage(BuildContext context, double gutter) {
+ final width = MediaQuery.sizeOf(context).width;
+ final titleSize = (width * 0.031).clamp(28.0, 44.0);
+ final text = Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Semantics(
+ header: true,
+ child: Text(
+ signInStepTitle,
+ key: const Key('sign-in-step-title'),
+ style:
+ grid.AppType.display(
+ color: grid.AppPalette.textPrimary,
+ fontWeight: FontWeight.w700,
+ ).copyWith(
+ fontSize: titleSize,
+ height: 1.08,
+ letterSpacing: -0.02 * titleSize,
+ ),
+ ),
+ ),
+ const SizedBox(height: 26),
+ for (final (index, benefit) in signInStepBenefits.indexed) ...[
+ if (index > 0) const SizedBox(height: 16),
+ _Benefit(icon: benefit.icon, line: benefit.line),
+ ],
+ ],
+ );
+ return Stack(
+ children: [
+ const Positioned.fill(child: TourGlow()),
+ Positioned.fill(
+ child: Padding(
+ // Top: clear of the traffic lights' band. Bottom: room for the
+ // tagline.
+ padding: EdgeInsets.fromLTRB(
+ gutter,
+ windowDragBandHeight + 16,
+ gutter,
+ 56,
+ ),
+ child: Row(
+ children: [
+ Expanded(
+ flex: 120,
+ child: Center(
+ child: SingleChildScrollView(
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: text,
+ ),
+ ),
+ ),
+ ),
+ SizedBox(width: gutter * 0.8),
+ Expanded(
+ flex: 100,
+ child: Center(
+ child: SingleChildScrollView(child: _waysIn(context)),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ Positioned(
+ left: gutter,
+ right: gutter,
+ bottom: 20,
+ child: Text(
+ tourTagline,
+ style: grid.AppType.label(color: grid.AppPalette.onboardingTagline)
+ .copyWith(fontSize: 13.5, letterSpacing: 0.3),
+ ),
+ ),
+ ],
+ );
+ }
+
+ Widget _waysIn(BuildContext context) => ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 440),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Container(
+ // The app's raised-block recipe, as the sign-in card: fill plus a
+ // soft lift, no rim.
+ decoration: BoxDecoration(
+ color: grid.AppGlass.surfaceFill,
+ borderRadius: BorderRadius.circular(14),
+ boxShadow: grid.AppCard.shadow,
+ ),
+ padding: const EdgeInsets.all(_cardPadding),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ spacing: 12,
+ children: [
+ for (final provider in SignInProvider.values)
+ _stepsBack(
+ starting && startingProvider == provider,
+ SignInProviderButton(
+ provider: provider,
+ prominent: true,
+ // Return signs in with the first.
+ autofocus: provider == SignInProvider.values.first,
+ onPressed: () => onSignIn(provider),
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 10),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _cardPadding),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ QuietLink(
+ key: const Key('sign-in-step-skip'),
+ label: 'Skip',
+ onPressed: onSkip,
+ ),
+ const SizedBox(width: 16),
+ // The longer of the two gives way first, at a large text size in
+ // a small window.
+ Flexible(
+ child: _stepsBack(
+ starting && startingProvider == null,
+ QuietLink(
+ key: const Key('sign-in-step-email'),
+ label: 'Continue with email',
+ onPressed: () => onSignIn(null),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (error case final error?) ...[
+ const SizedBox(height: 10),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _cardPadding),
+ child: Semantics(
+ liveRegion: true,
+ child: Text(
+ error,
+ key: const Key('sign-in-step-error'),
+ style: grid.AppType.label(
+ color: Theme.of(context).colorScheme.error,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ );
+
+ /// [child], stepped back while its own sign-in is starting.
+ Widget _stepsBack(bool back, Widget child) => AnimatedOpacity(
+ opacity: back ? 0.55 : 1,
+ duration: const Duration(milliseconds: 120),
+ child: child,
+ );
+}
+
+class _Benefit extends StatelessWidget {
+ const _Benefit({required this.icon, required this.line});
+
+ final IconData icon;
+ final String line;
+
+ @override
+ Widget build(BuildContext context) {
+ final accent = grid.AppPalette.onboardingAccent;
+ return Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: 36,
+ height: 36,
+ decoration: BoxDecoration(
+ color: accent.withValues(alpha: 0.12),
+ borderRadius: BorderRadius.circular(10),
+ border: Border.all(color: accent.withValues(alpha: 0.28)),
+ ),
+ child: ExcludeSemantics(child: Icon(icon, size: 18, color: accent)),
+ ),
+ const SizedBox(width: 14),
+ Flexible(
+ child: Text(
+ line,
+ style: grid.AppType.body(color: grid.AppPalette.textPrimary)
+ .copyWith(fontSize: 18, fontWeight: FontWeight.w600),
+ ),
+ ),
+ ],
+ );
+ }
+}
+
+/// The tour's install line in its finished state: this page comes after it.
+class _ReadyBar extends StatelessWidget {
+ const _ReadyBar({required this.gutter, required this.line});
+
+ final double gutter;
+ final String line;
+
+ @override
+ Widget build(BuildContext context) => Container(
+ padding: EdgeInsets.fromLTRB(gutter, 14, gutter, 16),
+ decoration: BoxDecoration(
+ color: grid.AppPalette.panelBg,
+ border: Border(top: BorderSide(color: grid.AppPalette.divider)),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 4),
+ child: Row(
+ children: [
+ Container(
+ width: 8,
+ height: 8,
+ margin: const EdgeInsets.symmetric(horizontal: 3),
+ decoration: BoxDecoration(
+ color: grid.AppPalette.online,
+ shape: BoxShape.circle,
+ ),
+ ),
+ const SizedBox(width: 8),
+ Flexible(
+ child: Semantics(
+ liveRegion: true,
+ child: Text(
+ line,
+ key: const Key('sign-in-step-ready-line'),
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.label(
+ color: grid.AppPalette.textPrimary,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: 9),
+ ClipRRect(
+ borderRadius: BorderRadius.circular(3),
+ child: Container(height: 5, color: grid.AppPalette.online),
+ ),
+ ],
+ ),
+ );
+}
+
+/// The sign-in step bound to the app: shown by RootShell between setup and the
+/// first workspace (see [AppNotifier.signInStepShowing]).
+class SignInStepScreen extends StatefulWidget {
+ const SignInStepScreen({super.key, required this.app});
+
+ final AppNotifier app;
+
+ @override
+ State<SignInStepScreen> createState() => _SignInStepScreenState();
+}
+
+class _SignInStepScreenState extends State<SignInStepScreen> {
+ var _wasSigningIn = false;
+
+ /// Why a sign-in begun on this page ended without an account. Not
+ /// [AppNotifier.lastError] as it stands: that also carries what the desk
+ /// behind this page has to say, which is not this page's to show.
+ String? _error;
+
+ @override
+ void initState() {
+ super.initState();
+ appLog.info('onboarding', 'sign-in step: shown');
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final app = widget.app;
+ return ListenableBuilder(
+ listenable: app,
+ builder: (context, _) {
+ if (app.signingIn) {
+ _error = null;
+ } else if (_wasSigningIn) {
+ // A cancelled sign-in leaves no error; a failed one leaves its own.
+ _error = app.signedIn ? null : app.lastError;
+ }
+ _wasSigningIn = app.signingIn;
+ return SignInStep(
+ onSignIn: (provider) => unawaited(app.signInFromStep(provider)),
+ onSkip: app.skipSignInStep,
+ // Its browser is not open yet: the CLI has to start before it can
+ // name the page.
+ starting: app.canCancelLogin && app.pendingAuthorizeUrl == null,
+ startingProvider: app.signInProvider,
+ finishing: app.signingIn && !app.canCancelLogin,
+ error: _error,
+ );
+ },
+ );
+ }
+}
diff --git a/desktop/lib/widgets/workspace_account_button.dart b/desktop/lib/widgets/workspace_account_button.dart
new file mode 100644
index 000000000..04ac496dd
--- /dev/null
+++ b/desktop/lib/widgets/workspace_account_button.dart
@@ -0,0 +1,181 @@
+import 'dart:math' as math;
+
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_icons.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import 'desktop_chrome.dart';
+import 'workspace_bar_control.dart';
+
+/// The last thing in the tab row, as in a browser's toolbar: Sign in while this
+/// computer holds no account, and whose account it is once it does.
+///
+/// Sign in is the only control in the row with a word and a fill — everything
+/// before it is an icon — because it is the one the row is asking for
+/// (owner, 2026-10-11). Design:
+/// `docs/research/2026-10-08-onboarding-redesign/index.html`, section 5.
+class WorkspaceSignInButton extends StatelessWidget {
+ const WorkspaceSignInButton({super.key, this.onPressed});
+
+ final VoidCallback? onPressed;
+
+ static const label = 'Sign in';
+ static const tooltip = 'Sign in to Harness';
+
+ static Size _labelSize(BuildContext context) {
+ final painter = TextPainter(
+ text: TextSpan(text: label, style: DesktopChrome.control(medium: true)),
+ textDirection: Directionality.of(context),
+ textScaler: MediaQuery.textScalerOf(context),
+ maxLines: 1,
+ )..layout();
+ final size = painter.size;
+ painter.dispose();
+ return size;
+ }
+
+ static double widthOf(BuildContext context) => _labelSize(context).width + 28;
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final enabled = onPressed != null;
+ final accent = grid.AppPalette.swarmAccent;
+ // The accent is the bar's own ink, so the bar's own surface reads on it.
+ final ink = grid.AppPalette.swarmTabBar;
+ return WorkspaceBarControl(
+ label: label,
+ tooltip: tooltip,
+ onPressed: onPressed,
+ builder: (context, emphasized) => Container(
+ width: widthOf(context),
+ height: math.max(
+ grid.AppControl.heightSmall,
+ _labelSize(context).height + 12,
+ ),
+ alignment: Alignment.center,
+ decoration: ShapeDecoration(
+ color: accent.withValues(
+ alpha: !enabled
+ ? .35
+ : emphasized
+ ? 1
+ : .9,
+ ),
+ shape: const StadiumBorder(),
+ ),
+ child: Text(
+ label,
+ maxLines: 1,
+ softWrap: false,
+ style: DesktopChrome.control(color: ink, medium: true),
+ ),
+ ),
+ );
+ }
+}
+
+/// Whose account this window is signed in to: its initial, in a circle. A
+/// press opens the account menu (`account_menu.dart`).
+///
+/// The initial, not the account's picture: the Mac's tab row is native and
+/// loads nothing from the web, and the two hosts draw the same thing.
+class WorkspaceAvatarButton extends StatelessWidget {
+ const WorkspaceAvatarButton({
+ super.key,
+ required this.initial,
+ required this.tooltip,
+ this.onPressed,
+ });
+
+ /// One letter, or empty while the profile has not been read: a person mark.
+ final String initial;
+ final String tooltip;
+ final VoidCallback? onPressed;
+
+ /// The circle. Its slot in the row is [widthOf].
+ static const diameter = 24.0;
+
+ static double widthOf(BuildContext context) => diameter + 8;
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ final enabled = onPressed != null;
+ final accent = grid.AppPalette.swarmAccent;
+ return WorkspaceBarControl(
+ label: 'Account',
+ tooltip: tooltip,
+ onPressed: onPressed,
+ builder: (context, emphasized) => SizedBox(
+ width: widthOf(context),
+ height: math.max(grid.AppControl.heightSmall, diameter),
+ child: Center(
+ child: AccountAvatar(
+ initial: initial,
+ diameter: diameter,
+ emphasized: emphasized,
+ enabled: enabled,
+ accent: accent,
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// The account's mark, in the tab row and at the head of its menu.
+class AccountAvatar extends StatelessWidget {
+ const AccountAvatar({
+ super.key,
+ required this.initial,
+ required this.diameter,
+ required this.accent,
+ this.emphasized = false,
+ this.enabled = true,
+ });
+
+ final String initial;
+ final double diameter;
+ final Color accent;
+ final bool emphasized;
+ final bool enabled;
+
+ @override
+ Widget build(BuildContext context) {
+ final ink = accent.withValues(alpha: enabled ? 1 : .45);
+ return Container(
+ width: diameter,
+ height: diameter,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: accent.withValues(alpha: emphasized ? .28 : .18),
+ border: Border.all(
+ color: accent.withValues(alpha: emphasized ? .7 : .4),
+ ),
+ ),
+ child: initial.isEmpty
+ ? Icon(AppIcons.user, size: diameter * .55, color: ink)
+ : Text(
+ initial,
+ maxLines: 1,
+ softWrap: false,
+ // Its own size, whatever the window's text size: it is a mark in
+ // a fixed circle, not a line of text.
+ textScaler: TextScaler.noScaling,
+ style: DesktopChrome.control(
+ color: ink,
+ medium: true,
+ ).copyWith(fontSize: diameter * .48, height: 1),
+ ),
+ );
+ }
+}
+
+/// The one letter an account wears: of its name, else of its email.
+String accountInitial(String? name, String? email) {
+ final source = ((name?.trim().isNotEmpty ?? false) ? name! : email ?? '')
+ .trim();
+ return source.isEmpty ? '' : source.characters.first.toUpperCase();
+}
diff --git a/desktop/lib/widgets/workspace_store_button.dart b/desktop/lib/widgets/workspace_store_button.dart
index 084e4b174..1c5149a4c 100644
--- a/desktop/lib/widgets/workspace_store_button.dart
+++ b/desktop/lib/widgets/workspace_store_button.dart
@@ -1,14 +1,17 @@
-import 'dart:math' as math;
-
import 'package:flutter/material.dart';
import '../shared/theme/app_theme.dart' as grid;
+import '../shared/theme/workspace_bar_style.dart';
import '../devices/device_artwork.dart';
import '../store/store_mark.dart';
-import 'desktop_chrome.dart';
import 'workspace_bar_control.dart';
-/// The Store's rounded, marked button, restored from the original tab bar.
+/// Harness Store, and Devices beside it: each its own mark, and nothing else.
+///
+/// Icons like the search before them, as in a browser's toolbar, so the one
+/// thing in the row with a word on it is Sign in (owner, 2026-10-11;
+/// `workspace_account_button.dart`). The name is the tooltip's and the screen
+/// reader's. They were pills carrying their names until then.
class WorkspaceStoreButton extends StatelessWidget {
const WorkspaceStoreButton({
super.key,
@@ -23,77 +26,31 @@ class WorkspaceStoreButton extends StatelessWidget {
final VoidCallback? onPressed;
final bool devices;
- static Size _labelSize(BuildContext context, {bool devices = false}) {
- final painter = TextPainter(
- text: TextSpan(
- text: devices ? 'Devices' : 'Harness Store',
- style: DesktopChrome.control(),
- ),
- textDirection: Directionality.of(context),
- textScaler: MediaQuery.textScalerOf(context),
- maxLines: 1,
- )..layout();
- final size = painter.size;
- painter.dispose();
- return size;
- }
-
+ /// The slot each takes in the row: the search icon's.
static double widthOf(BuildContext context, {bool devices = false}) =>
- _labelSize(context, devices: devices).width + 52;
+ workspaceBarCellSizeOf(context).width * 4;
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
final enabled = onPressed != null;
- final accent = grid.AppPalette.swarmAccent;
return WorkspaceBarControl(
label: devices ? 'Devices' : 'Harness Store',
tooltip: tooltip,
onPressed: onPressed,
- builder: (context, emphasized) => Container(
+ builder: (context, emphasized) => SizedBox(
width: width,
- height: math.max(
- grid.AppControl.heightSmall,
- _labelSize(context, devices: devices).height + 12,
- ),
- padding: const EdgeInsets.symmetric(horizontal: 12),
- decoration: ShapeDecoration(
- color: Color.alphaBlend(
- accent.withValues(
- alpha: !enabled
- ? .04
- : emphasized
- ? .18
- : .10,
- ),
- grid.AppPalette.swarmWelcome,
- ),
- shape: StadiumBorder(
- side: BorderSide(
- color: accent.withValues(alpha: emphasized ? .85 : .12),
- width: emphasized ? 1.5 : 1,
- ),
+ height: workspaceBarControlHeight(context),
+ child: Center(
+ // A mark has its own colors, so it steps forward by opacity, as the
+ // search glyph beside it does.
+ child: Opacity(
+ opacity: !enabled || emphasized ? 1 : .82,
+ child: devices
+ ? DeviceMark(size: 20, enabled: enabled)
+ : StoreMark(size: 18, enabled: enabled),
),
),
- child: Row(
- children: [
- if (devices)
- DeviceMark(enabled: enabled)
- else
- StoreMark(enabled: enabled),
- const SizedBox(width: 8),
- Expanded(
- child: Text(
- devices ? 'Devices' : 'Harness Store',
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(
- color: accent.withValues(alpha: enabled ? 1 : .45),
- ),
- ),
- ),
- ],
- ),
),
);
}
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index f7ef15443..ee853a549 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -1017,43 +1017,109 @@ private class SwarmPlainIconButton: SwarmIconButton {
}
}
-/// A quiet filled pill, with the Store's colorful mark as its focal point.
-/// Drawing the content keeps the same spacing across AppKit button styles.
+/// Harness Store, and Devices beside it: each its own mark and nothing else,
+/// an icon like the search before them (WorkspaceStoreButton in Flutter). The
+/// title stays for accessibility and the tooltip; it is not drawn.
private final class SwarmStoreButton: SwarmIconButton {
- var markSize: CGFloat = 16
+ var markSize: CGFloat = 18
var palette = SwarmNativePalette() { didSet { needsDisplay = true } }
- var preferredWidth: CGFloat {
- ceil(workspaceBarTextWidth(title,
- font: font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular))) + 48
- }
+ /// The search icon's slot.
+ var preferredWidth: CGFloat { 32 }
override func draw(_ dirtyRect: NSRect) {
- let shape = NSBezierPath(roundedRect: bounds.insetBy(dx: 0.5, dy: 0.5),
- xRadius: bounds.height / 2, yRadius: bounds.height / 2)
- palette.workspace.setFill()
- shape.fill()
- let alpha: CGFloat = !isEnabled ? 0.04 : isHighlighted ? 0.24 : hovered ? 0.18 : 0.10
- palette.accent.withAlphaComponent(alpha).setFill()
- shape.fill()
- palette.accent.withAlphaComponent(hasKeyboardFocus && isEnabled ? 0.85 : 0.12).setStroke()
- shape.lineWidth = hasKeyboardFocus && isEnabled ? 1.5 : 1
- shape.stroke()
- let iconRect = NSRect(x: 12, y: (bounds.height - markSize) / 2, width: markSize, height: markSize)
+ // A mark has its own colors, so it steps forward by opacity, as the search
+ // glyph does; the keyboard gets a ring, having no hover.
+ let emphasized = hovered || hasKeyboardFocus || isHighlighted
+ let iconRect = NSRect(x: (bounds.width - markSize) / 2, y: (bounds.height - markSize) / 2,
+ width: markSize, height: markSize)
image?.draw(in: iconRect,
- from: .zero, operation: .sourceOver, fraction: isEnabled ? 1 : 0.45,
+ from: .zero, operation: .sourceOver, fraction: !isEnabled ? 0.45 : emphasized ? 1 : 0.82,
respectFlipped: true, hints: [.interpolation: NSImageInterpolation.high])
- let paragraph = NSMutableParagraphStyle()
- paragraph.lineBreakMode = .byTruncatingTail
- let attributes: [NSAttributedString.Key: Any] = [
- .paragraphStyle: paragraph,
- .font: font ?? NSFont.monospacedSystemFont(ofSize: 13, weight: .regular),
- .foregroundColor: palette.accent.withAlphaComponent(isEnabled ? 1 : 0.45),
- ]
- let text = title as NSString
- let height = text.size(withAttributes: attributes).height
- let textX = 20 + markSize
- text.draw(in: NSRect(x: textX, y: (bounds.height - height) / 2,
- width: max(0, bounds.width - textX - 12), height: height), withAttributes: attributes)
+ if hasKeyboardFocus && isEnabled {
+ let ring = NSBezierPath(roundedRect: bounds.insetBy(dx: 2.5, dy: 2.5), xRadius: 7, yRadius: 7)
+ palette.accent.withAlphaComponent(0.85).setStroke()
+ ring.lineWidth = 1.5
+ ring.stroke()
+ }
+ }
+}
+
+/// The tab row's last control, as in a browser's toolbar: Sign in while this
+/// computer holds no account — the only control in the row with a word and a
+/// fill — and the account's initial in a circle once it does
+/// (WorkspaceSignInButton / WorkspaceAvatarButton in Flutter).
+private final class SwarmAccountButton: SwarmIconButton {
+ enum Kind { case signIn, avatar }
+ var kind = Kind.signIn { didSet { needsDisplay = true } }
+ /// One letter, or empty while the profile has not been read.
+ var initial = "" { didSet { needsDisplay = true } }
+ var palette = SwarmNativePalette() { didSet { needsDisplay = true } }
+ static let label = "Sign in"
+ static let avatarDiameter: CGFloat = 24
+ private var labelFont: NSFont { NSFont.systemFont(ofSize: 13, weight: .medium) }
+ var preferredWidth: CGFloat {
+ switch kind {
+ case .signIn:
+ return ceil((Self.label as NSString).size(withAttributes: [.font: labelFont]).width) + 28
+ case .avatar:
+ return Self.avatarDiameter + 8
+ }
+ }
+
+ override func draw(_ dirtyRect: NSRect) {
+ let emphasized = isEnabled && (hovered || hasKeyboardFocus || isHighlighted)
+ switch kind {
+ case .signIn:
+ let shape = NSBezierPath(roundedRect: bounds, xRadius: bounds.height / 2, yRadius: bounds.height / 2)
+ palette.accent.withAlphaComponent(!isEnabled ? 0.35 : emphasized ? 1 : 0.9).setFill()
+ shape.fill()
+ // The accent is the bar's own ink, so the bar's own surface reads on it.
+ let line = NSAttributedString(string: Self.label, attributes: [
+ .font: labelFont, .foregroundColor: palette.tabBar,
+ ])
+ let size = line.size()
+ line.draw(in: NSRect(x: (bounds.width - size.width) / 2, y: (bounds.height - size.height) / 2,
+ width: size.width, height: size.height))
+ if hasKeyboardFocus && isEnabled {
+ let ring = NSBezierPath(roundedRect: bounds.insetBy(dx: -2, dy: -2),
+ xRadius: bounds.height / 2 + 2, yRadius: bounds.height / 2 + 2)
+ palette.accent.withAlphaComponent(0.85).setStroke()
+ ring.lineWidth = 1.5
+ ring.stroke()
+ }
+ case .avatar:
+ let diameter = Self.avatarDiameter
+ let circle = NSRect(x: (bounds.width - diameter) / 2, y: (bounds.height - diameter) / 2,
+ width: diameter, height: diameter)
+ let shape = NSBezierPath(ovalIn: circle.insetBy(dx: 0.5, dy: 0.5))
+ palette.accent.withAlphaComponent(emphasized ? 0.28 : 0.18).setFill()
+ shape.fill()
+ palette.accent.withAlphaComponent(emphasized ? 0.7 : 0.4).setStroke()
+ shape.lineWidth = hasKeyboardFocus && isEnabled ? 1.5 : 1
+ shape.stroke()
+ let ink = palette.accent.withAlphaComponent(isEnabled ? 1 : 0.45)
+ if initial.isEmpty {
+ // The profile has not been read yet: a person, not a blank.
+ if let person = HarnessControlSymbols.image("person.fill") {
+ let side = diameter * 0.5
+ let rect = NSRect(x: circle.midX - side / 2, y: circle.midY - side / 2, width: side, height: side)
+ let tinted = NSImage(size: rect.size, flipped: false) { area in
+ person.draw(in: area)
+ ink.set()
+ area.fill(using: .sourceAtop)
+ return true
+ }
+ tinted.draw(in: rect)
+ }
+ } else {
+ let line = NSAttributedString(string: initial, attributes: [
+ .font: NSFont.systemFont(ofSize: diameter * 0.48, weight: .medium), .foregroundColor: ink,
+ ])
+ let size = line.size()
+ line.draw(in: NSRect(x: circle.midX - size.width / 2, y: circle.midY - size.height / 2,
+ width: size.width, height: size.height))
+ }
+ }
}
}
@@ -1863,6 +1929,7 @@ private final class SwarmTabStrip: NSView {
fileprivate let searchButton = SwarmPlainIconButton()
fileprivate let storeButton = SwarmStoreButton()
fileprivate let devicesButton = SwarmStoreButton()
+ fileprivate let accountButton = SwarmAccountButton()
private var shareTarget: [String: Any]?
private var barFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
private var resourceValueGapCells: CGFloat = 0.75
@@ -2020,6 +2087,15 @@ private final class SwarmTabStrip: NSView {
storeButton.action = #selector(openStore)
storeButton.setAccessibilityLabel("Harness Store")
addSubview(storeButton)
+ accountButton.isBordered = false
+ accountButton.title = ""
+ accountButton.palette = palette
+ accountButton.isEnabled = false
+ accountButton.isHidden = true
+ accountButton.focusRingType = .none
+ accountButton.target = self
+ accountButton.action = #selector(openAccount)
+ addSubview(accountButton)
shareButton.isBordered = false
shareButton.title = "[ Share ]"
shareButton.target = self
@@ -2115,6 +2191,7 @@ private final class SwarmTabStrip: NSView {
storeButton.palette = palette
newButton.contentTintColor = palette.accent
devicesButton.palette = palette
+ accountButton.palette = palette
newButton.foreground = palette.navigationForeground
for tab in tabs {
tab.palette = palette
@@ -2135,10 +2212,31 @@ private final class SwarmTabStrip: NSView {
statusBar.setAccessibilityHidden(passiveFooter || statusBar.isHidden)
devicesButton.isHidden = state["devicesVisible"] as? Bool != true
devicesButton.setAccessibilityHidden(devicesButton.isHidden)
- setAccessibilityChildren(
- [scroll, newButton, searchButton] +
- (devicesButton.isHidden ? [] : [devicesButton]) + [storeButton] +
- (statusBar.isHidden || passiveFooter ? [] : [statusBar]))
+ // The row's last control: Sign in, or whose account this is. Absent (a
+ // viewer build, teardown), nothing is drawn.
+ let account = state["account"] as? [String: Any]
+ let accountKind: SwarmAccountButton.Kind? = switch account?["kind"] as? String {
+ case "signIn": .signIn
+ case "avatar": .avatar
+ default: nil
+ }
+ accountButton.isHidden = accountKind == nil
+ accountButton.setAccessibilityHidden(accountButton.isHidden)
+ if let accountKind {
+ accountButton.kind = accountKind
+ // One character at most reaches the circle, whatever was sent.
+ accountButton.initial = accountKind == .avatar
+ ? String(((account?["initial"] as? String) ?? "").prefix(1)) : ""
+ accountButton.toolTip = (account?["tooltip"] as? String).map { String($0.prefix(200)) }
+ accountButton.setAccessibilityLabel(accountKind == .signIn ? SwarmAccountButton.label : "Account")
+ accountButton.setAccessibilityHelp(accountButton.toolTip)
+ }
+ var children: [Any] = [scroll, newButton, searchButton]
+ if !devicesButton.isHidden { children.append(devicesButton) }
+ children.append(storeButton)
+ if !accountButton.isHidden { children.append(accountButton) }
+ if !(statusBar.isHidden || passiveFooter) { children.append(statusBar) }
+ setAccessibilityChildren(children)
reduceMotion = state["reduceMotion"] as? Bool == true
if let style = state["barStyle"] as? [String: Any] {
let size = CGFloat(min(36, max(8, (style["size"] as? NSNumber)?.doubleValue ?? 13)))
@@ -2157,6 +2255,7 @@ private final class SwarmTabStrip: NSView {
storeButton.font = navigationFont
storeButton.isEnabled = actionsEnabled
devicesButton.isEnabled = actionsEnabled && !devicesButton.isHidden
+ accountButton.isEnabled = actionsEnabled && !accountButton.isHidden
searchButton.foreground = palette.navigationForeground
searchButton.isEnabled = actionsEnabled
searchButton.toolTip = state["searchTooltip"] as? String ?? "Open Harness"
@@ -2399,16 +2498,21 @@ private final class SwarmTabStrip: NSView {
let trailing: CGFloat = 12 // AppDesktop.tabBarTrailingInset.
let toolHeight: CGFloat = 32
let capsuleHeight: CGFloat = 28 // AppControl.heightSmall.
- let storeWidth = min(storeButton.preferredWidth,
- max(0, bounds.width - cell * 14))
- storeButton.frame = NSRect(x: bounds.width - trailing - storeWidth,
- y: (bounds.height - capsuleHeight) / 2, width: storeWidth, height: capsuleHeight)
let iconWidth = cell * 4
+ // Search, Devices and Store are icons side by side; then, after
+ // AppDesktop.controlGap, Sign in or the account ends the row.
+ let accountWidth = accountButton.isHidden ? 0 : accountButton.preferredWidth
+ accountButton.frame = NSRect(x: bounds.width - trailing - accountWidth,
+ y: (bounds.height - capsuleHeight) / 2, width: accountWidth, height: capsuleHeight)
+ let actionsEdge = accountButton.isHidden ? bounds.width - trailing : accountButton.frame.minX - 8
+ let storeWidth = min(storeButton.preferredWidth, max(0, actionsEdge))
+ storeButton.frame = NSRect(x: actionsEdge - storeWidth,
+ y: (bounds.height - toolHeight) / 2, width: storeWidth, height: toolHeight)
let devicesWidth = devicesButton.isHidden ? 0 : devicesButton.preferredWidth
- devicesButton.frame = NSRect(x: storeButton.frame.minX - devicesWidth - 8,
- y: (bounds.height - capsuleHeight) / 2, width: devicesWidth, height: capsuleHeight)
+ devicesButton.frame = NSRect(x: storeButton.frame.minX - devicesWidth,
+ y: (bounds.height - toolHeight) / 2, width: devicesWidth, height: toolHeight)
let searchEdge = devicesButton.isHidden ? storeButton.frame.minX : devicesButton.frame.minX
- searchButton.frame = NSRect(x: searchEdge - iconWidth - 8,
+ searchButton.frame = NSRect(x: searchEdge - iconWidth,
y: (bounds.height - toolHeight) / 2, width: iconWidth, height: toolHeight)
// Only navigation actions share the tab row. Context has the full footer.
let tabBudget = max(0, searchButton.frame.minX - cell * 6)
@@ -2566,6 +2670,10 @@ private final class SwarmTabStrip: NSView {
@objc private func openDevices() {
if actionsEnabled && devicesButton.isEnabled && !devicesButton.isHidden { emit?("devices", nil) }
}
+ @objc private func openAccount() {
+ guard actionsEnabled, accountButton.isEnabled, !accountButton.isHidden else { return }
+ emit?(accountButton.kind == .signIn ? "signIn" : "account", nil)
+ }
@objc private func openFocusedPullRequest() {
if actionsEnabled && pullRequestButton.isEnabled, let url = pullRequestButton.actionURL {
emit?("focusedPullRequest", ["url": url])
diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dart
index fcbd21e6b..bc2a9bad8 100644
--- a/desktop/test/boot_flow_widget_test.dart
+++ b/desktop/test/boot_flow_widget_test.dart
@@ -25,6 +25,7 @@ import 'package:harness/widgets/update_notice.dart';
import 'package:harness/widgets/bootstrapping_screen.dart';
import 'package:harness/widgets/environment_setup_screen.dart';
import 'package:harness/widgets/setup_tour.dart';
+import 'package:harness/widgets/sign_in_step.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -1676,11 +1677,13 @@ void main() {
});
// First launch on a fresh computer (onboarding redesign, 2026-10-08): the
- // tour is the only screen of an unattended install, and Harness opens by
+ // tour is the only screen of an unattended install, and hands over by
// itself once setup and the downloads beside it are done, at the end of the
- // slide on screen.
+ // slide on screen. Not signed in, it hands over to the sign-in step
+ // (2026-10-11), and Skip there opens Harness.
testWidgets(
- 'a fresh install runs under the tour, which opens Harness by itself',
+ 'a fresh install runs under the tour, then offers a sign-in, and Skip '
+ 'opens Harness',
(tester) async {
final missing = EnvironmentReadiness(
steps: {
@@ -1749,12 +1752,24 @@ void main() {
app.setupDownloads.value = SetupDownloads.none;
await tester.pump();
- expect(tester.widget<Text>(line).data, 'Harness is ready. Opening…');
+ // Not "Opening…": what comes next is the sign-in step, not Harness.
+ expect(tester.widget<Text>(line).data, setupTourReadyLine);
await tester.pump(tourSlideDuration);
await tester.pump();
expect(find.byType(SetupTour), findsNothing);
- expect(find.text('Workspace reached'), findsOneWidget);
expect(app.setupTourShowing, isFalse);
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.text('Workspace reached'), findsNothing);
+ // It waits for the person: no timer opens Harness behind it.
+ await tester.pump(const Duration(minutes: 5));
+ expect(find.byType(SignInStep), findsOneWidget);
+
+ await tester.tap(find.byKey(const Key('sign-in-step-skip')));
+ await tester.pump();
+ expect(find.byType(SignInStep), findsNothing);
+ expect(find.text('Workspace reached'), findsOneWidget);
+ expect(app.isGuest, isTrue);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/sign_in_step_flow_test.dart b/desktop/test/sign_in_step_flow_test.dart
new file mode 100644
index 000000000..7af42331e
--- /dev/null
+++ b/desktop/test/sign_in_step_flow_test.dart
@@ -0,0 +1,285 @@
+import 'dart:async';
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/api/api_client.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/auth/cli_login.dart';
+import 'package:harness/auth/sign_in_provider.dart';
+import 'package:harness/bootstrap/environment_provisioner.dart';
+import 'package:harness/core/config.dart';
+import 'package:harness/state/app_state.dart';
+
+import 'swarm_state_test.dart' show MemoryStore;
+
+/// When the sign-in step shows, and what its controls do to the app: a
+/// computer new to Harness that holds no account is asked once, between setup
+/// and its first workspace (`widgets/sign_in_step.dart`). Nothing here draws;
+/// `sign_in_step_test.dart` has the page and `boot_flow_widget_test.dart` the
+/// window it stands in.
+class _Login extends CliLogin {
+ _Login({this.loggedIn = false});
+
+ /// What `harness auth status` says.
+ bool loggedIn;
+ final started = <SignInProvider?>[];
+ var cancels = 0;
+ Completer<void>? pending;
+ bool fail = false;
+
+ @override
+ Future<CliAuthStatus> checkStatus() async =>
+ CliAuthStatus(loggedIn: loggedIn);
+
+ @override
+ Future<void> logout() async {}
+
+ @override
+ void cancel() => cancels++;
+
+ @override
+ Future<void> login({
+ required void Function(String) onAuthorizeUrl,
+ SignInProvider? provider,
+ }) async {
+ started.add(provider);
+ final wait = pending = Completer<void>();
+ await wait.future;
+ if (fail) throw StateError('The sign-in page could not be reached.');
+ loggedIn = true;
+ }
+}
+
+class _Api extends ApiClient {
+ _Api()
+ : super(
+ config: AppConfig.dev,
+ session: AuthSession(storage: MemoryStore()),
+ );
+
+ @override
+ Future<Map<String, dynamic>?> me() async => null;
+
+ @override
+ Future<Map<String, dynamic>?> desk() async => null;
+}
+
+final _missing = EnvironmentReadiness(
+ steps: {
+ EnvironmentStep.harness: EnvironmentStepStatus.failed,
+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,
+ },
+ phase: EnvironmentSetupPhase.review,
+ plan: [EnvironmentPlanItem.harnessCli],
+);
+
+final _ready = EnvironmentReadiness(
+ steps: {
+ for (final step in EnvironmentStep.values)
+ step: EnvironmentStepStatus.ready,
+ },
+ phase: EnvironmentSetupPhase.ready,
+ mode: EnvironmentSetupMode.automatic,
+);
+
+/// A computer whose probe finds no Harness CLI, and whose install puts it in.
+/// [installed] is a computer that needs nothing.
+class _Setup extends EnvironmentProvisioner {
+ _Setup({this.installed = false}) : super(isMacOS: true);
+
+ final bool installed;
+
+ @override
+ Future<EnvironmentReadiness> ensureReady({
+ required void Function(EnvironmentReadiness value) onProgress,
+ EnvironmentReadiness? resumeFrom,
+ bool install = true,
+ EnvironmentSetupMode? mode,
+ }) async {
+ final result = install || installed ? _ready : _missing;
+ onProgress(result);
+ return result;
+ }
+}
+
+class _Desktop extends AppNotifier {
+ _Desktop(this.cli, {bool installed = false})
+ : super(
+ config: AppConfig.dev,
+ configStore: null,
+ authSession: AuthSession(storage: MemoryStore()),
+ cliLogin: cli,
+ environmentProvisioner: _Setup(installed: installed),
+ ) {
+ api = _Api();
+ }
+
+ final _Login cli;
+
+ @override
+ Future<void> ensureCliDaemonReady() async {}
+
+ @override
+ Future<bool> refreshMachines() async => true;
+}
+
+/// Lets a sign-in that has been released run to its end.
+Future<void> _settle() async {
+ for (var i = 0; i < 20; i++) {
+ await Future<void>.delayed(Duration.zero);
+ }
+}
+
+void main() {
+ test('a computer new to Harness, not signed in, is asked after the tour and '
+ 'Skip opens Harness', () async {
+ final app = _Desktop(_Login());
+ addTearDown(app.dispose);
+ await app.bootstrap();
+
+ expect(app.status, AppStatus.authenticated);
+ expect(app.isGuest, isTrue);
+ // The tour first; the step is next, and says so for the tour's last line.
+ expect(app.setupTourShowing, isTrue);
+ expect(app.signInStepNext, isTrue);
+ expect(app.signInStepShowing, isFalse);
+
+ app.finishSetupTour();
+ expect(app.signInStepShowing, isTrue);
+
+ var notified = 0;
+ app.addListener(() => notified++);
+ app.skipSignInStep();
+ expect(notified, greaterThan(0));
+ expect(app.signInStepShowing, isFalse);
+ expect(app.signInStepNext, isFalse);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.isGuest, isTrue);
+ expect(app.cli.started, isEmpty);
+ });
+
+ test('signing in from the step opens Harness signed in, and the page stays '
+ 'up until the account has arrived', () async {
+ final app = _Desktop(_Login());
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ app.finishSetupTour();
+
+ final signIn = app.signInFromStep(SignInProvider.google);
+ await _settle();
+ expect(app.cli.started, [SignInProvider.google]);
+ // The browser is open: the page stays, whatever the status says meanwhile.
+ expect(app.status, AppStatus.bootstrapping);
+ expect(app.signInStepShowing, isTrue);
+
+ app.cli.pending!.complete();
+ await signIn;
+ expect(app.signedIn, isTrue);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.signInStepShowing, isFalse);
+ // Spent: a sign-out later in the same launch does not bring it back.
+ expect(app.signInStepNext, isFalse);
+ });
+
+ test('every way in stays live while the browser is open', () async {
+ final app = _Desktop(_Login());
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ app.finishSetupTour();
+
+ unawaited(app.signInFromStep(SignInProvider.google));
+ await _settle();
+ // The same one again is its page again, not a second sign-in.
+ await app.signInFromStep(SignInProvider.google);
+ await _settle();
+ expect(app.cli.started, [SignInProvider.google]);
+ expect(app.cli.cancels, 0);
+
+ // Another one ends the first and begins its own. No provider is the
+ // sign-in page's own chooser: Continue with email.
+ unawaited(app.signInFromStep(SignInProvider.apple));
+ await _settle();
+ unawaited(app.signInFromStep());
+ await _settle();
+ expect(app.cli.started, [
+ SignInProvider.google,
+ SignInProvider.apple,
+ null,
+ ]);
+ expect(app.cli.cancels, 2);
+ expect(app.signInStepShowing, isTrue);
+
+ // Skip leaves, and takes the sign-in still waiting with it.
+ app.skipSignInStep();
+ expect(app.cli.cancels, 3);
+ expect(app.signingIn, isFalse);
+ expect(app.signInStepShowing, isFalse);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.isGuest, isTrue);
+ });
+
+ test('a sign-in that fails leaves the page up, with why', () async {
+ final app = _Desktop(_Login()..fail = true);
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ app.finishSetupTour();
+
+ final signIn = app.signInFromStep(SignInProvider.apple);
+ await _settle();
+ app.cli.pending!.complete();
+ await signIn;
+ expect(app.signedIn, isFalse);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.signInStepShowing, isTrue);
+ expect(app.lastError, contains('could not be reached'));
+ });
+
+ test('a new computer that is signed in already is not asked', () async {
+ final app = _Desktop(_Login(loggedIn: true));
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ await _settle();
+
+ expect(app.status, AppStatus.authenticated);
+ expect(app.signedIn, isTrue);
+ expect(app.setupTourShowing, isTrue);
+ // The tour's last line promises Harness itself, and keeps the promise.
+ expect(app.signInStepNext, isFalse);
+ app.finishSetupTour();
+ expect(app.signInStepShowing, isFalse);
+ });
+
+ test('a computer that already has Harness is never asked', () async {
+ // Setup has nothing to install here: someone who has used Harness without
+ // an account keeps the desk they open on, and finds Sign in in the tab row.
+ final app = _Desktop(_Login(), installed: true);
+ addTearDown(app.dispose);
+ await app.bootstrap();
+
+ expect(app.status, AppStatus.authenticated);
+ expect(app.isGuest, isTrue);
+ expect(app.setupTourShowing, isFalse);
+ expect(app.signInStepNext, isFalse);
+ expect(app.signInStepShowing, isFalse);
+ });
+
+ test('a CLI that is only being repaired is not a new computer', () async {
+ final app = _Desktop(_Login())..harnessInstalledBefore = () => true;
+ addTearDown(app.dispose);
+ await app.bootstrap();
+
+ expect(app.status, AppStatus.authenticated);
+ expect(app.setupTourShowing, isFalse);
+ expect(app.signInStepShowing, isFalse);
+ });
+
+ test('without a tour — setup that needed the person — the step follows '
+ 'setup', () async {
+ final app = _Desktop(_Login());
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ // Manual setup is the setup screen's, not the tour's.
+ app.selectEnvironmentSetupMode(EnvironmentSetupMode.manual);
+ expect(app.setupTourShowing, isFalse);
+ expect(app.signInStepShowing, isTrue);
+ });
+}
diff --git a/desktop/test/sign_in_step_test.dart b/desktop/test/sign_in_step_test.dart
new file mode 100644
index 000000000..bf93ee885
--- /dev/null
+++ b/desktop/test/sign_in_step_test.dart
@@ -0,0 +1,237 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/auth/sign_in_provider.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/widgets/setup_tour.dart';
+import 'package:harness/widgets/sign_in_step.dart';
+
+import 'support/capture.dart';
+
+/// The sign-in step as a computer new to Harness sees it after setup: one
+/// headline, four lines, two buttons, and Skip and Continue with email under
+/// them. The page takes callbacks and flags, so no app, CLI or browser is
+/// involved. `HARNESS_SIGN_IN_CAPTURE_DIR` writes what it draws.
+final _skip = find.byKey(const Key('sign-in-step-skip'));
+final _email = find.byKey(const Key('sign-in-step-email'));
+final _google = find.byKey(const Key('login-continue-google'));
+final _apple = find.byKey(const Key('login-continue-apple'));
+final _boundary = GlobalKey();
+
+Future<void> _mount(
+ WidgetTester tester, {
+ ValueChanged<SignInProvider?>? onSignIn,
+ VoidCallback? onSkip,
+ bool starting = false,
+ SignInProvider? startingProvider,
+ bool finishing = false,
+ String? error,
+ Size size = const Size(1280, 800),
+ Brightness brightness = Brightness.dark,
+ double textScale = 1,
+}) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context)
+ .copyWith(textScaler: TextScaler.linear(textScale)),
+ child: child!,
+ ),
+ home: RepaintBoundary(
+ key: _boundary,
+ child: SignInStep(
+ onSignIn: onSignIn ?? (_) {},
+ onSkip: onSkip ?? () {},
+ starting: starting,
+ startingProvider: startingProvider,
+ finishing: finishing,
+ error: error,
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+}
+
+Future<void> _capture(WidgetTester tester, String name) => captureBoundary(
+ tester,
+ _boundary.currentContext!.findRenderObject()! as RenderRepaintBoundary,
+ Platform.environment['HARNESS_SIGN_IN_CAPTURE_DIR'],
+ name,
+);
+
+void main() {
+ setUpAll(
+ () => loadCaptureFonts(Platform.environment['HARNESS_SIGN_IN_CAPTURE_DIR']),
+ );
+
+ testWidgets('one headline, four lines, two buttons, Skip and email', (
+ tester,
+ ) async {
+ await _mount(tester);
+ expect(find.text(signInStepTitle), findsOneWidget);
+ for (final line in const [
+ 'All your machines, one window',
+ 'Your agents on your phone',
+ 'Harness in any browser',
+ 'Same tabs on every computer',
+ ]) {
+ expect(find.text(line), findsOneWidget);
+ }
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.text('Continue with Apple'), findsOneWidget);
+ expect(find.text('Skip'), findsOneWidget);
+ expect(find.text('Continue with email'), findsOneWidget);
+ // It follows the tour: the same tagline, and the install line finished.
+ expect(find.text(tourTagline), findsOneWidget);
+ expect(find.text('Harness is ready.'), findsOneWidget);
+ // Nothing the sign-in sheet carries beside its buttons is on this page.
+ for (final absent in const [
+ 'Scan with your phone',
+ 'End-to-end encrypted',
+ 'Sign in through your browser to continue.',
+ 'Cancel',
+ 'Open browser',
+ 'Copy link',
+ ]) {
+ expect(find.text(absent), findsNothing, reason: absent);
+ }
+ await _capture(tester, 'sign-in-step-dark');
+ });
+
+ testWidgets('each control reports itself; Return is Continue with Google', (
+ tester,
+ ) async {
+ final pressed = <SignInProvider?>[];
+ var skipped = 0;
+ await _mount(tester, onSignIn: pressed.add, onSkip: () => skipped++);
+
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(pressed, [SignInProvider.google]);
+
+ await tester.tap(_apple);
+ await tester.tap(_google);
+ // No provider is the sign-in page's own chooser, which takes an email.
+ await tester.tap(_email);
+ expect(pressed, [
+ SignInProvider.google,
+ SignInProvider.apple,
+ SignInProvider.google,
+ null,
+ ]);
+ expect(skipped, 0);
+ await tester.tap(_skip);
+ expect(skipped, 1);
+ });
+
+ testWidgets(
+ 'Skip starts where the buttons start, email ends where they end',
+ (tester) async {
+ for (final size in const [Size(1280, 800), Size(880, 560)]) {
+ await _mount(tester, size: size);
+ final button = tester.getRect(_google);
+ expect(tester.getRect(_apple).left, button.left);
+ expect(tester.getRect(_apple).right, button.right);
+ expect(
+ tester.getRect(find.text('Skip')).left,
+ moreOrLessEquals(button.left, epsilon: 0.5),
+ reason: '$size',
+ );
+ expect(
+ tester.getRect(find.text('Continue with email')).right,
+ moreOrLessEquals(button.right, epsilon: 0.5),
+ reason: '$size',
+ );
+ // Under the card, not in it.
+ expect(
+ tester.getRect(find.text('Skip')).top,
+ greaterThan(tester.getRect(_apple).bottom + 20),
+ );
+ }
+ },
+ );
+
+ testWidgets('nothing changes while the browser is open, and every way in '
+ 'stays live', (tester) async {
+ final pressed = <SignInProvider?>[];
+ await _mount(
+ tester,
+ onSignIn: pressed.add,
+ starting: true,
+ startingProvider: SignInProvider.google,
+ );
+ // The pressed button keeps its words; it only steps back until its
+ // browser opens.
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.textContaining('Waiting'), findsNothing);
+ double opacity(Finder control) => tester
+ .widget<AnimatedOpacity>(
+ find.ancestor(of: control, matching: find.byType(AnimatedOpacity)),
+ )
+ .opacity;
+ expect(opacity(_google), lessThan(1));
+ expect(opacity(_apple), 1);
+ expect(opacity(_email), 1);
+
+ await tester.tap(_google);
+ await tester.tap(_apple);
+ await tester.tap(_email);
+ expect(pressed, [SignInProvider.google, SignInProvider.apple, null]);
+
+ // Email pressed: it is the one that steps back.
+ await _mount(tester, starting: true);
+ expect(opacity(_email), lessThan(1));
+ expect(opacity(_google), 1);
+ });
+
+ testWidgets('says it is signing in once the browser has approved, and why '
+ 'a sign-in failed', (tester) async {
+ await _mount(tester, finishing: true);
+ expect(find.text('Signing in…'), findsOneWidget);
+ expect(find.text('Harness is ready.'), findsNothing);
+
+ await _mount(tester, error: 'The sign-in page could not be reached.');
+ expect(find.text('The sign-in page could not be reached.'), findsOneWidget);
+ expect(find.text('Harness is ready.'), findsOneWidget);
+ });
+
+ for (final brightness in Brightness.values) {
+ for (final (size, scale) in const [
+ (Size(1280, 800), 1.0),
+ (Size(880, 560), 1.0),
+ (Size(880, 560), 1.6),
+ (Size(880, 560), 2.0),
+ (Size(1920, 1200), 1.0),
+ ]) {
+ testWidgets('draws in ${brightness.name} at ${size.width.round()}×'
+ '${size.height.round()}, text ${scale}x, without overflow', (
+ tester,
+ ) async {
+ await _mount(
+ tester,
+ size: size,
+ brightness: brightness,
+ textScale: scale,
+ error: 'The sign-in page could not be reached.',
+ );
+ expect(tester.takeException(), isNull);
+ expect(find.text('Skip'), findsOneWidget);
+ if (scale == 1.0) {
+ await _capture(
+ tester,
+ 'sign-in-step-${brightness.name}-${size.width.round()}',
+ );
+ }
+ });
+ }
+ }
+}
diff --git a/desktop/test/support/capture.dart b/desktop/test/support/capture.dart
new file mode 100644
index 000000000..e773ff83b
--- /dev/null
+++ b/desktop/test/support/capture.dart
@@ -0,0 +1,105 @@
+import 'dart:convert';
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'real_fonts.dart';
+
+/// Fonts for a test that can also write what it draws.
+///
+/// With [captureDir] set on a Mac, the actual system face and the app's icon
+/// faces, so the picture is the app's and not Ahem's boxes; otherwise the
+/// shared metric-compatible faces every regression run uses.
+Future<void> loadCaptureFonts(String? captureDir) async {
+ if (captureDir == null || !Platform.isMacOS) return loadRealFonts();
+ for (final family in ['.AppleSystemUIFont', 'Roboto']) {
+ final bytes = ByteData.sublistView(
+ await File('/System/Library/Fonts/SFNS.ttf').readAsBytes(),
+ );
+ await (FontLoader(family)..addFont(Future.value(bytes))).load();
+ }
+ final manifest =
+ jsonDecode(await rootBundle.loadString('FontManifest.json')) as List;
+ for (final entry in manifest.cast<Map<String, dynamic>>()) {
+ final loader = FontLoader(entry['family'] as String);
+ for (final font in (entry['fonts'] as List).cast<Map>()) {
+ loader.addFont(rootBundle.load(font['asset'] as String));
+ }
+ await loader.load();
+ }
+}
+
+/// Writes [boundary] to `<captureDir>/<name>.png`, shadows included. Does
+/// nothing without a [captureDir].
+Future<void> captureBoundary(
+ WidgetTester tester,
+ RenderRepaintBoundary boundary,
+ String? captureDir,
+ String name,
+) => _capture(
+ tester,
+ boundary,
+ captureDir,
+ name,
+ () => boundary.toImage(pixelRatio: 2),
+);
+
+/// The same for the whole window, every route in it: a menu or a dialog is a
+/// route of its own, outside the boundary of the screen under it.
+Future<void> captureWindow(
+ WidgetTester tester,
+ String? captureDir,
+ String name,
+) {
+ final view = tester.binding.renderViews.first;
+ // The view's own layer already scales by the display's pixel ratio, and its
+ // bounds are in those pixels: on a 2x display, asking for logical bounds at
+ // 2x drew the top-left quarter of the window twice as large.
+ final ratio = view.configuration.devicePixelRatio;
+ return _capture(
+ tester,
+ view,
+ captureDir,
+ name,
+ () => (view.debugLayer! as OffsetLayer).toImage(
+ Offset.zero & (view.size * ratio),
+ pixelRatio: 2 / ratio,
+ ),
+ );
+}
+
+Future<void> _capture(
+ WidgetTester tester,
+ RenderObject root,
+ String? captureDir,
+ String name,
+ Future<ui.Image> Function() draw,
+) async {
+ if (captureDir == null) return;
+ final oldShadows = debugDisableShadows;
+ void repaint(RenderObject object) {
+ object.markNeedsPaint();
+ object.visitChildren(repaint);
+ }
+
+ try {
+ debugDisableShadows = false;
+ repaint(root);
+ await tester.pump();
+ await tester.runAsync(() async {
+ final picture = await draw();
+ final bytes = await picture.toByteData(format: ui.ImageByteFormat.png);
+ await Directory(captureDir).create(recursive: true);
+ await File('$captureDir/$name.png')
+ .writeAsBytes(bytes!.buffer.asUint8List());
+ picture.dispose();
+ });
+ } finally {
+ debugDisableShadows = oldShadows;
+ repaint(root);
+ await tester.pump();
+ }
+}
diff --git a/desktop/test/workspace_account_test.dart b/desktop/test/workspace_account_test.dart
new file mode 100644
index 000000000..d2a4f6344
--- /dev/null
+++ b/desktop/test/workspace_account_test.dart
@@ -0,0 +1,440 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/screens/login_screen.dart';
+import 'package:harness/settings/settings_screen.dart';
+import 'package:harness/settings/settings_section.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/app_state.dart';
+import 'package:harness/widgets/account_menu.dart';
+import 'package:harness/widgets/workspace_account_button.dart';
+
+import 'support/capture.dart';
+import 'swarm_screen_test.dart' show mount;
+import 'swarm_state_test.dart' show createApp;
+
+/// The tab row's right end, as in a browser's toolbar (owner, 2026-10-11):
+/// Search, Devices and Harness Store are icons, and the last control is Sign
+/// in while this computer holds no account, then the account's initial, whose
+/// menu opens what the app already has. `HARNESS_ACCOUNT_CAPTURE_DIR` writes
+/// what it draws.
+final _captureDir = Platform.environment['HARNESS_ACCOUNT_CAPTURE_DIR'];
+
+Future<void> _capture(WidgetTester tester, String name) =>
+ captureWindow(tester, _captureDir, name);
+
+final _search = find.byKey(const ValueKey('swarm-search-button'));
+final _bell = find.byKey(const ValueKey('workspace-notifications-button'));
+final _devices = find.byKey(const ValueKey('swarm-devices-button'));
+final _store = find.byKey(const ValueKey('swarm-store-button'));
+final _signIn = find.byKey(const ValueKey('swarm-sign-in-button'));
+final _avatar = find.byKey(const ValueKey('swarm-account-button'));
+final _menu = find.byKey(const ValueKey('account-menu'));
+
+AppNotifier _signedIn() => createApp()
+ ..currentUser = const CurrentUserProfile(
+ name: 'Dee Example',
+ email: '[email protected]',
+ );
+
+Future<void> _mountMenu(
+ WidgetTester tester, {
+ String name = 'Dee Example',
+ String email = '[email protected]',
+ bool showAddPhone = true,
+ void Function(AccountMenuChoice?)? onChoice,
+}) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1280, 800);
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Builder(
+ builder: (context) => Scaffold(
+ body: TextButton(
+ onPressed: () async {
+ // Opened whether or not anyone listens for the answer.
+ final choice = await showAccountMenu(
+ context,
+ name: name,
+ email: email,
+ showAddPhone: showAddPhone,
+ );
+ onChoice?.call(choice);
+ },
+ child: const Text('open'),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.text('open'));
+ await tester.pump();
+ await tester.pump();
+}
+
+void main() {
+ setUpAll(() => loadCaptureFonts(_captureDir));
+
+ testWidgets('not signed in, the row ends in Sign in, after three icons', (
+ tester,
+ ) async {
+ final app = createApp()..signedIn = false;
+ addTearDown(app.dispose);
+ await mount(tester, app);
+
+ expect(_signIn, findsOneWidget);
+ expect(_avatar, findsNothing);
+ // Where this app draws the row it carries the bell too; on a Mac that is
+ // in the menu bar.
+ final order = [
+ for (final control in [_search, _bell, _devices, _store, _signIn])
+ tester.getCenter(control).dx,
+ ];
+ expect(
+ order,
+ [...order]..sort(),
+ reason: 'Search, Devices, Store, Sign in',
+ );
+ // The only control in the row with a word on it.
+ expect(
+ find.descendant(of: _signIn, matching: find.text('Sign in')),
+ findsOneWidget,
+ );
+ for (final icon in [_search, _devices, _store]) {
+ expect(
+ find.descendant(of: icon, matching: find.byType(Text)),
+ findsNothing,
+ );
+ }
+ // Icons sit side by side; nothing is drawn between them and Sign in.
+ expect(tester.getRect(_search).right, tester.getRect(_bell).left);
+ expect(tester.getRect(_bell).right, tester.getRect(_devices).left);
+ expect(tester.getRect(_devices).right, tester.getRect(_store).left);
+ expect(
+ tester.getRect(_signIn).left - tester.getRect(_store).right,
+ grid.AppDesktop.controlGap,
+ );
+ expect(
+ tester.getRect(_signIn).right,
+ 1280 - grid.AppDesktop.tabBarTrailingInset,
+ );
+ expect(find.byTooltip('Sign in to Harness'), findsOneWidget);
+ expect(find.byTooltip('Explore Harness Store · ⌘S'), findsOneWidget);
+ await _capture(tester, 'tab-row-sign-in');
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+
+ testWidgets(
+ 'Sign in opens the sign-in over the desk, and closes back to it',
+ (tester) async {
+ final app = createApp()..signedIn = false;
+ addTearDown(app.dispose);
+ await mount(tester, app);
+
+ await tester.tap(_signIn);
+ await tester.pump();
+ await tester.pump();
+ expect(find.byType(LoginScreen), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ // The quiet way in is on this sign-in too — as words, not as one more
+ // button the width of the two above it.
+ final email = find.byKey(const Key('login-continue-email'));
+ expect(email, findsOneWidget);
+ expect(
+ find.ancestor(
+ of: find.text('Continue with email'),
+ matching: find.byType(TextButton),
+ ),
+ findsNothing,
+ );
+ expect(
+ tester.getSize(email).width,
+ lessThan(
+ tester.getSize(find.byKey(const Key('login-continue-google'))).width *
+ .8,
+ ),
+ );
+
+ await tester.tap(find.byKey(const Key('login-close-button')));
+ await tester.pump();
+ await tester.pump();
+ expect(find.byType(LoginScreen), findsNothing);
+ expect(_signIn, findsOneWidget);
+ },
+ );
+
+ testWidgets('signed in, the same place is the account\'s initial', (
+ tester,
+ ) async {
+ final app = _signedIn();
+ addTearDown(app.dispose);
+ await mount(tester, app);
+
+ expect(_signIn, findsNothing);
+ expect(_avatar, findsOneWidget);
+ expect(
+ find.descendant(of: _avatar, matching: find.text('D')),
+ findsOneWidget,
+ );
+ expect(find.byTooltip('Dee Example · [email protected]'), findsOneWidget);
+ expect(
+ tester.getRect(_avatar).right,
+ 1280 - grid.AppDesktop.tabBarTrailingInset,
+ );
+ expect(
+ tester.getRect(_avatar).left - tester.getRect(_store).right,
+ grid.AppDesktop.controlGap,
+ );
+
+ // The profile has not been read yet: a person, not a letter or a blank.
+ app.currentUser = null;
+ app.notifyListeners();
+ await tester.pump();
+ expect(_avatar, findsOneWidget);
+ expect(
+ find.descendant(of: _avatar, matching: find.byType(Text)),
+ findsNothing,
+ );
+ expect(
+ find.descendant(of: _avatar, matching: find.byType(Icon)),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('the avatar opens its menu under the row, at the right', (
+ tester,
+ ) async {
+ final app = _signedIn();
+ addTearDown(app.dispose);
+ await mount(tester, app);
+
+ await tester.tap(_avatar);
+ await tester.pump();
+ await tester.pump();
+ expect(_menu, findsOneWidget);
+ expect(find.text('Dee Example'), findsOneWidget);
+ expect(find.text('[email protected]'), findsOneWidget);
+ final menu = tester.getRect(_menu);
+ expect(menu.top, greaterThanOrEqualTo(tester.getRect(_avatar).bottom));
+ expect(menu.right, greaterThan(1280 - 24));
+ await _capture(tester, 'tab-row-account-menu');
+
+ // Escape puts it away and opens nothing.
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ await tester.pump();
+ expect(_menu, findsNothing);
+ expect(find.byType(SettingsScreen), findsNothing);
+ });
+
+ testWidgets('Notifications and Settings open Settings, each on its page', (
+ tester,
+ ) async {
+ final app = _signedIn();
+ addTearDown(app.dispose);
+ await mount(tester, app);
+
+ for (final (row, section) in [
+ ('notifications', SettingsSection.notifications),
+ ('settings', null),
+ ]) {
+ await tester.tap(_avatar);
+ await tester.pump();
+ await tester.pump();
+ await tester.tap(find.byKey(ValueKey('account-menu-$row')));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ // The menu has gone before what it opened arrives.
+ expect(_menu, findsNothing);
+ final settings = tester.widget<SettingsScreen>(
+ find.byType(SettingsScreen),
+ );
+ expect(settings.initialSection, section, reason: row);
+ Navigator.of(tester.element(find.byType(SettingsScreen))).pop();
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(find.byType(SettingsScreen), findsNothing);
+ }
+ });
+
+ testWidgets('the native tab row is told which of the two to draw', (
+ tester,
+ ) async {
+ const channel = MethodChannel('harness/swarm_tabs');
+ final updates = <Map>[];
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (
+ call,
+ ) async {
+ if (call.method == 'update') updates.add(call.arguments as Map);
+ return true;
+ });
+ addTearDown(
+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ null,
+ ),
+ );
+ final app = createApp()..signedIn = false;
+ addTearDown(app.dispose);
+ await mount(tester, app, nativeTabs: true);
+ expect(updates.last['account'], {
+ 'kind': 'signIn',
+ 'tooltip': 'Sign in to Harness',
+ });
+ // AppKit draws the row, so this app draws none of it.
+ expect(_signIn, findsNothing);
+
+ app
+ ..signedIn = true
+ ..currentUser = const CurrentUserProfile(email: '[email protected]')
+ ..notifyListeners();
+ await tester.pump();
+ expect(updates.last['account'], {
+ 'kind': 'avatar',
+ // No name: the email's first letter.
+ 'initial': 'D',
+ 'tooltip': '[email protected]',
+ });
+
+ // A click there comes back as the native action.
+ await tester.binding.defaultBinaryMessenger.handlePlatformMessage(
+ channel.name,
+ channel.codec.encodeMethodCall(const MethodCall('account')),
+ (_) {},
+ );
+ await tester.pump();
+ await tester.pump();
+ expect(_menu, findsOneWidget);
+ });
+
+ testWidgets('the menu: who, then five rows, no ellipses', (tester) async {
+ await _mountMenu(tester);
+ expect(find.text('Dee Example'), findsOneWidget);
+ expect(find.text('[email protected]'), findsOneWidget);
+ final rows = [
+ 'Add Phone',
+ 'Customize Harness',
+ 'Notifications',
+ 'Settings',
+ 'Sign out',
+ ];
+ final tops = [for (final row in rows) tester.getTopLeft(find.text(row)).dy];
+ expect(tops, [...tops]..sort(), reason: 'in this order');
+ expect(find.textContaining('…'), findsNothing);
+ expect(find.textContaining('...'), findsNothing);
+ // Nothing the menu was offered and turned down.
+ for (final absent in ['Machines', 'Your devices', 'Usage']) {
+ expect(find.text(absent), findsNothing);
+ }
+ });
+
+ testWidgets('each row answers with itself and closes the menu', (
+ tester,
+ ) async {
+ for (final choice in AccountMenuChoice.values) {
+ AccountMenuChoice? chosen;
+ var answered = false;
+ await _mountMenu(
+ tester,
+ onChoice: (value) {
+ chosen = value;
+ answered = true;
+ },
+ );
+ await tester.tap(find.byKey(ValueKey('account-menu-${choice.name}')));
+ await tester.pump();
+ await tester.pump();
+ expect(answered, isTrue);
+ expect(chosen, choice);
+ expect(_menu, findsNothing);
+ }
+ });
+
+ testWidgets('opened, no row is lit; Down and Up walk them, Return takes '
+ 'the one it is on, a click outside takes none', (tester) async {
+ AccountMenuChoice? chosen;
+ var answers = 0;
+ void answer(AccountMenuChoice? value) {
+ chosen = value;
+ answers++;
+ }
+
+ // Return on a menu just opened is no choice, and leaves it open.
+ await _mountMenu(tester, onChoice: answer);
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(answers, 0);
+ expect(_menu, findsOneWidget);
+
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ await tester.pump();
+ expect(chosen, AccountMenuChoice.addPhone);
+
+ // Up from nothing is the last row, and Down from there the first again.
+ await _mountMenu(tester, onChoice: answer);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ await tester.pump();
+ expect(chosen, AccountMenuChoice.signOut);
+
+ await _mountMenu(tester, onChoice: answer);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ await tester.pump();
+ expect(chosen, AccountMenuChoice.customize);
+
+ await _mountMenu(tester, onChoice: answer);
+ await tester.tapAt(const Offset(40, 700));
+ await tester.pump();
+ await tester.pump();
+ expect(answers, 4);
+ expect(chosen, isNull);
+ expect(_menu, findsNothing);
+ });
+
+ testWidgets('an account with a phone is not offered one; an account with '
+ 'no name says its email once', (tester) async {
+ await _mountMenu(tester, name: '', showAddPhone: false);
+ expect(find.text('Add Phone'), findsNothing);
+ expect(find.text('Customize Harness'), findsOneWidget);
+ expect(find.text('[email protected]'), findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ await tester.pump();
+ expect(_menu, findsNothing);
+ // Down now lands on what is first.
+ AccountMenuChoice? chosen;
+ await _mountMenu(
+ tester,
+ showAddPhone: false,
+ onChoice: (value) => chosen = value,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ await tester.pump();
+ expect(chosen, AccountMenuChoice.customize);
+ });
+
+ test('the one letter an account wears', () {
+ expect(accountInitial('Dee Example', '[email protected]'), 'D');
+ expect(accountInitial(null, '[email protected]'), 'Z');
+ expect(accountInitial(' ', '[email protected]'), 'A');
+ expect(accountInitial('élan', null), 'É');
+ expect(accountInitial(null, null), '');
+ });
+}
diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dart
index a7aaa7be2..03ae6fd84 100644
--- a/desktop/test/workspace_status_test.dart
+++ b/desktop/test/workspace_status_test.dart
@@ -1724,27 +1724,21 @@ void main() {
for (final element in barControls.evaluate()) {
final control = element.widget as WorkspaceBarControl;
final rect = tester.getRect(find.byWidget(control));
+ // Harness Store is an icon like the rest (2026-10-11): its name is
+ // its tooltip's, and it has the row's one height.
if (control.label == 'Harness Store') {
- final label = find.descendant(
- of: find.byWidget(control),
- matching: find.text('Harness Store'),
- );
- expect(
- tester.widget<Text>(label).style!.fontFamily,
- grid.AppType.sansFamily,
- );
- expect(
- rect.height,
- greaterThanOrEqualTo(tester.getSize(label).height + 12),
- );
- } else {
expect(
- rect.height,
- control.selectedBackground == null
- ? 28
- : tester.getSize(bar).height,
+ find.descendant(
+ of: find.byWidget(control),
+ matching: find.byType(Text),
+ ),
+ findsNothing,
);
}
+ expect(
+ rect.height,
+ control.selectedBackground == null ? 28 : tester.getSize(bar).height,
+ );
if (control.selected == true) {
final fill = find.descendant(
of: find.byWidget(control),
@@ -1802,6 +1796,8 @@ void main() {
}
await captureControls(tester, 'workspace-bottom-bar');
final workspace = tester.widget<SwarmScreen>(find.byType(SwarmScreen));
+ // A computer with no account: the row then ends in Sign in.
+ app.signedIn = false;
for (final scale in [1.0, 2.0]) {
await tester.pumpWidget(
MaterialApp(
@@ -1821,16 +1817,23 @@ void main() {
MediaQuery.textScalerOf(tester.element(store)).scale(13),
13 * scale,
);
+ // Store is its mark alone (2026-10-11); the row's one word is Sign
+ // in, which follows the window's text size as Store's name did.
+ expect(
+ find.descendant(of: store, matching: find.byType(Text)),
+ findsNothing,
+ );
+ final signIn = find.byKey(const ValueKey('swarm-sign-in-button'));
final label = find.descendant(
- of: store,
- matching: find.text('Harness Store'),
+ of: signIn,
+ matching: find.text('Sign in'),
);
expect(
tester.renderObject<RenderParagraph>(label).didExceedMaxLines,
isFalse,
);
expect(
- tester.getSize(store).height,
+ tester.getSize(signIn).height,
greaterThanOrEqualTo(tester.getSize(label).height + 12),
);
expect(
diff --git a/desktop/tool/native_ax.swift b/desktop/tool/native_ax.swift
new file mode 100644
index 000000000..104b8eb06
--- /dev/null
+++ b/desktop/tool/native_ax.swift
@@ -0,0 +1,110 @@
+import ApplicationServices
+import Cocoa
+
+// Reads and presses the native controls of ONE process, named by its pid,
+// through the accessibility API, and names its on-screen window for
+// `screencapture -l`. `tool/native_driver.py` builds and runs this for a native
+// integration test: AppKit draws the tab row, so a Flutter test can neither
+// see nor press it, and a click it synthesised would move the person's pointer.
+//
+// native_ax windowid <pid>
+// native_ax list <pid> every named button in the window
+// native_ax find <pid> <label>
+// native_ax press <pid> <label>
+// native_ax tree <pid> the first levels of the window, to debug
+//
+// It needs Accessibility for the terminal that runs it (System Settings ▸
+// Privacy & Security). It reads no other process and no screen contents.
+func value(_ element: AXUIElement, _ name: String) -> CFTypeRef? {
+ var out: CFTypeRef?
+ return AXUIElementCopyAttributeValue(element, name as CFString, &out) == .success ? out : nil
+}
+func text(_ element: AXUIElement, _ name: String) -> String { (value(element, name) as? String) ?? "" }
+func frame(_ element: AXUIElement) -> CGRect? {
+ guard let p = value(element, kAXPositionAttribute), let s = value(element, kAXSizeAttribute) else { return nil }
+ var point = CGPoint.zero, size = CGSize.zero
+ AXValueGetValue(p as! AXValue, .cgPoint, &point)
+ AXValueGetValue(s as! AXValue, .cgSize, &size)
+ return CGRect(origin: point, size: size)
+}
+var visited = 0
+func walk(_ element: AXUIElement, _ depth: Int, _ visit: (AXUIElement) -> Void) {
+ visited += 1
+ if depth > 14 || visited > 6000 { return }
+ visit(element)
+ // The Flutter view's own tree is not what this reads.
+ if text(element, kAXRoleAttribute) == "AXTextArea" { return }
+ for child in (value(element, kAXChildrenAttribute) as? [AXUIElement]) ?? [] { walk(child, depth + 1, visit) }
+}
+func describe(_ element: AXUIElement) -> [String: Any] {
+ let rect = frame(element) ?? .zero
+ return ["role": text(element, kAXRoleAttribute), "title": text(element, kAXTitleAttribute),
+ "label": text(element, kAXDescriptionAttribute), "help": text(element, kAXHelpAttribute),
+ "enabled": (value(element, kAXEnabledAttribute) as? Bool) ?? false,
+ "x": rect.minX, "y": rect.minY, "w": rect.width, "h": rect.height]
+}
+func emit(_ object: Any) {
+ print(String(data: try! JSONSerialization.data(withJSONObject: object, options: [.sortedKeys]), encoding: .utf8)!)
+}
+func mainWindow(_ pid: pid_t) -> AXUIElement? {
+ let app = AXUIElementCreateApplication(pid)
+ return ((value(app, kAXWindowsAttribute) as? [AXUIElement]) ?? []).first
+}
+func windowInfo(_ pid: pid_t) -> [String: Any]? {
+ let all = (CGWindowListCopyWindowInfo([.optionOnScreenOnly, .excludeDesktopElements], kCGNullWindowID) as? [[String: Any]]) ?? []
+ return all.first { ($0[kCGWindowOwnerPID as String] as? Int).map { pid_t($0) } == pid && ($0[kCGWindowLayer as String] as? Int) == 0 }
+}
+
+let arguments = CommandLine.arguments
+guard arguments.count >= 3, let pid = pid_t(arguments[2]) else { emit(["error": "usage"]); exit(2) }
+guard AXIsProcessTrusted() else { emit(["error": "accessibility is not allowed for this process"]); exit(3) }
+switch arguments[1] {
+case "windowid":
+ guard let info = windowInfo(pid) else { emit(["error": "no window"]); exit(1) }
+ emit(["id": info[kCGWindowNumber as String] as? Int ?? 0, "bounds": info[kCGWindowBounds as String] ?? [:]])
+case "list", "find", "press":
+ guard let window = mainWindow(pid) else { emit(["error": "no window"]); exit(1) }
+ var buttons: [(AXUIElement, [String: Any])] = []
+ walk(window, 0) { element in
+ guard text(element, kAXRoleAttribute) == "AXButton" else { return }
+ let about = describe(element)
+ if !(about["label"] as! String).isEmpty || !(about["title"] as! String).isEmpty { buttons.append((element, about)) }
+ }
+ let bounds = frame(window) ?? .zero
+ if arguments[1] == "list" {
+ emit(["window": ["x": bounds.minX, "y": bounds.minY, "w": bounds.width, "h": bounds.height],
+ "buttons": buttons.map { $0.1 }, "visited": visited])
+ break
+ }
+ guard arguments.count >= 4 else { emit(["error": "usage"]); exit(2) }
+ let wanted = arguments[3]
+ let hits = buttons.filter { ($0.1["label"] as! String) == wanted || ($0.1["title"] as! String) == wanted }
+ guard let hit = hits.first else {
+ emit(["found": false, "window": ["x": bounds.minX, "y": bounds.minY, "w": bounds.width, "h": bounds.height]])
+ break
+ }
+ var answer = hit.1
+ answer["found"] = true
+ answer["count"] = hits.count
+ answer["window"] = ["x": bounds.minX, "y": bounds.minY, "w": bounds.width, "h": bounds.height]
+ if arguments[1] == "press" {
+ answer["pressed"] = AXUIElementPerformAction(hit.0, kAXPressAction as CFString) == .success
+ }
+ emit(answer)
+case "tree":
+ guard let window = mainWindow(pid) else { emit(["error": "no window"]); exit(1) }
+ var lines: [String] = []
+ func dump(_ element: AXUIElement, _ depth: Int) {
+ if lines.count > 260 || depth > 9 { return }
+ let children = (value(element, kAXChildrenAttribute) as? [AXUIElement]) ?? []
+ let rect = frame(element) ?? .zero
+ lines.append(String(repeating: " ", count: depth) + text(element, kAXRoleAttribute) + "/" + text(element, kAXSubroleAttribute)
+ + " title=" + text(element, kAXTitleAttribute) + " label=" + text(element, kAXDescriptionAttribute)
+ + " [\(Int(rect.minX)),\(Int(rect.minY)) \(Int(rect.width))x\(Int(rect.height))] kids=\(children.count)")
+ for child in children { dump(child, depth + 1) }
+ }
+ dump(window, 0)
+ emit(["tree": lines])
+default:
+ emit(["error": "unknown command"]); exit(2)
+}
diff --git a/desktop/tool/native_driver.py b/desktop/tool/native_driver.py
new file mode 100755
index 000000000..84cacbf4a
--- /dev/null
+++ b/desktop/tool/native_driver.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python3
+"""Presses and photographs a native integration test's window from OUTSIDE it.
+
+AppKit draws the tab row in the title bar, so a Flutter test cannot see or
+press it. A test that wants the real controls (`integration_test/
+sign_in_native_test.dart`) asks this driver, which runs beside it in the
+terminal: macOS then counts accessibility and screen capture against the
+terminal, which a developer has usually allowed, not against a debug build
+nobody has.
+
+ python3 tool/native_driver.py <request-dir> <shots-dir> &
+ FLUTTER_TEST=1 HARNESS_NATIVE_DRIVER_DIR=<request-dir> \\
+ HARNESS_NATIVE_SHOTS_DIR=<shots-dir> \\
+ flutter test -d macos --no-pub integration_test/sign_in_native_test.dart
+
+(`--no-enable-impeller` on an Intel Mac.) The test writes <request-dir>/pid,
+then req-NNN.json {"cmd", "arg"}; this answers in res-NNN.json and ends when
+<request-dir>/done appears. Commands: shot <name>, list, find <label>,
+press <label>, tree, locked.
+
+Every action names the test app by its pid: no other window or app is read,
+pressed or photographed. With the screen locked macOS shows a driver neither
+the controls nor the window; `locked` says so, and the test then sends the
+row's actions through its channel instead.
+"""
+import glob
+import json
+import os
+import subprocess
+import sys
+import tempfile
+import time
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+
+
+def build_helper():
+ """native_ax.swift, compiled once per source into the temp folder."""
+ source = os.path.join(HERE, "native_ax.swift")
+ stamp = str(int(os.path.getmtime(source)))
+ binary = os.path.join(tempfile.gettempdir(), f"harness-native-ax-{stamp}")
+ if not os.path.exists(binary):
+ subprocess.run(["xcrun", "swiftc", "-O", source, "-o", binary], check=True)
+ return binary
+
+
+def screen_locked():
+ done = subprocess.run(["ioreg", "-n", "Root", "-d1"], capture_output=True, text=True)
+ return '"CGSSessionScreenIsLocked"=Yes' in done.stdout
+
+
+def main():
+ requests, shots = sys.argv[1:3]
+ helper = sys.argv[3] if len(sys.argv) > 3 else build_helper()
+ os.makedirs(requests, exist_ok=True)
+ os.makedirs(shots, exist_ok=True)
+
+ def ax(*argv):
+ done = subprocess.run([helper, *argv], capture_output=True, text=True, timeout=90)
+ try:
+ return json.loads(done.stdout)
+ except ValueError:
+ return {"error": done.stderr.strip() or done.stdout.strip() or "no answer"}
+
+ seen = set()
+ deadline = time.time() + 1800
+ while time.time() < deadline and not os.path.exists(os.path.join(requests, "done")):
+ for path in sorted(glob.glob(os.path.join(requests, "req-*.json"))):
+ if path in seen:
+ continue
+ try:
+ with open(path) as file:
+ request = json.load(file)
+ except ValueError:
+ continue # still being written
+ seen.add(path)
+ with open(os.path.join(requests, "pid")) as file:
+ pid = file.read().strip()
+ command, argument = request["cmd"], request.get("arg", "")
+ if command == "locked":
+ answer = {"locked": screen_locked()}
+ elif command == "shot":
+ window = ax("windowid", pid)
+ target = os.path.join(shots, argument + ".png")
+ if window.get("id") and not screen_locked():
+ subprocess.run(
+ ["screencapture", "-x", "-o", "-l", str(window["id"]), target],
+ timeout=60,
+ )
+ answer = {"ok": os.path.exists(target), "bounds": window.get("bounds")}
+ else:
+ answer = ax(command, pid, *([argument] if argument else []))
+ print(command, argument, "->", json.dumps(answer)[:240], flush=True)
+ temporary = path.replace("req-", "tmp-")
+ with open(temporary, "w") as file:
+ json.dump(answer, file)
+ os.rename(temporary, path.replace("req-", "res-"))
+ time.sleep(0.05)
+ print("native driver: finished", flush=True)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 65133b42b..29213ca58 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -1337,11 +1337,15 @@ private extension SwarmTabStrip {
setFrameSize(NSSize(width: width, height: 40))
update(state)
try checkTitlebar(searchButton.isEnabled && searchButton.frame.width > 0 &&
- searchButton.frame.maxX < storeButton.frame.minX &&
- storeButton.frame.maxX <= bounds.width &&
+ searchButton.frame.maxX == storeButton.frame.minX &&
+ storeButton.frame.width == searchButton.frame.width &&
+ storeButton.frame.maxX == bounds.width - 12 &&
newButton.frame.maxX < searchButton.frame.minX &&
contextButton.superview === statusBar,
- "Search and Store stay adjacent after the tabs at width \(width)")
+ "Search and Store are icons side by side after the tabs at width \(width)")
+ try checkTitlebar(accountButton.isHidden && !accountButton.isEnabled &&
+ accessibilityChildren()?.contains(where: { $0 as? NSView === accountButton }) == false,
+ "No account control is drawn until the app says which")
try checkTitlebar(!subviews.contains { $0.accessibilityLabel() == "Notifications" },
"Notifications live in the macOS menu bar, with no duplicate titlebar bell")
try checkTitlebar(devicesButton.isHidden && !devicesButton.isEnabled &&
@@ -1362,8 +1366,9 @@ private extension SwarmTabStrip {
setFrameSize(NSSize(width: width, height: 40))
update(state)
try checkTitlebar(!devicesButton.isHidden && devicesButton.isEnabled &&
- searchButton.frame.maxX < devicesButton.frame.minX &&
- devicesButton.frame.maxX < storeButton.frame.minX &&
+ searchButton.frame.maxX == devicesButton.frame.minX &&
+ devicesButton.frame.maxX == storeButton.frame.minX &&
+ devicesButton.frame.width == searchButton.frame.width &&
newButton.frame.maxX < searchButton.frame.minX &&
devicesButton.font == storeButton.font &&
accessibilityChildren()?.contains(where: { $0 as? NSView === devicesButton }) == true,
@@ -1387,9 +1392,68 @@ private extension SwarmTabStrip {
devicesButton.performClick(nil)
try checkTitlebar(devicesButton.isHidden && !devicesButton.isEnabled && calls.count == 3,
"Turning the experiment off removes and disables the native entry")
+ // The row's last control: Sign in while this computer holds no account,
+ // and the account's initial once it does.
+ state["devicesVisible"] = true
+ state["account"] = ["kind": "signIn", "tooltip": "Sign in to Harness"]
+ for width in [CGFloat(360), CGFloat(640), CGFloat(1280)] {
+ setFrameSize(NSSize(width: width, height: 40))
+ update(state)
+ try checkTitlebar(!accountButton.isHidden && accountButton.isEnabled &&
+ accountButton.kind == .signIn &&
+ accountButton.frame.width == accountButton.preferredWidth &&
+ accountButton.frame.maxX == bounds.width - 12 &&
+ storeButton.frame.maxX + 8 == accountButton.frame.minX &&
+ searchButton.frame.maxX == devicesButton.frame.minX &&
+ devicesButton.frame.maxX == storeButton.frame.minX &&
+ newButton.frame.maxX < searchButton.frame.minX &&
+ accountButton.accessibilityLabel() == "Sign in" &&
+ accountButton.toolTip == "Sign in to Harness" &&
+ accessibilityChildren()?.contains(where: { $0 as? NSView === accountButton }) == true,
+ "Sign in ends the row after Search, Devices and Store at width \(width)")
+ try captureTabPresentation("native-tabs-sign-in-\(Int(width))")
+ }
+ accountButton.performClick(nil)
+ try checkTitlebar(calls == ["sessions", "store", "devices", "signIn"],
+ "Sign in opens the sign-in through the native action")
+ state["account"] = ["kind": "avatar", "initial": "Dee", "tooltip": "Dee · [email protected]"]
+ for width in [CGFloat(360), CGFloat(640), CGFloat(1280)] {
+ setFrameSize(NSSize(width: width, height: 40))
+ update(state)
+ try checkTitlebar(!accountButton.isHidden && accountButton.isEnabled &&
+ accountButton.kind == .avatar && accountButton.initial == "D" &&
+ accountButton.frame.width == 32 &&
+ accountButton.frame.maxX == bounds.width - 12 &&
+ storeButton.frame.maxX + 8 == accountButton.frame.minX &&
+ accountButton.accessibilityLabel() == "Account" &&
+ accountButton.toolTip == "Dee · [email protected]",
+ "Signed in, the same place is the account's one initial at width \(width)")
+ try captureTabPresentation("native-tabs-account-\(Int(width))")
+ }
+ accountButton.performClick(nil)
+ try checkTitlebar(calls == ["sessions", "store", "devices", "signIn", "account"],
+ "The avatar opens the account menu through the native action")
+ state["account"] = ["kind": "avatar", "initial": ""]
+ update(state)
+ try checkTitlebar(!accountButton.isHidden && accountButton.initial.isEmpty,
+ "An account whose profile is unread still has its place")
+ state["enabled"] = false
+ update(state)
+ accountButton.performClick(nil)
+ try checkTitlebar(!accountButton.isEnabled && calls.count == 5, "A modal prevents the account control")
+ state["enabled"] = true
+ state["account"] = ["kind": "billing"]
+ update(state)
+ accountButton.performClick(nil)
+ try checkTitlebar(accountButton.isHidden && !accountButton.isEnabled && calls.count == 5 &&
+ storeButton.frame.maxX == bounds.width - 12,
+ "A kind this build does not know draws nothing, and Store ends the row")
+ state["account"] = nil
+ state["devicesVisible"] = false
update([:])
try checkTitlebar(!searchButton.isEnabled && !storeButton.isEnabled &&
- devicesButton.isHidden && !devicesButton.isEnabled,
+ devicesButton.isHidden && !devicesButton.isEnabled &&
+ accountButton.isHidden && !accountButton.isEnabled,
"Teardown disables the toolbar")
}
@@ -1594,7 +1658,7 @@ private extension SwarmTabStrip {
tab.drawWithHoverControl()
NSGraphicsContext.restoreGraphicsState()
}
- for control in [newButton, searchButton, devicesButton, storeButton] where !control.isHidden {
+ for control in [newButton, searchButton, devicesButton, storeButton, accountButton] where !control.isHidden {
NSGraphicsContext.saveGraphicsState()
let transform = NSAffineTransform()
transform.translateX(by: control.frame.minX, yBy: control.frame.minY + 40)
diff --git a/docs/research/2026-10-08-onboarding-redesign/index.html b/docs/research/2026-10-08-onboarding-redesign/index.html
index ccd71922e..485b730bc 100644
--- a/docs/research/2026-10-08-onboarding-redesign/index.html
+++ b/docs/research/2026-10-08-onboarding-redesign/index.html
@@ -158,14 +158,68 @@
.chip { font-size: 1.15cqw; border: 1px solid var(--line); border-radius: 2cqw; padding: .45cqw 1.1cqw; background: var(--surface); display: flex; gap: .5cqw; align-items: center; }
.chip img { width: 1.4cqw; height: 1.4cqw; border-radius: .3cqw; }
.inline { position: absolute; inset: 7.5cqw 3cqw 4cqw 3cqw; }
+
+ /* 2026-10-11: the top right of the tab row. Icons, then Sign in or the account. */
+ .bar .ic { width: 2.6cqw; height: 2.6cqw; border-radius: .6cqw; display: grid; place-items: center; color: #cfcfc6; flex: none; }
+ .bar .ic img { width: 1.6cqw; height: 1.6cqw; display: block; }
+ .bar .ic svg { width: 1.45cqw; height: 1.45cqw; display: block; }
+ .bar .signin { margin-left: .5cqw; font-size: 1.08cqw; font-weight: 600; background: #bdcbdc; color: #14181d; border-radius: 2cqw; padding: .42cqw 1.25cqw; white-space: nowrap; }
+ .bar .avatar { margin-left: .5cqw; width: 2.2cqw; height: 2.2cqw; border-radius: 50%; background: rgba(189,203,220,.18); border: 1px solid rgba(189,203,220,.4); color: #bdcbdc;
+ display: grid; place-items: center; font-size: 1.05cqw; font-weight: 600; flex: none; }
+ .bar .oldpill { font-size: 1.05cqw; color: #bdcbdc; background: rgba(189,203,220,.10); border: 1px solid rgba(189,203,220,.14); border-radius: 2cqw;
+ padding: .38cqw 1.1cqw; display: flex; align-items: center; gap: .6cqw; white-space: nowrap; }
+ .bar .oldpill img { width: 1.4cqw; height: 1.4cqw; }
+ .acct { position: absolute; right: 1.2cqw; top: 4.9cqw; width: 21cqw; background: var(--elev); border: 1px solid rgba(255,250,240,.14); border-radius: 1cqw;
+ box-shadow: 0 1.500cqw 3.500cqw rgba(0,0,0,.6); padding: .6cqw; }
+ .acct .who { display: flex; align-items: center; gap: 1cqw; padding: .8cqw .8cqw 1cqw; border-bottom: 1px solid var(--line); margin-bottom: .5cqw; }
+ .acct .who .big { width: 3cqw; height: 3cqw; border-radius: 50%; background: rgba(189,203,220,.18); border: 1px solid rgba(189,203,220,.4); color: #bdcbdc;
+ display: grid; place-items: center; font-size: 1.35cqw; font-weight: 600; flex: none; }
+ .acct .who b { display: block; font-size: 1.2cqw; }
+ .acct .who div span { display: block; font-size: 1cqw; color: var(--muted); }
+ .acct .mi { display: flex; align-items: center; gap: .9cqw; font-size: 1.15cqw; padding: .65cqw .8cqw; border-radius: .6cqw; color: #e4e4dc; }
+ .acct .mi svg { width: 1.35cqw; height: 1.35cqw; color: var(--muted); flex: none; }
+ .acct .sep { height: 1px; background: var(--line); margin: .5cqw 0; }
+ .win.strip { aspect-ratio: auto; }
+ .win.strip .slice { height: 2.4cqw; background: var(--bg); }
+ .new { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #1a1205; background: var(--amber);
+ border-radius: 20px; padding: 2px 9px; vertical-align: 3px; margin-left: 8px; }
+ .update { background: var(--surface); border: 1px solid rgba(255,159,10,.35); border-radius: 12px; padding: 14px 16px; margin: 18px 0 6px; font-size: 15px; max-width: 900px; }
+ .update b { color: var(--text); }
+ .update a, .note a { color: var(--amber); }
+
+ /* 2026-10-11: the last step, sign in. */
+ .tour .stage.signin { grid-template-columns: 1.2fr 1fr; gap: 4cqw; }
+ .tour .stage.signin h4 { font-size: 3.1cqw; margin-bottom: 1.9cqw; }
+ .gets { display: grid; gap: 1.3cqw; }
+ .get { display: flex; gap: 1.2cqw; align-items: center; }
+ .get .gi { width: 2.9cqw; height: 2.9cqw; border-radius: .8cqw; background: rgba(255,159,10,.12); border: 1px solid rgba(255,159,10,.28);
+ display: grid; place-items: center; color: var(--amber); flex: none; }
+ .get .gi svg { width: 1.5cqw; height: 1.5cqw; }
+ .get b { display: block; font-size: 1.5cqw; font-weight: 600; }
+ .sicard { background: var(--surface); border: 1px solid var(--line); border-radius: 1.3cqw; padding: 2cqw; box-shadow: 0 1.5cqw 3cqw rgba(0,0,0,.45); display: grid; gap: 1cqw; }
+ .sibtn { display: flex; align-items: center; justify-content: center; gap: .9cqw; height: 4.1cqw; border-radius: 1cqw; font-size: 1.32cqw; font-weight: 600;
+ background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
+ .sibtn.apple { background: #000; color: #fff; border-color: #3a3a36; }
+ .sibtn.ghost { background: transparent; color: var(--text); border-color: rgba(255,250,240,.22); font-weight: 500; }
+ .sibtn img, .sibtn svg { width: 1.55cqw; height: 1.55cqw; }
+ .sior { display: flex; align-items: center; gap: .9cqw; color: var(--muted); font-size: .95cqw; }
+ .sior i { flex: 1; height: 1px; background: var(--line); }
+ .sihint { text-align: center; font-size: 1cqw; color: var(--muted); }
+ .siseal { text-align: center; font-size: .95cqw; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1cqw; margin-top: .2cqw; }
+ .sifoot { display: flex; justify-content: space-between; margin-top: 1.2cqw; padding: 0 calc(2cqw + 1px); font-size: 1.15cqw; color: #bdbdb4; }
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; place-items: center; z-index: 9; }
</style>
</head>
<body>
<main>
<h1>Onboarding redesign, for approval</h1>
- <p class="lede">Renders only; nothing is built yet. They replace the setup checklist, the New Harness box and the
+ <p class="lede">Renders. They replace the setup checklist, the New Harness box and the
picker's badges you marked up. The copy, numbers and session names in them are examples.</p>
+ <div class="update"><b>Update 2026-10-11. Approved and built.</b> Two changes so people find sign-in:
+ <a href="#signin-step">1b · a sign-in page as the last step</a> before Harness opens, with Skip, and
+ <a href="#top-right">5 · a Sign in button top right</a> that becomes your avatar, with Devices and Store as icons beside it.
+ The first workspaces in sections 2 and 3 now show that top right. Sections 1 to 4 are otherwise as approved on 2026-10-08 and shipped in Desktop 1.2.60
+ (<a href="../2026-10-09-onboarding-shipped/index.html">onboarding as shipped</a>).</div>
<div class="principles">
<div><b>Teach while it installs</b>Five short slides on what Harness does, with the install as one quiet line underneath, like an OS installer.</div>
<div><b>Land in work, not in a form</b>No setup field and no New Harness box. Harness opens straight into panes that are already working.</div>
@@ -178,7 +232,8 @@
<p class="lede">Seven slides, about 6 s each, in order of importance; the arrow or dots move them by hand. Setup now includes the agents: Harness's own Node and CLI (about 30 MB), and, for someone
with no agents, OpenCode, Codex and Claude Code (about 290 MB). That took about 30–40 s on the VM's connection and would be nearer 2 minutes on 25 Mbit/s; on a slow connection the slides keep cycling.
The bottom line is the only sign of the install: one sentence, a thin bar and the real time left. ▸ opens the log; a failure turns that line red, with Retry.
- Harness opens by itself, at the end of the slide on screen, once everything is downloaded: no button, nothing to click, and no install screen anywhere afterwards.</p>
+ Harness opens by itself, at the end of the slide on screen, once everything is downloaded: no button, nothing to click, and no install screen anywhere afterwards.
+ <b style="color:var(--text)">Changed 2026-10-11:</b> on a computer that is not signed in, the sign-in page (1b) comes at that moment, before Harness opens.</p>
<div class="stack">
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -362,7 +417,8 @@
<div class="foot"><div class="row"><span style="color:var(--green)">●</span><span style="color:var(--text)">Harness is ready. Opening…</span><span class="sp"></span></div><div class="track"><i style="width:100%;background:var(--green)"></i></div></div>
</div>
</div>
- <p class="cap"><b>7 · The Harness device.</b> Everything is downloaded here, so Harness opens by itself at the end of this slide.</p>
+ <p class="cap"><b>7 · The Harness device.</b> Everything is downloaded here, so Harness opens by itself at the end of this slide.
+ <b>Changed 2026-10-11:</b> not signed in, the line reads "Harness is ready." and the sign-in page (1b) is next.</p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -388,13 +444,58 @@
<b>Underneath:</b> the setup checklist, its first-task field and the "Next: start your first harness" footer leave the first screen.
OpenCode downloads only when the Mac has no Claude Code, Codex or OpenCode at all (in #1067, including programs installed but never run). Help ▸ Welcome Tour can show the slides again.</p>
+ <!-- ===================== 1b. SIGN IN (2026-10-11) ===================== -->
+ <h2 id="signin-step">1b. Last step: sign in <span class="new">New</span></h2>
+ <p class="lede">One page between the tour and the first workspace. It says what signing in adds in four lines, and has two buttons, with Skip and Continue with email as one quiet row under the card. Nothing else.
+ It shows at the moment Harness used to open by itself: the end of the slide on screen, once setup is done.
+ The first workspace is already built behind it, so no time is lost.</p>
+ <div class="stack">
+ <div class="win">
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
+ <div class="tour">
+ <div class="stage signin">
+ <div>
+ <h4>Sign in to take<br>Harness everywhere.</h4>
+ <div class="gets">
+ <div class="get"><div class="gi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="12" rx="1.5"/><path d="M8 20h8M12 16v4"/></svg></div><b>All your machines, one window</b></div>
+ <div class="get"><div class="gi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="2.5" width="10" height="19" rx="2"/><path d="M11 18.5h2"/></svg></div><b>Your agents on your phone</b></div>
+ <div class="get"><div class="gi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c2.5 2.6 3.8 5.6 3.8 9s-1.3 6.4-3.8 9c-2.5-2.6-3.8-5.6-3.8-9S9.500 5.600 12 3z"/></svg></div><b>Harness in any browser</b></div>
+ <div class="get"><div class="gi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 9h18M9 9v11"/></svg></div><b>Same tabs on every computer</b></div>
+ </div>
+ </div>
+ <div>
+ <div class="sicard">
+ <div class="sibtn"><img src="../../../desktop/assets/sign-in/google.svg" alt="">Continue with Google</div>
+ <div class="sibtn apple"><img src="../../../desktop/assets/sign-in/apple.svg" alt="">Continue with Apple</div>
+ </div>
+ <div class="sifoot"><span>Skip</span><span>Continue with email</span></div>
+ </div>
+ </div>
+ <div class="tagline">All your machines. All your agents. One command center.</div>
+ <div class="foot"><div class="row"><span style="color:var(--green)">●</span><span style="color:var(--text)">Harness is ready.</span><span class="sp"></span></div><div class="track"><i style="width:100%;background:var(--green)"></i></div></div>
+ </div>
+ </div>
+ <p class="cap"><b>The page.</b> Left: what an account adds. Right: Continue with Google and Continue with Apple. Under the card, one quiet row: Skip starts at the buttons' left edge and Continue with email ends at their right edge. No other words. Return presses Continue with Google.
+ <b>After a click</b> the page stays exactly as it is: the browser opens, and when the account arrives Harness opens, signed in.</p>
+ </div>
+ <p class="note" style="line-height:1.7"><b>Who sees it:</b> only a computer that has never had Harness, and only when nobody is signed in on it. A computer already signed in (from the terminal, say) skips it and Harness opens by itself as before. People who already use Harness never see it.<br>
+ <b>When:</b> at the end of the slide on screen once setup is done. On Linux, where setup has its own screen and no tour, it shows right after setup.<br>
+ <b>No time lost:</b> the first workspace (sections 2 and 3) is built behind this page, as it is behind the tour. The agents are already open when the page goes away.<br>
+ <b>Sign in:</b> Google or Apple, in the browser, as today. When the account arrives, Harness opens on the same first workspace, signed in.<br>
+ <b>Continue with email:</b> opens the browser on the Autonomous sign-in page, which takes an email and the code sent to it. Kept small on purpose: waiting for a code is slower, and most people will use Google or Apple. New to the desktop app; the sign-in page and the phone app already work this way.<br>
+ <b>While the browser is open:</b> nothing on the page changes. No "Waiting…" on the button, no Open browser, Copy link or Cancel. Every control stays live: press a button again to open the browser again, pick another way in to switch, or Skip.<br>
+ <b>Left off this page, to keep it to two buttons:</b> Scan with your phone, the "End-to-end encrypted" line, and the waiting state today's sign-in shows. All stay on the sign-in that Sign in (top right) opens.<br>
+ <b>Skip:</b> Harness opens without an account, as it does today. The page is not shown again; Sign in stays in the top right (section 5).<br>
+ <b>What it costs:</b> someone who skips makes one click before their first result, where there was none (−5 on the activation score in <code>2026-10-08-activation-sim.md</code>, for a prompt before the first result). And if nobody is at the keyboard when setup ends, Harness waits on this page instead of opening.<br>
+ <b>Not changed:</b> the seven slides, the first workspace itself, and Help ▸ Welcome Tour, which shows the slides only.</p>
+
<!-- ===================== 2. NEW USER ===================== -->
<h2>2. Arrival: someone with no agents yet</h2>
<p class="lede">No New Harness box, no starter game, no webview: one tab, three ordinary harness panes. OpenCode runs full height on the left, ready and focused, with a first task in its
message box. Codex and Claude Code, downloaded during the setup tour, simply open on the right, each on its own sign-in screen.
No special panes: these are the same panes ⌘N makes, and each has the usual × to close it.</p>
<div class="win">
- <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="store">Harness Store</span></div>
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="signin">Sign in</span></div>
<div class="ws">
<div class="panes" style="grid-template-columns: 1.25fr 1fr; grid-template-rows: 1fr 1fr">
<div class="p" style="grid-row: 1 / span 2">
@@ -423,7 +524,7 @@
<div class="status"><span>Harnesses 3</span><span>Machines 1</span><span>Models 0</span><span class="sp"></span><span>first-project</span></div>
</div>
</div>
- <p class="cap"><b>The first screen after the tour.</b> All three are each agent's own screen: OpenCode's start screen with a first task typed in, Codex's and Claude Code's sign-in. Signing in is optional; × closes either pane.</p>
+ <p class="cap"><b>The first screen after the tour and the sign-in page</b> (here: skipped, so Sign in is top right). All three are each agent's own screen: OpenCode's start screen with a first task typed in, Codex's and Claude Code's sign-in. Signing in is optional; × closes either pane.</p>
<p class="note"><b>Logic:</b>
<b>Downloads happen during the setup tour,</b> not here: OpenCode from the first second (its installer needs only curl), and Codex and Claude Code with one npm command as soon as
setup's own Node is in place (both are npm packages, installed into <code>~/.local</code> exactly as the panes would). The Details line in the tour lists them.
@@ -439,7 +540,7 @@
so the first thing they see is two agents at once; tab 2 holds the next 3 most recently active, mixing both where they can. No strip or banner: the Claude Code and Codex limits stay in the footer, with a low one in amber.</p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span>
- <span class="tab on">harness-web</span><span class="tab">api-server</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="store">Harness Store</span></div>
+ <span class="tab on">harness-web</span><span class="tab">api-server</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="signin">Sign in</span></div>
<div class="ws">
<div class="panes" style="grid-template-columns: 1fr 1fr">
<div class="p"><div class="h"><img src="../../../desktop/assets/engine-icons/codex.png" alt="">Codex<span class="m">harness-web · main</span></div><div class="b"><span class="dim">20 min ago</span><br><span class="u">› find why the build is slow</span><br><span class="ok">✓</span> 3 fixes, build 94 s → 31 s<br>Opened PR #418. Want me to also cache the lint step?<div class="composer"><span class="cur"></span></div></div></div>
@@ -451,7 +552,7 @@
<p class="cap"><b>Tab 1: one Claude Code and one Codex</b>, each that agent's most recently active session. Typing in either picks the conversation up where it stopped.</p>
<div class="win" style="margin-top:22px">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span>
- <span class="tab">harness-web</span><span class="tab on">api-server</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="store">Harness Store</span></div>
+ <span class="tab">harness-web</span><span class="tab on">api-server</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="signin">Sign in</span></div>
<div class="ws">
<div class="panes" style="grid-template-columns: 1.2fr 1fr; grid-template-rows: 1fr 1fr">
<div style="grid-row: 1 / span 2; display:grid"><div class="p"><div class="h"><img src="../../../desktop/assets/model-icons/claude.png" alt="">Claude Code<span class="m">api-server · rate-limits</span></div><div class="b"><span class="dim">yesterday</span><br><span class="u">› add per-key rate limits</span><br><span class="ok">✓</span> middleware.ts, limits.test.ts<br>All 214 tests pass. Shall I write the migration for the keys table?</div></div></div>
@@ -514,6 +615,56 @@
</div>
</div>
+ <!-- ===================== 5. TOP RIGHT (2026-10-11) ===================== -->
+ <h2 id="top-right">5. Top right: icons, then Sign in or you <span class="new">New</span></h2>
+ <p class="lede">Like Chrome's toolbar. Search, Devices and Harness Store become icons. Last comes the one thing with a word on it: Sign in.
+ Once signed in, that spot is your avatar. Today a guest finds sign-in only in Settings ▸ Account, the Machines panel and Add Phone.</p>
+ <div class="stack">
+ <div>
+ <div class="win strip">
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="oldpill"><img src="../../../desktop/assets/devices/harness-mark.png" alt="">Devices</span><span class="oldpill"><img src="../../../desktop/assets/store/polymath.png" alt="">Harness Store</span></div>
+ <div class="slice"></div>
+ </div>
+ <p class="cap"><b>Today.</b> Search, then Devices and Harness Store as pills with their names. No sign-in anywhere on screen.</p>
+ </div>
+ <div>
+ <div class="win strip">
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="signin">Sign in</span></div>
+ <div class="slice"></div>
+ </div>
+ <p class="cap"><b>New, not signed in.</b> Search · Devices · Harness Store as icons, then <b>Sign in</b>: the only filled button in the row. It opens the sign-in the app has today, over the workspace.</p>
+ </div>
+ <div>
+ <div class="win strip">
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="avatar">D</span></div>
+ <div class="slice"></div>
+ </div>
+ <p class="cap"><b>New, signed in.</b> The same spot is your avatar: your initial in a circle. A click opens its menu, below.</p>
+ </div>
+ <div>
+ <div class="win strip">
+ <div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="tab on">code</span><span class="tab"><span class="plus">+</span></span><span class="sp"></span><span class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg></span><span class="ic"><img src="../../../desktop/assets/devices/harness-mark.png" alt="Devices"></span><span class="ic"><img src="../../../desktop/assets/store/polymath.png" alt="Harness Store"></span><span class="avatar">D</span></div>
+ <div class="slice" style="height:25.5cqw"></div>
+ <div class="acct">
+ <div class="who"><span class="big">D</span><div><b>Dee</b><span>[email protected]</span></div></div>
+ <div class="mi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="7" y="2.5" width="10" height="19" rx="2"/><path d="M11 18.5h2"/></svg>Add Phone</div>
+ <div class="mi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3a9 9 0 1 0 0 18c1.2 0 1.8-.9 1.8-1.8 0-.5-.2-.9-.5-1.200-.3-.3-.5-.7-.5-1.200 0-1 .8-1.800 1.800-1.800H17a4 4 0 0 0 4-4c0-4.400-4-8-9-8z"/><circle cx="7.500" cy="11.500" r=".9"/><circle cx="10.500" cy="7.500" r=".9"/><circle cx="15" cy="7.500" r=".9"/></svg>Customize Harness</div>
+ <div class="mi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M6 16v-5a6 6 0 1 1 12 0v5l1.500 2h-15L6 16z"/><path d="M10 20.500a2 2 0 0 0 4 0"/></svg>Notifications</div>
+ <div class="mi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 3v2.500M12 18.500V21M3 12h2.500M18.500 12H21M5.600 5.600l1.800 1.800M16.600 16.600l1.800 1.800M5.600 18.400l1.800-1.800M16.600 7.400l1.800-1.800"/></svg>Settings</div>
+ <div class="sep"></div>
+ <div class="mi"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4"/><path d="M15 8l4 4-4 4M19 12H9"/></svg>Sign out</div>
+ </div>
+ </div>
+ <p class="cap"><b>New, the avatar clicked.</b> A short menu: who is signed in, then Add Phone, Customize Harness, Notifications, Settings and Sign out. Each row opens something the app already has.</p>
+ </div>
+ </div>
+ <p class="note" style="line-height:1.7"><b>Icons:</b> each keeps its own mark and its click; the name moves to the tooltip, with the shortcut where there is one ("Explore Harness Store · ⌘S").<br>
+ <b>Sign in:</b> shown whenever this computer has no account, on every tab. It is the same sheet Settings ▸ Account opens, so there is still one sign-in.<br>
+ <b>Avatar:</b> the first letter of your name, or of your email. Its tooltip is your name and email. Not your Google or Apple photo yet: the Mac title bar is native and does not load pictures from the web.<br>
+ <b>Where:</b> Mac and Linux, same order. Linux keeps its bell between Search and Devices. The browser app is not changed.<br>
+ <b>Narrow window:</b> tabs give way first, as today; Devices is the first icon to drop; Sign in or the avatar always stays.<br>
+ <b>The menu:</b> Add Phone opens Add Phone, and goes away once a phone is linked. Customize Harness opens what the app menu's Customize Harness opens. Notifications opens Settings ▸ Notifications. Settings opens Settings. Sign out signs out. Kept to these five; no machine list, no numbers.</p>
+
<h2>Checked: can it be built (2026-10-08)</h2>
<p class="note" style="font-size:15px;line-height:1.7">
<b>Recent sessions and their order (screen 3): yes.</b> The daemon's <code>session_search</code>, asked with a time and no words, returns recent Claude Code and Codex sessions with engine,
@@ -532,6 +683,15 @@
<b>Pickers:</b> no status badges; agent installs get a friendly progress screen instead of installer text (built: #1069, checked on a fresh VM).<br>
<b>Not changed:</b> the footer and everything outside onboarding. (Footers in these renders now match the app: usage on the left after Models.)<br>
<b>Still open:</b> nothing; waiting for your approval.</p>
+
+ <h2>Decided 2026-10-11</h2>
+ <p class="note" style="font-size:15px;line-height:1.7">
+ <b>Sign-in page (1b):</b> the last step on a computer new to Harness that is not signed in: four things an account adds, one line each, Continue with Google, Continue with Apple, and under them Skip (left) and Continue with email (right). The first workspace is built behind it. Shown once.<br>
+ <b>Top right (5):</b> Search, Devices and Harness Store as icons; then Sign in, which becomes your avatar. Mac and Linux.<br>
+ <b>Settled with you on 2026-10-11:</b> the page's words (one headline, four lines); Google and Apple as the only buttons; Skip on the left and Continue with email on the right under the card; nothing on the page changes while the browser is open; no line before Sign in; the avatar opens a short menu: Add Phone, Customize Harness, Notifications, Settings, Sign out. No "…" on any row.<br>
+ <b>Built as proposed, say if not:</b> (a) people already using Harness without an account get the button only, never the page; (b) Linux shows the page after its setup screen; (c) the browser app stays as it is; (d) the avatar is your initial, not your photo.<br>
+ <b>Found while building:</b> the pressed button dims for the moment before its browser opens, and the line at the foot reads "Signing in…" once the browser has approved, so the wait is not silent. Continue with email is also on the sign-in that Sign in (top right) opens, except in a short window, where one more row would push the "you were signed out" line off the screen.<br>
+ <b>Supersedes:</b> "Harness opens by itself … no button" above, for a computer that is not signed in. Signed in, that still holds.</p>
</main>
</body>
</html>