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.

Require sign-in on Desktop and TUI; unify recovery and restore tab hints (#1276)

Dee4d5764bb7c65
diff --git a/.github/workflows/os.yml b/.github/workflows/os.yml
index 642171c83..9a162c237 100644
--- a/.github/workflows/os.yml
+++ b/.github/workflows/os.yml
@@ -47,11 +47,11 @@ on:
default: false
type: boolean
checks:
- description: 'Image journey, browser focus, lock/suspend, recovery, Wi-Fi/audio, Ethernet recovery, hardware, private zram, or changed-kernel recovery acceptance'
+ description: 'Image journey, sign-in, browser focus, lock/suspend, recovery, Wi-Fi/audio, Ethernet recovery, hardware, private zram, or changed-kernel recovery acceptance'
required: false
default: image
type: choice
- options: [image, browser, browser-suspend, session, recovery, essentials, network-recovery, hardware, zram, hardware-update, public-update, lock-presentation]
+ options: [image, sign-in, browser, browser-suspend, session, recovery, essentials, network-recovery, hardware, zram, hardware-update, public-update, lock-presentation]
browser_memory:
description: 'With checks=browser, diagnose memory in the UEFI VM only; retain ordinary workload and deadlines'
required: false
@@ -67,6 +67,54 @@ concurrency:
cancel-in-progress: false
jobs:
+ sign-in:
+ if: ${{ inputs.checks == 'sign-in' && !inputs.publish_run_id && !inputs.development_update }}
+ runs-on: ubuntu-24.04
+ timeout-minutes: 35
+ steps:
+ - uses: actions/checkout@v7
+ - name: Require an existing source image
+ env:
+ IMAGE_RUN_ID: ${{ inputs.image_run_id }}
+ run: '[[ "$IMAGE_RUN_ID" =~ ^[0-9]+$ ]]'
+ - uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: x86_64-unknown-linux-musl
+ - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
+ with:
+ workspaces: tui
+ shared-key: tui-x86_64-unknown-linux-musl
+ cache-bin: false
+ - name: Prepare native build and VM tools
+ run: |
+ sudo apt-get update -qq
+ sudo apt-get install -y --no-install-recommends musl-tools qemu-system-x86 qemu-utils python3-pil tesseract-ocr
+ sudo chmod a+rw /dev/kvm
+ - name: Build the exact candidate TUI
+ run: cargo build --manifest-path tui/Cargo.toml --locked --release --target x86_64-unknown-linux-musl
+ - uses: actions/download-artifact@v6
+ with:
+ name: programmer-os-x86_64
+ path: os/dist
+ run-id: ${{ inputs.image_run_id }}
+ github-token: ${{ github.token }}
+ - name: Check networking before TUI launch and required sign-in
+ run: >-
+ timeout 20m python3 os/tests/sign_in_vm.py --iso os/dist/*.iso
+ --tui tui/target/x86_64-unknown-linux-musl/release/harness-tui
+ - name: Retain screenshots and validation evidence
+ if: always()
+ uses: actions/upload-artifact@v6
+ with:
+ name: harness-os-required-sign-in
+ path: |
+ os/test-results/required-sign-in/*.json
+ os/test-results/required-sign-in/*.jsonl
+ os/test-results/required-sign-in/*.png
+ os/test-results/required-sign-in/*.txt
+ os/test-results/required-sign-in/*.log
+ retention-days: 14
+
lock-presentation:
if: ${{ inputs.checks == 'lock-presentation' && inputs.image_run_id != '' && !inputs.publish_run_id && !inputs.development_update }}
runs-on: ubuntu-24.04
@@ -123,7 +171,7 @@ jobs:
retention-days: 14
image:
- if: ${{ !inputs.image_run_id && !inputs.publish_run_id && !inputs.development_update && inputs.checks != 'zram' && inputs.checks != 'hardware-update' && inputs.checks != 'browser-suspend' && inputs.checks != 'public-update' && inputs.checks != 'network-recovery' && inputs.checks != 'lock-presentation' }}
+ if: ${{ !inputs.image_run_id && !inputs.publish_run_id && !inputs.development_update && inputs.checks != 'zram' && inputs.checks != 'hardware-update' && inputs.checks != 'browser-suspend' && inputs.checks != 'public-update' && inputs.checks != 'network-recovery' && inputs.checks != 'lock-presentation' && inputs.checks != 'sign-in' }}
runs-on: ubuntu-24.04
timeout-minutes: 50
steps:
@@ -222,7 +270,7 @@ jobs:
machine:
needs: image
- if: ${{ always() && !inputs.publish_run_id && !inputs.development_update && inputs.checks != 'essentials' && inputs.checks != 'hardware' && inputs.checks != 'zram' && inputs.checks != 'hardware-update' && inputs.checks != 'public-update' && inputs.checks != 'network-recovery' && inputs.checks != 'lock-presentation' && (needs.image.result == 'success' || inputs.image_run_id != '' || inputs.checks == 'browser-suspend') && !cancelled() }}
+ if: ${{ always() && !inputs.publish_run_id && !inputs.development_update && inputs.checks != 'essentials' && inputs.checks != 'hardware' && inputs.checks != 'zram' && inputs.checks != 'hardware-update' && inputs.checks != 'public-update' && inputs.checks != 'network-recovery' && inputs.checks != 'lock-presentation' && inputs.checks != 'sign-in' && (needs.image.result == 'success' || inputs.image_run_id != '' || inputs.checks == 'browser-suspend') && !cancelled() }}
runs-on: ubuntu-24.04
timeout-minutes: 65
strategy:
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index c2f4c3337..f680988b5 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -193,19 +193,23 @@ 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**
+ **Desktop requires sign-in after setup and before opening the 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.
+ `../docs/research/2026-10-08-onboarding-redesign/index.html` 1b, owner 2026-10-12).
+ The tour has five slides: machines, agents, persistent sessions, phone and device;
+ the ⌘P and ⌘N slides are removed. The sign-in page keeps its four benefits and
+ standalone Google and Apple buttons, with Continue with email centered underneath;
+ there is no surrounding card or Skip. It applies to existing signed-out installations and relaunches after
+ setup too. A successful explicit sign-out brings it back. A signed-in offline launch
+ opens normally. A server-rejected session requires sign-in again; saved local work
+ and running harnesses survive behind the page. A temporary network outage keeps
+ an already signed-in workspace available.
+ Agent downloads still run during setup; first-arrival agents wait for an account.
+ The page does not change while the browser is open: the same option reopens its page,
+ and another option cancels and switches. Failures and cancellation keep the required
+ page visible. The workspace account menu is `widgets/account_menu.dart`
+ (`design/workspace-status-bar.md`). Every native sign-in entry uses this same
+ page; the old fleet-map card and desktop phone-scanning choice are removed.
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
@@ -455,8 +459,9 @@ add a kind there, not at the call site.
repaint on a theme flip.
- The [workspace status bar](design/workspace-status-bar.md) places system-font tabs and global actions at the top,
with harness, machine and installed local model counts plus subscription allowance remaining at the bottom left and focused machine/repo/branch/PR at the bottom right.
- Tabs center their name/status group and show no shortcut hint (Command changes nothing on
- them). Hovering a tab shows only its ×. Agent Messages has nothing on a tab: no 💬 (it was
+ Tabs center their name/status group. Holding Command shows their current shortcut in the status
+ slot using the original small labels; release or window deactivation restores the status.
+ Hovering a tab shows only its ×. Agent Messages has nothing on a tab: no 💬 (it was
easy to hit by mistake and turned the tab off, owner 2026-10-12; Settings ▸ Experimental holds
the account's switch) and no traffic, so its status slot keeps its own status (messages arrive when they
arrive). A tab's log is its menu's and File's Show Agent Messages (`lib/agent_messages/`,
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.md
index ed77a6f9e..f792fea49 100644
--- a/desktop/design/desktop-design-system.md
+++ b/desktop/design/desktop-design-system.md
@@ -340,8 +340,10 @@ Messages' 💬 that sat left of it was removed, since it was easy to hit by mist
and turned the tab off (owner, 2026-10-12); the account's Settings ▸ Experimental
holds that switch now, off by default. At rest the name and status have the whole tab; on hover a name that would run
into × moves left only as far as it needs, then truncates, so hover never
-crowds the name or status. Tabs show no shortcut hint, and holding Command
-changes nothing on them. An idle tab has no empty status slot; its name centers
+crowds the name or status. Holding Command shows the original small shortcut
+label in each tab's status slot. Release or window deactivation restores the
+status; remapped and unbound shortcuts follow the current keymap. An idle tab
+has no empty status slot when Command is released; its name centers
on its own. Hover never changes tab width. Long names truncate and retain a
full-name tooltip. Selection, dragging, middle-click close and the
existing keyboard commands keep their meaning.
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 12caf39c0..a899e1072 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -120,8 +120,9 @@ shared 10-point upper corners, 8-point outward lower shoulders and 6-point top
inset. Keep space after `+` available for dragging the window. Scroll overflow
and reveal the selected tab on keyboard navigation. Narrow viewports can show
smaller tabs while preserving their controls.
-Hovering a tab reveals × at its right; its status stays. Tabs show no shortcut
-hint, and holding Command changes nothing on them. A tab shows nothing of
+Hovering a tab reveals × at its right; its status stays. Holding Command replaces
+the status with the original small shortcut label (⌘1, ⌘2, ⌘3…), using the current
+keymap. Release or window deactivation restores the status. A tab shows nothing of
[Agent Messages](../../docs/design/2026-10-10-agent-messages.md), at rest or
hovered: traffic between its agents shows nothing on it, since messages arrive
when they arrive, and there is no on/off on the tab. Its 💬 beside × was easy to
diff --git a/desktop/integration_test/sign_in_native_test.dart b/desktop/integration_test/sign_in_native_test.dart
index 0b63e2a93..995c5fc19 100644
--- a/desktop/integration_test/sign_in_native_test.dart
+++ b/desktop/integration_test/sign_in_native_test.dart
@@ -17,7 +17,6 @@ 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';
@@ -33,8 +32,8 @@ 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.
+/// and from there, after successful sign-in, to a workspace whose native
+/// title bar ends 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
@@ -77,7 +76,10 @@ Future<Map<String, dynamic>> _native(
}
Future<void> _shot(WidgetTester tester, String name) async {
- if (!_driven) return;
+ if (!_driven) {
+ await captureWindow(tester, _shotsDir, '$name-flutter-only');
+ 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);
@@ -210,6 +212,9 @@ class _Api extends ApiClient {
@override
Future<Map<String, dynamic>?> desk() async => null;
+
+ @override
+ Future<Map<String, dynamic>?> daemonDevices() async => null;
}
/// A computer whose probe finds no Harness CLI, and whose install puts it in.
@@ -274,7 +279,6 @@ Future<void> _mount(WidgetTester tester, AppNotifier app) async {
);
}
-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'));
@@ -305,8 +309,8 @@ void main() {
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 {
+ testWidgets('native: the tour leads to mandatory sign-in, with cancellation '
+ 'and failure keeping the workspace closed', (tester) async {
final (:app, :cli) = _newComputer();
addTearDown(app.dispose);
await _mount(tester, app);
@@ -336,22 +340,18 @@ void main() {
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.
+ expect(find.text('Sign in to continue.'), findsOneWidget);
+ // Email is centered under the standalone buttons, and no Skip remains.
final google = tester.getRect(_google);
expect(tester.getRect(_apple).left, google.left);
+ expect(find.text('Skip'), findsNothing);
expect(
- tester.getRect(find.text('Skip')).left,
- moreOrLessEquals(google.left, epsilon: 0.5),
+ tester.getRect(find.text('Continue with email')).center.dx,
+ moreOrLessEquals(google.center.dx, 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),
+ tester.getRect(_email).top,
+ greaterThan(tester.getRect(_apple).bottom),
);
expect(tester.takeException(), isNull);
await _shot(tester, '2-sign-in-page');
@@ -377,76 +377,41 @@ void main() {
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);
+ // Escape and a cancelled browser flow cannot enter the workspace.
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ app.cancelLogin();
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.byType(SwarmScreen), findsNothing);
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',
+ // A failed attempt explains why and lets the person try again.
+ await tester.tap(_email);
+ await tester.pump(const Duration(milliseconds: 300));
+ cli.pending!.completeError(
+ StateError('The sign-in page could not be reached.'),
);
await _until(
tester,
- () => find.byType(LoginScreen).evaluate().isNotEmpty,
- reason: 'the native Sign in opens the sign-in',
+ () => find.textContaining('could not be reached').evaluate().isNotEmpty,
+ reason: 'the required page shows the sign-in error',
);
- 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')));
+ expect(find.byType(SwarmScreen), findsNothing);
+ await _shot(tester, '4-sign-in-error');
+
+ await tester.tap(_email);
+ await tester.pump(const Duration(milliseconds: 300));
+ cli.pending!.complete();
await _until(
tester,
- () => find.byType(LoginScreen).evaluate().isEmpty,
- reason: 'the sign-in closes back to the desk',
+ () => find.byType(SwarmScreen).evaluate().isNotEmpty,
+ reason: 'successful sign-in opens the workspace',
);
- expect(find.byType(SwarmScreen), findsOneWidget);
+ expect(find.byType(SignInStep), findsNothing);
+ expect(app.signedIn, isTrue);
expect(tester.takeException(), isNull);
+ await _shot(tester, '5-workspace-after-retry');
await tester.pumpWidget(const SizedBox());
}, timeout: const Timeout(Duration(minutes: 3)));
@@ -581,8 +546,34 @@ void main() {
reason: 'Settings closes',
);
- // Sign out: this computer is without an account again, and its row
- // ends in Sign in again.
+ // A rejected session returns to the same required page, even mid-work.
+ app.expireSessionForTest(
+ 'Your session ended. Sign in again to continue.',
+ );
+ await _until(
+ tester,
+ () => find.byType(SignInStep).evaluate().isNotEmpty,
+ reason: 'session expiry requires sign-in again',
+ );
+ expect(find.byType(SwarmScreen), findsNothing);
+ expect(
+ find.text('Your session ended. Sign in again to continue.'),
+ findsOneWidget,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(find.byType(SignInStep), findsOneWidget);
+ await _shot(tester, 'session-expired');
+ await tester.tap(_google);
+ await tester.pump(const Duration(milliseconds: 300));
+ cli.pending!.complete();
+ await _until(
+ tester,
+ () => find.byType(SwarmScreen).evaluate().isNotEmpty,
+ reason: 'signing in again restores the workspace',
+ );
+
+ // Explicit sign-out returns to the required sign-in page.
await openMenu();
await tester.tap(find.byKey(const ValueKey('account-menu-signOut')));
await _until(
@@ -593,17 +584,13 @@ void main() {
);
await _until(
tester,
- () => find.byType(SwarmScreen).evaluate().isNotEmpty,
- reason: 'the desk stays, as a guest',
+ () => find.byType(SignInStep).evaluate().isNotEmpty,
+ reason: 'sign-out requires sign-in again',
);
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);
+ expect(find.byType(SwarmScreen), findsNothing);
+ expect(find.text('Skip'), findsNothing);
+ expect(find.text('Sign in to continue.'), findsOneWidget);
await _shot(tester, '9-after-sign-out');
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dart
index 26bd2237a..9023a4570 100644
--- a/desktop/lib/app_shell.dart
+++ b/desktop/lib/app_shell.dart
@@ -367,8 +367,8 @@ 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.
+ // Every signed-out desktop launch requires an account before opening
+ // the workspace, including computers that already have Harness.
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.
diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dart
index 0378712c4..a3b3769a0 100644
--- a/desktop/lib/screens/login_screen.dart
+++ b/desktop/lib/screens/login_screen.dart
@@ -14,24 +14,11 @@ 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/sign_in_step.dart';
import '../widgets/web_download_button.dart';
-/// The sign-in screen.
-///
-/// Lead with the reach: your machines, wherever they are, feeding this one
-/// window — the picture is [LoginFleetMap], and it moves only where a packet
-/// moves. The privacy guarantee stays in the quiet footer.
-///
-/// **All four states live here**, in one layout, rather than the two screens this
-/// used to be. The web uses a full-page fleet map and prominent CTA; native
-/// sign-in retains its compact card. Pressing Sign in once swapped the window for
-/// `AwaitingBrowserLoginScreen`, at a different type scale — a hard cut in the
-/// middle of a flow, and the reason the button's own spinner was almost never
-/// seen. The wait is now a state of the button, so the frame never jumps.
-///
-/// The way in is two buttons, Continue with Google and Continue with Apple
-/// ([SignInProviderButton]), as on the Autonomous storefront — not one Sign in
-/// that left the choice to the browser (owner, 2026-10-01).
+/// Native sign-in uses the onboarding page. The browser keeps its full-page
+/// introduction; both surfaces share the existing account lifecycle.
///
/// ⚠️ **The SSO page cannot be embedded, and that is not a preference.**
/// `auth.autonomous.ai`'s Google sign-in uses Google's popup-based Identity
@@ -45,15 +32,8 @@ import '../widgets/web_download_button.dart';
class LoginScreen extends StatelessWidget {
final AppNotifier notifier;
- /// Closes this screen, when there is something behind it to go back to.
- ///
- /// Null is the WALL: the viewer's sign-in, and any window with nothing of its
- /// own to show — there is nowhere to close to, and an X that led nowhere would
- /// be the only control on the screen that does nothing. Non-null is the sheet
- /// a guest desktop window raises over its desk (`showSignInSheet`), and the X
- /// belongs on the CARD, where a person looks for the close of the thing in
- /// front of them — not in the corner of the screen behind it (owner,
- /// 2026-09-23).
+ /// Optional dismissal for web callers. Native sign-in is required and has
+ /// no close action; it uses the same page as onboarding.
final VoidCallback? onClose;
/// Why this sign-in, now — said in place of the pitch under the title. Null
@@ -77,27 +57,11 @@ class LoginScreen extends StatelessWidget {
'At home, at the office, in the cloud — every machine you '
'sign in to becomes part of one desk, here.';
- /// Matches `EnvironmentSetupScreen` (560) and `LinkMachineScreen` (460) —
- /// wide enough for the diagram to breathe, still centred at the 880×560
- /// minimum window.
- static const double _cardWidth = 520;
-
@override
Widget build(BuildContext context) {
- // Law 4: a widget that reads a colour token watches, or it freezes on the
- // boot palette when the theme flips. This screen used to call it zero times.
+ // Every native entry uses the same page as onboarding, including expired sessions.
+ if (!kIsWeb) return SignInStepScreen(app: notifier);
grid.AppTheme.watch(context);
-
- // The same flag `RootShell` routes on, so the button's state and the reason
- // this screen is on screen at all can never disagree.
- final waiting = notifier.signingIn || notifier.signingOut;
- final compact = MediaQuery.sizeOf(context).height < 640;
- final gap = compact ? 16.0 : 24.0;
- // Preserve room for the primary action and its explanation at the minimum
- // window size with enlarged text. The illustration is supplementary.
- final showFleet =
- !compact || MediaQuery.textScalerOf(context).scale(16) <= 20;
-
return CallbackShortcuts(
bindings: {
if (notifier.canCancelLogin)
@@ -107,101 +71,11 @@ class LoginScreen extends StatelessWidget {
): notifier.cancelLogin,
},
child: Scaffold(
- // The PANEL tone, not the window's. In light both `windowBg` and the
- // card's `surfaceFill` are pure white, so a card on the window is a card
- // you cannot see — only its shadow separates it, and at this size that
- // reads as a printing artefact rather than as a raised block. The rail's
- // own barely-there grey gives the card something to sit on in both
- // themes, which is the same trick the app plays everywhere else.
backgroundColor: grid.AppPalette.panelBg,
- body: kIsWeb
- ? _webPage(context, waiting: waiting)
- : Stack(
- children: [
- const Positioned.fill(child: LoginAurora()),
- Center(
- child: SingleChildScrollView(
- padding: EdgeInsets.all(compact ? 16 : 24),
- child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: _cardWidth),
- child: Container(
- // The app's raised-block recipe: fill plus a soft lift, no rim.
- decoration: BoxDecoration(
- color: grid.AppGlass.surfaceFill,
- borderRadius: BorderRadius.circular(14),
- boxShadow: grid.AppCard.shadow,
- ),
- padding: EdgeInsets.all(compact ? 20 : 24),
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- if (onClose != null)
- // Into the card's own padding, so the glyph sits in
- // the CORNER rather than level with the app mark —
- // which read as a misplaced control (owner,
- // 2026-09-23). Negative offsets need Clip.none above.
- Positioned(
- top: compact ? -12 : -16,
- right: compact ? -12 : -16,
- child: IconButton(
- key: const Key('login-close-button'),
- tooltip: 'Close',
- iconSize: 18,
- visualDensity: VisualDensity.compact,
- color: grid.AppPalette.textSecondary,
- icon: const Icon(AppIcons.close),
- onPressed: onClose,
- ),
- ),
- Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const _AppMark(),
- SizedBox(height: gap),
- Text(
- 'Your agents, wherever they run',
- textAlign: TextAlign.center,
- style: grid.AppType.title(),
- ),
- const SizedBox(height: 8),
- Text(
- reason ?? _pitch,
- textAlign: TextAlign.center,
- style: Theme.of(context)
- .textTheme
- .bodySmall,
- ),
- SizedBox(height: gap),
- if (showFleet) ...[
- const LoginFleetMap(),
- SizedBox(height: gap),
- ],
- _Action(
- notifier: notifier,
- waiting: waiting,
- compact: compact,
- offerPhone: offerPhone,
- ),
- if (notifier.lastError != null &&
- !notifier.sessionExpired) ...[
- const SizedBox(height: 16),
- _ErrorTile(
- message: notifier.lastError!,
- onRetry: notifier.retryLogin,
- ),
- ],
- SizedBox(height: gap),
- const _Seal(),
- ],
- ),
- ],
- ),
- ),
- ),
- ),
- ),
- ],
- ),
+ body: _webPage(
+ context,
+ waiting: notifier.signingIn || notifier.signingOut,
+ ),
),
);
}
@@ -791,64 +665,9 @@ class _Seal extends StatelessWidget {
}
}
-/// The app icon, on a recess that gives it somewhere to stand.
-///
-/// The asset is the Dock icon: an amber mark on its own charcoal tile. At 40px
-/// on this card that tile composites into the card behind it — they are within
-/// a few points of the same grey — so the tile disappears and what is left is a
-/// bare amber shape floating in the middle of an indigo-and-teal screen. It
-/// read as a warning badge rather than as a logo, and it took the eye before
-/// the headline did.
-///
-/// The fix is not to recolour the brand. It is to give the mark the ground it
-/// was drawn to sit on: [grid.AppCard.inset] is a step *darker* than the card
-/// in dark and a step warmer-grey in light, so the tile has an edge again in
-/// both themes. The amber then reads as deliberate — the one warm thing on the
-/// screen, contained — instead of as a sticker someone left on.
-class _AppMark extends StatelessWidget {
- const _AppMark();
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return Container(
- width: 56,
- height: 56,
- decoration: BoxDecoration(
- color: grid.AppCard.inset,
- // Radius 12 inside the card's 14 — a child is never rounder than its
- // parent, and the asset's own corners are rounder still inside this.
- borderRadius: BorderRadius.circular(12),
- ),
- alignment: Alignment.center,
- // No ClipRRect: the asset carries its own rounded corners, and clipping
- // would cut the edge twice. Same reason About renders it bare.
- child: Image.asset(
- 'assets/app_icon.png',
- width: 36,
- height: 36,
- filterQuality: FilterQuality.medium,
- ),
- );
- }
-}
-
-/// The sign-in screen, raised OVER the desk rather than instead of it.
-///
-/// A desktop window opens on this computer without an account, and what an
-/// account adds — the other machines, the shared desk, voice on the dial — is
-/// asked for at the moment the person reaches for it. This is [LoginScreen]
-/// ITSELF on a route above the desk, not a smaller copy: a second layout was a
-/// second sign-in to keep in step, and it read as the screen having been
-/// redesigned. [reason], when a call site has one, takes the place of the
-/// pitch under the title: the person reached for something, and this says
-/// what the sign-in is for. [offerPhone] false leaves out Scan with your phone
-/// — see [LoginScreen.offerPhone].
-///
-/// Closes itself the moment the account arrives — [AppNotifier.signedIn] flips
-/// — or when the person cancels, whichever comes first. Returns whether the
-/// sign-in completed, so a caller that opened it on the way to something (Link
-/// Machine, say) knows whether to carry on.
+/// Opens required sign-in over a caller that needs an account. Native uses the
+/// onboarding page and stays until an account arrives. The saved workspace and
+/// running harnesses remain intact underneath.
Future<bool> showSignInSheet(
BuildContext context,
AppNotifier notifier, {
@@ -924,6 +743,9 @@ class _SignInSheetState extends State<_SignInSheet> {
@override
Widget build(BuildContext context) {
+ if (!kIsWeb) {
+ return PopScope(canPop: false, child: SignInStepScreen(app: notifier));
+ }
// ⚠️ THE SCREEN ITSELF, not a smaller copy of it. A sheet with its own
// layout was a second sign-in to keep in step with this one — two cards,
// two button states, two sets of words — and it read as the login screen
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index d792e9440..846553d50 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -392,6 +392,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
// editor mounted so its text-input connection and composition survive.
late GlobalKey _searchInputKey;
final _tabScroll = ScrollController();
+ final _tabShortcutHints = ValueNotifier(false);
({String activeId, List<String> order, double viewport, List<double> widths})?
_tabGeometry;
bool _tabRevealScheduled = false;
@@ -608,6 +609,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
},
onHide: app.announceWindowForeground,
onInactive: () {
+ _tabShortcutHints.value = false;
app.announceWindowForeground();
},
// Whether the app is in front of anyone decides whether the model surfaces refresh at all
@@ -894,6 +896,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
_searchDialogScope.dispose();
_searchText.dispose();
_tabScroll.dispose();
+ _tabShortcutHints.dispose();
_canvasFocus.dispose();
_shellFocus.dispose();
_startSearchFocus.dispose();
@@ -4260,6 +4263,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
bool _noteKey(KeyEvent event) {
+ // Paint hints only; the keymap still owns every shortcut and input event.
+ _tabShortcutHints.value = HardwareKeyboard.instance.isMetaPressed;
// Off, this is not here at all: every key goes where it went before.
if (event is! KeyDownEvent || _zoo.daemons == DaemonsSwitch.off) {
return false;
@@ -8050,6 +8055,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
DesktopWorkspaceTab.naturalWidth(
context,
labels[index],
+ shortcutHint: _keymap.hint(
+ 'swarm.select_${index + 1}',
+ ),
hasActivity: activity != null,
) >
_tabWidths[index],
@@ -8060,6 +8068,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
].join('\n');
return DesktopWorkspaceTab(
id: swarm.id,
+ showShortcuts: _tabShortcutHints,
+ shortcutHint: _keymap.hint(
+ 'swarm.select_${index + 1}',
+ ),
onRename: () => _rename(swarm.id),
label: labels[index],
selected: selected,
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index a7abfdd13..680f78bcf 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1119,8 +1119,8 @@ class AppNotifier extends ChangeNotifier {
readiness.needsTerminal ||
readiness.plan.any((item) => item.requiresTerminal);
- /// A computer new to Harness builds its first workspace behind the welcome tour, as soon as the app
- /// is ready, so the agents have started and OpenCode's task is typed by the time the tour hands
+ /// A computer new to Harness builds its first workspace behind the welcome tour, once signed in
+ /// and ready, so the agents have started and OpenCode's task is typed by the time the tour hands
/// over: OpenCode's own first start took about 12 s after the tour had ended (fresh macOS VM,
/// 2026-10-09). The workspace joins this run when it appears ([FirstArrival.run]).
///
@@ -1132,6 +1132,7 @@ class AppNotifier extends ChangeNotifier {
void _firstArrivalBehindTour() {
if (!firstArrivalBehindTour ||
viewer != null ||
+ !signedIn ||
// Behind the sign-in step as well: it stands where the tour stood.
!(_setupTour || _signInStep) ||
status != AppStatus.authenticated ||
@@ -1149,22 +1150,21 @@ class AppNotifier extends ChangeNotifier {
}
// --- 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:
+ // Desktop requires an account before opening the workspace, including on
+ // computers that already have the CLI. The page stays until sign-in succeeds;
+ // cancelling or restarting the app cannot bypass it. Explicit sign-out brings
+ // it back, as does a session the server can no longer renew. A signed-in
+ // offline launch needs no new sign-in. 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
+ /// Whether the sign-in step comes after setup: this computer 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.
+ /// the moment setup (and its tour) hands over, until an account arrives.
bool get signInStepShowing {
if (!_signInStep || viewer != null || setupTourShowing) return false;
final signingInHere = status == AppStatus.bootstrapping && signingIn;
@@ -1179,19 +1179,6 @@ class AppNotifier extends ChangeNotifier {
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.
@@ -2942,12 +2929,10 @@ class AppNotifier extends ChangeNotifier {
/// Whether this computer holds an account.
///
- /// Guest is the ABSENCE of one, not a mode of its own: everything on this
- /// computer works without it — agents, terminals, tabs, DSH, the cabled dial
- /// — and what an account adds is the OTHER machines, the shared desk, voice
- /// on the dial and the profile. The window opens either way; see [isGuest]
- /// for what a guest is asked to sign in for, and `showSignInSheet` for how
- /// it is asked.
+ /// Local services can run without an account, but desktop launch requires
+ /// one before the workspace opens ([signInStepShowing]). After runtime
+ /// expiry, local recovery keeps agents, terminals, tabs and DSH available;
+ /// remote machines, the shared desk and the profile require sign-in again.
///
/// Presumed true until the CLI says otherwise (`bootstrap` asks, and every
/// change after that goes through [_rebindAuth]): nothing gated on it is on
@@ -4548,7 +4533,7 @@ class AppNotifier extends ChangeNotifier {
if (firstHarness) {
agentPrefetch?.setupRunning = true;
agentPrefetch?.start();
- // Asked once, after setup: see [signInStepShowing].
+ // The tour's final line announces sign-in: see [signInStepShowing].
_signInStep = true;
}
if (!result.isReady && _canInstallUnattended(result, mode: null)) {
@@ -4686,16 +4671,16 @@ class AppNotifier extends ChangeNotifier {
signedIn = authStatus.loggedIn;
if (!authStatus.loggedIn) {
currentUser = null;
- // A VIEWER has nothing to show without an account — no daemon, no
- // machine of its own — so it keeps its login screen. A desktop window
- // has this computer, and opens on it: the sign-in becomes a sheet it
- // raises when the person reaches for another machine, not a wall in
- // front of agents that are already running.
+ // Viewers keep their own login screen. Desktop can prepare the saved
+ // workspace locally, but the required sign-in page stays in front of
+ // it. Arm it on every signed-out launch, including existing installs
+ // and a relaunch after leaving setup before signing in.
if (viewer != null) {
status = AppStatus.unauthenticated;
notifyListeners();
return;
}
+ _signInStep = true;
}
status = AppStatus.bootstrapping;
notifyListeners();
@@ -5122,11 +5107,13 @@ class AppNotifier extends ChangeNotifier {
}) async {
_guestDeskRestorePending = true;
signedIn = false;
+ _signInStep = true;
currentUser = null;
if (banner != null) {
_lastError = banner;
_lastErrorRetryable = true;
}
+ notifyListeners();
// Account teardown already removed private remote content. Finish closing
// its transports before restoring this computer from the saved desk.
await _workspaceCleanup;
@@ -5629,14 +5616,14 @@ class AppNotifier extends ChangeNotifier {
static const _signedOutMessage =
'You were signed out on this computer. This computer\'s agents keep '
- 'running; sign in again to reach your other machines.';
+ 'running; sign in again to continue.';
/// Inject the same account-expiry event the connection pool reports, without a real daemon.
@visibleForTesting
void expireSessionForTest(String message) => _signedOutAtRuntime(message);
- /// A running session lost its account. Viewers return to login; desktop windows
- /// keep this computer available as guests and explain how to reconnect remotely.
+ /// A running session lost its account. Return to required sign-in while
+ /// preserving this computer's saved workspace and running harnesses.
void _signedOutAtRuntime(String message) {
if (status == AppStatus.unauthenticated || isGuest) {
return; // idempotent: several sources can race here
@@ -5658,10 +5645,8 @@ class AppNotifier extends ChangeNotifier {
notifyListeners();
return;
}
- // A desktop window becomes a GUEST instead: the daemon comes back signed out
- // and goes on serving this computer, so the agents that were running are
- // still running. This computer's tiles stay (under the id it serves now),
- // the other machines' leave, and the banner says why the list got shorter.
+ // Restore local panes behind required sign-in. The daemon keeps serving
+ // this computer so running agents survive; old account transports close.
//
// The work was invalidated above, so the guest transition runs under THIS
// revision: invalidating again would clear [sessionExpired], and the banner
@@ -6370,10 +6355,9 @@ class AppNotifier extends ChangeNotifier {
_monitorHarnesses.clear();
// What was said about the account's devices was about this account's.
_clearDeviceNoticeState();
- // A VIEWER goes back to its login screen; a desktop window stays on the desk
- // and becomes a guest — the daemon comes back signed out and keeps serving
- // this computer, so signing out of the account is not a reason to take the
- // agents off the screen. The rebind at the end sits the desk back down.
+ // A viewer goes back to its login screen; desktop returns to its required
+ // sign-in page once credentials are cleared. Its local daemon and agents
+ // keep running, and the rebind preserves the desk for the next sign-in.
// The local-manual dev fixture goes back to the login screen too: it has
// no daemon of its own, and a guest desk would be served by the REAL CLI.
final becomesGuest = viewer == null && localManualFixture == null;
@@ -6396,6 +6380,12 @@ class AppNotifier extends ChangeNotifier {
signOutError = didClear
? null
: 'Your saved sign-in could not be cleared. Try signing out again.';
+ if (becomesGuest && didClear) {
+ // Explicit sign-out returns to the required page. Set both together so
+ // its getter cannot consume the gate under the account that just left.
+ signedIn = false;
+ _signInStep = true;
+ }
notifyListeners();
// The CLI restarts its daemon signed out (`harness logout` does it itself),
// so this window waits for that one and sits its desk back down on the id it
diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dart
index 0adac2e57..3d9c354dc 100644
--- a/desktop/lib/widgets/desktop_workspace_tab.dart
+++ b/desktop/lib/widgets/desktop_workspace_tab.dart
@@ -1,5 +1,6 @@
import 'dart:math' as math;
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
@@ -11,10 +12,11 @@ import 'desktop_chrome.dart';
/// The Flutter counterpart of the AppKit tab: a centered name/status group
/// and, at its trailing edge, the close action.
///
-/// At rest the name and status have the whole tab; hovering reveals ×. Agent
-/// Messages has nothing on a tab: traffic between its agents shows nothing,
+/// At rest the name and status have the whole tab; hovering reveals ×.
+/// Holding Command replaces the status with the tab's shortcut, as before.
+/// Agent Messages has nothing on a tab: traffic between its agents shows nothing,
/// since messages arrive when they arrive, and its on/off is Settings ▸
-/// Agents'. The 💬 that sat beside × was easy to hit by mistake and turned
+/// Experimental's. The 💬 that sat beside × was easy to hit by mistake and turned
/// the tab off, failing a message that was waiting (owner, 2026-10-12).
class DesktopWorkspaceTab extends StatefulWidget {
const DesktopWorkspaceTab({
@@ -22,6 +24,7 @@ class DesktopWorkspaceTab extends StatefulWidget {
required this.id,
required this.label,
required this.selected,
+ required this.showShortcuts,
required this.onSelect,
required this.onClose,
this.tooltip,
@@ -29,13 +32,15 @@ class DesktopWorkspaceTab extends StatefulWidget {
this.activityLabel,
this.highlighted = false,
this.onRename,
+ this.shortcutHint,
});
final String id, label;
final bool selected, highlighted;
+ final ValueListenable<bool> showShortcuts;
final VoidCallback? onSelect, onClose;
final VoidCallback? onRename;
- final String? tooltip, activityLabel;
+ final String? shortcutHint, tooltip, activityLabel;
/// The status cell: an [ActivityMark].
final Widget? activity;
@@ -60,6 +65,24 @@ class DesktopWorkspaceTab extends StatefulWidget {
static const _revealedInset = closeWidth + grid.AppDesktop.tabCloseInset;
static const _statusWidth = 16.0, _indicatorGap = 6.0;
+ static TextStyle _hintStyle({Color? color}) =>
+ DesktopChrome.metadata(color: color).copyWith(
+ fontFamilyFallback: [...grid.AppType.sansFallback, 'Apple Symbols'],
+ );
+
+ static double indicatorWidth(
+ BuildContext context,
+ String? hint, {
+ required bool hasActivity,
+ }) => math
+ .max(
+ hasActivity ? _statusWidth : 0.0,
+ hint == null || hint.isEmpty
+ ? 0.0
+ : _measure(context, hint, _hintStyle()),
+ )
+ .clamp(0.0, 72.0);
+
static double labelWidth(BuildContext context, String label) =>
_measure(context, label, DesktopChrome.control());
@@ -69,11 +92,15 @@ class DesktopWorkspaceTab extends StatefulWidget {
BuildContext context,
String label, {
bool hasActivity = false,
+ String? shortcutHint,
}) =>
labelWidth(context, label) +
_restingInset +
_revealedInset +
- (hasActivity ? _statusWidth + _indicatorGap : 0);
+ ((hasActivity || (shortcutHint?.isNotEmpty ?? false))
+ ? indicatorWidth(context, shortcutHint, hasActivity: hasActivity) +
+ _indicatorGap
+ : 0);
/// The name's left edge and width: centered with its status, and when
/// revealed moved left only as far as × needs, then shortened. A name with
@@ -83,8 +110,9 @@ class DesktopWorkspaceTab extends StatefulWidget {
required double labelWidth,
required bool hasActivity,
required bool revealed,
+ double indicatorWidth = _statusWidth,
}) {
- final status = hasActivity ? _statusWidth + _indicatorGap : 0.0;
+ final status = hasActivity ? indicatorWidth + _indicatorGap : 0.0;
final right = revealed ? _revealedInset : _restingInset;
final width = math.min(
labelWidth,
@@ -198,111 +226,141 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
explicitChildNodes: true,
selected: widget.selected,
child: LayoutBuilder(
- builder: (context, constraints) {
- final revealed = enabled && _hovered;
- final hasActivity = widget.activity != null;
- final (groupLeft, labelWidth) = DesktopWorkspaceTab.titleLayout(
- tabWidth: constraints.maxWidth,
- labelWidth: DesktopWorkspaceTab.labelWidth(
+ builder: (context, constraints) => ValueListenableBuilder(
+ valueListenable: widget.showShortcuts,
+ builder: (context, showHints, _) {
+ final revealed = enabled && _hovered;
+ final showHint =
+ enabled &&
+ showHints &&
+ (widget.shortcutHint?.isNotEmpty ?? false);
+ final hasActivity = widget.activity != null || showHint;
+ final indicator = DesktopWorkspaceTab.indicatorWidth(
context,
- widget.label,
- ),
- hasActivity: hasActivity,
- revealed: revealed,
- );
- return Stack(
- children: [
- Positioned.fill(
- child: Semantics(
- button: true,
- enabled: enabled,
- label: [widget.label, ?widget.activityLabel].join(', '),
- onTap: widget.onSelect,
- customSemanticsActions: {
- if (widget.onClose != null)
- const CustomSemanticsAction(label: 'Close tab'):
- widget.onClose!,
- },
- child: FocusableActionDetector(
+ showHint ? widget.shortcutHint : null,
+ hasActivity: widget.activity != null,
+ );
+ final (groupLeft, labelWidth) = DesktopWorkspaceTab.titleLayout(
+ tabWidth: constraints.maxWidth,
+ labelWidth: DesktopWorkspaceTab.labelWidth(
+ context,
+ widget.label,
+ ),
+ hasActivity: hasActivity,
+ revealed: revealed,
+ indicatorWidth: indicator,
+ );
+ return Stack(
+ children: [
+ Positioned.fill(
+ child: Semantics(
+ button: true,
enabled: enabled,
- onShowFocusHighlight: (value) =>
- setState(() => _focused = value),
- actions: {
- ActivateIntent: CallbackAction<ActivateIntent>(
- onInvoke: (_) {
- widget.onSelect?.call();
- return null;
- },
- ),
+ label: [widget.label, ?widget.activityLabel].join(', '),
+ onTap: widget.onSelect,
+ customSemanticsActions: {
+ if (widget.onClose != null)
+ const CustomSemanticsAction(label: 'Close tab'):
+ widget.onClose!,
},
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: widget.onSelect,
- onDoubleTap: widget.onRename,
- child: ExcludeSemantics(
- child: Stack(
- children: [
- Positioned(
- left: groupLeft,
- width: labelWidth,
- top: 0,
- bottom: 0,
- child: Center(
- child: Text(
- widget.label,
- key: ValueKey('tab-label:${widget.id}'),
- textAlign: TextAlign.center,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(color: ink),
- ),
- ),
- ),
- if (widget.activity case final activity?)
+ child: FocusableActionDetector(
+ enabled: enabled,
+ onShowFocusHighlight: (value) =>
+ setState(() => _focused = value),
+ actions: {
+ ActivateIntent: CallbackAction<ActivateIntent>(
+ onInvoke: (_) {
+ widget.onSelect?.call();
+ return null;
+ },
+ ),
+ },
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: widget.onSelect,
+ onDoubleTap: widget.onRename,
+ child: ExcludeSemantics(
+ child: Stack(
+ children: [
Positioned(
- left:
- groupLeft +
- labelWidth +
- DesktopWorkspaceTab._indicatorGap,
- width: DesktopWorkspaceTab._statusWidth,
+ left: groupLeft,
+ width: labelWidth,
top: 0,
bottom: 0,
- child: Center(child: activity),
+ child: Center(
+ child: Text(
+ widget.label,
+ key: ValueKey('tab-label:${widget.id}'),
+ textAlign: TextAlign.center,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(
+ color: ink,
+ ),
+ ),
+ ),
),
- ],
+ if (hasActivity)
+ Positioned(
+ left:
+ groupLeft +
+ labelWidth +
+ DesktopWorkspaceTab._indicatorGap,
+ width: indicator,
+ top: 0,
+ bottom: 0,
+ child: Center(
+ child: showHint
+ ? Text(
+ widget.shortcutHint!,
+ key: ValueKey(
+ 'tab-shortcut:${widget.id}',
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style:
+ DesktopWorkspaceTab._hintStyle(
+ color: ink,
+ ),
+ )
+ : widget.activity,
+ ),
+ ),
+ ],
+ ),
),
),
),
),
),
- ),
- Positioned(
- right: grid.AppDesktop.tabCloseInset,
- top: 0,
- bottom: 0,
- child: _accessory(
- visible: revealed,
- width: DesktopWorkspaceTab.closeWidth,
- child: IconButton(
- key: ValueKey('tab-close:${widget.id}'),
- tooltip: 'Close tab',
- onPressed: widget.onClose,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints.tightFor(
- width: DesktopWorkspaceTab.closeWidth,
- height: 32,
- ),
- style: _accessoryStyle(foreground, quietOpacity),
- icon: const Icon(
- AppIcons.close,
- size: AppIcons.closeSize,
+ Positioned(
+ right: grid.AppDesktop.tabCloseInset,
+ top: 0,
+ bottom: 0,
+ child: _accessory(
+ visible: revealed,
+ width: DesktopWorkspaceTab.closeWidth,
+ child: IconButton(
+ key: ValueKey('tab-close:${widget.id}'),
+ tooltip: 'Close tab',
+ onPressed: widget.onClose,
+ padding: EdgeInsets.zero,
+ constraints: const BoxConstraints.tightFor(
+ width: DesktopWorkspaceTab.closeWidth,
+ height: 32,
+ ),
+ style: _accessoryStyle(foreground, quietOpacity),
+ icon: const Icon(
+ AppIcons.close,
+ size: AppIcons.closeSize,
+ ),
),
),
),
- ),
- ],
- );
- },
+ ],
+ );
+ },
+ ),
),
),
),
diff --git a/desktop/lib/widgets/quiet_link.dart b/desktop/lib/widgets/quiet_link.dart
index 9ef1ca903..df2edfa6e 100644
--- a/desktop/lib/widgets/quiet_link.dart
+++ b/desktop/lib/widgets/quiet_link.dart
@@ -2,8 +2,8 @@ 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
+/// A way on that is words, not a box: Continue with email on the
+/// sign-in step and 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,
diff --git a/desktop/lib/widgets/setup_tour.dart b/desktop/lib/widgets/setup_tour.dart
index 37e1026d9..660538afd 100644
--- a/desktop/lib/widgets/setup_tour.dart
+++ b/desktop/lib/widgets/setup_tour.dart
@@ -9,15 +9,12 @@ import '../bootstrap/setup_progress.dart';
import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_icon_button.dart';
-import '../shortcuts/app_shortcuts.dart';
-import '../shortcuts/keymap.dart';
-import '../shortcuts/keymap_commands.dart';
import '../state/app_state.dart';
import 'environment_setup_screen.dart';
import 'setup_tour_art.dart';
import 'window_chrome.dart';
-/// The welcome tour: seven slides on what Harness does.
+/// The welcome tour: five slides on what Harness does.
///
/// A fresh computer sees it while setup installs with nobody at the keyboard
/// ([SetupTourScreen]), with the install as one line under it, like an OS
@@ -68,34 +65,8 @@ 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 {
- final command = harnessCommands.firstWhere(
- (command) => command.id == 'harnesses.list',
- );
- final keys = command.keys;
- return keys.isEmpty
- ? const ['⌘', 'P']
- : describeKeyStrokeKeys(KeyStroke.parse(keys.first));
-}
-
-/// The keycaps for New Harness (Cmd-N), the same way.
-List<String> get tourNewHarnessKeys {
- for (final shortcut in appShortcuts()) {
- if (shortcut.action == ShortcutAction.newAgent) {
- return describeShortcutKeys(shortcut.activator);
- }
- }
- return const ['⌘', 'N'];
-}
-
-/// The seven slides, in order of importance. Copy is the approved render's.
+/// The five slides, in order of importance. Copy is the approved render's.
List<TourSlide> tourSlides() {
- final search = tourSearchKeys;
- final create = tourNewHarnessKeys;
- final searchChord = search.join(chordKeySeparator);
- final createChord = create.join(chordKeySeparator);
final computer = tourComputerNoun;
return [
TourSlide(
@@ -116,24 +87,6 @@ List<TourSlide> tourSlides() {
artLabel: 'Four agents working in a two by two grid',
art: (_) => const TourAgentsArt(),
),
- TourSlide(
- kicker: 'Keyboard first',
- title: '$searchChord finds\nany harness.',
- copy:
- 'One search over every harness on all your machines, with all your '
- "agents. A few letters, Return, you're in it.",
- artLabel: 'Search results from three machines and three agents',
- art: (_) => TourSearchArt(keys: search),
- ),
- TourSlide(
- kicker: 'Keyboard first',
- title: '$createChord starts\na new harness.',
- copy:
- 'Any agent, on any of your machines, in any project. Pick them by '
- 'keys, type what you want, press Return.',
- artLabel: 'The New Harness box with an agent, a machine and a project',
- art: (_) => TourNewHarnessArt(keys: create),
- ),
TourSlide(
kicker: 'Always there',
title: 'Sessions that\nkeep going.',
diff --git a/desktop/lib/widgets/sign_in_step.dart b/desktop/lib/widgets/sign_in_step.dart
index 7b835182c..e7a6cc2c2 100644
--- a/desktop/lib/widgets/sign_in_step.dart
+++ b/desktop/lib/widgets/sign_in_step.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import '../auth/sign_in_provider.dart';
import '../logging/app_log.dart';
@@ -12,12 +13,13 @@ 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]).
+/// Required sign-in after setup on a computer 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.
+/// Continue with Apple on the right. The buttons stand alone, with Continue
+/// with email centered under them (owner, 2026-10-12).
/// 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.
@@ -33,22 +35,25 @@ const signInStepBenefits = [
(icon: AppIcons.panelsTopLeft, line: 'Same tabs on every computer'),
];
-/// The page itself, apart from the app: what it says and its five controls.
+/// The page itself, apart from the app: what it says and its three 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,
+ this.sessionExpired = false,
+ this.signingOut = false,
+ this.signOutError,
+ this.onRetrySignOut,
+ this.recovery,
});
/// 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
@@ -61,10 +66,11 @@ class SignInStep extends StatelessWidget {
/// 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;
+ final bool sessionExpired;
+ final bool signingOut;
+ final String? signOutError;
+ final VoidCallback? onRetrySignOut;
+ final Widget? recovery;
@override
Widget build(BuildContext context) {
@@ -82,7 +88,13 @@ class SignInStep extends StatelessWidget {
Expanded(child: _stage(context, gutter)),
_ReadyBar(
gutter: gutter,
- line: finishing ? 'Signing in…' : 'Harness is ready.',
+ line: signingOut
+ ? 'Signing out…'
+ : finishing
+ ? 'Signing in…'
+ : sessionExpired
+ ? 'Your session ended. Sign in again to continue.'
+ : 'Sign in to continue.',
),
],
);
@@ -174,70 +186,52 @@ class SignInStep extends StatelessWidget {
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),
- ),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 24),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ spacing: 12,
+ children: [
+ if (signingOut)
+ const Center(
+ child: SizedBox.square(
+ dimension: 24,
+ child: CircularProgressIndicator(strokeWidth: 2),
+ ),
+ )
+ else if (signOutError != null)
+ FilledButton(
+ autofocus: true,
+ onPressed: onRetrySignOut,
+ child: const Text('Retry sign out'),
+ )
+ else ...[
+ 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),
- ),
+ Align(
+ alignment: Alignment.center,
+ 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(
+ ),
+ ],
+ if ((signOutError ?? error) case final error?)
+ Semantics(
liveRegion: true,
child: Text(
error,
@@ -247,9 +241,9 @@ class SignInStep extends StatelessWidget {
),
),
),
- ),
+ if (recovery case final recovery?) recovery,
],
- ],
+ ),
),
);
@@ -372,35 +366,105 @@ class _SignInStepScreenState extends State<SignInStepScreen> {
/// [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;
+ String? _copiedUrl;
+ String? _copyFailureUrl;
+ bool _copying = false;
@override
void initState() {
super.initState();
+ widget.app.addListener(_observeLogin);
+ _observeLogin();
appLog.info('onboarding', 'sign-in step: shown');
}
+ @override
+ void didUpdateWidget(SignInStepScreen oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.app != widget.app) {
+ oldWidget.app.removeListener(_observeLogin);
+ widget.app.addListener(_observeLogin);
+ _wasSigningIn = false;
+ _error = null;
+ _observeLogin();
+ }
+ }
+
+ @override
+ void dispose() {
+ widget.app.removeListener(_observeLogin);
+ super.dispose();
+ }
+
+ // Capture both notifications when a sign-in fails before the next frame.
+ void _observeLogin() {
+ final app = widget.app;
+ if (app.signingIn) {
+ _error = null;
+ } else if (_wasSigningIn) {
+ _error = app.signedIn ? null : app.lastError;
+ }
+ _wasSigningIn = app.signingIn;
+ }
+
+ Future<void> _copyLink() async {
+ final url = widget.app.pendingAuthorizeUrl;
+ if (url == null || _copying) return;
+ setState(() => _copying = true);
+ var copied = false;
+ try {
+ await Clipboard.setData(ClipboardData(text: url));
+ copied = true;
+ } catch (_) {}
+ if (!mounted) return;
+ setState(() {
+ _copying = false;
+ if (widget.app.pendingAuthorizeUrl == url) {
+ _copiedUrl = copied ? url : null;
+ _copyFailureUrl = copied ? null : url;
+ }
+ });
+ }
+
@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,
+ return CallbackShortcuts(
+ bindings: {
+ if (app.canCancelLogin)
+ const SingleActivator(
+ LogicalKeyboardKey.escape,
+ includeRepeats: false,
+ ): app.cancelLogin,
+ },
+ child: SignInStep(
+ onSignIn: (provider) => unawaited(app.signInFromStep(provider)),
+ // 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: app.loginBrowserError ?? _error,
+ sessionExpired: app.sessionExpired,
+ signingOut: app.signingOut,
+ signOutError: app.signOutError,
+ onRetrySignOut: () => unawaited(app.logout()),
+ recovery:
+ app.loginBrowserError != null && app.pendingAuthorizeUrl != null
+ ? QuietLink(
+ key: const Key('sign-in-step-copy-link'),
+ label: _copiedUrl == app.pendingAuthorizeUrl
+ ? 'Link copied'
+ : _copyFailureUrl == app.pendingAuthorizeUrl
+ ? 'Could not copy. Try again'
+ : 'Copy sign-in link',
+ onPressed: _copying ? null : () => unawaited(_copyLink()),
+ )
+ : null,
+ ),
);
},
);
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index a22ac0684..516e5dc81 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -1951,6 +1951,8 @@ private final class SwarmTabStrip: NSView {
private var activityTimer: Timer?
private var activityObservers: [NSObjectProtocol] = []
private var motionObserver: NSObjectProtocol?
+ private var modifierMonitor: Any?
+ private var shortcutHintsVisible = false
private var lastBackgroundClick: (time: TimeInterval, point: NSPoint)?
// Dragging is explicit below. AppKit must not also start a titlebar gesture.
override var mouseDownCanMoveWindow: Bool { false }
@@ -2134,6 +2136,7 @@ private final class SwarmTabStrip: NSView {
if notification.name == NSApplication.didResignActiveNotification ||
(notification.name == NSWindow.didResignKeyNotification && notification.object as? NSWindow === self.window) {
self.setDaemonHover(false)
+ self.setShortcutHintsVisible(false)
}
self.syncActivityAnimation()
})
@@ -2142,6 +2145,13 @@ private final class SwarmTabStrip: NSView {
forName: NSWorkspace.accessibilityDisplayOptionsDidChangeNotification, object: nil, queue: .main) {
[weak self] _ in self?.syncActivityAnimation()
}
+ // Observe only; AppKit and Flutter retain every shortcut and IME event.
+ modifierMonitor = NSEvent.addLocalMonitorForEvents(matching: .flagsChanged) { [weak self] event in
+ guard let self, let window = self.window,
+ event.window === window || (event.window == nil && window.isKeyWindow) else { return event }
+ self.setShortcutHintsVisible(event.modifierFlags.contains(.command))
+ return event
+ }
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@@ -2150,12 +2160,19 @@ private final class SwarmTabStrip: NSView {
daemonRevealTimer?.invalidate()
activityObservers.forEach(NotificationCenter.default.removeObserver)
if let motionObserver { NSWorkspace.shared.notificationCenter.removeObserver(motionObserver) }
+ if let modifierMonitor { NSEvent.removeMonitor(modifierMonitor) }
}
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
if window == nil { setDaemonHover(false) }
syncActivityAnimation()
+ setShortcutHintsVisible(window?.isKeyWindow == true && NSEvent.modifierFlags.contains(.command))
+ }
+
+ private func setShortcutHintsVisible(_ visible: Bool) {
+ shortcutHintsVisible = visible
+ for tab in tabs { tab.showsShortcutHint = visible && actionsEnabled }
}
/// Tabs whose status slot moves: a working spinner.
@@ -2345,7 +2362,7 @@ private final class SwarmTabStrip: NSView {
tabOrderChanged = tabOrderChanged || ids != previousOrder
for tab in tabs where !ids.contains(tab.swarmId) { tab.removeFromSuperview() }
let previous = Dictionary(tabs.map { ($0.swarmId, $0) }, uniquingKeysWith: { first, _ in first })
- tabs = rows.compactMap { row in
+ tabs = rows.enumerated().compactMap { index, row in
guard let id = row["id"] as? String else { return nil }
let tab = previous[id] ?? SwarmTabButton(id: id)
tab.palette = palette
@@ -2356,6 +2373,9 @@ private final class SwarmTabStrip: NSView {
tab.displayLabel = row["label"] != nil && !row.keys.contains("shortcutHint")
? displayLabel.replacingOccurrences(of: #"^\d+:"#, with: "", options: .regularExpression)
: displayLabel
+ tab.shortcutHint = row.keys.contains("shortcutHint")
+ ? row["shortcutHint"] as? String : (index < 9 ? "⌘\(index + 1)" : nil)
+ tab.showsShortcutHint = shortcutHintsVisible && actionsEnabled
tab.foreground = palette.navigationForeground
tab.selected = id == activeId
tab.keyboardFocus = tabsFocused && id == activeId
@@ -2749,6 +2769,10 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
let swarmId: String
var name = "New Tab" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
var displayLabel = "New Tab" { didSet { if displayLabel != oldValue { invalidateLabel() } } }
+ var shortcutHint: String? { didSet { if shortcutHint != oldValue { invalidateLabel() } } }
+ var showsShortcutHint = false {
+ didSet { if showsShortcutHint != oldValue { needsLayout = true; needsDisplay = true } }
+ }
/// Whether the tab's menu offers Show Agent Messages (docs/design/2026-10-10-agent-messages.md): false
/// where the row says nothing (the Store tab). The tab itself shows nothing of Agent Messages.
var canShowAgentMessages = false {
@@ -2760,9 +2784,14 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
closeButton.foreground = foreground
}
}
- /// The status slot: the activity mark.
+ private var displaysShortcut: Bool { actionsEnabled && showsShortcutHint && shortcutHint?.isEmpty == false }
+ private var indicatorWidth: CGFloat {
+ min(72, max(activityLabel == nil ? 0 : Self.activityWidth,
+ displaysShortcut ? shortcutLayout?.size.width ?? 0 : 0))
+ }
+ /// The status slot holds the same small shortcut label while Command is down.
private var statusSpace: CGFloat {
- !(activityMark?.isEmpty ?? true) ? Self.activityWidth + Self.gap : 0
+ !(activityMark?.isEmpty ?? true) || displaysShortcut ? indicatorWidth + Self.gap : 0
}
private var naturalTitleWidth: CGFloat { max(labelLayout.size.width, emphasizedLabelLayout.size.width) }
var minimumWidth: CGFloat { Self.restingInset * 2 + statusSpace + 16 }
@@ -2793,11 +2822,18 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
return NSRect(x: x, y: 0, width: width, height: bounds.height)
}
private var titleRect: NSRect { titleRect(revealed: isRevealed) }
+ private var indicatorRect: NSRect {
+ if bounds.width < minimumWidth {
+ let width = min(indicatorWidth, max(0, bounds.width - 16))
+ return NSRect(x: bounds.midX - width / 2, y: 0, width: width, height: bounds.height)
+ }
+ return NSRect(x: titleRect.maxX + Self.gap, y: 0, width: indicatorWidth, height: bounds.height)
+ }
private var activityRect: NSRect {
if bounds.width < minimumWidth {
return NSRect(x: bounds.midX - Self.activityWidth / 2, y: 0, width: Self.activityWidth, height: bounds.height)
}
- return NSRect(x: titleRect.maxX + Self.gap, y: 0, width: Self.activityWidth, height: bounds.height)
+ return NSRect(x: indicatorRect.midX - Self.activityWidth / 2, y: 0, width: Self.activityWidth, height: bounds.height)
}
/// Flutter holds the keyboard after Close; accessibility explains Return.
var keyboardFocus = false { didSet { if keyboardFocus != oldValue { needsDisplay = true; updateAccessibility() } } }
@@ -2829,6 +2865,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
}
private var cachedLabel: MeasuredLabel?
private var cachedEmphasizedLabel: MeasuredLabel?
+ private var cachedShortcutLabel: MeasuredLabel?
var actionsEnabled = true {
didSet {
selectButton.isEnabled = actionsEnabled
@@ -2932,6 +2969,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
private func invalidateLabel() {
cachedLabel = nil
cachedEmphasizedLabel = nil
+ cachedShortcutLabel = nil
updateAccessoryVisibility()
needsDisplay = true
needsLayout = true
@@ -2958,6 +2996,18 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
cachedEmphasizedLabel = measured
return measured
}
+ private var shortcutLayout: MeasuredLabel? {
+ guard let shortcutHint, !shortcutHint.isEmpty else { return nil }
+ if let cachedShortcutLabel { return cachedShortcutLabel }
+ let paragraph = NSMutableParagraphStyle()
+ paragraph.alignment = .center
+ paragraph.lineBreakMode = .byTruncatingTail
+ let measured = MeasuredLabel(NSAttributedString(string: shortcutHint, attributes: [
+ .font: NSFont.systemFont(ofSize: 12, weight: .regular),
+ .foregroundColor: foreground.withAlphaComponent(0.75), .paragraphStyle: paragraph]))
+ cachedShortcutLabel = measured
+ return measured
+ }
private var tabShape: NSBezierPath {
let path = NSBezierPath()
let top = max(0, bounds.maxY - Self.topInset)
@@ -3010,12 +3060,16 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
width: titleRect.width, height: text.size.height))
}
let status = NSRect(x: activityRect.minX, y: contentCenterY - 8, width: activityRect.width, height: 16)
- if let activityMark {
+ if !displaysShortcut, let activityMark {
NSGraphicsContext.saveGraphicsState()
bounds.clip()
HarnessNativeActivity.draw(activityMark, in: status, color: activity?.color ?? .systemOrange)
NSGraphicsContext.restoreGraphicsState()
}
+ if displaysShortcut, let shortcut = shortcutLayout {
+ shortcut.text.draw(in: NSRect(x: indicatorRect.minX, y: contentCenterY - shortcut.size.height / 2,
+ width: indicatorRect.width, height: shortcut.size.height))
+ }
}
// Overflowed tabs might not be drawn. Their names and selection still need
// to be available to VoiceOver and automation before they scroll into view.
diff --git a/desktop/test/agent_messages_tab_test.dart b/desktop/test/agent_messages_tab_test.dart
index 5ab455396..1c95e631a 100644
--- a/desktop/test/agent_messages_tab_test.dart
+++ b/desktop/test/agent_messages_tab_test.dart
@@ -41,6 +41,8 @@ Widget _host(
id: tab.id,
label: tab.id,
selected: index == 0,
+ showShortcuts: const AlwaysStoppedAnimation(false),
+ shortcutHint: '⌘${index + 1}',
onSelect: () {},
onClose: () => onClose?.call(tab.id),
activityLabel: tab.working ? 'Working' : null,
@@ -106,7 +108,7 @@ void main() {
findsNothing,
);
expect(_status('app'), findsOneWidget, reason: 'hover keeps the status');
- expect(find.text('⌘1'), findsNothing, reason: 'tabs show no shortcut');
+ expect(find.text('⌘1'), findsNothing, reason: 'Command is not held');
expect(
tester.getRect(_label('app')),
title,
diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dart
index df3f17e37..323a30c32 100644
--- a/desktop/test/boot_flow_widget_test.dart
+++ b/desktop/test/boot_flow_widget_test.dart
@@ -6,8 +6,10 @@ import 'package:flutter/services.dart';
import 'dart:async';
+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/bootstrap/setup_progress.dart';
import 'package:harness/core/config.dart';
@@ -93,6 +95,29 @@ class _ControlledCliLogin extends CliLogin {
Future<CliAuthStatus> checkStatus() => status.future;
}
+class _OnboardingCliLogin extends _FakeCliLogin {
+ final completed = Completer<void>();
+
+ @override
+ Future<void> login({
+ required void Function(String) onAuthorizeUrl,
+ SignInProvider? provider,
+ }) => completed.future;
+}
+
+class _OnboardingApi extends ApiClient {
+ _OnboardingApi() : super(config: AppConfig.dev, session: AuthSession());
+
+ @override
+ Future<Map<String, dynamic>?> me() async => null;
+
+ @override
+ Future<Map<String, dynamic>?> desk() async => null;
+
+ @override
+ Future<Map<String, dynamic>?> daemonDevices() async => null;
+}
+
class _BrokenConfigStore extends ConfigStore {
var resetCalls = 0;
@@ -228,9 +253,7 @@ void main() {
await app.bootstrap();
- // A signed-out DESKTOP window lands on the desk as a guest: everything on this
- // computer is served by the daemon over the loopback, and the sign-in is a sheet
- // raised when the person reaches for another machine.
+ // Local state prepares behind the required desktop sign-in page.
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
expect(app.config.apiBaseUrl, ConfigStore.defaultBaseUrl);
@@ -258,9 +281,7 @@ void main() {
expect(provisioner.called, isTrue);
expect(app.environmentReadiness.isReady, isTrue);
// Reached the login check rather than getting stuck on preparingEnvironment.
- // A signed-out DESKTOP window lands on the desk as a guest: everything on this
- // computer is served by the daemon over the loopback, and the sign-in is a sheet
- // raised when the person reaches for another machine.
+ // Local state prepares behind the required desktop sign-in page.
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
},
@@ -520,9 +541,7 @@ void main() {
// what lets the provisioner skip the already-`ready` harness step during the recheck.
expect(provisioner.resumeFromCalls.last, same(stuck));
expect(app.environmentReadiness.isReady, isTrue);
- // A signed-out DESKTOP window lands on the desk as a guest: everything on this
- // computer is served by the daemon over the loopback, and the sign-in is a sheet
- // raised when the person reaches for another machine.
+ // Local state prepares behind the required desktop sign-in page.
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
expect(storage.values['environment_setup_version'], isNull);
@@ -684,7 +703,7 @@ void main() {
// The card leads with what the app does for you, not with its own name —
// the wordmark left when the screen stopped being a logo over a button.
- expect(find.text('Your agents, wherever they run'), findsOneWidget);
+ expect(find.byKey(const Key('sign-in-step-title')), findsOneWidget);
expect(find.text('Continue with Google'), findsOneWidget);
expect(find.text('Continue with Apple'), findsOneWidget);
});
@@ -762,13 +781,13 @@ void main() {
await bootstrap;
await tester.pump();
- // A signed-out DESKTOP window lands on the desk as a guest: everything on this
- // computer is served by the daemon over the loopback, and the sign-in is a sheet
- // raised when the person reaches for another machine.
+ // Local state prepares behind the required desktop sign-in page.
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
- // …and the desk is what is on screen, not the sign-in.
- expect(find.text('Continue with Google'), findsNothing);
+ // The local state is ready behind the mandatory sign-in page.
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.byType(SwarmScreen), findsNothing);
app.dispose();
},
);
@@ -878,13 +897,12 @@ void main() {
await tester.tap(find.text('Install 1 tool'));
await tester.pump();
expect(provisioner.installCalls, [true]);
- // A signed-out DESKTOP window lands on the desk as a guest: everything on this
- // computer is served by the daemon over the loopback, and the sign-in is a sheet
- // raised when the person reaches for another machine.
+ // Local state prepares behind the required desktop sign-in page.
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
- // …on the desk, not in front of it.
- expect(find.text('Continue with Google'), findsNothing);
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.byType(SwarmScreen), findsNothing);
await tester.pumpWidget(const SizedBox());
app.dispose();
},
@@ -1680,10 +1698,10 @@ void main() {
// 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. Not signed in, it hands over to the sign-in step
- // (2026-10-11), and Skip there opens Harness.
+ // (2026-10-12), which requires an account before opening Harness.
testWidgets(
- 'a fresh install runs under the tour, then offers a sign-in, and Skip '
- 'opens Harness',
+ 'a fresh install runs under the tour, then requires sign-in before '
+ 'opening Harness',
(tester) async {
final missing = EnvironmentReadiness(
steps: {
@@ -1702,11 +1720,12 @@ void main() {
mode: EnvironmentSetupMode.automatic,
);
final gate = Completer<void>();
+ final login = _OnboardingCliLogin();
final app = _GuestApp(
config: AppConfig.dev,
authSession: AuthSession(),
configStore: ConfigStore(storage: _FakeKeyValueStore()),
- cliLogin: _FakeCliLogin(loggedIn: false),
+ cliLogin: login,
environmentProvisioner: _GatedInstallProvisioner(missing, ready, gate),
);
// What the agent downloads report while they run.
@@ -1765,11 +1784,24 @@ void main() {
await tester.pump(const Duration(minutes: 5));
expect(find.byType(SignInStep), findsOneWidget);
- await tester.tap(find.byKey(const Key('sign-in-step-skip')));
+ expect(find.text('Skip'), findsNothing);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await chord(tester, LogicalKeyboardKey.keyN);
+ await tester.pump();
+ expect(find.text('Workspace reached'), findsNothing);
+
+ app.api = _OnboardingApi();
+ await tester.tap(find.byKey(const Key('login-continue-google')));
+ await tester.pump();
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Workspace reached'), findsNothing);
+ login.completed.complete();
+ await tester.pump();
+ await tester.pump();
await tester.pump();
expect(find.byType(SignInStep), findsNothing);
expect(find.text('Workspace reached'), findsOneWidget);
- expect(app.isGuest, isTrue);
+ expect(app.signedIn, isTrue);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/desktop_workspace_tab_test.dart b/desktop/test/desktop_workspace_tab_test.dart
index 76312379f..b77b75eef 100644
--- a/desktop/test/desktop_workspace_tab_test.dart
+++ b/desktop/test/desktop_workspace_tab_test.dart
@@ -1,6 +1,7 @@
import 'dart:io';
import 'dart:ui' as ui;
+import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
@@ -35,6 +36,8 @@ Widget _host({
VoidCallback? onClose,
VoidCallback? onRename,
bool enabled = true,
+ ValueListenable<bool> showShortcuts = const AlwaysStoppedAnimation(false),
+ Map<String, String?> shortcuts = const {},
}) => RepaintBoundary(
key: boundary,
child: MaterialApp(
@@ -63,7 +66,7 @@ Widget _host({
scrollDirection: Axis.horizontal,
child: Row(
children: [
- for (final tab in tabs)
+ for (final (index, tab) in tabs.indexed)
Builder(
builder: (context) => SizedBox(
width:
@@ -76,6 +79,12 @@ Widget _host({
id: tab.name,
label: tab.name,
selected: tab.name == 'Desktop',
+ showShortcuts: showShortcuts,
+ shortcutHint: shortcuts.containsKey(tab.name)
+ ? shortcuts[tab.name]
+ : index < 9
+ ? '⌘${index + 1}'
+ : null,
onSelect: enabled
? (onSelect ?? () {})
: null,
@@ -187,8 +196,15 @@ void main() {
addTearDown(tester.view.reset);
grid.AppTheme.brightness.value = brightness;
final boundary = GlobalKey();
+ final showShortcuts = ValueNotifier(false);
+ addTearDown(showShortcuts.dispose);
await tester.pumpWidget(
- _host(brightness: brightness, scale: scale, boundary: boundary),
+ _host(
+ brightness: brightness,
+ scale: scale,
+ boundary: boundary,
+ showShortcuts: showShortcuts,
+ ),
);
expect(tester.takeException(), isNull);
if (scale == 1) {
@@ -217,6 +233,25 @@ void main() {
await mouse.addPointer(location: const Offset(1260, 90));
await tester.pump();
await _capture(tester, boundary, 'tabs-${brightness.name}-$scale-rest');
+ showShortcuts.value = true;
+ await tester.pump();
+ for (var number = 1; number <= _eightTabs.length; number++) {
+ expect(find.text('⌘$number'), findsOneWidget);
+ }
+ expect(mark, findsNothing, reason: 'Command replaces the status');
+ expect(tester.getRect(_tab('Desktop')), tabBounds);
+ expect(_close('Desktop').hitTestable(), findsNothing);
+ expect(tester.takeException(), isNull);
+ await _capture(
+ tester,
+ boundary,
+ 'tabs-${brightness.name}-$scale-command',
+ );
+ showShortcuts.value = false;
+ await tester.pump();
+ expect(find.text('⌘2'), findsNothing);
+ expect(mark, findsOneWidget);
+ expect(tester.getRect(_label('Desktop')), title);
await mouse.moveTo(title.center);
await tester.pumpAndSettle();
expect(_close('Desktop').hitTestable(), findsOneWidget);
@@ -336,7 +371,7 @@ void main() {
tester.getSemantics(status).getSemanticsData().flagsCollection.isButton,
isTrue,
);
- expect(find.text('⌘1'), findsNothing, reason: 'tabs show no shortcut');
+ expect(find.text('⌘1'), findsNothing, reason: 'Command is not held');
Focus.of(tester.element(_label('Desktop'))).requestFocus();
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
@@ -362,8 +397,13 @@ void main() {
testWidgets('a disabled tab reveals nothing', (tester) async {
await tester.pumpWidget(
- _host(tabs: const [(name: 'Notes', working: true)], enabled: false),
+ _host(
+ tabs: const [(name: 'Notes', working: true)],
+ enabled: false,
+ showShortcuts: const AlwaysStoppedAnimation(true),
+ ),
);
+ expect(find.text('⌘1'), findsNothing);
expect(find.byKey(const ValueKey('status:Notes')), findsOneWidget);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: tester.getCenter(_label('Notes')));
@@ -371,4 +411,24 @@ void main() {
expect(_close('Notes').hitTestable(), findsNothing);
await mouse.removePointer();
});
+
+ testWidgets('held hints follow remapped and unbound shortcuts', (
+ tester,
+ ) async {
+ await tester.pumpWidget(
+ _host(
+ tabs: const [
+ (name: 'Desktop', working: true),
+ (name: 'Notes', working: true),
+ ],
+ showShortcuts: const AlwaysStoppedAnimation(true),
+ shortcuts: const {'Desktop': '⌃⌥⌘R', 'Notes': null},
+ ),
+ );
+ expect(find.text('⌃⌥⌘R'), findsOneWidget);
+ expect(find.text('⌘1'), findsNothing);
+ expect(find.text('⌘2'), findsNothing);
+ expect(find.byKey(const ValueKey('status:Desktop')), findsNothing);
+ expect(find.byKey(const ValueKey('status:Notes')), findsOneWidget);
+ });
}
diff --git a/desktop/test/login_screen_phone_test.dart b/desktop/test/login_screen_phone_test.dart
index 9bdbb65ca..d602cc91e 100644
--- a/desktop/test/login_screen_phone_test.dart
+++ b/desktop/test/login_screen_phone_test.dart
@@ -7,50 +7,10 @@ import 'package:flutter_test/flutter_test.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_client.dart';
-import 'package:harness/auth/sign_in_provider.dart';
import 'package:harness/core/config.dart';
import 'package:harness/screens/login_screen.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
-import 'package:harness/widgets/or_divider.dart';
-
-/// The login screen's second way in: a QR a signed-in phone approves, then a yes here to the
-/// account that approved it.
-
-/// Shows a QR, then asks the account question, and records the answer — no process started.
-class _PhoneLogin extends CliLogin {
- final answers = <bool>[];
- final Completer<void> finished = Completer<void>();
-
- @override
- Future<void> loginWithPhone({
- required void Function(String link, int expiresIn) onQr,
- required Future<bool> Function(String email) onConfirm,
- }) async {
- onQr('https://harness.autonomous.ai/signin#k=hnq_${'a' * 43}', 120);
- await Future<void>.delayed(const Duration(milliseconds: 10));
- answers.add(await onConfirm('[email protected]'));
- await finished.future;
- if (!answers.last) throw StateError('Not signed in as [email protected].');
- }
-}
-
-/// A sign-in that waits behind another one — what the CLI's `waiting` event sets — until released.
-class _WaitingLogin extends CliLogin {
- static const note = 'Another sign-in on this computer is still running — waiting for it to finish…';
- final release = Completer<void>();
-
- @override
- Future<void> loginWithPhone({
- required void Function(String link, int expiresIn) onQr,
- required Future<bool> Function(String email) onConfirm,
- }) async {
- waitingNote.value = note;
- await release.future;
- throw StateError('Sign-in was cancelled.');
- }
-}
/// A phone sign-in that never hears back from the phone, and counts how often it is told to stop.
class _HangingLogin extends CliLogin {
@@ -83,160 +43,77 @@ Widget _host(AppNotifier app) => MaterialApp(
home: MediaQuery(
data: const MediaQueryData(size: Size(880, 700)),
child: grid.BrightnessScope(
- child: ListenableBuilder(listenable: app, builder: (_, _) => LoginScreen(notifier: app)),
+ child: ListenableBuilder(
+ listenable: app,
+ builder: (_, _) => LoginScreen(notifier: app),
+ ),
),
),
);
-/// [_host] says the window is 700 tall while the test surface is 600, so the last way in can sit
-/// under the fold: bring it up before pressing it.
-Future<void> _tapScanWithPhone(WidgetTester tester) async {
- final scan = find.byKey(const Key('login-scan-with-phone'));
- await tester.ensureVisible(scan);
- await tester.tap(scan);
-}
-
void main() {
- testWidgets('offers "Scan with your phone", shows the QR, then asks whose account', (tester) async {
- grid.AppTheme.brightness.value = Brightness.light;
- final login = _PhoneLogin();
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: login)
- ..status = AppStatus.unauthenticated;
- addTearDown(app.dispose);
- await tester.pumpWidget(_host(app));
- expect(find.byKey(const Key('login-scan-with-phone')), findsOneWidget);
- // A way in of its own, set apart from the two accounts above it.
- expect(find.byType(OrDivider), findsOneWidget);
-
- await _tapScanWithPhone(tester);
- await tester.pump();
- expect(find.byKey(const Key('login-phone-qr')), findsOneWidget);
- expect(find.textContaining('Sign in a computer'), findsOneWidget);
-
- await tester.pump(const Duration(milliseconds: 20));
- expect(find.text('Sign in as [email protected]?'), findsOneWidget);
- await tester.tap(find.byKey(const Key('login-phone-refuse')));
- await tester.pump();
- expect(login.answers, [false]);
- login.finished.complete();
- await tester.pump();
- expect(app.signingIn, isFalse);
- expect(find.byKey(const Key('login-scan-with-phone')), findsOneWidget);
- });
-
- testWidgets('over the desk (a guest signing in), the QR still appears and the question too', (tester) async {
- // The sheet is its own route, built once: it has to follow the notifier itself, or a QR that
- // arrives after the click is never drawn (2026-10-01, a guest's "Scan with your phone").
- grid.AppTheme.brightness.value = Brightness.light;
- final login = _PhoneLogin();
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: login)
- ..status = AppStatus.authenticated
- ..signedIn = false;
- addTearDown(app.dispose);
- await tester.pumpWidget(MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.light),
- home: MediaQuery(
- data: const MediaQueryData(size: Size(880, 700)),
- child: grid.BrightnessScope(
- child: Builder(
- builder: (context) => Center(
- child: TextButton(
- key: const Key('open-sheet'),
- onPressed: () => unawaited(showSignInSheet(context, app)),
- child: const Text('Sign in'),
- ),
- ),
- ),
- ),
- ),
- ));
- await tester.tap(find.byKey(const Key('open-sheet')));
- await tester.pump();
- await tester.tap(find.byKey(const Key('login-scan-with-phone')));
- await tester.pump();
- expect(find.byKey(const Key('login-phone-qr')), findsOneWidget);
-
- await tester.pump(const Duration(milliseconds: 20));
- expect(find.text('Sign in as [email protected]?'), findsOneWidget);
- await tester.tap(find.byKey(const Key('login-phone-refuse')));
- await tester.pump();
- expect(login.answers, [false]);
- login.finished.complete();
- await tester.pump();
- });
-
- testWidgets('a sign-in waiting behind another one says so, rather than showing nothing', (tester) async {
- grid.AppTheme.brightness.value = Brightness.light;
- final login = _WaitingLogin();
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: login)
- ..status = AppStatus.unauthenticated;
- addTearDown(app.dispose);
- await tester.pumpWidget(_host(app));
- await _tapScanWithPhone(tester);
- await tester.pump();
- expect(find.text(_WaitingLogin.note), findsOneWidget);
- // Its turn comes: the note goes with the wait.
- login.waitingNote.value = null;
- await tester.pump();
- expect(find.text(_WaitingLogin.note), findsNothing);
- login.release.complete();
- await tester.pump();
- });
-
- testWidgets('quitting the app stops a phone sign-in still waiting on the phone', (tester) async {
- // Its CLI would otherwise wait on after the app has gone — minutes, holding the lock the next
- // sign-in needs, with its QR still good for anyone who scans it.
- final login = _HangingLogin();
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: login)
- ..status = AppStatus.unauthenticated;
- unawaited(app.loginWithPhone());
- await tester.pumpWidget(_wholeApp(app));
- await tester.pump();
- expect(app.signingIn, isTrue);
- expect(app.pendingQrLink, isNotNull);
-
- final observer = tester.state(find.byType(RootShell)) as WidgetsBindingObserver;
- expect(await observer.didRequestAppExit(), AppExitResponse.exit);
- expect(login.cancels, 1);
- expect(app.signingIn, isFalse);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
-
- testWidgets('quitting with no sign-in in flight stops nothing', (tester) async {
+ testWidgets(
+ 'quitting the app stops a phone sign-in still waiting on the phone',
+ (tester) async {
+ // Its CLI would otherwise wait on after the app has gone — minutes, holding the lock the next
+ // sign-in needs, with its QR still good for anyone who scans it.
+ final login = _HangingLogin();
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ cliLogin: login,
+ )..status = AppStatus.unauthenticated;
+ unawaited(app.loginWithPhone());
+ await tester.pumpWidget(_wholeApp(app));
+ await tester.pump();
+ expect(app.signingIn, isTrue);
+ expect(app.pendingQrLink, isNotNull);
+
+ final observer =
+ tester.state(find.byType(RootShell)) as WidgetsBindingObserver;
+ expect(await observer.didRequestAppExit(), AppExitResponse.exit);
+ expect(login.cancels, 1);
+ expect(app.signingIn, isFalse);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
+
+ testWidgets('quitting with no sign-in in flight stops nothing', (
+ tester,
+ ) async {
// A signed-out app on its login screen quits as before: there is no CLI to stop.
final login = _HangingLogin();
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: login)
- ..status = AppStatus.unauthenticated;
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ cliLogin: login,
+ )..status = AppStatus.unauthenticated;
await tester.pumpWidget(_wholeApp(app));
await tester.pump();
- final observer = tester.state(find.byType(RootShell)) as WidgetsBindingObserver;
+ final observer =
+ tester.state(find.byType(RootShell)) as WidgetsBindingObserver;
expect(await observer.didRequestAppExit(), AppExitResponse.exit);
expect(login.cancels, 0);
await tester.pumpWidget(const SizedBox());
app.dispose();
});
- testWidgets('a build that cannot sign in by phone does not offer it', (tester) async {
- grid.AppTheme.brightness.value = Brightness.light;
- final app = AppNotifier(config: AppConfig.dev, authSession: AuthSession(), configStore: null, cliLogin: _SsoOnly())
- ..status = AppStatus.unauthenticated;
- addTearDown(app.dispose);
- await tester.pumpWidget(_host(app));
- expect(find.byKey(const Key('login-scan-with-phone')), findsNothing);
- });
-}
-
-class _SsoOnly implements SignInClient {
- @override
- Future<CliAuthStatus> checkStatus() async => const CliAuthStatus(loggedIn: false);
- @override
- Future<void> login({
- required void Function(String url) onAuthorizeUrl,
- SignInProvider? provider,
- }) async {}
- @override
- void cancel() {}
- @override
- Future<void> logout() async {}
+ testWidgets(
+ 'Desktop uses onboarding choices instead of the old phone dialog',
+ (tester) async {
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ )..status = AppStatus.unauthenticated;
+ addTearDown(app.dispose);
+ await tester.pumpWidget(_host(app));
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.text('Continue with email'), findsOneWidget);
+ expect(find.byKey(const Key('login-scan-with-phone')), findsNothing);
+ },
+ );
}
diff --git a/desktop/test/login_screen_test.dart b/desktop/test/login_screen_test.dart
index 8e2aec24c..b915f5c98 100644
--- a/desktop/test/login_screen_test.dart
+++ b/desktop/test/login_screen_test.dart
@@ -11,6 +11,8 @@ import 'package:harness/screens/login_screen.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
import 'package:harness/widgets/login_fleet_map.dart';
+import 'package:harness/widgets/sign_in_step.dart';
+import 'package:flutter/services.dart';
/// Wraps the screen in the same chrome `main.dart` gives it, at the app's
/// minimum window size — 880×560 — because that is where a card gets cramped
@@ -81,11 +83,13 @@ class _WaitingCliLogin extends CliLogin {
AppNotifier _notifier(AppStatus status, {CliLogin? cliLogin}) {
grid.AppTheme.brightness.value = Brightness.light;
return AppNotifier(
- config: AppConfig.dev,
- authSession: AuthSession(),
- configStore: null,
- cliLogin: cliLogin,
- )..status = status;
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ cliLogin: cliLogin,
+ )
+ ..status = status
+ ..signedIn = status == AppStatus.authenticated;
}
/// WCAG 2.x relative luminance and contrast — the same arithmetic as
@@ -104,179 +108,94 @@ double _contrast(Color a, Color b) {
}
void main() {
- testWidgets('idle offers the action and says what it costs', (tester) async {
- final app = _notifier(AppStatus.unauthenticated);
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- expect(find.text('Your agents, wherever they run'), findsOneWidget);
- // Two ways in, named — not one Sign in that left the choice to the browser.
- expect(find.text('Continue with Google'), findsOneWidget);
- expect(find.text('Continue with Apple'), findsOneWidget);
- expect(find.text('Sign in'), findsNothing);
- // One size, both of them.
- expect(
- tester.getSize(find.byKey(const Key('login-continue-google'))),
- tester.getSize(find.byKey(const Key('login-continue-apple'))),
- );
- expect(find.byType(LoginFleetMap), findsOneWidget);
- // The real mark, from the bundle — `AppIcons.cpu` used to stand here and
- // appeared nowhere else in the app.
- final logo = tester.widget<Image>(
- find.byWidgetPredicate(
- (widget) =>
- widget is Image &&
- widget.image is AssetImage &&
- (widget.image as AssetImage).assetName == 'assets/app_icon.png',
- ),
- );
- expect((logo.image as AssetImage).assetName, 'assets/app_icon.png');
- // The promise the screen exists to make, in words with no jargon in them.
- expect(
- find.textContaining(
- 'every machine you sign in to becomes part of one desk',
- ),
- findsOneWidget,
- );
- expect(find.textContaining('Sign in through your browser'), findsOneWidget);
- expect(find.textContaining('End-to-end encrypted'), findsOneWidget);
- });
-
- testWidgets('the browser wait is a state of the button, not a new screen', (
- tester,
- ) async {
- // `signingIn` is what `main.dart` routes on — see the note there.
- final app = _notifier(AppStatus.bootstrapping)
- ..signingIn = true
- ..pendingAuthorizeUrl = 'https://auth.example/authorize';
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- // Still the same card — the workspace example never leaves, so the frame can't jump.
- expect(find.byType(LoginFleetMap), findsOneWidget);
- expect(find.text('Waiting for your browser'), findsOneWidget);
- expect(find.text('Cancel'), findsOneWidget);
- // The idle label is gone, so the two states cannot both be on screen.
- expect(find.text('Continue with Google'), findsNothing);
-
- final button = tester.widget<FilledButton>(find.byType(FilledButton));
- expect(button.onPressed, isNull, reason: 'in-flight, so not pressable');
- });
+ testWidgets(
+ 'every native login uses the onboarding page without the old card',
+ (tester) async {
+ final app = _notifier(AppStatus.unauthenticated);
+ addTearDown(app.dispose);
+ await tester.pumpWidget(_host(app));
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text(signInStepTitle), findsOneWidget);
+ for (final label in [
+ 'Continue with Google',
+ 'Continue with Apple',
+ 'Continue with email',
+ ]) {
+ expect(find.text(label), findsOneWidget);
+ }
+ expect(find.byType(LoginFleetMap), findsNothing);
+ expect(find.text('Scan with your phone'), findsNothing);
+ expect(find.byKey(const Key('login-close-button')), findsNothing);
+ },
+ );
testWidgets(
- 'each button signs in with its own account, and says so while it waits',
+ 'provider choices stay in place through browser wait and cancellation',
(tester) async {
+ final cli = _WaitingCliLogin();
+ final app = _notifier(AppStatus.unauthenticated, cliLogin: cli);
+ addTearDown(app.dispose);
+ await tester.pumpWidget(_host(app));
for (final provider in SignInProvider.values) {
- final cli = _WaitingCliLogin();
- final app = _notifier(AppStatus.unauthenticated, cliLogin: cli);
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
await tester.tap(find.text('Continue with ${provider.label}'));
- await tester.pump(const Duration(milliseconds: 100));
- expect(cli.providers, [provider]);
-
- // The pressed button is the one working; the other stays where it was,
- // and neither can start a second sign-in.
- final pressed = find.byKey(Key('login-continue-${provider.name}'));
- expect(
- find.descendant(of: pressed, matching: find.text('Signing in…')),
- findsOneWidget,
- );
- final other = SignInProvider.values.firstWhere((p) => p != provider);
- expect(find.text('Continue with ${other.label}'), findsOneWidget);
- for (final button in tester.widgetList<FilledButton>(
- find.byType(FilledButton),
- )) {
- expect(button.onPressed, isNull);
- }
-
- app.cancelLogin();
- await tester.pump(const Duration(milliseconds: 100));
- expect(find.text('Continue with ${provider.label}'), findsOneWidget);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
+ await tester.pump();
+ expect(cli.providers.last, provider);
+ app.pendingAuthorizeUrl = 'https://auth.example/authorize';
+ app.notifyListeners();
+ await tester.pump();
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.text('Continue with Apple'), findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(app.signingIn, isFalse);
+ expect(find.byType(SignInStep), findsOneWidget);
}
},
);
- testWidgets('Try again goes back to the account that failed', (tester) async {
+ testWidgets('a fast failure stays on the shared page and can be retried', (
+ tester,
+ ) async {
final cli = _FailingCliLogin();
final app = _notifier(AppStatus.unauthenticated, cliLogin: cli);
- await app.login(SignInProvider.apple);
+ addTearDown(app.dispose);
await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- await tester.ensureVisible(find.text('Try again'));
- await tester.tap(find.text('Try again'));
- await tester.pump(const Duration(milliseconds: 100));
+ await tester.tap(find.text('Continue with Apple'));
+ await tester.pump();
+ expect(find.byKey(const Key('sign-in-step-error')), findsOneWidget);
+ await tester.tap(find.text('Continue with Apple'));
+ await tester.pump();
expect(cli.providers, [SignInProvider.apple, SignInProvider.apple]);
});
- testWidgets('a failure names itself and offers a way on', (tester) async {
- final app = _notifier(
- AppStatus.unauthenticated,
- cliLogin: _FailingCliLogin(),
- );
- // Drive the notifier's real failure path rather than setting the field, so
- // the test breaks if that path ever stops recording the error.
- await app.login();
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- expect(app.lastError, isNotNull, reason: 'the fake CLI always fails');
- expect(find.text('Could not sign in'), findsOneWidget);
- expect(find.text('Try again'), findsOneWidget);
- });
-
- testWidgets('the login illustration stays visible without idle frames', (
- tester,
- ) async {
- final app = _notifier(AppStatus.unauthenticated);
- await tester.pumpWidget(_host(app));
- await tester.pumpAndSettle();
- expect(find.text('Continue with Google'), findsOneWidget);
- expect(find.byType(LoginFleetMap), findsOneWidget);
- expect(tester.binding.hasScheduledFrame, isFalse);
- await tester.pump(const Duration(milliseconds: 3200));
- expect(tester.binding.hasScheduledFrame, isFalse);
- });
-
- testWidgets('Reduce Motion still shows the picture, not a blank', (
- tester,
- ) async {
- final app = _notifier(AppStatus.unauthenticated);
- await tester.pumpWidget(_host(app, reduceMotion: true));
- // The background animation is parked with reduced motion; the workspace
- // example is static in both modes.
- await tester.pumpAndSettle();
-
- // The example stays visible without depending on animation.
- expect(find.byType(LoginFleetMap), findsOneWidget);
- expect(find.text('Continue with Google'), findsOneWidget);
- });
-
- testWidgets('holds at the 880x560 minimum window without overflowing', (
- tester,
- ) async {
- tester.view.physicalSize = const Size(880, 560);
- tester.view.devicePixelRatio = 1;
- addTearDown(tester.view.reset);
-
- final app = _notifier(AppStatus.unauthenticated);
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- expect(tester.takeException(), isNull);
- expect(find.text('Continue with Google'), findsOneWidget);
- expect(find.text('Continue with Google').hitTestable(), findsOneWidget);
- expect(
- tester
- .getRect(find.widgetWithText(FilledButton, 'Continue with Apple'))
- .bottom,
- lessThan(tester.view.physicalSize.height),
- );
- });
+ testWidgets(
+ 'the shared page fits the minimum window in both palettes without idle frames',
+ (tester) async {
+ tester.view.physicalSize = const Size(880, 560);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
+ for (final brightness in Brightness.values) {
+ final app = _notifier(AppStatus.unauthenticated);
+ grid.AppTheme.brightness.value = brightness;
+ await tester.pumpWidget(
+ _host(app, brightness: brightness, reduceMotion: true),
+ );
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ expect(find.text('Continue with Google').hitTestable(), findsOneWidget);
+ expect(find.text('Continue with email').hitTestable(), findsOneWidget);
+ final page = tester.widget<Material>(
+ find.byKey(const Key('sign-in-step')),
+ );
+ expect(page.color, grid.AppPalette.windowBg);
+ expect(tester.binding.hasScheduledFrame, isFalse);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ }
+ grid.AppTheme.brightness.value = Brightness.light;
+ },
+ );
test('the diagram\'s caption clears the body-text contrast floor', () {
// Measured with tool/contrast.py, pinned here so a later "let\'s soften
@@ -314,40 +233,6 @@ void main() {
grid.AppTheme.brightness.value = Brightness.light;
});
- testWidgets('the card survives the whole sign-in, URL or no URL', (
- tester,
- ) async {
- // The regression this guards: `RootShell` and this screen both used to key
- // the wait off `pendingAuthorizeUrl`, which only exists for the MIDDLE of
- // the flow. The CLI has to start before it can print a URL, and the URL is
- // cleared again while the post-login restore runs — so the user's own
- // screen was replaced by a bare full-screen spinner twice per sign-in.
- final app = _notifier(AppStatus.bootstrapping)..signingIn = true;
- await tester.pumpWidget(_host(app));
- await tester.pump(const Duration(milliseconds: 100));
-
- // Just pressed: in flight, no URL yet.
- expect(app.pendingAuthorizeUrl, isNull);
- expect(find.text('Signing in…'), findsOneWidget);
- expect(find.byType(LoginFleetMap), findsOneWidget);
-
- // The CLI hands one over; nothing about the screen should change.
- app.pendingAuthorizeUrl = 'https://auth.example/authorize';
- app.notifyListeners();
- await tester.pump(const Duration(milliseconds: 100));
- expect(find.text('Waiting for your browser'), findsOneWidget);
- expect(find.byType(LoginFleetMap), findsOneWidget);
-
- // Signed in: the URL goes while the restore is still running. The card has
- // to hold until the shell is actually ready.
- app.pendingAuthorizeUrl = null;
- app.notifyListeners();
- await tester.pump(const Duration(milliseconds: 100));
- expect(find.text('Signing in…'), findsOneWidget);
- expect(find.text('Copy link'), findsNothing);
- expect(find.byType(LoginFleetMap), findsOneWidget);
- });
-
test('every frame of the diagram carries a sealed packet', () {
// The seal — plaintext dot becoming a glowing block — is the one beat this
// drawing exists to make, so it must be on screen whenever someone looks.
@@ -385,20 +270,4 @@ void main() {
reason: 'too few frames show plaintext and ciphertext side by side',
);
});
-
- testWidgets('dark is drawn deliberately, not inherited', (tester) async {
- final app = _notifier(AppStatus.unauthenticated);
- // After the notifier, which resets the global to light for the other tests.
- grid.AppTheme.brightness.value = Brightness.dark;
- addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);
- await tester.pumpWidget(_host(app, brightness: Brightness.dark));
- await tester.pump(const Duration(milliseconds: 100));
-
- final scaffold = tester.widget<Scaffold>(find.byType(Scaffold));
- // Law 5: the screen wears the dark panel, not a frozen light constant.
- // `panelBg`, not `windowBg` — in light the two ends of that pair are pure
- // white and the card would have nothing to sit on.
- expect(scaffold.backgroundColor, const Color(0xFF141414));
- expect(find.text('Continue with Google'), findsOneWidget);
- });
}
diff --git a/desktop/test/machines_panel_test.dart b/desktop/test/machines_panel_test.dart
index 3c3d33de3..a48c80fee 100644
--- a/desktop/test/machines_panel_test.dart
+++ b/desktop/test/machines_panel_test.dart
@@ -23,6 +23,7 @@ import 'package:harness/shortcuts/app_keymap.dart';
import 'package:harness/shortcuts/keymap_host.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/widgets/machines_panel.dart';
+import 'package:harness/widgets/sign_in_step.dart';
import 'keymap_host_test.dart' show MemoryKeymap, key;
import 'support/password_cli.dart';
@@ -859,16 +860,18 @@ void main() {
);
testWidgets(
- 'guest sign-in can be cancelled and successful sign-in returns to machines',
+ 'required sign-in stays open until an account arrives, then returns to machines',
(tester) async {
app.signedIn = false;
await mount(tester);
await tap(tester, find.text('Sign in'));
expect(find.byKey(const ValueKey('machines-panel')), findsNothing);
- await tap(tester, find.byTooltip('Close'));
- expect(find.text('Sign in'), findsOneWidget);
+ expect(find.byType(SignInStep), findsOneWidget);
+ expect(find.byTooltip('Close'), findsNothing);
+ await key(tester, LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(find.byType(SignInStep), findsOneWidget);
expect(app.refreshes, 0);
- await tap(tester, find.text('Sign in'));
app.signedIn = true;
app.notifyListeners();
await tester.pumpAndSettle();
diff --git a/desktop/test/setup_tour_test.dart b/desktop/test/setup_tour_test.dart
index 3a395afd7..124a13a16 100644
--- a/desktop/test/setup_tour_test.dart
+++ b/desktop/test/setup_tour_test.dart
@@ -11,8 +11,6 @@ import 'package:harness/widgets/setup_tour.dart';
const _macTitles = [
'All your machines,\none window.',
'All your agents,\nside by side.',
- '⌘P finds\nany harness.',
- '⌘N starts\na new harness.',
'Sessions that\nkeep going.',
'Your agents\nin your pocket.',
'The Harness\ndevice.',
@@ -21,8 +19,6 @@ const _macTitles = [
const _kickers = [
'WELCOME TO HARNESS',
'EVERY AGENT',
- 'KEYBOARD FIRST',
- 'KEYBOARD FIRST',
'ALWAYS THERE',
'ON THE GO',
'ON YOUR DESK',
@@ -85,11 +81,11 @@ Future<void> _nextSlide(WidgetTester tester) async {
}
void main() {
- testWidgets('seven slides in the approved order, each with the tagline', (
+ testWidgets('five slides in the approved order, each with the tagline', (
tester,
) async {
await _mount(tester);
- for (var i = 0; i < 7; i++) {
+ for (var i = 0; i < _macTitles.length; i++) {
expect(_shownTitle(tester), _macTitles[i], reason: 'slide ${i + 1}');
expect(find.text(_kickers[i]).last, findsWidgets);
expect(find.text(tourTagline), findsOneWidget);
@@ -107,7 +103,9 @@ void main() {
);
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
- testWidgets('Linux names its own chords and its computer', (tester) async {
+ testWidgets('Linux names its computer in setup and the artwork', (
+ tester,
+ ) async {
final progress = ValueNotifier(SetupProgress.starting);
addTearDown(progress.dispose);
await _mount(tester, progress: progress);
@@ -115,17 +113,12 @@ void main() {
tester.widget<Text>(_line).data,
'Setting up Harness on this computer',
);
- await tester.tap(find.byKey(const ValueKey('tour-dot-2')));
- await tester.pump(const Duration(milliseconds: 400));
- expect(_shownTitle(tester), 'Alt+Shift+P finds\nany harness.');
- await tester.tap(_next);
- await tester.pump(const Duration(milliseconds: 400));
- expect(_shownTitle(tester), 'Alt+N starts\na new harness.');
+ expect(find.text('this computer'), findsOneWidget);
}, variant: TargetPlatformVariant.only(TargetPlatform.linux));
testWidgets('advances every 6 s and loops', (tester) async {
await _mount(tester);
- for (var i = 1; i < 7; i++) {
+ for (var i = 1; i < _macTitles.length; i++) {
await _nextSlide(tester);
expect(_shownTitle(tester), _macTitles[i]);
}
@@ -144,17 +137,17 @@ void main() {
await tester.pump(const Duration(seconds: 5));
expect(_shownTitle(tester), _macTitles[1]);
- await tester.tap(find.byKey(const ValueKey('tour-dot-5')));
+ await tester.tap(find.byKey(const ValueKey('tour-dot-3')));
await tester.pump(const Duration(milliseconds: 400));
- expect(_shownTitle(tester), _macTitles[5]);
+ expect(_shownTitle(tester), _macTitles[3]);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
await tester.pump(const Duration(milliseconds: 400));
- expect(_shownTitle(tester), _macTitles[6]);
+ expect(_shownTitle(tester), _macTitles[4]);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
await tester.pump(const Duration(milliseconds: 400));
- expect(_shownTitle(tester), _macTitles[4]);
+ expect(_shownTitle(tester), _macTitles[2]);
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
testWidgets('one install line with the time left; ▸ unfolds the details', (
@@ -372,7 +365,7 @@ void main() {
);
tester.view.physicalSize = const Size(880, 560);
await tester.pump();
- for (var i = 0; i < 7; i++) {
+ for (var i = 0; i < _macTitles.length; i++) {
await tester.tap(_next);
await tester.pump(const Duration(milliseconds: 400));
expect(tester.takeException(), isNull);
diff --git a/desktop/test/sign_in_step_flow_test.dart b/desktop/test/sign_in_step_flow_test.dart
index 7af42331e..38490ee5e 100644
--- a/desktop/test/sign_in_step_flow_test.dart
+++ b/desktop/test/sign_in_step_flow_test.dart
@@ -12,15 +12,16 @@ 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;
+/// desktop without an account must sign in between setup and its 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});
+ _Login({this.loggedIn = false, this.offline = false});
/// What `harness auth status` says.
bool loggedIn;
+ final bool offline;
final started = <SignInProvider?>[];
var cancels = 0;
Completer<void>? pending;
@@ -28,10 +29,10 @@ class _Login extends CliLogin {
@override
Future<CliAuthStatus> checkStatus() async =>
- CliAuthStatus(loggedIn: loggedIn);
+ CliAuthStatus(loggedIn: loggedIn, offline: offline);
@override
- Future<void> logout() async {}
+ Future<void> logout() async => loggedIn = false;
@override
void cancel() => cancels++;
@@ -61,6 +62,9 @@ class _Api extends ApiClient {
@override
Future<Map<String, dynamic>?> desk() async => null;
+
+ @override
+ Future<Map<String, dynamic>?> daemonDevices() async => null;
}
final _missing = EnvironmentReadiness(
@@ -130,8 +134,7 @@ Future<void> _settle() async {
}
void main() {
- test('a computer new to Harness, not signed in, is asked after the tour and '
- 'Skip opens Harness', () async {
+ test('a computer new to Harness must sign in after the tour', () async {
final app = _Desktop(_Login());
addTearDown(app.dispose);
await app.bootstrap();
@@ -146,12 +149,9 @@ void main() {
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);
+ await _settle();
+ expect(app.signInStepShowing, isTrue);
+ expect(app.signInStepNext, isTrue);
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
expect(app.cli.started, isEmpty);
@@ -176,7 +176,7 @@ void main() {
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.
+ // Complete for this account; explicit sign-out requires it again.
expect(app.signInStepNext, isFalse);
});
@@ -208,11 +208,11 @@ void main() {
expect(app.cli.cancels, 2);
expect(app.signInStepShowing, isTrue);
- // Skip leaves, and takes the sign-in still waiting with it.
- app.skipSignInStep();
+ // Cancelling the browser flow keeps the required page in place.
+ app.cancelLogin();
expect(app.cli.cancels, 3);
expect(app.signingIn, isFalse);
- expect(app.signInStepShowing, isFalse);
+ expect(app.signInStepShowing, isTrue);
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
});
@@ -248,9 +248,7 @@ void main() {
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.
+ test('an existing signed-out installation must sign in too', () async {
final app = _Desktop(_Login(), installed: true);
addTearDown(app.dispose);
await app.bootstrap();
@@ -258,20 +256,104 @@ void main() {
expect(app.status, AppStatus.authenticated);
expect(app.isGuest, isTrue);
expect(app.setupTourShowing, isFalse);
- expect(app.signInStepNext, isFalse);
- expect(app.signInStepShowing, isFalse);
+ expect(app.signInStepNext, isTrue);
+ expect(app.signInStepShowing, isTrue);
});
- test('a CLI that is only being repaired is not a new computer', () async {
+ test('a repaired CLI skips the tour but still requires sign-in', () 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, isTrue);
+ });
+
+ test('relaunching after setup cannot bypass sign-in', () async {
+ final cli = _Login();
+ final first = _Desktop(cli);
+ await first.bootstrap();
+ first.finishSetupTour();
+ expect(first.signInStepShowing, isTrue);
+ first.dispose();
+
+ final reopened = _Desktop(cli, installed: true);
+ addTearDown(reopened.dispose);
+ await reopened.bootstrap();
+ expect(reopened.setupTourShowing, isFalse);
+ expect(reopened.signInStepShowing, isTrue);
+ });
+
+ test('first arrival waits for an account before starting agents', () async {
+ final app = _Desktop(_Login())..firstArrivalBehindTour = true;
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ await _settle();
+ expect(app.firstArrival.pending, isTrue);
+ expect(app.firstArrival.running, isFalse);
+ app.finishSetupTour();
+ await _settle();
+ expect(app.signInStepShowing, isTrue);
+ expect(app.firstArrival.pending, isTrue);
+ expect(app.firstArrival.running, isFalse);
+ });
+
+ test(
+ 'a cancelled sign-in cannot open the workspace with a late reply',
+ () async {
+ final app = _Desktop(_Login(), installed: true);
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ final signIn = app.signInFromStep(SignInProvider.google);
+ await _settle();
+ app.cancelLogin();
+ app.cli.pending!.complete();
+ await signIn;
+ expect(app.signedIn, isFalse);
+ expect(app.signInStepShowing, isTrue);
+ },
+ );
+
+ test('explicit sign-out requires sign-in again', () async {
+ final app = _Desktop(_Login(loggedIn: true), installed: true);
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ expect(app.signInStepShowing, isFalse);
+ await app.logout();
+ await _settle();
+ expect(app.signedIn, isFalse);
+ expect(app.signInStepShowing, isTrue);
+ });
+
+ test('a signed-in offline launch opens the workspace', () async {
+ final app = _Desktop(
+ _Login(loggedIn: true, offline: true),
+ installed: true,
+ );
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ expect(app.signedIn, isTrue);
+ expect(app.status, AppStatus.authenticated);
expect(app.signInStepShowing, isFalse);
+ expect(app.cli.started, isEmpty);
});
+ test(
+ 'runtime expiry requires sign-in again while restoring saved local work',
+ () async {
+ final app = _Desktop(_Login(loggedIn: true), installed: true);
+ addTearDown(app.dispose);
+ await app.bootstrap();
+ app.expireSessionForTest('Sign in again to reach your other machines.');
+ await _settle();
+ expect(app.signedIn, isFalse);
+ expect(app.sessionExpired, isTrue);
+ expect(app.status, AppStatus.authenticated);
+ expect(app.signInStepShowing, isTrue);
+ },
+ );
+
test('without a tour — setup that needed the person — the step follows '
'setup', () async {
final app = _Desktop(_Login());
diff --git a/desktop/test/sign_in_step_test.dart b/desktop/test/sign_in_step_test.dart
index bf93ee885..8c086c582 100644
--- a/desktop/test/sign_in_step_test.dart
+++ b/desktop/test/sign_in_step_test.dart
@@ -12,10 +12,9 @@ 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
+/// headline, four lines, two buttons, 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'));
@@ -24,7 +23,6 @@ final _boundary = GlobalKey();
Future<void> _mount(
WidgetTester tester, {
ValueChanged<SignInProvider?>? onSignIn,
- VoidCallback? onSkip,
bool starting = false,
SignInProvider? startingProvider,
bool finishing = false,
@@ -33,6 +31,9 @@ Future<void> _mount(
Brightness brightness = Brightness.dark,
double textScale = 1,
}) async {
+ final previousBrightness = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previousBrightness);
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = size;
addTearDown(tester.view.reset);
@@ -49,7 +50,6 @@ Future<void> _mount(
key: _boundary,
child: SignInStep(
onSignIn: onSignIn ?? (_) {},
- onSkip: onSkip ?? () {},
starting: starting,
startingProvider: startingProvider,
finishing: finishing,
@@ -73,7 +73,7 @@ void main() {
() => loadCaptureFonts(Platform.environment['HARNESS_SIGN_IN_CAPTURE_DIR']),
);
- testWidgets('one headline, four lines, two buttons, Skip and email', (
+ testWidgets('one headline, four lines, two buttons and email; no Skip', (
tester,
) async {
await _mount(tester);
@@ -88,11 +88,11 @@ void main() {
}
expect(find.text('Continue with Google'), findsOneWidget);
expect(find.text('Continue with Apple'), findsOneWidget);
- expect(find.text('Skip'), findsOneWidget);
+ expect(find.text('Skip'), findsNothing);
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);
+ expect(find.text('Sign in to continue.'), findsOneWidget);
// Nothing the sign-in sheet carries beside its buttons is on this page.
for (final absent in const [
'Scan with your phone',
@@ -111,8 +111,7 @@ void main() {
tester,
) async {
final pressed = <SignInProvider?>[];
- var skipped = 0;
- await _mount(tester, onSignIn: pressed.add, onSkip: () => skipped++);
+ await _mount(tester, onSignIn: pressed.add);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
@@ -128,37 +127,30 @@ void main() {
SignInProvider.google,
null,
]);
- expect(skipped, 0);
- await tester.tap(_skip);
- expect(skipped, 1);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(find.byType(SignInStep), findsOneWidget);
});
- 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('email is centered beneath the two provider buttons', (
+ 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('Continue with email')).center.dx,
+ moreOrLessEquals(button.center.dx, epsilon: 0.5),
+ reason: '$size',
+ );
+ expect(
+ tester.getRect(_email).top,
+ greaterThan(tester.getRect(_apple).bottom),
+ );
+ }
+ });
testWidgets('nothing changes while the browser is open, and every way in '
'stays live', (tester) async {
@@ -197,11 +189,11 @@ void main() {
'a sign-in failed', (tester) async {
await _mount(tester, finishing: true);
expect(find.text('Signing in…'), findsOneWidget);
- expect(find.text('Harness is ready.'), findsNothing);
+ expect(find.text('Sign in to continue.'), 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);
+ expect(find.text('Sign in to continue.'), findsOneWidget);
});
for (final brightness in Brightness.values) {
@@ -224,13 +216,13 @@ void main() {
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()}',
- );
- }
+ expect(find.text('Skip'), findsNothing);
+ expect(_email, findsOneWidget);
+ await _capture(
+ tester,
+ 'sign-in-step-${brightness.name}-${size.width.round()}'
+ '${scale == 1.0 ? '' : '-text-${(scale * 100).round()}'}',
+ );
});
}
}
diff --git a/desktop/test/signin_recovery_test.dart b/desktop/test/signin_recovery_test.dart
index afe66cbba..f056669de 100644
--- a/desktop/test/signin_recovery_test.dart
+++ b/desktop/test/signin_recovery_test.dart
@@ -101,7 +101,7 @@ void main() {
if (hasUrl) {
cli.attempts.single.authorize('https://auth.example/fixture');
await tester.pump(const Duration(milliseconds: 100));
- expect(find.text('Waiting for your browser'), findsOneWidget);
+ expect(find.text('Continue with Google'), findsOneWidget);
}
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump(const Duration(milliseconds: 100));
@@ -180,23 +180,23 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump(const Duration(milliseconds: 100));
expect(cli.attempts, hasLength(1));
- expect(find.text('Signing in…'), findsOneWidget);
- expect(find.text('Copy link'), findsNothing);
+ expect(find.text('Continue with Google'), findsOneWidget);
+ expect(find.text('Copy sign-in link'), findsNothing);
const url = 'https://auth.example/authorize?state=fixture';
cli.attempts.single.authorize(url);
await tester.pump(const Duration(milliseconds: 100));
expect(find.textContaining('Couldn’t open your browser'), findsOneWidget);
expect(app.signingIn, isTrue);
- await tester.tap(find.text('Open browser'));
+ await tester.tap(find.text('Copy sign-in link'));
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(clipboard, url);
+ expect(find.text('Link copied'), findsOneWidget);
+ await tester.tap(find.text('Continue with Google'));
await tester.pump(const Duration(milliseconds: 100));
expect(launches, [url, url]);
expect(cli.attempts, hasLength(1));
expect(app.loginBrowserError, isNull);
- await tester.tap(find.text('Copy link'));
- await tester.pump(const Duration(milliseconds: 100));
- expect(clipboard, url);
- expect(find.text('Link copied'), findsOneWidget);
- await tester.tap(find.text('Cancel'));
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump(const Duration(milliseconds: 100));
expect(app.signingIn, isFalse);
expect(app.status, AppStatus.unauthenticated);
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 6eb5419b3..c6aee266a 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -88,7 +88,7 @@ TerminalSession terminal(String id, List<TerminalBinaryFrame> input) =>
void main() {
testWidgets(
- 'tabs show names, reveal hover close only, and preserve Command-W',
+ 'tabs reveal Command hints and hover close, and preserve Command-W',
(tester) async {
final app = createApp();
final first = app.activeSwarm;
@@ -109,15 +109,15 @@ void main() {
await mouse.moveTo(tester.getCenter(label));
await tester.pumpAndSettle();
expect(close.hitTestable(), findsOneWidget);
- // Hover reveals ×; tabs show no shortcut, and a name with room keeps
+ // Hover reveals ×; hints wait for Command, and a name with room keeps
// its place.
expect(find.text('⌘1'), findsNothing);
expect(find.text('⌘2'), findsNothing);
expect(tester.getRect(label), nameBounds);
await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
await tester.pump();
- // Command no longer reveals tabs.
- expect(find.text('⌘1'), findsNothing);
+ expect(find.text('⌘1'), findsOneWidget);
+ expect(find.text('⌘2'), findsOneWidget);
expect(
find.byKey(ValueKey('tab-close:${first.id}')).hitTestable(),
findsNothing,
@@ -126,7 +126,18 @@ void main() {
expect(app.activeSwarm, same(second));
await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
await tester.pump();
+ expect(find.text('⌘1'), findsNothing);
+ expect(find.text('⌘2'), findsNothing);
expect(close.hitTestable(), findsOneWidget);
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.metaRight);
+ await tester.pump();
+ expect(find.text('⌘1'), findsOneWidget);
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);
+ await tester.pump();
+ expect(find.text('⌘1'), findsNothing, reason: 'focus loss clears hints');
+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.metaRight);
+ await tester.pump();
await mouse.removePointer();
await tester.pump();
expect(close.hitTestable(), findsNothing);
diff --git a/desktop/test/workspace_account_test.dart b/desktop/test/workspace_account_test.dart
index 1e5508032..f544fcc2a 100644
--- a/desktop/test/workspace_account_test.dart
+++ b/desktop/test/workspace_account_test.dart
@@ -4,7 +4,7 @@ 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/widgets/sign_in_step.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;
@@ -130,7 +130,7 @@ void main() {
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
testWidgets(
- 'Sign in opens the sign-in over the desk, and closes back to it',
+ 'Sign in uses the onboarding page and stays until an account arrives',
(tester) async {
final app = createApp()..signedIn = false;
addTearDown(app.dispose);
@@ -139,11 +139,11 @@ void main() {
await tester.tap(_signIn);
await tester.pump();
await tester.pump();
- expect(find.byType(LoginScreen), findsOneWidget);
+ expect(find.byType(SignInStep), 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'));
+ final email = find.byKey(const Key('sign-in-step-email'));
expect(email, findsOneWidget);
expect(
find.ancestor(
@@ -160,11 +160,15 @@ void main() {
),
);
- await tester.tap(find.byKey(const Key('login-close-button')));
+ expect(find.byKey(const Key('login-close-button')), findsNothing);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
+ expect(find.byType(SignInStep), findsOneWidget);
+ app.signedIn = true;
+ app.notifyListeners();
await tester.pump();
- expect(find.byType(LoginScreen), findsNothing);
- expect(_signIn, findsOneWidget);
+ await tester.pump();
+ expect(find.byType(SignInStep), findsNothing);
},
);
diff --git a/desktop/test/workspace_expiry_screen_test.dart b/desktop/test/workspace_expiry_screen_test.dart
index c95131e86..890fa22d8 100644
--- a/desktop/test/workspace_expiry_screen_test.dart
+++ b/desktop/test/workspace_expiry_screen_test.dart
@@ -50,8 +50,17 @@ void main() {
expect(find.text('Continue with Google'), findsOneWidget);
expect(find.text('Could not sign in'), findsNothing);
expect(find.text('Try again'), findsNothing);
- final notice = find.textContaining('You were signed out');
+ final notice = find.text(
+ 'Your session ended. Sign in again to continue.',
+ );
expect(notice, findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(
+ notice,
+ findsOneWidget,
+ reason: 'expiry requires sign-in again',
+ );
expect(tester.getRect(notice).bottom, lessThanOrEqualTo(544));
expect(
tester.getRect(find.text('Continue with Google')).top,
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 940b9e989..d9ee5bf6c 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -124,6 +124,8 @@ private extension SwarmTabButton {
let fresh = SwarmTabButton(id: "fresh-label-check")
fresh.name = name
fresh.displayLabel = displayLabel
+ fresh.shortcutHint = shortcutHint
+ fresh.showsShortcutHint = showsShortcutHint
fresh.foreground = foreground
fresh.canShowAgentMessages = canShowAgentMessages
fresh.labelFont = labelFont
@@ -148,6 +150,12 @@ private extension SwarmTabButton {
activity = HarnessNativeActivity(["mark": "⠋", "label": "Working", "working": true,
"color": Int64(0xff64d2ff)])
try compareWithFresh("Initial populated tab")
+ for hint: String? in ["⌘1", "⌃⌥⌘R", nil] {
+ shortcutHint = hint
+ showsShortcutHint = true
+ try compareWithFresh("Shortcut text and visibility")
+ }
+ showsShortcutHint = false
for title in ["a-very-long-project-name-that-truncates", "", "设备 日本語", "🧑🏽‍💻 café مرحبا", "desktop"] {
displayLabel = title
try compareWithFresh("Rename displayed title")
@@ -385,6 +393,7 @@ private extension SwarmContextButton {
private extension SwarmTabButton {
// `label` is private to the tab; a same-file extension reads what it draws.
var drawnFont: NSFont? { label.attribute(.font, at: 0, effectiveRange: nil) as? NSFont }
+ var drawsShortcut: Bool { displaysShortcut }
func checkHoverStyleAndTooltips() throws {
frame = NSRect(x: 0, y: 0, width: 160, height: 40)
@@ -1512,6 +1521,8 @@ private extension SwarmTabStrip {
update(["enabled": true, "activeId": "work", "tabs": rows])
try checkTitlebar(tabs.map(\.displayLabel) == ["New Tab", "Desktop", "1: Release planning", "Notes"],
"Clean labels preserve numeric-looking custom names and omit generated prefixes")
+ try checkTitlebar(tabs.map(\.shortcutHint) == ["⌘1", "⌘2", "⌃⌥⌘R", nil],
+ "Hints use current bindings and keep an explicitly unbound tab empty")
let initial = tabs.map(\.frame)
var statusChanged: [String: Any] = ["enabled": true, "activeId": "work", "tabs": rows,
"barStyle": ["family": "Menlo", "size": 28.0, "foreground": Int64(0xffdddddd)]]
@@ -1531,12 +1542,27 @@ private extension SwarmTabStrip {
try checkTitlebar(name == "light" ? ink.redComponent < 0.2 : ink.redComponent > 0.8,
"Tab labels remain readable on the UI surface with an independently chosen status foreground")
try captureTabPresentation("native-tabs-\(name)-rest")
+ setShortcutHintsVisible(true)
+ try checkTitlebar(tabs.map(\.drawsShortcut) == [true, true, true, false] &&
+ tabs.map(\.frame) == initial,
+ "Command reveals the same small status-slot hints without resizing tabs")
+ try captureTabPresentation("native-tabs-\(name)-command")
+ setShortcutHintsVisible(false)
+ try checkTitlebar(tabs.allSatisfy { !$0.drawsShortcut },
+ "Releasing Command restores each tab's status")
tabs[1].mouseEntered(with: hover)
try checkTitlebar(tabs.map(\.frame) == initial && tabs.filter(\.isRevealed).count == 1,
"Hover reveals one tab without moving any")
try captureTabPresentation("native-tabs-\(name)-hover")
tabs[1].mouseExited(with: hover)
}
+ setShortcutHintsVisible(true)
+ update(["enabled": false, "activeId": "work", "tabs": rows])
+ try checkTitlebar(tabs.allSatisfy { !$0.drawsShortcut }, "A modal hides tab shortcuts")
+ update(["enabled": true, "activeId": "work", "tabs": rows])
+ try checkTitlebar(tabs[0].drawsShortcut, "Hints follow a held Command when controls re-enable")
+ NotificationCenter.default.post(name: NSApplication.didResignActiveNotification, object: NSApp)
+ try checkTitlebar(tabs.allSatisfy { !$0.drawsShortcut }, "Losing app focus clears held hints")
let crowdedNames = ["New Tab", "Desktop", "Docs", "Web", "Notes", "API", "Tests", "Release"]
let crowdedRows: [[String: Any]] = crowdedNames.enumerated().map { index, name in
["id": "dense-\(index)", "name": name, "label": name, "shortcutHint": "⌘\(index + 1)",
diff --git a/docs/research/2026-10-08-onboarding-redesign/command-tab-hints.png b/docs/research/2026-10-08-onboarding-redesign/command-tab-hints.png
new file mode 100644
index 000000000..1e246a490
Binary files /dev/null and b/docs/research/2026-10-08-onboarding-redesign/command-tab-hints.png differ
diff --git a/docs/research/2026-10-08-onboarding-redesign/index.html b/docs/research/2026-10-08-onboarding-redesign/index.html
index bf6c1d140..be8366cd2 100644
--- a/docs/research/2026-10-08-onboarding-redesign/index.html
+++ b/docs/research/2026-10-08-onboarding-redesign/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
-<title>Onboarding Redesign</title>
+<title>Desktop onboarding · Required sign-in</title>
<style>
:root {
--page: #0f0f0e; --text: #f5f5f0; --muted: #9a9a90; --line: rgba(255,250,240,.10);
@@ -196,7 +196,7 @@
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; }
+ .sibuttons { display: grid; gap: 1cqw; margin: 0 2cqw; }
.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; }
@@ -206,34 +206,36 @@
.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; }
+ .sifoot { display: flex; justify-content: center; 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. 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>
+ <h1>Desktop onboarding: an account comes first</h1>
+ <p class="lede">Updated flow for review · 2026-10-12. Setup finishes, you sign in, then your workspace opens.
+ The screens below show each step; names and sessions are examples.</p>
+ <div class="update"><b>The flow:</b>
+ <a href="#setup-tour">1 · Setup &amp; tour</a> →
+ <a href="#signin-step">2 · Required sign-in</a> →
+ <a href="#first-workspace">3 · Your workspace</a>.<br>
+ Google, Apple or email. No Skip. <a href="#existing-users">Existing signed-out users</a> enter at sign-in;
+ signed-in installations go straight to their workspace.</div>
+ <p class="note">Desktop renders: <a href="required-sign-in.png">required sign-in</a> · <a href="command-tab-hints.png">tab shortcuts while Command is held</a>.</p>
<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>
+ <div><b>One account, then your work</b>Sign in once before entering Harness. Your first workspace opens automatically after sign-in.</div>
<div><b>Use what they already have</b>If you have Claude Code or Codex, nothing else is downloaded, and your recent sessions open in tabs by project.</div>
<div><b>No status clutter</b>No Installed, Installs on start or Needs sign-in labels. An install or sign-in happens when you pick that agent.</div>
</div>
<!-- ===================== 1. SETUP TOUR ===================== -->
- <h2>1. First launch: a tour while Harness sets up</h2>
- <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
+ <h2 id="setup-tour">1. First launch: a tour while Harness sets up</h2>
+ <p class="lede">Five 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.
- <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>
+ Once everything is downloaded, the current slide finishes and the required sign-in page opens.
+ A computer already signed in goes straight to its workspace.</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>
@@ -243,7 +245,7 @@
<div class="kicker">Welcome to Harness</div>
<h4>All your machines,<br>one window.</h4>
<div class="copy">Your laptop, the desktop under your desk, a box in the cloud. Run agents on any of them and switch between them like tabs.</div>
- <div class="pager"><i class="on"></i><i></i><i></i><i></i><i></i><i></i><i></i></div>
+ <div class="pager"><i class="on"></i><i></i><i></i><i></i><i></i></div>
</div>
<div class="art">
<svg class="lines" viewBox="0 0 100 80" preserveAspectRatio="none">
@@ -272,7 +274,7 @@
<div class="kicker">Every agent</div>
<h4>All your agents,<br>side by side.</h4>
<div class="copy">Claude Code, Codex, OpenCode and a dozen more in one grid. Give each job to the agent that is best at it.</div>
- <div class="pager"><i></i><i class="on"></i><i></i><i></i><i></i><i></i><i></i></div>
+ <div class="pager"><i></i><i class="on"></i><i></i><i></i><i></i></div>
</div>
<div class="art" style="display:grid;place-items:center">
<div class="card panes4" style="position:relative">
@@ -290,65 +292,6 @@
</div>
<p class="cap"><b>2 · Agents.</b></p>
- <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">
- <div>
- <div class="kicker">Keyboard first</div>
- <h4>⌘P finds<br>any harness.</h4>
- <div class="copy">One search over every harness on all your machines, with all your agents. A few letters, Return, you're in it.</div>
- <div class="pager"><i></i><i></i><i class="on"></i><i></i><i></i><i></i><i></i></div>
- </div>
- <div class="art" style="display:grid;place-items:center">
- <div style="width:44cqw">
- <div class="keys"><span class="key">⌘</span><span class="key">P</span></div>
- <div class="palette">
- <div class="q">checkout<span class="cur"></span></div>
- <div class="r on"><img src="../../../desktop/assets/engine-icons/codex.png" alt=""><div><div>write e2e tests for checkout</div><div class="rm">ios-app · 3 days ago</div></div><span class="mtag">MacBook</span></div>
- <div class="r"><img src="../../../desktop/assets/model-icons/claude.png" alt=""><div><div>redesign the checkout flow</div><div class="rm">web · yesterday</div></div><span class="mtag">Studio desktop</span></div>
- <div class="r"><img src="../../../desktop/assets/engine-icons/opencode.png" alt=""><div><div>checkout copy for the pricing page</div><div class="rm">docs · last week</div></div><span class="mtag">Cloud box</span></div>
- <div class="r"><img src="../../../desktop/assets/model-icons/claude.png" alt=""><div><div>checkout webhook retries</div><div class="rm">api-server · 2 weeks ago</div></div><span class="mtag">Cloud box</span></div>
- </div>
- <div class="mini"><span>Every harness</span><span>·</span><span>all your machines</span><span>·</span><span>all your agents</span></div>
- </div>
- </div>
- </div>
- <div class="tagline">All your machines. All your agents. One command center.</div>
- <div class="arrow">›</div>
- <div class="foot"><div class="row"><span class="tri">▸</span><span>Setting up Harness on this Mac</span><span class="sp"></span><span>about 30 s left</span></div><div class="track"><i style="width:36%"></i></div></div>
- </div>
- </div>
- <p class="cap"><b>3 · ⌘P.</b> Results from three machines and three agents in one list.</p>
-
- <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">
- <div>
- <div class="kicker">Keyboard first</div>
- <h4>⌘N starts<br>a new harness.</h4>
- <div class="copy">Any agent, on any of your machines, in any project. Pick them by keys, type what you want, press Return.</div>
- <div class="pager"><i></i><i></i><i></i><i class="on"></i><i></i><i></i><i></i></div>
- </div>
- <div class="art" style="display:grid;place-items:center">
- <div style="width:44cqw">
- <div class="keys"><span class="key">⌘</span><span class="key">N</span></div>
- <div class="nh">
- <div class="chips"><span class="chip"><img src="../../../desktop/assets/model-icons/claude.png" alt="">Claude Code ⌄</span><span class="chip">Studio desktop ⌄</span><span class="chip">api-server ⌄</span></div>
- <div class="field">add a health check endpoint<span class="cur"></span></div>
- <div class="go"><span class="hint">⏎ start</span></div>
- </div>
- <div class="mini"><span>Any agent</span><span>·</span><span>any machine</span><span>·</span><span>any project</span></div>
- </div>
- </div>
- </div>
- <div class="tagline">All your machines. All your agents. One command center.</div>
- <div class="arrow">›</div>
- <div class="foot"><div class="row"><span class="tri">▸</span><span>Setting up Harness on this Mac</span><span class="sp"></span><span>about 26 s left</span></div><div class="track"><i style="width:46%"></i></div></div>
- </div>
- </div>
- <p class="cap"><b>4 · ⌘N.</b></p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -358,7 +301,7 @@
<div class="kicker">Always there</div>
<h4>Sessions that<br>keep going.</h4>
<div class="copy">Close the lid, quit, restart. Every session on all your machines is where you left it, conversation and all.</div>
- <div class="pager"><i></i><i></i><i></i><i></i><i class="on"></i><i></i><i></i></div>
+ <div class="pager"><i></i><i></i><i class="on"></i><i></i><i></i></div>
</div>
<div class="art">
<div class="card p" style="left:2cqw;top:2cqw;width:38cqw;height:26cqw;position:absolute">
@@ -373,7 +316,7 @@
<div class="foot"><div class="row"><span class="tri">▸</span><span>Setting up Harness on this Mac</span><span class="sp"></span><span>about 22 s left</span></div><div class="track"><i style="width:58%"></i></div></div>
</div>
</div>
- <p class="cap"><b>5 · Persistent sessions.</b></p>
+ <p class="cap"><b>3 · Persistent sessions.</b></p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -383,7 +326,7 @@
<div class="kicker">On the go</div>
<h4>Your agents<br>in your pocket.</h4>
<div class="copy">The Harness phone app shows every session on all your machines. When an agent needs you, answer from anywhere.</div>
- <div class="pager"><i></i><i></i><i></i><i></i><i></i><i class="on"></i><i></i></div>
+ <div class="pager"><i></i><i></i><i></i><i class="on"></i><i></i></div>
</div>
<div class="art" style="display:grid;place-items:center">
<div class="phone">
@@ -398,7 +341,7 @@
<div class="foot"><div class="row"><span class="tri">▸</span><span>Setting up Harness on this Mac</span><span class="sp"></span><span>about 12 s left</span></div><div class="track"><i style="width:78%"></i></div></div>
</div>
</div>
- <p class="cap"><b>6 · The Harness phone app.</b> Could carry a QR code to get the app.</p>
+ <p class="cap"><b>4 · The Harness phone app.</b> Could carry a QR code to get the app.</p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -408,17 +351,17 @@
<div class="kicker">On your desk</div>
<h4>The Harness<br>device.</h4>
<div class="copy">It shows what every agent on all your machines is doing. Turn and press to answer the one that needs you.</div>
- <div class="pager"><i></i><i></i><i></i><i></i><i></i><i></i><i class="on"></i></div>
+ <div class="pager"><i></i><i></i><i></i><i></i><i class="on"></i></div>
</div>
<div class="art device" style="height:30cqw"><img src="../../../desktop/assets/devices/harness-desk.webp" alt="The Harness device on a desk"></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. Opening…</span><span class="sp"></span></div><div class="track"><i style="width:100%;background:var(--green)"></i></div></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>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>
+ <p class="cap"><b>5 · The Harness device.</b> Everything is downloaded here. At the end of this slide,
+ the required sign-in page is next. If already signed in, the workspace opens.</p>
<div class="win">
<div class="bar"><span class="dots"><i></i><i></i><i></i></span><span class="sp"></span></div>
@@ -427,7 +370,7 @@
<div>
<div class="kicker">Every agent</div>
<h4>All your agents,<br>side by side.</h4>
- <div class="pager"><i></i><i class="on"></i><i></i><i></i><i></i><i></i><i></i></div>
+ <div class="pager"><i></i><i class="on"></i><i></i><i></i><i></i></div>
</div>
<div></div>
</div>
@@ -445,10 +388,10 @@
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.
+ <h2 id="signin-step">1b. Sign in to continue <span class="new">Required</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 Continue with email centered beneath them. There is no surrounding card. Sign-in is required. 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>
+ Agent downloads continue during setup. The first agents start once an account arrives.</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>
@@ -464,38 +407,77 @@
</div>
</div>
<div>
- <div class="sicard">
+ <div class="sibuttons">
<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 class="sifoot"><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 class="foot"><div class="row"><span style="color:var(--green)">●</span><span style="color:var(--text)">Sign in to continue.</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.
+ <p class="cap"><b>The page.</b> Left: what an account adds. Right: Continue with Google and Continue with Apple. No background card surrounds the buttons. Continue with email is centered beneath them. 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>
+ <p class="note" style="line-height:1.7"><b>Who sees it:</b> every desktop computer without an account, including existing installations and relaunches after setup. A computer already signed in (from the terminal, say) opens Harness directly, including when offline.<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>Ready after sign-in:</b> agent downloads finish during setup. First-arrival agents start after sign-in; saved local panes are preserved.<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>
+ <b>While the browser is open:</b> nothing on the page changes. Every control stays live: press a button again to open the browser again, or pick another way in to switch. Escape cancels the attempt. If the browser cannot open, a Copy sign-in link action appears.<br>
+ <b>Two main buttons:</b> Google and Apple, with email centered beneath. Every native sign-in uses this same page; the old fleet-map card and phone-scanning option are removed.<br>
+ <b>Required:</b> there is no Skip. Cancelling or failing sign-in leaves this page available for another attempt. Explicit sign-out and a server-rejected session return here. Saved work and running harnesses survive behind the page.<br>
+ <b>Before the first result:</b> an account is now required. If nobody is at the keyboard when setup ends, Harness waits here. Closing and reopening the app returns to this step.<br>
+ <b>Shorter tour:</b> five slides: machines, agents, persistent sessions, the phone app and the device. The ⌘P and ⌘N slides are removed. Help ▸ Welcome Tour uses the same five slides.</p>
+
+ <h2 id="existing-users">1c. Existing users: the next launch after updating</h2>
+ <p class="lede">If you used Harness without an account, this is the screen you see when you next open the updated app.
+ You go straight here, without repeating setup or the tour. It is the same required sign-in page as a new user's.</p>
+ <img src="required-sign-in.png" alt="Desktop sign-in screen: Sign in to take Harness everywhere, with Continue with Google, Continue with Apple, and centered Continue with email. The footer says Sign in to continue."
+ style="display:block;width:100%;height:auto;border-radius:12px;border:1px solid var(--line)">
+ <p class="cap"><b>Actual Desktop render.</b> Use Google, Apple or email to sign in or create an account. There is no Skip.</p>
+ <div class="principles">
+ <div><b>Open the updated app</b>Signed out: this page. Already signed in: your workspace, including when offline.</div>
+ <div><b>Sign in once</b>Finish in your browser. Cancelling or a failed attempt keeps this page ready to try again.</div>
+ <div><b>Return to your work</b>Your saved local tabs and panes are preserved. Harnesses already running on this computer keep running during sign-in.</div>
+ </div>
+ <p class="note">After signing in, your saved workspace opens. Existing users do not repeat the first-time agent setup shown below.</p>
+
+ <h2 id="session-expired">1d. If your session expires</h2>
+ <p class="lede">The same sign-in page returns, with “Your session ended. Sign in again to continue.” in the footer. Escape cancels a sign-in attempt and keeps this page open. Your saved workspace and running harnesses survive.</p>
+ <div class="win"><img src="session-expired.png" alt="The shared required sign-in page after a session expires" style="display:block;width:100%;height:auto"></div>
+ <p class="cap"><b>Offline is different:</b> a temporary network outage keeps an already signed-in workspace available, on both Desktop and TUI. Sign-in is required when the server rejects the session or you sign out.</p>
+
+ <h2 id="tui-signin">1e. Sign in from your terminal</h2>
+ <p class="lede">The TUI requires the same account. Choose Google, Apple or email to use a browser. Over SSH, copy the browser link or use a phone already signed in to Harness. Escape cancels the attempt; Ctrl+C quits without stopping your harnesses.</p>
+ <pre id="tui-sign-in-capture" style="padding:24px;background:#171819;border-radius:14px;overflow:auto;line-height:1.5;font-size:14px">Sign in to Harness
+
+All your machines. Your tabs everywhere.
+
+Your saved tabs stay here. Running harnesses keep running.
+
+
+
+
+
+› Continue with Google
+ Continue with Apple
+ Continue with email
+ Continue with your phone
+
+↑↓ choose enter open esc cancel ^C quit
+</pre>
+ <p class="cap">Captured from the native terminal fixture. Successful sign-in returns to your saved tabs. A rejected session brings this page back; a temporary network outage allows an already signed-in account to keep working.</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
+ <h2 id="first-workspace">2. After sign-in: someone with no agents yet</h2>
+ <p class="lede">Your account is connected and your avatar is in the toolbar. 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="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="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="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">
@@ -524,7 +506,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 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="cap"><b>The first screen after signing in to Harness.</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. Each agent has its own account setup; × 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.
@@ -540,7 +522,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="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>
+ <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="avatar">D</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>
@@ -552,7 +534,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="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>
+ <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="avatar">D</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>
@@ -616,30 +598,24 @@
</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>
+ <h2 id="top-right">5. Your account in the toolbar</h2>
+ <p class="lede">Search, Devices and Harness Store are icons, followed by your avatar.
+ The workspace opens with an account. If the server rejects the session, the required sign-in page returns. A temporary network outage keeps the signed-in workspace available.</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>
+ <p class="cap"><b>Previous toolbar, for reference.</b> Search, then Devices and Harness Store as pills with their names.</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>
+ <p class="cap"><b>Normal workspace.</b> Your avatar: your initial in a circle. A click opens its menu, below.</p>
</div>
<div>
<div class="win strip">
@@ -659,12 +635,16 @@
</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>Session recovery:</b> A rejected session returns to the same required page as onboarding. Signing in again opens the saved workspace; there is no dismissible recovery card.<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. It stays once a phone is linked (changed 2026-10-12: as built it showed at the first click and was gone at the second). 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>
+ <b>Narrow window:</b> tabs give way first, as today; Devices is the first icon to drop; the avatar always stays.<br>
+ <b>The menu:</b> Add Phone stays available once a phone is linked. Customize Harness opens customization. Notifications opens Settings ▸ Notifications. Settings opens Settings. Sign out returns to the required sign-in page and preserves saved local panes.</p>
+
+ <h2>Updated 2026-10-12</h2>
+ <p class="note"><b>Shorter flow:</b> five tour slides; ⌘P and ⌘N are removed. The sign-in buttons stand alone, with Continue with email centered below.<br><b>Required account on Desktop and TUI:</b> sign-in is mandatory, including on existing signed-out installations and the TUI bundled with Harness OS. Sign-out and rejected sessions return to required sign-in. An already signed-in account can keep working through a temporary network outage. First-arrival agents start after sign-in.<br><b>Harness OS:</b> install → OS Wi-Fi or Ethernet setup → launch TUI → sign in → workspace. The installer works offline, and Super+W can reopen network settings before sign-in. Browser behavior is unchanged.</p>
+ <details style="margin-top:32px"><summary style="color:var(--muted);cursor:pointer">Earlier design decisions · October 8–11 (superseded where noted above)</summary>
<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,
@@ -684,7 +664,7 @@
<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>
+ <h2>Earlier decision · 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>
@@ -692,6 +672,7 @@
<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>
+ </details>
</main>
</body>
</html>
diff --git a/docs/research/2026-10-08-onboarding-redesign/required-sign-in.png b/docs/research/2026-10-08-onboarding-redesign/required-sign-in.png
new file mode 100644
index 000000000..c572e94cd
Binary files /dev/null and b/docs/research/2026-10-08-onboarding-redesign/required-sign-in.png differ
diff --git a/docs/research/2026-10-08-onboarding-redesign/session-expired.png b/docs/research/2026-10-08-onboarding-redesign/session-expired.png
new file mode 100644
index 000000000..1c6b21ce5
Binary files /dev/null and b/docs/research/2026-10-08-onboarding-redesign/session-expired.png differ
diff --git a/docs/research/2026-10-08-onboarding-redesign/tui-sign-in.txt b/docs/research/2026-10-08-onboarding-redesign/tui-sign-in.txt
new file mode 100644
index 000000000..12bd9810b
--- /dev/null
+++ b/docs/research/2026-10-08-onboarding-redesign/tui-sign-in.txt
@@ -0,0 +1,16 @@
+Sign in to Harness
+
+All your machines. Your tabs everywhere.
+
+Your saved tabs stay here. Running harnesses keep running.
+
+
+
+
+
+› Continue with Google
+ Continue with Apple
+ Continue with email
+ Continue with your phone
+
+↑↓ choose enter open esc cancel ^C quit
diff --git a/docs/research/2026-10-12-os-onboarding/index.html b/docs/research/2026-10-12-os-onboarding/index.html
new file mode 100644
index 000000000..5126dda79
--- /dev/null
+++ b/docs/research/2026-10-12-os-onboarding/index.html
@@ -0,0 +1,271 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Harness OS · Onboarding review</title>
+<style>
+ :root { color-scheme: dark; --page:#111211; --panel:#191a18; --line:#30312d; --text:#ededdf; --muted:#a0a397; --accent:#d7e5a6; --terminal:#101010; --yellow:#d9c727; --mono:ui-monospace,"SFMono-Regular",Consolas,"Liberation Mono",monospace; --sans:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
+ * { box-sizing:border-box; }
+ body { margin:0; background:var(--page); color:var(--text); font:15px/1.5 var(--sans); }
+ button,input,select { font:inherit; }
+ button,a,input,select { -webkit-tap-highlight-color:transparent; }
+ button,a { touch-action:manipulation; }
+ button { cursor:pointer; }
+ button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
+ button:disabled { opacity:.35; cursor:default; }
+ a { color:inherit; text-decoration:none; }
+ header { max-width:1512px; margin:auto; padding:25px 36px 22px; display:flex; align-items:center; gap:16px; border-bottom:1px solid var(--line); }
+ .identity { display:flex; align-items:center; gap:11px; font-weight:600; font-size:16px; letter-spacing:-.02em; }
+ .identity svg { width:27px; height:27px; }
+ .slash { color:#53554d; }
+ .review-label { color:var(--muted); font-size:14px; }
+ .header-actions { margin-left:auto; display:flex; align-items:center; gap:18px; font-size:13px; }
+ .header-actions a { color:var(--muted); }
+ .header-actions a:hover { color:var(--text); }
+ .tag { color:var(--accent); border:1px solid #454d34; border-radius:5px; padding:3px 8px; font-size:11px; letter-spacing:.05em; }
+ .intro { max-width:1512px; margin:auto; padding:30px 36px 26px; }
+ h1 { font-size:clamp(25px,3vw,35px); font-weight:500; letter-spacing:-.035em; margin:0 0 8px; line-height:1.2; }
+ .intro p { margin:0; color:var(--muted); max-width:850px; }
+ .path { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-top:21px; font-size:13px; }
+ .path a { color:#d6d8cc; }
+ .path span { color:#62675b; }
+ .path a:hover { color:var(--accent); }
+ .layout { max-width:1512px; margin:auto; padding:0 36px 60px; display:grid; grid-template-columns:208px minmax(0,1fr); gap:30px; align-items:start; }
+ aside { padding-top:7px; position:sticky; top:20px; }
+ .nav-label { color:#7c8074; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.12em; margin:8px 10px 10px; }
+ .nav-label.later { margin-top:27px; }
+ .nav-item { display:flex; gap:11px; align-items:center; padding:9px 10px; margin:2px 0; border-radius:5px; color:var(--muted); font-size:13px; }
+ .nav-item .number { font:11px var(--mono); color:#6a7061; width:19px; }
+ .nav-item[aria-current="step"] { color:var(--text); background:#24281e; }
+ .nav-item[aria-current="step"] .number { color:var(--accent); }
+ .nav-item:hover { background:#20221c; color:var(--text); }
+ .nav-tip { padding:22px 10px 0; font-size:12px; line-height:1.7; color:#7f8576; }
+ kbd { font:11px var(--mono); border:1px solid #393e31; border-bottom-width:2px; border-radius:3px; padding:1px 4px; color:#b3baaa; }
+ .preview-top { display:flex; justify-content:space-between; align-items:center; gap:16px; min-height:43px; font-size:12px; color:var(--muted); }
+ .preview-top .owner { color:var(--accent); }
+ .screen { container-type:inline-size; position:relative; width:100%; aspect-ratio:16/10; background:var(--terminal); border:1px solid #34362f; border-radius:7px; overflow:hidden; box-shadow:0 16px 48px #0003; font-family:var(--mono); color:#d8d8d8; }
+ .screen .contents { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:5cqw; font-size:1.35cqw; line-height:1.65; }
+ .form { width:52cqw; }
+ .wordmark { color:var(--yellow); margin:0 0 4.1cqw; font:1.65cqw/1.25 var(--mono); text-align:center; white-space:pre; }
+ .terminal-title { font-size:inherit; font-weight:600; margin:0 0 2.8cqw; }
+ .terminal-copy { color:#a9a9a9; margin:0 0 2.4cqw; }
+ .terminal-copy p { margin:0 0 1.15cqw; }
+ .field { display:grid; grid-template-columns:16cqw 1fr; align-items:center; gap:1cqw; margin:0 0 1.8cqw; }
+ .screen input,.screen select { appearance:none; min-width:0; border:0; border-radius:0; padding:.15cqw .65cqw; color:#d8d8d8; background:#252525; font:inherit; width:100%; }
+ .screen input:focus,.screen select:focus { background:#b9b9b9; color:#111; outline:0; }
+ .screen input[type=checkbox] { appearance:auto; width:1.2cqw; height:1.2cqw; accent-color:#c2c2c2; }
+ .notice { color:#d6bf72; margin:0 0 3.4cqw; font-size:1.15cqw; }
+ .terminal-button { display:block; background:transparent; border:0; border-radius:0; padding:.1cqw 1cqw; color:inherit; font:inherit; width:100%; text-align:left; }
+ .terminal-button:hover,.terminal-button:focus-visible { background:#3a3a36; outline:none; }
+ .terminal-button.selected { background:#b8b8b8; color:#101010; }
+ .terminal-button.center { text-align:center; width:auto; margin:2.4cqw auto 0; }
+ .terminal-button.primary { background:#b8b8b8; color:#101010; text-align:center; margin-top:3.6cqw; }
+ .centered { text-align:center; }
+ .network-list { margin-bottom:2.6cqw; }
+ .network-list button { display:flex; justify-content:space-between; gap:2cqw; }
+ .keyboard-hint { color:#777; font-size:1.1cqw; margin-top:2.8cqw; }
+ .account { width:70cqw; background:#191919; padding:2.2cqw; }
+ .account .terminal-title { margin-bottom:2.2cqw; }
+ .account .terminal-copy { margin-bottom:4.8cqw; }
+ .account .terminal-button { line-height:1.6; padding:0 .65cqw; }
+ .account .terminal-button.selected { background:#2c333c; color:#d9e5f7; }
+ .account .keyboard-hint { margin-bottom:0; }
+ .phone-layout { display:grid; grid-template-columns:1fr 18cqw; gap:2.4cqw; align-items:center; }
+ .qr { width:18cqw; aspect-ratio:1; background:#eee; color:#111; padding:1cqw; display:grid; place-items:center; }
+ .qr svg { width:100%; height:100%; }
+ .qr-label { text-align:center; font-size:.9cqw; color:#888; margin:.8cqw 0 0; }
+ .screen .error { color:#e2a585; }
+ .screen .success { color:#bed29d; }
+ .screen .muted { color:#777; }
+ .workspace { position:absolute; inset:0; display:grid; grid-template-rows:3cqw 1fr 2.5cqw; font-size:1.35cqw; line-height:1.65; }
+ .tabs { display:flex; align-items:center; gap:2cqw; padding:0 1cqw; background:#202020; font-size:1.1cqw; }
+ .tabs .active { color:#e4d498; }
+ .tabs .right { margin-left:auto; color:#8c9385; }
+ .panes { display:grid; grid-template-columns:1.2fr 1fr; min-height:0; }
+ .pane { position:relative; padding:1.3cqw; }
+ .panes>.pane { border-right:1px solid #454545; }
+ .shells { display:grid; grid-template-rows:1fr 1fr; }
+ .shells .pane:first-child { border-bottom:1px solid #454545; }
+ .pane-title { margin:-1.3cqw -1.3cqw 2cqw; padding:.3cqw 1cqw; color:#858585; font-size:1cqw; }
+ .agent-start { position:absolute; left:3cqw; right:3cqw; top:23%; }
+ .agent-name { font-weight:600; font-size:2.4cqw; letter-spacing:-.1em; color:#d8d8d8; margin-bottom:2cqw; }
+ .prompt { border-top:1px solid #40403b; border-bottom:1px solid #40403b; padding:1.2cqw 0; color:#777; margin-top:2.6cqw; }
+ .status { display:flex; gap:2cqw; padding:.25cqw 1cqw; background:#202020; color:#9b9e91; font-size:1cqw; }
+ .status .right { margin-left:auto; }
+ .cursor { display:inline-block; background:#bcbcbc; width:.75cqw; height:1.4cqw; vertical-align:-.2cqw; }
+ .power { font-family:var(--sans); color:#8e9486; font-size:1.35cqw; }
+ .boot-logo { color:var(--yellow); white-space:pre; font:1.3cqw/1.2 var(--mono); margin-bottom:3cqw; }
+ .explanation { display:grid; grid-template-columns:1fr auto; gap:24px; margin-top:22px; align-items:start; }
+ .eyebrow { color:#818878; font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.11em; }
+ h2 { font-size:20px; line-height:1.3; font-weight:500; letter-spacing:-.02em; margin:7px 0 8px; }
+ #description { color:var(--muted); margin:0; max-width:720px; font-size:14px; line-height:1.6; }
+ .pager { display:flex; gap:7px; padding-top:3px; }
+ .small-button { background:var(--panel); color:var(--text); border:1px solid #3b3e34; border-radius:5px; padding:8px 13px; font-size:12px; }
+ .small-button:hover { border-color:#697457; }
+ .small-button.accent { background:var(--accent); color:#1d2514; border-color:var(--accent); }
+ .review-controls { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:23px; padding-top:20px; border-top:1px solid var(--line); }
+ .review-controls span { color:#818878; font-size:11px; margin-right:3px; }
+ .review-controls button { background:transparent; }
+ .preview-disclaimer { margin:20px 0 0; color:#787d70; font-size:11px; line-height:1.6; }
+ .overview { display:grid; grid-template-columns:1fr 1fr; gap:26px 20px; }
+ .overview-card { cursor:pointer; }
+ .overview-card h3 { font-size:15px; font-weight:500; margin:10px 0 4px; }
+ .overview-card p { color:var(--muted); font-size:12px; margin:0; }
+ .overview-card .screen { box-shadow:none; pointer-events:none; }
+ .overview-card:hover .screen { border-color:#7a855f; }
+ [hidden] { display:none !important; }
+ @media (min-width:1600px) { .screen { max-height:72vh; aspect-ratio:auto; height:690px; } .overview .screen { height:auto; aspect-ratio:16/10; } }
+ @media (max-width:1000px) { .layout { grid-template-columns:165px minmax(0,1fr); gap:20px; padding:0 24px 40px; } header,.intro { padding-left:24px; padding-right:24px; } .nav-item { font-size:12px; gap:7px; } .explanation { display:block; } .pager { margin-top:17px; } }
+ @media (max-width:720px) { header { padding:17px 16px; gap:10px; flex-wrap:wrap; } .header-actions { gap:12px; } .review-label,.slash { display:none; } .intro { padding:25px 16px 21px; } .layout { display:block; padding:0 16px 40px; } aside { display:none; } .screen { aspect-ratio:4/3; } .overview { grid-template-columns:1fr; } .path { gap:9px; font-size:12px; } .preview-top { min-height:38px; } h2 { font-size:18px; } }
+ @media print { header,aside,.intro,.pager,.review-controls,.preview-disclaimer { display:none; } .layout { display:block; padding:0; } .overview { display:block; } .overview-card { break-inside:avoid; margin-bottom:30px; } .screen { print-color-adjust:exact; -webkit-print-color-adjust:exact; } }
+</style>
+</head>
+<body>
+<header>
+ <a class="identity" href="#install" aria-label="Harness OS onboarding start"><svg viewBox="0 0 28 28" fill="none" aria-hidden="true"><rect x=".5" y=".5" width="27" height="27" rx="5" stroke="#596345"/><path d="M8 7v14M20 7v14M8 14h12" stroke="#d7e5a6" stroke-width="2"/></svg>Harness OS</a>
+ <span class="slash">/</span><span class="review-label">Onboarding</span>
+ <div class="header-actions"><a href="#overview">All screens</a><a href="../2026-10-08-onboarding-redesign/index.html">Desktop flow ↗</a><span class="tag">PREVIEW</span></div>
+</header>
+<div class="intro">
+ <h1>Connect first. Then sign in.</h1>
+ <p>The complete OS onboarding flow. Installation and network setup belong to the OS. The TUI opens once connected and uses its standard sign-in.</p>
+ <nav class="path" aria-label="Main journey"><a href="#install">01 · Install</a><span>→</span><a href="#unlock">02 · Boot</a><span>→</span><a href="#network">03 · Connect</a><span>→</span><a href="#signin">04 · Sign in</a><span>→</span><a href="#workspace">05 · Work</a></nav>
+</div>
+<main class="layout">
+ <aside>
+ <nav aria-label="Preview screens">
+ <div class="nav-label">First use</div>
+ <a class="nav-item" data-group="install" href="#install"><span class="number">01</span>Install from USB</a>
+ <a class="nav-item" data-group="installed" href="#installed"><span class="number">02</span>Shut down &amp; restart</a>
+ <a class="nav-item" data-group="unlock" href="#unlock"><span class="number">03</span>Unlock the disk</a>
+ <a class="nav-item" data-group="network" href="#network"><span class="number">04</span>Connect to Wi-Fi</a>
+ <a class="nav-item" data-group="signin" href="#signin"><span class="number">05</span>Sign in to Harness</a>
+ <a class="nav-item" data-group="browser" href="#browser"><span class="number">↳</span>Browser sign-in</a>
+ <a class="nav-item" data-group="phone" href="#phone"><span class="number">↳</span>Phone sign-in</a>
+ <a class="nav-item" data-group="workspace" href="#workspace"><span class="number">06</span>Your workspace</a>
+ <div class="nav-label later">Returning users</div>
+ <a class="nav-item" data-group="existing" href="#existing"><span class="number">↳</span>No account yet</a>
+ <a class="nav-item" data-group="expired" href="#expired"><span class="number">↳</span>Session expired</a>
+ <a class="nav-item" data-group="offline" href="#offline"><span class="number">↳</span>Temporary outage</a>
+ <a class="nav-item" data-group="overview" href="#overview"><span class="number">▦</span>All screens</a>
+ </nav>
+ <div class="nav-tip">Click inside the screen to follow the flow.<br><kbd>←</kbd> <kbd>→</kbd> browse steps<br><kbd>↑</kbd> <kbd>↓</kbd> choose an action</div>
+ </aside>
+ <section aria-label="Interactive onboarding preview">
+ <div class="preview-top"><span id="breadcrumb">First use / Install</span><span class="owner" id="owner">OS · USB installer</span></div>
+ <div id="screen" class="screen" aria-label="OS screen preview"></div>
+ <div id="overview" class="overview" hidden></div>
+ <div id="details">
+ <div class="explanation">
+ <div aria-live="polite"><div class="eyebrow" id="step-label">Step 01</div><h2 id="title">Install from USB</h2><p id="description"></p></div>
+ <div class="pager"><button class="small-button" id="previous">← Back</button><button class="small-button accent" id="next">Next →</button></div>
+ </div>
+ <div class="review-controls" id="review-controls"></div>
+ </div>
+ <p class="preview-disclaimer">Interactive HTML mockup · 12 Oct 2026. Screens follow the repository’s OS forms and TUI sign-in. Example disks, networks, accounts and workspace content are fictional. Controls simulate transitions; they do not install, connect, or sign in. Browser and phone approval are simulated outside the OS screen.</p>
+ </section>
+</main>
+<script>
+'use strict';
+const wordmark = '<pre class="wordmark" aria-label="Harness">█ █ ▄▀█ █▀█ █▄ █ █▀▀ █▀ █▀\n█▀█ █▀█ █▀▄ █ ▀█ ██▄ ▄█ ▄█</pre>';
+const btn = (text, action, cls='') => `<button class="terminal-button ${cls}" data-action="${action}">${text}</button>`;
+const frame = (content, cls='form') => `<div class="contents"><div class="${cls}">${content}</div></div>`;
+const form = content => frame(wordmark + content);
+const hint = '<p class="keyboard-hint">↑↓ choose enter open esc cancel ^C quit</p>';
+const authChoices = () => btn('› Continue with Google','google','selected') + btn(' Continue with Apple','apple') + btn(' Continue with email','email') + btn(' Continue with your phone','phone');
+const signin = (error='') => frame('<h3 class="terminal-title">Sign in to Harness</h3><div class="terminal-copy">'+ (error ? `<p class="error">${error}</p>` : '<p>All your machines. Your tabs everywhere.</p><p>Your saved tabs stay here. Running harnesses keep running.</p>') + '</div>' + authChoices() + hint, 'account');
+const qr = '<svg viewBox="0 0 29 29" aria-hidden="true" shape-rendering="crispEdges"><path fill="#111" d="M1 1h7v7H1zM21 1h7v7h-7zM1 21h7v7H1z"/><path fill="#eee" d="M2 2h5v5H2zM22 2h5v5h-5zM2 22h5v5H2z"/><path fill="#111" d="M3 3h3v3H3zM23 3h3v3h-3zM3 23h3v3H3zM10 1h2v4h-2zM14 2h3v2h-3zM17 5h2v5h-2zM10 7h5v3h-5zM1 10h4v3H1zM6 12h4v2H6zM2 16h2v3H2zM5 17h5v2H5zM10 15h4v5h-4zM12 11h6v2h-6zM16 15h2v3h-2zM20 11h3v4h-3zM25 10h3v2h-3zM23 16h5v2h-5zM19 19h4v4h-4zM25 20h3v3h-3zM10 22h3v6h-3zM14 21h3v2h-3zM15 25h4v3h-4zM21 25h2v3h-2zM25 25h3v3h-3z"/></svg>';
+function workspace(offline=false, returning=false) {
+ return `<div class="workspace"><div class="tabs"><span class="active">1 ${returning ? 'Website' : 'OpenCode'}</span><span>+</span><span class="right">harness</span></div><div class="panes"><div class="pane"><div class="pane-title">OpenCode · ~/projects/${returning ? 'website' : ''}</div>${returning ? '<p class="muted">You</p><p>Help me build a small website.</p><br><p class="success">✓ Created the project</p><p>Changes are saved in your project.</p><div class="prompt">Ask anything… <span class="cursor"></span></div>' : '<div class="agent-start"><div class="agent-name">opencode</div><div class="prompt">Ask anything… <span class="cursor"></span></div><p class="muted">~/projects</p></div>'}</div><div class="shells"><div class="pane"><div class="pane-title">Terminal · ~/projects</div><span class="success">me@harness</span> ~/projects<br>❯ <span class="cursor"></span></div><div class="pane"><div class="pane-title">Terminal · ~/projects</div><span class="success">me@harness</span> ~/projects<br>❯</div></div></div><div class="status"><span>1:${returning ? 'Website' : 'OpenCode'}</span><span>Ctrl+b prefix</span><span class="right">${offline ? 'local work' : 'harness'}</span></div></div>`;
+}
+let provider='Google', returning=false, networkBack='signin', encrypted=true;
+const steps = {
+ install: {group:'install', owner:'OS · USB installer', label:'First use / USB', title:'Install from USB', description:'The USB boots directly into the installer. Pick the internal disk and set a local password. Encryption starts enabled. Installation works offline and does not require a Harness account.', next:'installing', controls:[['See disk picker','disk'],['Installation error','install-error']], view:()=>form('<p class="notice">The selected disk will be erased.</p><label class="field"><span>Disk</span><select aria-label="Installation disk"><option>Internal SSD · 512 GB</option><option>Secondary SSD · 1 TB</option></select></label><label class="field"><span>Encryption</span><input type="checkbox" data-encryption '+(encrypted?'checked':'')+' aria-label="Encrypt the installed disk"></label><label class="field"><span>Password</span><input type="password" value="preview-password" aria-label="Example local password" autocomplete="off"></label><label class="field"><span>Repeat password</span><input type="password" value="preview-password" aria-label="Repeat example password" autocomplete="off"></label>'+btn('Install Harness','installing','primary'))},
+ disk: {group:'install', owner:'OS · USB installer', label:'First use / Select disk', title:'Choose the installation disk', description:'The disk picker shows eligible disks. The booted USB is excluded. The selected disk returns to the installer form; choosing it does not start installation.', back:'install', next:'install', controls:[], view:()=>form('<h3 class="terminal-title">Select disk</h3>'+btn('› Internal SSD · 512 GB /dev/nvme0n1','install','selected')+btn(' Secondary SSD · 1 TB /dev/sda','install')+'<p class="keyboard-hint">↑↓ choose enter select esc back</p>')},
+ 'install-error': {group:'install', owner:'OS · USB installer', label:'First use / Check password', title:'Fix the field and try again', description:'Invalid or mismatched passwords keep the user in the installer. No disk is changed before the form passes validation.', back:'install', next:'install', controls:[], view:()=>form('<label class="field"><span>Disk</span><input value="Internal SSD · 512 GB" readonly></label><label class="field"><span>Password</span><input type="password" value="preview-password" aria-label="Example password"></label><label class="field"><span>Repeat password</span><input type="password" value="wrong" aria-label="Mismatched example password"></label><p class="error">Passwords do not match.</p>'+btn('Install Harness','install','primary'))},
+ installing: {group:'install', owner:'OS · USB installer', label:'First use / Installing', title:'Installation runs on the OS screen', description:'The screen shows the current installation operation beneath the Harness wordmark. There is no account step or network check here.', back:'install', next:'installed', controls:[['Finish installation','installed']], view:()=>form('<p class="centered">Writing system files…</p>')},
+ installed: {group:'installed', owner:'OS · USB installer', label:'First use / Installation complete', title:'Shut down, remove the USB, restart', description:'Completion stays on screen until Shut down is chosen. Remove the USB, then turn on the computer to boot the installed system.', back:'installing', next:'poweroff', controls:[], view:()=>form('<p class="centered">Harness is installed. Shut down, remove the USB,<br>then turn on your computer.</p>'+btn('[ Shut down ]','poweroff','center selected'))},
+ poweroff: {group:'installed', owner:'Computer · powered off', label:'First use / Remove USB', title:'Remove the USB and turn the computer on', description:'This is a physical step. The computer is off; there is no extra welcome wizard. Use the preview control to simulate the next boot.', back:'installed', next:()=>encrypted?'unlock':'local-login', controls:[['Turn computer on','boot']], view:()=>frame('<span class="power">Computer is off</span>','centered')},
+ unlock: {group:'unlock', owner:'OS · disk unlock', label:'First use / Installed boot', title:'Unlock with the installation password', description:'On an encrypted installation, this unlocks the disk and starts the local OS session. This is the computer’s password, separate from the Harness account.', back:'installed', next:'network', controls:[['Unencrypted installation','local-login']], view:()=>frame('<pre class="boot-logo" aria-label="Harness"> _ _ _ ____ _ _ _____ ____ ____\n| | | | / \\ | _ \\| \\ | | ____/ ___/ ___|\n| |_| | / _ \\ | |_) | \\| | _| \\___ \\___ \\\n| _ |/ ___ \\| _ &lt;| |\\ | |___ ___) |__) |\n|_| |_/_/ \\_\\_| \\_\\_| \\_|_____|____/____/</pre><p>Enter your password</p><label><span class="muted" hidden>Example disk password</span><input aria-label="Example disk password" type="password" value="preview-password" data-enter="network" style="background:transparent;text-align:center;width:24cqw"></label>','centered')},
+ 'local-login': {group:'unlock', owner:'OS · local login', label:'First use / Unencrypted boot', title:'Log in to the local OS account', description:'Without disk encryption, the user logs in as me with the password set during installation. Networking and Harness account sign-in follow.', back:'installed', next:'network', controls:[], view:()=>frame('<p>harness login: me</p><label>Password: <input aria-label="Example OS password" type="password" value="preview-password" data-enter="network" style="width:26cqw"></label>','form')},
+ network: {group:'network', owner:'OS · network setup · TUI has not started', label:'First use / Connect', title:'Connect before the TUI starts', description:'The OS owns this screen. Choose Wi-Fi and enter its password, or use Ethernet. The TUI starts automatically once connected. A working Ethernet connection skips this screen.', back:'unlock', next:'wifi-password', controls:[['Ethernet is already connected','ethernet'],['No networks found','no-networks']], view:()=>form('<h3 class="terminal-title">Connect to Wi-Fi</h3><div class="network-list">'+btn('<span>Studio</span><span>92%</span>','wifi-password','selected')+btn('<span>Home network</span><span>73%</span>','wifi-password')+btn('<span>Guest</span><span>51%</span>','wifi-password')+'</div>'+btn('[ Rescan ]','network','center')+btn('Ethernet enp1s0','ethernet'))},
+ 'wifi-password': {group:'network', owner:'OS · network setup · TUI has not started', label:'First use / Wi-Fi password', title:'Enter the network password', description:'A successful connection advances automatically to the TUI sign-in screen. A failed connection stays here for another attempt. Escape returns to the network list.', back:'network', next:'signin', controls:[['Wrong password','wifi-error']], view:()=>form('<h3 class="terminal-title">Connect to Wi-Fi</h3><p>Network Studio</p><label class="field"><span>Password</span><input type="password" value="example-wifi" aria-label="Example Wi-Fi password" data-enter="signin"></label>'+btn('[ Connect ]','signin','center selected'))},
+ 'wifi-error': {group:'network', owner:'OS · network setup · TUI has not started', label:'First use / Connection failed', title:'Stay in network setup and retry', description:'A connection failure does not open the TUI. Correct the password, choose another network, or plug in Ethernet.', back:'network', next:'signin', controls:[['Choose another network','network'],['Connect Ethernet','ethernet']], view:()=>form('<h3 class="terminal-title">Connect to Wi-Fi</h3><p>Network Studio</p><label class="field"><span>Password</span><input type="password" aria-label="Retry example Wi-Fi password" data-enter="signin"></label><p class="error">Could not connect. Check the password and try again.</p>'+btn('[ Connect ]','signin','center selected'))},
+ 'no-networks': {group:'network', owner:'OS · network setup · TUI has not started', label:'First use / No networks', title:'Rescan or use Ethernet', description:'Missing Wi-Fi does not hide the wired option. Initial setup waits here until a connection is available.', back:'network', next:'network', controls:[['Plug in Ethernet','ethernet']], view:()=>form('<h3 class="terminal-title">Connect to Wi-Fi</h3><br>'+btn('[ Rescan ]','network','center selected')+btn('Ethernet enp1s0','ethernet')+'<p class="terminal-copy" style="margin-top:5cqw">No Wi-Fi networks found. Rescan or use Ethernet.</p>')},
+ signin: {group:'signin', owner:'TUI · shared account sign-in', label:'First use / Harness account', title:'The TUI now starts and requires sign-in', description:'Choose Google, Apple, email, or your phone. This is the same account flow as the standalone TUI. Cancelling an attempt returns here; the workspace opens after sign-in succeeds.', back:'network', next:'browser', controls:[['Open Wi-Fi settings','wifi-settings'],['Sign-in service unavailable','signin-error']], view:()=>signin()},
+ browser: {group:'browser', owner:'TUI · waiting for browser sign-in', label:'Sign in / Browser', title:()=>`Continue with ${provider}`, description:'The selected sign-in method opens in the OS browser. Complete authentication there and the TUI opens the workspace. The provider’s own screens are outside this preview; use Complete sign-in below to simulate the callback.', back:'signin', next:'workspace', controls:[['Complete sign-in','complete'],['Cancel browser sign-in','signin'],['Browser cannot open','browser-error']], view:()=>frame('<h3 class="terminal-title">Sign in to Harness</h3><div class="terminal-copy"><p>Finish signing in in your browser.</p><p>Using SSH? Cancel and choose Continue with your phone.</p></div>'+btn('› Open sign-in page','stay','selected')+btn(' Copy sign-in link','copy')+btn(' Cancel sign-in','signin')+hint,'account')},
+ phone: {group:'phone', owner:'TUI · waiting for phone approval', label:'Sign in / Phone', title:'Sign in with your phone', description:'Use Harness on a signed-in phone to scan and approve this computer. This also supports SSH sessions. Approval returns directly to the workspace. The code shown here is a visual placeholder.', back:'signin', next:'workspace', controls:[['Approve on phone','complete'],['Code expires','phone-expired'],['Cancel phone sign-in','signin']], view:()=>frame('<div class="phone-layout"><div><h3 class="terminal-title">Sign in to Harness</h3><div class="terminal-copy"><p>On your phone, open Harness → Settings → Sign in a computer.</p><p>Expires in 120s</p></div>'+btn('› Copy phone sign-in link','copy','selected')+btn(' Cancel sign-in','signin')+'</div><div><div class="qr">'+qr+'</div><p class="qr-label">Preview code · not scannable</p></div></div>'+hint,'account')},
+ 'phone-expired': {group:'phone', owner:'TUI · account sign-in', label:'Sign in / Code expired', title:'Request a new phone code', description:'An expired phone code returns to sign-in. It does not delete local work or open the workspace.', back:'phone', next:'phone', controls:[['New phone code','phone']], view:()=>signin('This code expired. Choose Sign in with phone to get a new one.')},
+ 'browser-error': {group:'browser', owner:'TUI · account sign-in', label:'Sign in / Browser unavailable', title:'Use the link or phone sign-in', description:'If the OS browser cannot open, the user can copy the link or return to the sign-in choices and use a phone.', back:'browser', next:'phone', controls:[['Use phone instead','phone'],['Back to sign-in','signin']], view:()=>frame('<h3 class="terminal-title">Sign in to Harness</h3><div class="terminal-copy"><p class="error">Could not open a browser. Copy the link, or use Continue with your phone.</p></div>'+btn('› Open sign-in page','browser','selected')+btn(' Copy sign-in link','copy')+btn(' Cancel sign-in','signin')+hint,'account')},
+ 'signin-error': {group:'signin', owner:'TUI · account sign-in', label:'Sign in / Unavailable', title:'Sign-in can be retried', description:'When this computer has no signed-in account, unavailable authentication keeps it on sign-in. Wi-Fi settings remain accessible. Already signed-in offline use is shown separately.', back:'signin', next:'signin', controls:[['Retry sign-in','signin'],['Open Wi-Fi settings','wifi-settings']], view:()=>signin('Could not finish sign-in. Try again.')},
+ 'wifi-settings': {group:'signin', owner:'OS · Wi-Fi settings opened from TUI', label:'Sign in / Network settings', title:'Wi-Fi stays reachable from sign-in', description:'Super+w opens the existing OS Wi-Fi form when reconnection is needed. Closing it returns to sign-in. Initial network setup has already finished before the TUI launch.', back:()=>networkBack, next:()=>networkBack, controls:[['Close Wi-Fi settings','close-wifi']], view:()=>form('<h3 class="terminal-title">Connect to Wi-Fi</h3><div class="network-list">'+btn('<span>Studio</span><span>Connected</span>','close-wifi','selected')+btn('<span>Home network</span><span>73%</span>','close-wifi')+'</div>'+btn('[ Rescan ]','stay','center')+btn('Ethernet enp1s0','close-wifi')+'<p class="keyboard-hint">esc back</p>')},
+ workspace: {group:'workspace', owner:'TUI · workspace', label:'First use / Ready', title:'Start working', description:'After sign-in, the first workspace opens with OpenCode and two terminals. There is no extra OS tutorial or account wizard. Projects stay on this computer. Agent providers may ask for their own credentials when needed.', back:'signin', controls:[['Existing user without an account','existing'],['Session expires','expired'],['Network goes offline','offline']], view:()=>workspace(false,returning)},
+ existing: {group:'existing', owner:'TUI · required account sign-in', label:'Returning user / No account yet', title:'Existing unsigned users see the same sign-in', description:'After updating, an existing user who never created an account sees this screen before their saved workspace. They do not repeat installation or first-use Wi-Fi setup. Their tabs and running harnesses stay intact and reappear after sign-in.', next:'browser', controls:[['Sign in and restore work','complete'],['Open Wi-Fi settings','wifi-settings']], view:()=>signin()},
+ expired: {group:'expired', owner:'TUI · required account sign-in', label:'Returning user / Session ended', title:'Ask for sign-in again when the session is rejected', description:'A confirmed expired or rejected session returns to the required sign-in screen. Running harnesses keep running. Signing in again restores the saved workspace; cancellation stays at sign-in.', next:'browser', controls:[['Sign in again and restore work','complete'],['Open Wi-Fi settings','wifi-settings']], view:()=>signin()},
+ offline: {group:'offline', owner:'TUI · already signed in', label:'Returning user / Temporary outage', title:'Keep local work available during an outage', description:'A temporary network failure keeps an already signed-in account in its workspace. Saved tabs and local terminals remain available. Remote machines and online models need connectivity. Reconnecting does not add a sign-in step unless the session is explicitly rejected.', next:'workspace', controls:[['Network reconnects','complete'],['Session is explicitly rejected','expired']], view:()=>workspace(true,true)}
+};
+const mainPath=['install','installing','installed','poweroff','unlock','network','wifi-password','signin','browser','workspace'];
+const overviewPath=['install','installing','installed','unlock','network','wifi-password','signin','browser','phone','workspace','existing','expired','offline','wifi-settings','wifi-error','no-networks','browser-error','phone-expired'];
+const el=id=>document.getElementById(id);
+const value=v=>typeof v==='function'?v():v;
+let current='install';
+function go(id) { if(location.hash==='#'+id) render(); else location.hash=id; }
+function action(id) {
+ if(id==='stay') return;
+ if(id==='copy') { el('description').textContent='Preview only: the real TUI copies its active sign-in link. This mockup has no active account link.'; return; }
+ if(id==='boot') return go(encrypted?'unlock':'local-login');
+ if(id==='ethernet') { returning=false; return go('signin'); }
+ if(id==='close-wifi') return go(networkBack);
+ if(id==='complete') return go('workspace');
+ if(id==='wifi-settings') networkBack=current;
+ if(['google','apple','email'].includes(id)) { provider={google:'Google',apple:'Apple',email:'email'}[id]; return go('browser'); }
+ go(id);
+}
+function render() {
+ const id=location.hash.slice(1);
+ current=id==='overview'||steps[id]?id:'install';
+ document.querySelectorAll('.nav-item').forEach(a=>{ if(a.dataset.group===(steps[current]?.group||current)) a.setAttribute('aria-current','step'); else a.removeAttribute('aria-current'); });
+ const all=current==='overview';
+ el('screen').hidden=all; el('details').hidden=all; el('overview').hidden=!all;
+ if(all) {
+ el('breadcrumb').textContent='Complete flow / All screens'; el('owner').textContent='Click a screen to explore';
+ el('overview').innerHTML=overviewPath.map((id,i)=>{const s=steps[id]; return `<a class="overview-card" href="#${id}"><div class="screen" aria-hidden="true" inert>${s.view()}</div><h3>${String(i+1).padStart(2,'0')} · ${value(s.title)}</h3><p>${s.owner}</p></a>`;}).join('');
+ return;
+ }
+ if(['existing','expired','offline'].includes(current)) returning=true;
+ if(['install','network','unlock','local-login'].includes(current)) returning=false;
+ const s=steps[current];
+ el('breadcrumb').textContent=s.label; el('owner').textContent=s.owner;
+ el('screen').innerHTML=s.view();
+ el('screen').setAttribute('aria-label',value(s.title)+' — screen preview');
+ const i=mainPath.indexOf(current);
+ el('step-label').textContent=i>=0?'First-use journey':'Alternate path';
+ el('title').textContent=value(s.title); el('description').textContent=s.description;
+ el('previous').disabled=!s.back && i<=0;
+ el('next').disabled=!s.next;
+ el('next').textContent=['browser','phone'].includes(current)?'Complete sign-in →':current==='poweroff'?'Turn computer on →':'Next →';
+ el('review-controls').innerHTML='<span>Preview controls</span>'+s.controls.map(([label,id])=>`<button class="small-button" data-action="${id}">${label}</button>`).join('');
+ el('review-controls').hidden=s.controls.length===0;
+}
+el('previous').addEventListener('click',()=>{const s=steps[current]; const id=value(s?.back)||mainPath[mainPath.indexOf(current)-1]; if(id) go(id);});
+el('next').addEventListener('click',()=>{const next=value(steps[current]?.next); if(next) go(next);});
+document.addEventListener('click',event=>{const control=event.target.closest('[data-action]'); if(control) action(control.dataset.action);});
+document.addEventListener('change',event=>{if(event.target.matches('[data-encryption]')) encrypted=event.target.checked;});
+document.addEventListener('keydown',event=>{
+ if(event.altKey||event.metaKey||event.ctrlKey) return;
+ const editing=event.target.matches('input,select,textarea');
+ if(editing) { if(event.key==='Enter'&&event.target.dataset.enter) {event.preventDefault(); action(event.target.dataset.enter);} return; }
+ if(event.key==='ArrowRight') {event.preventDefault(); el('next').click();}
+ if(event.key==='ArrowLeft') {event.preventDefault(); el('previous').click();}
+ if(event.key==='Escape') { if(current==='wifi-settings') go(networkBack); else if(['browser','phone','browser-error'].includes(current)) go('signin'); else if(['wifi-password','wifi-error'].includes(current)) go('network'); }
+ if(['ArrowUp','ArrowDown'].includes(event.key)) {
+ const controls=[...el('screen').querySelectorAll('button')]; if(!controls.length) return;
+ event.preventDefault(); const previous=controls.indexOf(document.activeElement); const index=(previous+(event.key==='ArrowDown'?1:-1)+controls.length)%controls.length; controls[index].focus();
+ }
+});
+window.addEventListener('hashchange',render);
+render();
+</script>
+</body>
+</html>
diff --git a/os/DEVELOPMENT.md b/os/DEVELOPMENT.md
index c3a450a7d..a49d37ca1 100644
--- a/os/DEVELOPMENT.md
+++ b/os/DEVELOPMENT.md
@@ -94,6 +94,13 @@ The same terminal process, heartbeat and project must survive. This is a quick
integration check, followed by a fresh final image test. It does not establish
physical laptop suspend, radio, audio or battery behavior.
+`checks=sign-in` reuses a verified image and installs the candidate OS launcher,
+onboarding script and exact-source TUI into a disposable BIOS installation. It
+checks that the real network form runs before the TUI, connecting Ethernet opens
+required sign-in, workspace shortcuts stay gated and Wi-Fi settings can return
+to sign-in. The receipt identifies the base image and each candidate file. This
+does not exercise a live account, physical Wi-Fi radio or a complete new image.
+
The focused sleep test uses QEMU standard VGA (`bochs-drm`), whose pinned LTS
driver implements display suspend/resume. The normal install tests retain
`virtio-vga`. Preview 4's Virtio display resumed with a working guest and terminal
diff --git a/os/README.md b/os/README.md
index 8421cf49a..4496162dd 100644
--- a/os/README.md
+++ b/os/README.md
@@ -17,6 +17,11 @@ the Wi-Fi page opens first and advances automatically when connected; Ethernet
skips that step. OpenCode starts on the left with two real terminals on the right.
There is no trial choice or installation dock.
+**Next build:** the OS finishes Wi-Fi or Ethernet setup before launching hn.
+hn then requires a Harness account before opening the workspace. The USB
+installer remains available offline. An already signed-in account can reopen
+local work during a temporary network outage.
+
Later launches restore existing work. The installed system keeps hn’s standard
status bar. Ctrl+b, then c opens a terminal in a new tab. Projects live under
`~/projects`. The full TUI reference and OS guide are bundled for agent questions.
@@ -204,10 +209,12 @@ and, when enabled, the disk. There is no first-boot account wizard.
`--config` file, set `username`, `hostname` and `encrypt` in that file instead.
Ordinary hn on macOS or another Linux distribution does not expose OS installation.
-On the installed system's first boot, the existing Wi-Fi page opens when there
-is no connection. Connecting advances automatically to OpenCode on the left and
-two terminal panes on the right. Working Ethernet skips Wi-Fi setup. Later boots
-reconnect to saved Wi-Fi and restore existing work. Super+n starts New Harness,
+On the installed system's first boot, the OS opens Wi-Fi setup when there is no
+connection. Working Ethernet skips that screen. Once connected, the OS launches
+hn, which asks for a Harness account. Signing in opens OpenCode on the left and
+two terminal panes on the right. Later boots reconnect to saved Wi-Fi and restore
+existing work; a temporary outage does not sign out an existing account.
+Super+n starts New Harness,
Super+t opens a shell directly, Super+m connects a computer, Super+w opens Wi-Fi
and Super+l locks the session behind the same wordmark and "Enter your password"
as disk unlock. Super+e opens the file manager in its own window, a folder
diff --git a/os/network.py b/os/network.py
index a7bf3cb56..62171e201 100644
--- a/os/network.py
+++ b/os/network.py
@@ -317,8 +317,8 @@ class NetworkPage:
curses.curs_set(0)
except curses.error:
pass
- # Both entry points share the same layout. Super+t remains available
- # from the compositor when setup cannot finish without a terminal.
+ # Initial setup and later Wi-Fi settings share the same layout.
+ # First use advances only once a network connection is available.
visible = max(1, min(10, height - self.top - 14 - len(self.wired)))
offset = max(0, min(self.selected, len(self.networks) - 1) - visible + 1)
networks = self.networks[offset:offset + visible]
diff --git a/os/onboarding.py b/os/onboarding.py
index 257873cba..622ce34ea 100644
--- a/os/onboarding.py
+++ b/os/onboarding.py
@@ -1,8 +1,19 @@
#!/usr/bin/env python3
-"""Open network setup directly, then give the workspace to the real agent."""
+"""Connect before launching hn; start the first workspace after hn's sign-in."""
import os
from pathlib import Path
import subprocess
+import sys
+
+
+def prepare():
+ if Path('/etc/harness-live').is_file() or (Path.home() / '.local/state/harness-os/onboarded').is_file():
+ return
+ # The OS owns initial connectivity. hn is launched only after this form
+ # succeeds; Ethernet advances immediately and Wi-Fi waits for a connection.
+ result = subprocess.run(['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
+ if result.returncode != 0:
+ raise SystemExit('Could not open Wi-Fi. Restart Harness to try again.')
def welcome():
@@ -10,10 +21,8 @@ def welcome():
if live:
os.execv('/usr/lib/harness-os/open-install', ['open-install'])
return
- # The installed first-use page advances as soon as connected.
- result = subprocess.run(['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
- if result.returncode != 0:
- raise SystemExit('Could not open Wi-Fi. Press Super+w to try again, or Super+t for a terminal.')
+ # Initial networking finished before hn launched. This pane is created only
+ # after hn's shared account gate has opened.
pane = os.environ.get('TMUX_PANE', '')
try:
result = subprocess.run(['hn', 'os-action', 'ready', pane], check=False, timeout=15)
@@ -27,4 +36,7 @@ def welcome():
if __name__ == '__main__':
- welcome()
+ if sys.argv[1:] == ['--prepare']:
+ prepare()
+ else:
+ welcome()
diff --git a/os/root/usr/bin/hn b/os/root/usr/bin/hn
index ab644ea24..3c4d80a2c 100644
--- a/os/root/usr/bin/hn
+++ b/os/root/usr/bin/hn
@@ -4,8 +4,8 @@
# of keeping a second Node process resident for the lifetime of the screen.
export HARNESS_CLI=/usr/bin/harness
export HARNESS_CLI_ARGS='[]'
-# This computer's working tabs must survive an update without a cloud account or
-# network. hn's ordinary local sessions retain their complete pane references.
+# This computer's working tabs survive sign-out and temporary network outages.
+# hn's ordinary local sessions retain their complete pane references.
# Signed in, these windows join the account's shared tabs as in the desktop app;
# on sign-out, the harnesses running on this computer stay.
export HARNESS_TUI_DESK=off HARNESS_TUI_DESK_SIGNED_IN=sync
@@ -20,4 +20,9 @@ if [ -f /etc/harness-live ]; then
else
unset HARNESS_OS_LIVE
fi
+# The OS connects before launching its interactive TUI. Commands sent to an
+# existing client must never open a form or wait for a network connection.
+if [ "${HARNESS_OS:-}" = 1 ] && [ "$#" -eq 0 ] && [ -t 0 ] && [ ! -f /etc/harness-live ]; then
+ /usr/bin/python3 /usr/lib/harness-os/onboarding.py --prepare || exit "$?"
+fi
exec "$harness_runtime/hn" "$@"
diff --git a/os/root/usr/share/harness-os/guide.md b/os/root/usr/share/harness-os/guide.md
index e4ed283c5..fc22663a6 100644
--- a/os/root/usr/share/harness-os/guide.md
+++ b/os/root/usr/share/harness-os/guide.md
@@ -26,8 +26,9 @@ This is a full Arch-based OS, with ordinary development tools installed as neede
## First conversation
Harness is already installed when the first agent opens. The USB goes directly
-to the offline installer. After installation and reboot, Wi-Fi setup appears if
-needed, then this agent opens beside two terminals. Do not suggest trying the OS
+to the offline installer. After installation and reboot, the OS finishes Wi-Fi
+or Ethernet setup, then opens hn for Harness sign-in. After sign-in, this agent
+opens beside two terminals. Do not suggest trying the OS
or ask the user to install it again.
Help the user accomplish something small: build a page, fix code, explore a repo,
@@ -88,10 +89,10 @@ These are separate from connecting computers. All agents running as the same
user on this computer can use its connected accounts without signing in again.
Account credentials are not synchronized to other computers.
+The workspace requires a Harness account. A rejected or expired session asks
+for sign-in again; a temporary network outage keeps already signed-in local work
+available. Wi-Fi settings remain available from sign-in with **Super+w**.
The **Connect a computer** action opens Harness's existing connection flow.
-This computer works without a Harness account. Connecting other computers uses
-the existing sign-in/link flow. If signed out, choose **Sign in on this computer**,
-complete the normal sign-in flow, then open **Connect a computer** again.
**Set up another computer** explains the other computer's setup. Guide the user there rather than
collecting passwords in chat. The other computer needs Harness running and its
connection configured. A sleeping/offline computer cannot run a new task for us.
diff --git a/os/tests/sign_in_vm.py b/os/tests/sign_in_vm.py
new file mode 100644
index 000000000..43fbad461
--- /dev/null
+++ b/os/tests/sign_in_vm.py
@@ -0,0 +1,164 @@
+#!/usr/bin/env python3
+"""Verify OS networking precedes the real TUI in a disposable installed VM."""
+import argparse
+from functools import partial
+import hashlib
+from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
+import json
+import os
+from pathlib import Path
+import shlex
+import subprocess
+import tarfile
+import threading
+import time
+
+from PIL import Image, ImageOps
+
+from session_vm import put
+from vm import VM
+
+ROOT = Path(__file__).resolve().parents[2]
+
+
+def digest(path):
+ with path.open('rb') as source:
+ return hashlib.file_digest(source, 'sha256').hexdigest()
+
+
+def screen_text(path):
+ # Both the OS form and hn use light text, but hn has a shaded panel. Global
+ # automatic thresholding mistakes that panel for ink. Normalize the known
+ # dark palette first; block OCR keeps a row's words on the same line.
+ readable = path.with_name(path.stem + '-ocr.png')
+ with Image.open(path) as frame:
+ ink = frame.convert('L').point(lambda value: 0 if value >= 96 else 255)
+ ink = ink.resize((frame.width * 2, frame.height * 2), Image.Resampling.NEAREST)
+ ImageOps.expand(ink, border=24, fill=255).save(readable)
+ return subprocess.check_output(['tesseract', str(readable), 'stdout', '--psm', '6'],
+ text=True, stderr=subprocess.DEVNULL, timeout=15)
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--iso', type=Path, required=True)
+ parser.add_argument('--tui', type=Path, required=True)
+ args = parser.parse_args()
+ if not os.access('/dev/kvm', os.R_OK | os.W_OK):
+ parser.error('Use native x86 KVM for this check.')
+ iso, tui = args.iso.resolve(), args.tui.resolve()
+ manifest = json.loads(iso.with_name('manifest.json').read_text())
+ assert digest(iso) == manifest['iso']['sha256']
+ assert iso.stat().st_size == manifest['iso']['bytes']
+ files = {
+ 'usr/bin/hn': ROOT / 'os/root/usr/bin/hn',
+ 'usr/lib/harness-os/onboarding.py': ROOT / 'os/onboarding.py',
+ 'usr/lib/harness/harness-tui': tui,
+ }
+ folder = ROOT / 'os/test-results/required-sign-in'
+ folder.mkdir(parents=True, exist_ok=False)
+ served = folder / 'served'
+ served.mkdir()
+ payload = served / 'candidate.tar.gz'
+ def root_owned(info):
+ info.uid = info.gid = 0
+ info.uname = info.gname = 'root'
+ return info
+ with tarfile.open(payload, 'w:gz') as archive:
+ for destination, source in files.items():
+ archive.add(source, arcname=destination, filter=root_owned)
+ server = ThreadingHTTPServer(('127.0.0.1', 0), partial(SimpleHTTPRequestHandler, directory=str(served)))
+ threading.Thread(target=server.serve_forever, daemon=True).start()
+ vm = VM(folder, iso, 'bios', 2048)
+ result = {'status': 'running', 'started_at': time.time(), 'checks': [],
+ 'source_commit': subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(),
+ 'image_source': manifest['source_commit'], 'iso_sha256': manifest['iso']['sha256'],
+ 'candidate_files': {name: digest(path) for name, path in files.items()},
+ 'scope': 'BIOS/plain disposable installation, real NetworkManager/virtual Ethernet, graphical input and required TUI sign-in. No live account or physical radio.'}
+ config = dict(disk='/dev/vda', expected_serial='HN_OS_TEST', confirm_erase='/dev/vda',
+ username='me', hostname='harness', password='test-password-123',
+ encrypt=False, serial_console=True)
+
+ def shown(name, text):
+ deadline = time.monotonic() + 90
+ while True:
+ vm.screenshot(name)
+ observed = screen_text(folder / (name + '.png'))
+ (folder / (name + '.txt')).write_text(observed)
+ if text.lower() in observed.lower():
+ return
+ if time.monotonic() >= deadline:
+ raise AssertionError(f'{text} was not visible')
+ time.sleep(1)
+
+ try:
+ vm.start(live=True)
+ vm.wait(r'root@[^\r\n]*[#] ', timeout=180)
+ vm.shell_ready = True
+ vm.command('stty -echo')
+ # The selected Install button is reverse video; whole-screen inverted
+ # OCR misses its text. The ordinary password label identifies the form.
+ shown('01-usb-installer', 'Repeat password')
+ put(vm, '/tmp/sign-in-install.json', json.dumps(config))
+ vm.command('nmcli networking off')
+ output, _ = vm.command('harness install --config /tmp/sign-in-install.json --yes-erase-disk', timeout=360)
+ (folder / 'install.log').write_text(output)
+ result['checks'].append('The USB installer works offline before a Harness account exists')
+ # Apply only the recorded candidate files before the first installed boot.
+ # The sole block device is the fixture-owned, serial-checked QEMU disk.
+ vm.command('nmcli networking on; nm-online -q --timeout=30', timeout=35)
+ vm.command(f'curl --noproxy "*" -fsS --max-time 90 http://10.0.2.2:{server.server_port}/candidate.tar.gz -o /tmp/candidate.tar.gz', timeout=100)
+ vm.command('printf %s ' + shlex.quote(digest(payload) + ' /tmp/candidate.tar.gz\n') + ' | sha256sum -c -')
+ vm.command('mkdir -p /mnt/sign-in-test && mount -o subvol=@ /dev/vda3 /mnt/sign-in-test && '
+ 'tar -xzf /tmp/candidate.tar.gz -C /mnt/sign-in-test && '
+ 'chmod 755 /mnt/sign-in-test/usr/bin/hn /mnt/sign-in-test/usr/lib/harness/harness-tui && '
+ 'sync && umount /mnt/sign-in-test')
+ vm.stop()
+ vm.start(live=False)
+ vm.monitor('set_link', name='hnnet', up=False)
+ vm.login_installed(config, wait_workspace=False)
+ vm.command('printf %s ' + shlex.quote(config['password'] + '\n') + ' | sudo -S -v')
+ shown('02-network-before-tui', 'Connect to Wi-Fi')
+ vm.command('! pgrep -u 1000 -f "^/usr/lib/harness/hn$" && ! pgrep -u 1000 -x opencode')
+ vm.keys('esc')
+ vm.keys('meta_l', 't')
+ shown('03-network-still-required', 'Connect to Wi-Fi')
+ result['checks'].append('The actual OS network form owns first setup; the TUI and agent have not launched, and Escape/workspace shortcuts cannot bypass it')
+ vm.monitor('set_link', name='hnnet', up=True)
+ vm.command('nm-online -q --timeout=30', timeout=35)
+ shown('04-required-sign-in', 'Sign in to Harness')
+ shown('05-sign-in-choices', 'Continue with email')
+ vm.command('test ! -e ~/.local/state/harness-os/onboarded && ! pgrep -u 1000 -x opencode')
+ vm.command('printf %s ' + shlex.quote(digest(tui) + ' /usr/lib/harness/harness-tui\n') + ' | sha256sum -c -')
+ result['checks'].append('Connecting Ethernet launches the exact candidate TUI at required sign-in, without starting an agent or claiming completed onboarding')
+ for key in ['t', 'n', 'm']:
+ vm.keys('meta_l', key)
+ shown('06-gated-' + key, 'Sign in to Harness')
+ vm.keys('meta_l', 'w')
+ shown('07-wifi-from-sign-in', 'Connect to Wi-Fi')
+ vm.keys('esc')
+ shown('08-back-to-sign-in', 'Sign in to Harness')
+ result['checks'].append('Real compositor shortcuts keep workspace actions gated; the existing Wi-Fi settings form opens and returns to sign-in')
+ result['status'] = 'passed'
+ except Exception as error:
+ result['status'] = 'failed'
+ result['error'] = str(error)
+ try:
+ vm.screenshot('failure')
+ output, _ = vm.command('journalctl --user -u hn-screen -u harness-daemon --no-pager -n 150', check=False)
+ (folder / 'services.log').write_text(output)
+ except Exception:
+ pass
+ raise
+ finally:
+ vm.stop()
+ server.shutdown()
+ server.server_close()
+ result['finished_at'] = time.time()
+ (folder / 'receipt.json').write_text(json.dumps(result, indent=2) + '\n')
+ if result['status'] == 'passed':
+ vm.disk.unlink(missing_ok=True)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/os/tests/test_onboarding.py b/os/tests/test_onboarding.py
index 125657aa1..e09501086 100644
--- a/os/tests/test_onboarding.py
+++ b/os/tests/test_onboarding.py
@@ -1,6 +1,8 @@
import importlib.util
import os
from pathlib import Path
+import pty
+import shlex
import subprocess
import tempfile
import unittest
@@ -16,7 +18,7 @@ def result(code=0):
class Onboarding(unittest.TestCase):
- def test_installed_network_page_advances_to_agent_and_workspace(self):
+ def test_signed_in_welcome_starts_the_agent_without_reopening_networking(self):
with tempfile.TemporaryDirectory() as temp, \
patch.object(onboarding.Path, 'is_file', return_value=False), \
patch.object(onboarding.Path, 'home', return_value=Path(temp)), \
@@ -25,8 +27,8 @@ class Onboarding(unittest.TestCase):
patch.dict(os.environ, {'TMUX_PANE': '%4'}):
onboarding.welcome()
self.assertEqual(command.call_args_list[0].args[0],
- ['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
- self.assertEqual(command.call_args_list[1].args[0], ['hn', 'os-action', 'ready', '%4'])
+ ['hn', 'os-action', 'ready', '%4'])
+ self.assertEqual(command.call_count, 1)
execute.assert_called_once_with('/usr/bin/hn-os', ['hn-os', 'try'])
self.assertTrue((Path(temp) / '.local/state/harness-os/onboarded').exists())
@@ -41,7 +43,7 @@ class Onboarding(unittest.TestCase):
def test_failed_layout_request_does_not_mark_first_use_complete(self):
with tempfile.TemporaryDirectory() as temp, patch.object(onboarding.Path, 'is_file', return_value=False), \
patch.object(onboarding.Path, 'home', return_value=Path(temp)), \
- patch.object(onboarding.subprocess, 'run', side_effect=[result(), subprocess.TimeoutExpired('hn', 15)]), \
+ patch.object(onboarding.subprocess, 'run', side_effect=subprocess.TimeoutExpired('hn', 15)), \
patch.object(onboarding.os, 'execv') as execute:
onboarding.welcome()
self.assertFalse((Path(temp) / '.local/state/harness-os/onboarded').exists())
@@ -52,5 +54,62 @@ class Onboarding(unittest.TestCase):
patch.object(onboarding.subprocess, 'run', return_value=result(1)), \
patch.object(onboarding.os, 'execv') as execute:
with self.assertRaisesRegex(SystemExit, 'Could not open Wi-Fi'):
- onboarding.welcome()
+ onboarding.prepare()
execute.assert_not_called()
+
+ def test_first_use_requires_networking_before_the_tui_starts(self):
+ with patch.object(onboarding.Path, 'is_file', return_value=False), \
+ patch.object(onboarding.subprocess, 'run', return_value=result()) as command, \
+ patch.object(onboarding.os, 'execv') as execute:
+ onboarding.prepare()
+ command.assert_called_once_with(
+ ['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
+ execute.assert_not_called()
+
+ def test_completed_setup_can_reopen_offline_and_usb_never_requires_network(self):
+ for files in ([False, True], [True]):
+ with self.subTest(files=files), \
+ patch.object(onboarding.Path, 'is_file', side_effect=files), \
+ patch.object(onboarding.subprocess, 'run') as command:
+ onboarding.prepare()
+ command.assert_not_called()
+
+ def test_launcher_connects_before_tui_and_stops_if_setup_fails(self):
+ with tempfile.TemporaryDirectory() as temp:
+ root = Path(temp)
+ events = root / 'events'
+ runtime = root / 'runtime'
+ runtime.mkdir()
+ for name, text in {
+ 'python': 'echo network >> "$EVENTS"; exit "$NETWORK_RESULT"',
+ 'runtime/hn': 'echo "tui $*" >> "$EVENTS"',
+ }.items():
+ path = root / name
+ path.write_text('#!/bin/sh\n' + text + '\n')
+ path.chmod(0o755)
+ source = (Path(__file__).resolve().parents[1] / 'root/usr/bin/hn').read_text()
+ source = source.replace('. /usr/lib/harness-os/runtime-path',
+ 'harness_runtime=' + shlex.quote(str(runtime)))
+ source = source.replace('/usr/bin/python3', shlex.quote(str(root / 'python')))
+ source = source.replace('/etc/harness-live', str(root / 'not-live'))
+ launcher = root / 'launcher'
+ launcher.write_text(source)
+ master, slave = pty.openpty()
+ try:
+ for args, os_mode, code, expected in [
+ ([], '1', '0', ['network', 'tui ']),
+ (['list-panes'], '1', '0', ['tui list-panes']),
+ ([], '0', '0', ['tui ']),
+ ([], '1', '1', ['network']),
+ ]:
+ with self.subTest(args=args, os_mode=os_mode, code=code):
+ events.unlink(missing_ok=True)
+ completed = subprocess.run(['/bin/sh', str(launcher), *args], stdin=slave,
+ capture_output=True, text=True, timeout=5,
+ env=dict(os.environ, HOME=str(root), HARNESS_OS=os_mode,
+ EVENTS=str(events), NETWORK_RESULT=code))
+ self.assertEqual(events.read_text().splitlines(), expected)
+ self.assertEqual(completed.returncode, int(code), completed.stderr)
+ finally:
+ os.close(master)
+ os.close(slave)
diff --git a/os/tests/vm.py b/os/tests/vm.py
index c2fedb76e..6899f9350 100644
--- a/os/tests/vm.py
+++ b/os/tests/vm.py
@@ -253,7 +253,7 @@ class VM:
raise RuntimeError(f'Guest file transfer is incomplete: {path}')
return base64.b64decode(''.join(match.group(1).splitlines()), validate=True)
- def login_installed(self, config, unlock_delay=0):
+ def login_installed(self, config, unlock_delay=0, wait_workspace=True):
if config['encrypt']:
self.unlock_count += 1
self.wait_unlock()
@@ -288,7 +288,8 @@ class VM:
self.keys('minus' if char == '-' else char)
self.keys('ret')
time.sleep(2)
- self.command('for n in $(seq 1 90); do systemctl --user is-active --quiet hn-screen && pgrep -x "hn|harness-tui" >/dev/null && exit 0; sleep 1; done; exit 1', timeout=110)
+ if wait_workspace:
+ self.command('for n in $(seq 1 90); do systemctl --user is-active --quiet hn-screen && pgrep -x "hn|harness-tui" >/dev/null && exit 0; sleep 1; done; exit 1', timeout=110)
self.command('/usr/lib/harness-os/wait-runtime', timeout=160)
self.boot_event('harness-ready')
diff --git a/tui/README.md b/tui/README.md
index dcee079f4..969db73e8 100644
--- a/tui/README.md
+++ b/tui/README.md
@@ -184,19 +184,24 @@ with the desktop and phone. With no daemon available, hn opens local shells inst
PTY supervisor keeps them running through detach, reconnect and a client crash. These local
sessions stay on this computer and remain intact when Harness reconnects.
-On a fresh computer `hn` starts your local daemon and opens without requiring an account.
-Choose **Sign in** in the status bar, or run `account` from `C-b :`, when you want your other
-machines, shared desk and access from your phone. The Account panel explains these benefits and
-offers browser sign-in or a phone QR code; you confirm the account before connecting it.
+`hn` requires a Harness account before opening the workspace, including in Harness OS and on existing signed-out
+installations. Continue with Google, Apple or email in your browser, or approve a phone QR code
+when using SSH. Escape cancels an attempt and returns to the sign-in choices; Ctrl+C detaches.
+Signing in opens your saved workspace automatically. Already signed-in computers open offline too.
+Harness OS connects to Wi-Fi or Ethernet before launching the TUI at that same sign-in page. Its installer
+works offline; Super+W keeps network settings accessible before sign-in. After first setup,
+an already signed-in account can reopen its workspace during a temporary outage.
+Explicit sign-out and a session the server rejects both return to required sign-in, as Desktop
+does. The background server keeps running throughout, preserving local work behind the page.
`harness login` remains available from a shell. Signing in keeps local work in place; changing
accounts removes the previous account's views without stopping its harnesses. If daemon startup
-fails, hn still opens a local shell. Each OS user connects through their own private Unix socket;
+fails, a signed-in computer can still open a local shell. Each OS user connects through their own private Unix socket;
hn never attaches to another user's daemon merely because it occupies the default TCP port.
Like `tmux new -A`, it restores your swarms if the desk has any,
else window 0 opens your shell in the folder you ran `hn` from. `C-b s` finds every
harness. Closing the last window ends `hn` (`[exited]`, as tmux says it); `C-b d` detaches.
-![Optional sign-in with local work still available](docs/account.png)
+[Required account entry (terminal capture)](../docs/research/2026-10-08-onboarding-redesign/tui-sign-in.txt)
<sub>Rendered from the isolated native fixture in `tests/workspace-controls.py`.</sub>
@@ -690,7 +695,7 @@ arm64, musl) with a checksummed manifest that `harness tui --install` verifies.
| `input.rs` | keys, mouse, the launcher's modes and actions |
| `workspace_controls.rs` / `workspace_menu.rs` | pane and footer controls, stable action targets and compact menus |
| `session_close.rs` / `agent_switch.rs` / `workspace_events.rs` | save-and-stop lifecycle, agent handoff and view updates between local clients |
-| `account.rs` / `account_scope.rs` | optional sign-in and account-aware workspace restoration |
+| `account.rs` / `account_scope.rs` | required sign-in and account-aware workspace restoration |
| `hardware.rs` / `workspace_resources.rs` | physical device settings and workspace counts |
| `dial.rs` | the Harness device: the ring and windows it turns through, its focus, scroll, taps and spoken tasks |
| `modal.rs` / `picker.rs` | the launcher's rows and its fzf matching (fzf.rs, ported from fzf) |
diff --git a/tui/src/account.rs b/tui/src/account.rs
index 4ba5654f3..7b2f64b39 100644
--- a/tui/src/account.rs
+++ b/tui/src/account.rs
@@ -1,4 +1,4 @@
-//! Optional account entry. Authentication remains owned by the installed CLI,
+//! Required account entry. Authentication remains owned by the installed CLI,
//! including cancellation, browser callbacks and phone approval; hn never reads tokens.
use std::time::{Duration, Instant};
@@ -40,6 +40,8 @@ enum Driver { Answer(bool), Cancel }
#[derive(Default)]
pub struct State {
pub status: Status,
+ mandatory: bool,
+ entry_required: bool,
phase: Phase,
checked: Option<Instant>,
checking: bool,
@@ -51,6 +53,107 @@ pub struct State {
started: Vec<Vec<String>>,
}
+pub fn entry_required(app: &App) -> bool { app.account.entry_required && !app.headless }
+
+/// Every interactive workspace needs an account, including the OS's bundled TUI.
+/// Detached servers keep their sessions running.
+pub fn begin_entry(app: &mut App) {
+ app.account.mandatory = true;
+ app.account.entry_required = true;
+ enforce_entry(app);
+}
+
+/// The local daemon already read this computer's saved identity during startup. Reuse that
+/// answer, including offline sign-ins, rather than putting a network round trip before work.
+pub fn daemon_status(app: &mut App, status: &Value) {
+ if app.account.mandatory && status["signedIn"] == false && !signing_in(app) && app.account.phase != Phase::SigningOut {
+ app.account.status = Status::SignedOut;
+ app.account.entry_required = true;
+ }
+ if entry_required(app) && app.account.status == Status::Unknown && !signing_in(app) {
+ match status["signedIn"].as_bool() {
+ Some(true) => app.account.status = Status::SignedIn { offline: status["offline"] == true, email: None },
+ Some(false) => app.account.status = Status::SignedOut,
+ None => {}
+ }
+ }
+ enforce_entry(app);
+ refill(app);
+}
+
+pub fn enforce_entry(app: &mut App) {
+ if app.account.mandatory && app.account.status == Status::SignedOut {
+ app.account.entry_required = true;
+ }
+ if !entry_required(app) { return }
+ if matches!(app.account.status, Status::SignedIn { .. }) && !signing_in(app) && app.account.phase != Phase::SigningOut {
+ app.account.entry_required = false;
+ if visible(app) { app.modal = None; }
+ app.redraw_all = true;
+ app.maybe_start_shell();
+ } else if !visible(app) && crate::os_welcome::entry_wifi(app).is_none() {
+ crate::input::picker(app, PickerKind::Account, "Sign in to Harness", "");
+ }
+}
+
+/// The entry page owns input before pane shortcuts, paste, mouse or OS welcome controls.
+/// Esc cancels a sign-in attempt; Ctrl+C leaves hn without stopping its harnesses.
+pub fn entry_input(app: &mut App, event: &crossterm::event::Event) -> bool {
+ use crossterm::event::{Event, KeyCode, KeyEventKind, KeyModifiers, MouseButton, MouseEventKind};
+ if !entry_required(app) { return false }
+ enforce_entry(app);
+ if !entry_required(app) { return false }
+ if let Some(pane) = crate::os_welcome::entry_wifi(app) {
+ return crate::input::system_form_input(app, pane, event);
+ }
+ let mut accept = false;
+ match event {
+ Event::Key(key) => {
+ if key.kind == KeyEventKind::Release { return true }
+ let ctrl = key.modifiers.contains(KeyModifiers::CONTROL);
+ match key.code {
+ KeyCode::Char('c') if ctrl => { cancel(app); app.quit = true; }
+ KeyCode::Esc => { cancel(app); refill(app); }
+ KeyCode::Enter => accept = true,
+ _ => if let Some(Modal::Picker { picker, .. }) = &mut app.modal {
+ match key.code {
+ KeyCode::Up | KeyCode::BackTab => picker.move_by(-1),
+ KeyCode::Down | KeyCode::Tab => picker.move_by(1),
+ KeyCode::Char('k') if !ctrl => picker.move_by(-1),
+ KeyCode::Char('j') if !ctrl => picker.move_by(1),
+ _ => {}
+ }
+ }
+ }
+ }
+ Event::Paste(_) => {}
+ Event::Mouse(mouse) => {
+ if !app.mouse { return true }
+ if let Some(Modal::Picker { picker, .. }) = &mut app.modal {
+ match mouse.kind {
+ MouseEventKind::ScrollUp => picker.move_by(-1),
+ MouseEventKind::ScrollDown => picker.move_by(1),
+ MouseEventKind::Down(MouseButton::Left) if picker.list_area.get().contains(Position::new(mouse.column, mouse.row)) => {
+ let row = picker.scroll + (mouse.row - picker.list_area.get().y) as usize;
+ picker.vset(row as i64, 1);
+ accept = true;
+ }
+ _ => {}
+ }
+ }
+ }
+ _ => return false,
+ }
+ if accept {
+ if let Some(Modal::Picker { picker, .. }) = app.modal.take() {
+ let id = picker.current_id().unwrap_or_default();
+ choose(app, picker, &id);
+ }
+ }
+ enforce_entry(app);
+ true
+}
+
pub fn label(app: &App) -> &'static str {
if app.account.status == Status::SignedOut { "Sign in" } else { "Account" }
}
@@ -122,6 +225,7 @@ pub fn refresh(app: &mut App, force: bool) {
}
}
}
+ enforce_entry(app);
refill(app);
});
}
@@ -137,9 +241,10 @@ fn load_email(app: &mut App, generation: u64) {
}
pub fn tick(app: &mut App) {
+ enforce_entry(app);
let open = visible(app);
if !open && !matches!(app.account.phase, Phase::Committed | Phase::Completing) { cancel(app); }
- if !app.headless && (app.account.checked.is_none() || open) { refresh(app, false); }
+ if !app.headless && (app.account.mandatory || app.account.checked.is_none() || open) { refresh(app, false); }
if matches!(app.account.phase, Phase::Phone { expires, .. } if Instant::now() >= expires) {
cancel(app);
app.account.phase = Phase::Failed("This code expired. Choose Sign in with phone to get a new one.".into());
@@ -150,8 +255,12 @@ pub fn tick(app: &mut App) {
pub fn fill(app: &App, picker: &mut Picker) {
picker.keep_order = true;
picker.preview = true;
- picker.hints = vec![("↑↓", "choose"), ("enter", "open"), ("esc", "back")];
+ picker.hints = vec![("↑↓", "choose"), ("enter", "open"), if entry_required(app) { ("^C", "quit") } else { ("esc", "back") }];
let mut rows = Vec::new();
+ if entry_required(app) && app.account.status == Status::Unknown && app.account.phase == Phase::Ready {
+ rows.push(Row::new(if app.account.checking || app.account.checked.is_none() { "account:wait" } else { "account:retry" },
+ if app.account.checking || app.account.checked.is_none() { "Checking your account…" } else { "Retry account check" }));
+ } else {
match &app.account.phase {
Phase::Starting => rows.push(Row::new("account:wait", app.account.waiting.as_deref().unwrap_or("Starting sign-in…"))),
Phase::Browser(_) => {
@@ -177,14 +286,13 @@ pub fn fill(app: &App, picker: &mut Picker) {
_ => {
rows.push(Row::new("account:google", "Continue with Google"));
rows.push(Row::new("account:apple", "Continue with Apple"));
+ rows.push(Row::new("account:email", "Continue with email"));
rows.push(Row::new("account:qr", "Continue with your phone"));
}
},
}
- // Signed in, Esc is the way back; signed out, "Keep using locally" says that sign-in is optional.
- if !matches!(app.account.status, Status::SignedIn { .. }) { rows.push(Row::new("account:back", "Keep using locally")) }
- // These are page actions, not a growing search result list. Keep Back last
- // across sign-in phases; set_rows still preserves the selected action by ID.
+ }
+ // These are page actions, not a growing search result list.
picker.rows.clear();
picker.set_rows(rows);
picker.busy = matches!(app.account.phase, Phase::Starting | Phase::Completing | Phase::Committed | Phase::SigningOut).then(|| "waiting".into());
@@ -206,7 +314,7 @@ pub fn preview(app: &App, _: &str) -> Vec<Line<'static>> {
lines.push(Line::raw(email.as_ref().map(|e| format!("Signed in as {e}")).unwrap_or_else(|| "Signed in".into())));
if *offline { lines.push(Line::raw("Account is offline. Local work is still available.")); }
}
- _ => lines.push(Line::raw("Sign-in is optional. Work on this computer anytime.")),
+ _ => lines.push(Line::raw("Sign in to continue. Your saved tabs and running harnesses stay here.")),
}
lines.push(Line::raw(""));
match &app.account.phase {
@@ -239,12 +347,12 @@ pub fn draw(buf: &mut Buffer, app: &App, body: Rect, picker: &mut Picker) -> Opt
picker.list_area.set(Rect::default());
picker.screen_area.set(body);
if body.width < 24 || body.height < 8 {
- put(buf, body.x, body.y, body.width, "Account · resize or Esc", c.base);
+ put(buf, body.x, body.y, body.width, if entry_required(app) { "Sign in · resize or ^C quit" } else { "Account · resize or Esc" }, c.base);
return None;
}
let available = settings::area(body, settings::PanelSize::Large, 0);
let phone = matches!(app.account.phase, Phase::Phone { .. });
- let (w, h) = (available.width.min(if phone { 108 } else { 76 }), available.height.min(if phone { 30 } else { 16 }));
+ let (w, h) = (available.width.min(if phone { 108 } else { 76 }), available.height.min(if phone { 30 } else { 18 }));
let r = Rect::new(body.x + (body.width - w) / 2, body.y + (body.height - h) / 2, w, h);
settings::fill(buf, r, c.base);
picker.screen_area.set(r);
@@ -262,19 +370,21 @@ pub fn draw(buf: &mut Buffer, app: &App, body: Rect, picker: &mut Picker) -> Opt
} else { needs_room = true; }
}
let width = right.saturating_sub(x);
- put(buf, x, r.y + 1, width, "Your Harness account", c.base.add_modifier(Modifier::BOLD));
+ put(buf, x, r.y + 1, width, if entry_required(app) { "Sign in to Harness" } else { "Your Harness account" }, c.base.add_modifier(Modifier::BOLD));
let mut lines = match &app.account.phase {
Phase::Ready => match &app.account.status {
Status::SignedIn { email, offline } => vec![Line::raw(email.clone().unwrap_or_else(|| "Signed in".into())),
Line::raw(if *offline { "Account is offline. Local work is still available." } else { "Manage your connected computers and phone." })],
+ _ if entry_required(app) => vec![Line::raw("All your machines. Your tabs everywhere."), Line::raw(""),
+ Line::raw(if app.account.status == Status::Unknown { "Checking this computer's account. Your work stays here." } else { "Your saved tabs stay here. Running harnesses keep running." })],
_ => vec![Line::raw("Connect computers and sync your workspace."), Line::raw("Use models on a linked machine. Follow work from your phone."),
- Line::raw(""), Line::raw("Sign-in is optional. Keep working locally anytime.")],
+ Line::raw(""), Line::raw("Sign in to continue.")],
},
Phase::Browser(_) => vec![Line::raw("Finish signing in in your browser."), Line::raw("Using SSH? Cancel and choose Continue with your phone.")],
Phase::Failed(message) => vec![Line::raw(message.clone())],
Phase::Phone { .. } => preview(app, ""),
Phase::Starting => vec![Line::raw(app.account.waiting.clone().unwrap_or_else(|| "Opening sign-in…".into()))],
- Phase::Completing => vec![Line::raw("Finishing sign-in. You can return to your workspace.")],
+ Phase::Completing => vec![Line::raw("Finishing sign-in…")],
Phase::Committed => vec![Line::raw("Signed in. Connecting this computer…")],
Phase::SigningOut => vec![Line::raw(SIGNING_OUT)],
};
@@ -295,7 +405,9 @@ pub fn draw(buf: &mut Buffer, app: &App, body: Rect, picker: &mut Picker) -> Opt
.render(Rect::new(x, description_top, width, list_top.saturating_sub(description_top + if compact { 0 } else { 1 })), buf);
}
settings::list(buf, picker, Rect::new(x, list_top, width, count), &c, false);
- let hint = if picker.query.is_empty() { if compact { "↑↓ choose · Enter · Esc back".into() } else { "↑↓ choose enter open esc back".into() } } else { format!("Filter: {}", picker.query) };
+ let hint = if entry_required(app) {
+ if compact { "↑↓ choose · Enter · ^C quit".into() } else { "↑↓ choose enter open esc cancel ^C quit".into() }
+ } else if picker.query.is_empty() { if compact { "↑↓ choose · Enter · Esc back".into() } else { "↑↓ choose enter open esc back".into() } } else { format!("Filter: {}", picker.query) };
put(buf, x, hint_y, width, &hint, c.muted);
None
}
@@ -303,7 +415,7 @@ pub fn draw(buf: &mut Buffer, app: &App, body: Rect, picker: &mut Picker) -> Opt
pub fn choose(app: &mut App, mut picker: Picker, id: &str) {
// Reattach before callbacks update the view; every completion checks its own attempt.
let action = id.strip_prefix("account:").unwrap_or("");
- if action == "back" { cancel(app); return }
+ if action == "back" { cancel(app); enforce_entry(app); return }
if matches!(action, "machines" | "phone") {
crate::input::run(app, if action == "machines" { "connect-machine" } else { "add-phone" });
return;
@@ -311,7 +423,8 @@ pub fn choose(app: &mut App, mut picker: Picker, id: &str) {
picker.set_query("");
app.modal = Some(Modal::Picker { kind: PickerKind::Account, picker });
match action {
- "google" | "apple" | "qr" => start(app, action),
+ "google" | "apple" | "email" | "qr" => start(app, action),
+ "retry" => { refresh(app, true); refill(app); }
"signout" => ask_sign_out(app, true),
"cancel" => { cancel(app); refill(app); }
"browser" => { if let Phase::Browser(url) = &app.account.phase { open_browser(app, url.clone()); } }
@@ -347,7 +460,9 @@ fn start(app: &mut App, method: &str) {
if app.account.driver.is_some() || matches!(app.account.status, Status::SignedIn { .. }) { return }
app.account.generation += 1;
let generation = app.account.generation;
- let mut args = vec!["login".into(), "--json".into(), "--entry-point=tui".into(), format!("--{method}")];
+ let mut args = vec!["login".into(), "--json".into(), "--entry-point=tui".into()];
+ // With no provider hint the existing SSO page offers email and a verification code.
+ if method != "email" { args.push(format!("--{method}")); }
if app.account.status == Status::SignedOut { args.push("--force".into()); }
let (driver, receive) = mpsc::unbounded_channel();
app.account.driver = Some(driver);
@@ -378,7 +493,7 @@ fn cli() -> tokio::process::Command {
}
/// Sign out as the desktop app does: `harness logout` clears the sign-in and brings this
-/// computer's daemon back signed out, so the harnesses here stay on screen.
+/// computer's daemon back signed out. Local harnesses keep running behind required sign-in.
fn sign_out(app: &mut App) {
if app.account.driver.is_some() || app.account.phase == Phase::SigningOut || !matches!(app.account.status, Status::SignedIn { .. }) { return }
app.account.generation += 1;
@@ -405,12 +520,14 @@ fn signed_out(app: &mut App, generation: u64, ok: bool) {
if ok {
app.account.status = Status::SignedOut;
app.account.phase = Phase::Ready;
+ begin_entry(app);
reconnect(app);
refresh(app, true);
} else {
app.account.phase = Phase::Failed("Could not sign out. Try again.".into());
refresh(app, true);
}
+ enforce_entry(app);
refill(app);
}
@@ -497,6 +614,7 @@ fn finished(app: &mut App, generation: u64, committed: bool, error: Option<Strin
} else if !matches!(app.account.phase, Phase::Failed(_)) {
app.account.phase = Phase::Failed(error.unwrap_or_else(|| "Sign-in did not complete. Try again.".into()));
}
+ enforce_entry(app);
refill(app);
}
@@ -563,7 +681,7 @@ async fn drive(mut command: tokio::process::Command, generation: u64, sink: mpsc
drain.abort();
let error = if committed && !exited {
Some("Signed in, but this computer could not reconnect. Run harness start, then reopen Account.".into())
- } else if cancelled && !committed { Some("Sign-in was cancelled or timed out. You can keep working locally.".into()) }
+ } else if cancelled && !committed { Some("Sign-in was cancelled or timed out. Try signing in again.".into()) }
else { None };
done(committed, error);
}
@@ -602,7 +720,7 @@ mod tests {
}
#[test]
- fn local_use_and_opening_account_never_start_sign_in() {
+ fn account_entry_waits_for_an_explicit_provider_choice() {
let mut app = app();
let seen = Arc::new(Mutex::new(Vec::new()));
let log = seen.clone();
@@ -615,8 +733,9 @@ mod tests {
assert!(app.account.started.is_empty());
open(&mut app);
let (text, _) = render(&mut app, 80, 24);
- for expected in ["Connect computers", "Sign-in is optional", "Keep using locally", "Continue with Google"] { assert!(text.contains(expected), "missing {expected}:\n{text}"); }
- select(&mut app, "account:back");
+ for expected in ["Connect computers", "Sign in to continue", "Continue with email", "Continue with Google"] { assert!(text.contains(expected), "missing {expected}:\n{text}"); }
+ assert!(!text.contains("Keep using locally"));
+ key(&mut app, KeyCode::Esc);
tick(&mut app);
assert!(app.modal.is_none());
assert!(app.account.started.is_empty());
@@ -631,7 +750,7 @@ mod tests {
crate::input::picker(&mut app, PickerKind::Account, "Your Harness account", "");
let (text, _) = render(&mut app, 40, 12);
for label in if signed_in { vec!["Connect a machine", "Add your phone", "Sign out"] }
- else { vec!["Continue with Google", "Continue with Apple", "Continue with your phone", "Keep using locally"] } {
+ else { vec!["Continue with Google", "Continue with Apple", "Continue with email", "Continue with your phone"] } {
assert!(text.contains(label), "{label}\n{text}");
}
if signed_in { for gone in ["Models on your machines", "Back to workspace"] { assert!(!text.contains(gone), "{gone} is not offered\n{text}") } }
@@ -641,6 +760,114 @@ mod tests {
}
}
+ #[test]
+ fn required_entry_owns_keys_paste_and_mouse_without_touching_saved_tabs() {
+ use crossterm::event::{MouseButton, MouseEvent, MouseEventKind};
+ let mut app = app();
+ app.devices.runner = Some(Box::new(|_| None));
+ app.rename_tab("Saved project");
+ app.keymap.bind(crate::keys::Table::Root, crate::keys::of(&KeyEvent::new(KeyCode::Char('x'), KeyModifiers::NONE)), "new-window".into(), false);
+ begin_entry(&mut app);
+ let tabs = app.tabs.len();
+ let (text, _) = render(&mut app, 80, 24);
+ assert!(text.contains("Sign in to Harness") && text.contains("Continue with email"), "{text}");
+ assert!(!text.contains("Saved project") && !text.contains("Keep using locally"), "the workspace is covered");
+ for event in [Event::Key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE)),
+ Event::Key(KeyEvent::new(KeyCode::Char('x'), KeyModifiers::NONE)),
+ Event::Paste("new-window\n".into()),
+ Event::Mouse(MouseEvent { kind: MouseEventKind::Down(MouseButton::Left), column: 0, row: 0, modifiers: KeyModifiers::NONE })] {
+ crate::input::handle(&mut app, event);
+ assert!(entry_required(&app) && visible(&app));
+ }
+ assert_eq!(app.tabs.len(), tabs);
+ assert_eq!(app.tab().name, "Saved project");
+ assert!(app.account.started.is_empty());
+ crate::input::handle(&mut app, Event::Key(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)));
+ assert!(app.quit);
+ assert_eq!(app.tabs.len(), tabs, "quit detaches without destroying saved work");
+ }
+
+ #[test]
+ fn entry_cancel_failure_and_late_approval_keep_the_gate_until_login_finishes() {
+ let mut app = app();
+ app.devices.runner = Some(Box::new(|_| None));
+ begin_entry(&mut app);
+ select(&mut app, "account:google");
+ let old = app.account.generation;
+ key(&mut app, KeyCode::Esc);
+ assert!(entry_required(&app) && visible(&app));
+ assert!(app.account.driver.is_none());
+ event(&mut app, old, json!({"type":"result", "status":"success"}));
+ assert_eq!(app.account.status, Status::SignedOut);
+ select(&mut app, "account:email");
+ assert_eq!(app.account.started.last().unwrap(), &["login", "--json", "--entry-point=tui", "--force"]);
+ let generation = app.account.generation;
+ finished(&mut app, generation, false, Some("Try again".into()));
+ assert!(entry_required(&app));
+ select(&mut app, "account:apple");
+ let generation = app.account.generation;
+ event(&mut app, generation, json!({"type":"result", "status":"success"}));
+ enforce_entry(&mut app);
+ assert!(entry_required(&app), "wait for the CLI to finish adopting the account");
+ finished(&mut app, generation, true, None);
+ assert!(!entry_required(&app) && app.modal.is_none());
+ }
+
+ #[test]
+ fn startup_reuses_a_signed_in_daemon_including_offline_and_expiry_requires_sign_in() {
+ let mut app = app();
+ app.account.status = Status::Unknown;
+ begin_entry(&mut app);
+ assert!(entry_required(&app));
+ daemon_status(&mut app, &json!({"signedIn":true,"offline":true}));
+ assert!(!entry_required(&app) && app.modal.is_none());
+ assert_eq!(app.account.status, Status::SignedIn { offline: true, email: None });
+ app.devices.runner = Some(Box::new(|req| match req {
+ Req::Cli { .. } => Some(Reply::Cli { ok: true, out: "{\"loggedIn\":false}".into(), err: String::new() }),
+ _ => None,
+ }));
+ // Check credentials periodically even while the account panel is closed.
+ app.account.checked = None;
+ tick(&mut app);
+ assert!(entry_required(&app), "runtime expiry requires sign-in again, as Desktop does");
+ begin_entry(&mut app);
+ assert!(entry_required(&app), "a new launch signed out requires sign-in again");
+ }
+
+ #[test]
+ fn os_workspaces_require_the_same_account_as_other_terminals() {
+ let mut app = app();
+ app.os_session = true;
+ app.os_live = true;
+ begin_entry(&mut app);
+ tick(&mut app);
+ assert!(entry_required(&app));
+ assert!(visible(&app));
+ app.os_live = false;
+ app.os_first_use = true;
+ begin_entry(&mut app);
+ assert!(entry_required(&app));
+ assert!(visible(&app));
+ app.account.status = Status::Unknown;
+ daemon_status(&mut app, &json!({"signedIn":true,"offline":true}));
+ assert!(!entry_required(&app));
+ }
+
+ #[test]
+ fn failed_or_missing_account_reads_do_not_admit_a_guest_and_retry_can_recover() {
+ let mut app = app();
+ app.account.status = Status::Unknown;
+ app.devices.runner = Some(Box::new(|_| Some(Reply::Cli { ok: false, out: String::new(), err: "unavailable".into() })));
+ begin_entry(&mut app);
+ refresh(&mut app, true);
+ assert!(entry_required(&app));
+ let (text, _) = render(&mut app, 80, 24);
+ assert!(text.contains("Retry account check"), "{text}");
+ app.devices.runner = Some(Box::new(|_| Some(Reply::Cli { ok: true, out: "{\"loggedIn\":true,\"offline\":true}".into(), err: String::new() })));
+ select(&mut app, "account:retry");
+ assert!(!entry_required(&app));
+ }
+
#[test]
fn sign_out_runs_the_cli_once_and_ends_signed_out_on_this_computer() {
let mut app = app();
diff --git a/tui/src/app.rs b/tui/src/app.rs
index 305246520..ee6589947 100644
--- a/tui/src/app.rs
+++ b/tui/src/app.rs
@@ -1262,6 +1262,7 @@ impl App {
app.follow_account(status.get("signedIn").and_then(Value::as_bool).unwrap_or(false));
app.connect(&id);
app.refresh_machines();
+ crate::account::daemon_status(app, &status);
}
Err(_) => {
app.daemon_down = true;
@@ -5732,6 +5733,7 @@ impl App {
/// started in — once, when the desk has answered and this computer's daemon is connected.
/// Until then (or if it never connects: not signed in) the window shows what it can.
pub fn maybe_start_shell(&mut self) {
+ if crate::account::entry_required(self) { return }
if self.shell_asked || !self.desk_answered || self.capture.is_some() { return }
// A headless client makes only the sessions it is asked for.
if self.headless { self.shell_asked = true; return }
diff --git a/tui/src/format.rs b/tui/src/format.rs
index 180adfe2c..a1a22e3b9 100644
--- a/tui/src/format.rs
+++ b/tui/src/format.rs
@@ -1826,6 +1826,9 @@ mod tests {
/// What the status line renders when the current window is `filled` and the tab name is `pane`.
#[test]
fn default_tab_format_includes_the_working_state_after_its_name() {
+ // This compares two expansions, not animation timing. Hold the spinner
+ // still so a wall-clock frame boundary cannot change the expected icon.
+ crate::theme::begin_animation_frame(false);
let mut app = status_fixture(1, 1);
app.tabs[0].root = Some(crate::layout::Node::new(1, 80, 24));
let fmt = crate::options::status_window_format("tmux", true);
diff --git a/tui/src/input.rs b/tui/src/input.rs
index b74121f58..b35fac591 100644
--- a/tui/src/input.rs
+++ b/tui/src/input.rs
@@ -18,7 +18,25 @@ use crate::pane::{encode_key, encode_mouse, Phase};
use crate::picker::Picker;
use crate::theme;
+/// A trusted OS form while sign-in is required. It receives text, never hn's
+/// root/prefix shortcuts. Resize and focus events still reach the client.
+pub fn system_form_input(app: &mut App, pane: u64, event: &CEvent) -> bool {
+ let bytes = match event {
+ CEvent::Key(key) if key.kind != KeyEventKind::Release =>
+ app.panes.get(&pane).and_then(|p| encode_key(key, p.mode())),
+ CEvent::Paste(text) => Some(text.as_bytes().to_vec()),
+ CEvent::Key(_) | CEvent::Mouse(_) => None,
+ _ => return false,
+ };
+ if let Some(bytes) = bytes {
+ if app.panes.get(&pane).is_some_and(|p| p.stream.is_some()) { app.send_input(pane, &bytes); }
+ else if let Some(p) = app.panes.get_mut(&pane) { p.queued.push(bytes); }
+ }
+ true
+}
+
pub fn handle(app: &mut App, event: CEvent) {
+ if crate::account::entry_input(app, &event) { return }
app.sync_copy_modal();
match event {
// A key is the session's activity (session_update_activity): a script's command with no -t
diff --git a/tui/src/main.rs b/tui/src/main.rs
index 51a948cf1..a9c22b2f2 100644
--- a/tui/src/main.rs
+++ b/tui/src/main.rs
@@ -491,6 +491,7 @@ async fn run(config: config::Config) -> io::Result<()> {
}
// When you last looked at each harness (what finished while hn was closed shows as done).
app.load_seen();
+ account::begin_entry(&mut app);
app.boot();
// The sessions a client left (C-b d), and the one asked for; attach's client flags.
app.client_flags = start.as_ref().map(|s| s.flags.clone()).unwrap_or_default();
@@ -524,7 +525,7 @@ async fn run(config: config::Config) -> io::Result<()> {
let mut mouse_all = false;
let mut cursor_colour: Option<String> = None;
let mut startup_input = std::collections::VecDeque::new();
- let mut input_ready = app.focused().is_some();
+ let mut input_ready = account::entry_required(&app) || app.focused().is_some();
loop {
// Wait for something — or for the frame we owe to come due.
let wait = if need_draw { frame_budget.saturating_sub(last_draw.elapsed()) } else { Duration::from_secs(3600) };
@@ -572,6 +573,7 @@ async fn run(config: config::Config) -> io::Result<()> {
server::publish(&mut app);
commands::run_pending_hooks(&mut app);
app.show_causes();
+ account::enforce_entry(&mut app);
app.mark_seen();
if app.quit { break }
if std::mem::take(&mut app.mouse_changed) {
diff --git a/tui/src/os_welcome.rs b/tui/src/os_welcome.rs
index 577046641..022f75b50 100644
--- a/tui/src/os_welcome.rs
+++ b/tui/src/os_welcome.rs
@@ -21,6 +21,17 @@ pub struct State {
pub fn live(app: &App) -> bool { app.os_session && app.os_live && !app.headless }
+/// Only the locally created OS Wi-Fi form may cover required sign-in. Never
+/// expose the other panes or route workspace shortcuts while it is visible.
+pub fn entry_wifi(app: &App) -> Option<u64> {
+ if !crate::account::entry_required(app) || !app.os_session { return None }
+ let id = app.os_welcome.wifi_pane?;
+ let pane = app.panes.get(&id)?;
+ (app.os_welcome.wifi_tab.as_ref() == Some(&app.tab().id) && app.tab().panes().contains(&id)
+ && this_computer(app, &pane.machine_id) && pane.dead.is_none()
+ && !matches!(pane.phase, crate::pane::Phase::Card { .. })).then_some(id)
+}
+
pub fn tick(app: &mut App) {
if !app.os_session || app.tick % 8 != 0 { return }
app.os_welcome.welcome_panes.retain(|id| app.panes.contains_key(id));
@@ -56,7 +67,10 @@ pub fn shell_created(app: &mut App, id: u64) {
split_starter(app, id, Dir::Vertical, "/usr/bin/hn-os starter lower");
}
Some("sudo /usr/bin/harness install") if live(app) => app.os_welcome.install_pane = Some(id),
- Some("/usr/bin/hn-os wifi") => app.os_welcome.wifi_pane = Some(id),
+ Some("/usr/bin/hn-os wifi") => {
+ app.os_welcome.wifi_pane = Some(id);
+ if entry_wifi(app).is_some() { app.modal = None; }
+ }
_ => {}
}
}
@@ -84,6 +98,13 @@ fn local_dialog(app: &mut App, name: &str, command: &str, install: bool) {
pub fn act(app: &mut App, action: Action) {
if !app.os_session || app.headless { return app.error("This action belongs to the Harness operating system.") }
if app.read_only() { return app.error("This client is read-only.") }
+ if crate::account::entry_required(app) {
+ // Compositor shortcuts arrive over IPC, outside the account page's key
+ // handling. Only the existing network form remains available here.
+ if action == Action::Wifi { local_dialog(app, "Wi-Fi", "/usr/bin/hn-os wifi", false); }
+ crate::account::enforce_entry(app);
+ return;
+ }
app.os_welcome.dock_focus = None;
match action {
Action::Install if live(app) => local_dialog(app, "Install", "sudo /usr/bin/harness install", true),
@@ -100,6 +121,11 @@ pub fn act(app: &mut App, action: Action) {
pub fn command(app: &mut App, args: &[String]) {
if !app.os_session || app.headless { return app.error("This action belongs to the Harness operating system.") }
if app.read_only() { return app.error("This client is read-only.") }
+ if crate::account::entry_required(app) {
+ if args.first().map(String::as_str) == Some("wifi") { act(app, Action::Wifi); }
+ else { crate::account::enforce_entry(app); }
+ return;
+ }
if args.first().map(String::as_str) == Some("ready") {
let Some(hint) = args.get(1).filter(|id| id.strip_prefix('%').is_some_and(|n| !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit()))) else {
return app.error("The welcome must identify its pane.");
@@ -240,6 +266,50 @@ mod tests {
}
}
+ #[tokio::test]
+ async fn required_sign_in_only_exposes_the_owned_local_wifi_form() {
+ use crossterm::event::Event;
+ let mut app = fixture(100, 30);
+ app.os_live = false;
+ app.fleet.local_id = "local-daemon".into();
+ app.open_agent("local-daemon", "wifi", Placement::Auto(None));
+ let wifi = app.focused().unwrap();
+ app.os_welcome.wifi_tab = Some(app.tab().id.clone());
+ let pane = app.panes.get_mut(&wifi).unwrap();
+ pane.start_command = Some("/usr/bin/hn-os wifi".into());
+ pane.phase = crate::pane::Phase::Live;
+ pane.feed(b"Connect to Wi-Fi");
+ app.open_agent("remote", "private-work", Placement::Auto(None));
+ let private = app.focused().unwrap();
+ let pane = app.panes.get_mut(&private).unwrap();
+ pane.phase = crate::pane::Phase::Live;
+ pane.feed(b"PRIVATE_WORKSPACE_CONTENT");
+ assert!(contents(&render(&mut app)).contains("PRIVATE_WORKSPACE_CONTENT"));
+ crate::account::begin_entry(&mut app);
+ shell_created(&mut app, wifi);
+ assert_eq!(entry_wifi(&app), Some(wifi));
+ app.keymap.bind(crate::keys::Table::Root,
+ crate::keys::of(&KeyEvent::new(KeyCode::Char('x'), KeyModifiers::NONE)), "new-window".into(), false);
+ for (width, height) in [(100, 30), (40, 12)] {
+ app.size = (width, height);
+ let text = contents(&render(&mut app));
+ assert!(text.contains("Connect to Wi-Fi"), "{text}");
+ assert!(!text.contains("PRIVATE_WORKSPACE_CONTENT") && !text.contains("Install Harness"), "{text}");
+ }
+ let tabs = app.tabs.len();
+ crate::input::handle(&mut app, Event::Key(KeyEvent::new(KeyCode::Char('x'), KeyModifiers::NONE)));
+ crate::input::handle(&mut app, Event::Paste("fixture password".into()));
+ assert_eq!(app.tabs.len(), tabs, "the form cannot invoke a workspace shortcut");
+ assert_eq!(app.panes[&wifi].queued, [b"x".to_vec(), b"fixture password".to_vec()]);
+ assert!(app.panes[&private].queued.is_empty());
+ for action in [Action::New, Action::Terminal, Action::Connect] { act(&mut app, action); }
+ assert_eq!(app.tabs.len(), tabs);
+ app.panes.remove(&wifi);
+ let text = contents(&render(&mut app));
+ assert!(text.contains("Sign in to Harness"), "closing networking returns to required sign-in: {text}");
+ assert!(!text.contains("PRIVATE_WORKSPACE_CONTENT"));
+ }
+
#[tokio::test]
async fn install_reuses_its_local_form_even_when_a_remote_pane_is_focused() {
let mut app = fixture(120, 40);
diff --git a/tui/src/ui.rs b/tui/src/ui.rs
index c078cc200..008a76273 100644
--- a/tui/src/ui.rs
+++ b/tui/src/ui.rs
@@ -209,6 +209,19 @@ pub fn draw(frame: &mut Frame, app: &mut App) {
app.size = (area.width, area.height);
app.fit_panes();
}
+ crate::account::enforce_entry(app);
+ if crate::account::entry_required(app) {
+ app.overlay_drawn = Some(area);
+ if let Some(pane) = crate::os_welcome::entry_wifi(app).and_then(|id| app.panes.get_mut(&id)) {
+ if let Some(cursor) = pane_body(frame.buffer_mut(), pane, area, true, (None, None)) {
+ frame.set_cursor_position(cursor);
+ }
+ } else if let Some(Modal::Picker { kind: PickerKind::Account, mut picker }) = app.modal.take() {
+ crate::account::draw(frame.buffer_mut(), app, area, &mut picker);
+ app.modal = Some(Modal::Picker { kind: PickerKind::Account, picker });
+ }
+ return;
+ }
// The status lines (tmux's status: off, on, 2 … 5), at the bottom or (status-position) the top.
let lines = app.status_lines().max(1).min(area.height);
let status = Rect::new(0, if app.status_top { 0 } else { area.height.saturating_sub(lines) }, area.width, lines);
diff --git a/tui/tests/account_fixture.py b/tui/tests/account_fixture.py
new file mode 100644
index 000000000..7d5720065
--- /dev/null
+++ b/tui/tests/account_fixture.py
@@ -0,0 +1,15 @@
+"""A saved offline account for isolated terminal fixtures that do not run a daemon."""
+import shlex
+import sys
+
+
+def signed_in_account(env, root):
+ """Exercise ordinary authenticated startup without a real account or network."""
+ script = root / 'account-fixture.py'
+ script.write_text('import json, sys\n'
+ 'if sys.argv[1:3] != ["auth", "status"]: sys.exit(1)\n'
+ 'print(json.dumps({"loggedIn": True, "offline": True}))\n')
+ wrapper = root / 'account-fixture'
+ wrapper.write_text('#!/bin/sh\nexec ' + shlex.join([sys.executable, str(script)]) + ' "$@"\n')
+ wrapper.chmod(0o700)
+ env['HARNESS_CLI'] = str(wrapper)
diff --git a/tui/tests/local-first.py b/tui/tests/local-first.py
index 62a6b9743..233c8c121 100644
--- a/tui/tests/local-first.py
+++ b/tui/tests/local-first.py
@@ -110,15 +110,17 @@ try:
assert second['machineId'] == 'b' * 32 and second['signedIn'] is False
assert second['config']['port'] != first['config']['port']
assert status(a)['pid'] == first['pid']
- wait(lambda: 'Welcome to Harness' in (s := screen()) or 'New Window' in s or 'Terminal on ' in s, 'guest home or local terminal')
+ wait(lambda: 'Sign in to Harness' in screen() and 'Continue with Google' in screen(), 'required sign-in')
assert 'OTHER_ACCOUNT_PRIVATE' not in screen()
assert not (b / 'browser-opened').exists()
assert not (b / 'auth/session.json').exists()
- print('PASS: real hn starts signed out beside another user daemon, with distinct ports and no browser login', flush=True)
+ print('PASS: real hn requires sign-in beside another user daemon, with distinct ports and no unsolicited browser login', flush=True)
outer('send-keys', '-t', 'guest', 'C-b', 'N')
- wait(lambda: 'New Harness' in screen() and 'Project' in screen(), 'signed-out New Harness popup', 15)
+ time.sleep(.3)
+ assert 'Sign in to Harness' in screen() and 'New Harness' not in screen(), 'workspace shortcuts cannot bypass sign-in'
assert 'OTHER_ACCOUNT_PRIVATE' not in screen()
- print('PASS: local New Harness opens; old unscoped account cache is ignored; first daemon stays running', flush=True)
+ assert status(a)['pid'] == first['pid']
+ print('PASS: sign-in owns input; old account cache stays hidden; first daemon keeps running', flush=True)
finally:
(BASE / 'guest-screen.txt').write_text(outer('capture-pane', '-p', '-t', 'guest', check=False).stdout)
for root, env in reversed(environments):
diff --git a/tui/tests/local-shells.py b/tui/tests/local-shells.py
index 756624d45..9c7bc5bb5 100644
--- a/tui/tests/local-shells.py
+++ b/tui/tests/local-shells.py
@@ -19,6 +19,7 @@ import subprocess
import sys
import tempfile
import time
+from account_fixture import signed_in_account
TUI = Path(__file__).resolve().parents[1]
PORT = int(os.environ.get('HN_LOCAL_TEST_PORT', '19441'))
@@ -38,6 +39,7 @@ shutil.copy2(SOURCE, HN)
ENV = {k: os.environ[k] for k in ('PATH', 'LANG', 'LC_ALL', 'USER', 'LOGNAME', 'TZ', 'NODE_PATH') if k in os.environ}
ENV.update(HOME=str(HOME), PORT=str(PORT), HN_SOCKET_NAME=PREFIX, HN_TMPDIR=str(BASE), SHELL='/bin/sh',
TERM='xterm-256color', HNE_REMOVE='bad', HNE_KEEP='bad', HNE_HIDDEN='bad')
+signed_in_account(ENV, BASE)
CONF = BASE / 'tmux.conf'
CONF.write_text('set -g default-shell /bin/sh\nset -g default-terminal tmux-256color\n'
'set -g pane-border-status off\nset -g status off\n'
diff --git a/tui/tests/native-terminal.py b/tui/tests/native-terminal.py
index 3d0df2192..83677c1f0 100644
--- a/tui/tests/native-terminal.py
+++ b/tui/tests/native-terminal.py
@@ -21,6 +21,7 @@ import tempfile
import termios
import threading
import time
+from account_fixture import signed_in_account
TUI = Path(__file__).resolve().parents[1]
PORT = int(os.environ.get('HN_NATIVE_TEST_PORT', '19433'))
@@ -39,6 +40,7 @@ ENV = {k: os.environ[k] for k in ('PATH', 'LANG', 'LC_ALL', 'TZ') if k in os.env
ENV.update(HOME=str(HOME), HN_TMPDIR=str(BASE), HN_SOCKET_NAME=PREFIX, PORT=str(PORT),
SHELL='/bin/sh', TERM='xterm-256color', HARNESS_TUI_DESK='off',
HARNESS_TUI_NOTIFY='off', HN_DESKTOP='off', PS1='$ ')
+signed_in_account(ENV, BASE)
CONF = BASE / 'tmux.conf'
CONF.write_text('set -g default-shell /bin/sh\nset -g @hn-look tmux\n'
'set -g automatic-rename off\nset -g status off\n'
diff --git a/tui/tests/session-picker.py b/tui/tests/session-picker.py
index 38c29d453..506d092e0 100644
--- a/tui/tests/session-picker.py
+++ b/tui/tests/session-picker.py
@@ -11,6 +11,7 @@ assert 19920 <= PORT <= 19929
with socket.socket() as probe: probe.bind(('127.0.0.1',PORT))
ENV={k:os.environ[k] for k in ('PATH','LANG','LC_ALL','TZ') if k in os.environ}
ENV.update(HOME=str(BASE),HN_TMPDIR=str(BASE),HN_SOCKET_NAME=NAME,PORT=str(PORT),SHELL='/bin/sh',TERM='xterm-256color',COLORTERM='truecolor',HN_DESKTOP='off',HARNESS_TUI_DESK='sync',HARNESS_TUI_NOTIFY='off',HN_SESSION_FIXTURE='1')
+(BASE/'account.json').write_text(json.dumps({'loggedIn':True}))
def run(args,check=True):
r=subprocess.run(list(map(str,args)),env=ENV,cwd=BASE,text=True,capture_output=True,timeout=10)
if check and r.returncode: raise AssertionError((args,r.stdout,r.stderr))
diff --git a/tui/tests/shell-first.py b/tui/tests/shell-first.py
index b0c52455a..f126d2c01 100644
--- a/tui/tests/shell-first.py
+++ b/tui/tests/shell-first.py
@@ -10,6 +10,7 @@ import socket
import subprocess
import tempfile
import time
+from account_fixture import signed_in_account
ROOT=Path(__file__).resolve().parents[1]
BASE=Path(tempfile.mkdtemp(prefix='hn-shell-first-',dir='/tmp')).resolve()
@@ -23,6 +24,7 @@ assert Path(SHELL).name in ('zsh','bash')
with socket.socket() as probe: probe.bind(('127.0.0.1',PORT))
ENV={k:os.environ[k] for k in ('PATH','LANG','LC_ALL','TZ') if k in os.environ}
ENV.update(HOME=str(BASE),HN_TMPDIR=str(BASE),HN_SOCKET_NAME=NAME,PORT=str(PORT),SHELL=SHELL,TERM='xterm-256color',COLORTERM='truecolor',HN_DESKTOP='off',HARNESS_TUI_DESK='off',HARNESS_TUI_NOTIFY='off')
+signed_in_account(ENV, BASE)
# These fixtures install their own widgets; Ubuntu's global compinit must not
# ask about completion directories supplied by the runner's unrelated tools.
ENV['skip_global_compinit']='1'
diff --git a/tui/tests/terminal-attributes.py b/tui/tests/terminal-attributes.py
index 3348f1af1..599ddbb15 100644
--- a/tui/tests/terminal-attributes.py
+++ b/tui/tests/terminal-attributes.py
@@ -5,6 +5,7 @@ Run from tui/: python3 tests/terminal-attributes.py [frozen-binary]
No daemon is started. Every process uses a private HOME and explicit guarded sockets.
"""
import os,pathlib,shlex,shutil,socket,subprocess,sys,tempfile,time,json,signal
+from account_fixture import signed_in_account
port=int(os.environ.get('HN_ATTR_TEST_PORT','19412'))
assert 19410<=port<=19419, 'refusing port outside the test range'
name='hn-attrs-test-'+os.urandom(4).hex()
@@ -16,6 +17,7 @@ binary=root/'hn';shutil.copy2(source,binary)
tmux=shutil.which('tmux')
assert tmux, 'tmux must be on PATH'
env={'PATH':os.environ['PATH'],'HOME':str(home),'SHELL':'/bin/sh','TERM':'xterm-256color','LANG':'en_US.UTF-8','PORT':str(port),'HN_SOCKET_NAME':name,'HN_TMPDIR':str(root),'HARNESS_TUI_DESK':'off','HN_DESKTOP':'off','HARNESS_TUI_NOTIFY':'off'}
+signed_in_account(env, root)
config=root/'tmux.conf';config.write_text('set -g default-shell /bin/sh\nset -g @hn-look tmux\nset -g status off\nset -g pane-border-status off\nset -g automatic-rename off\n')
program=root/'program.py';program.write_text('''import os,tty,time
# Attribute-only repaints must travel even when text and ratatui modifiers are unchanged.
diff --git a/tui/tests/workspace-controls.py b/tui/tests/workspace-controls.py
index 51be31a5d..2697dcea3 100644
--- a/tui/tests/workspace-controls.py
+++ b/tui/tests/workspace-controls.py
@@ -33,8 +33,47 @@ ENV.update(HOME=str(BASE), HN_TMPDIR=str(BASE), HN_SOCKET_NAME=PREFIX, PORT=str(
TERM='xterm-256color', COLORTERM='truecolor', SHELL='/bin/sh', HARNESS_TUI_DESK='sync',
HARNESS_TUI_NOTIFY='off', HN_DESKTOP='off', SSH_CONNECTION='disposable-fixture',
HARNESS_CLI=sys.executable, HARNESS_CLI_ARGS=json.dumps([str(BASE / 'cli.py')]))
+if '--os-required-sign-in' in sys.argv:
+ ENV['HARNESS_OS'] = '1'
+ # Run the shipped OS network form, replacing only NetworkManager/sudo in this
+ # private fixture. No host network or account is touched.
+ binaries = BASE / 'bin'
+ binaries.mkdir()
+ network = ROOT.parent / 'os/network.py'
+ (binaries / 'sudo').write_text('#!' + sys.executable + '\n' + f'''
+import importlib.util, os, sys
+from pathlib import Path
+assert sys.argv[1:] == ['/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use']
+spec = importlib.util.spec_from_file_location('network', {str(network)!r})
+network = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(network)
+network.os.geteuid = lambda: 0
+network.nmcli = lambda *args, **kwargs: ''
+network.scan = lambda **kwargs: []
+network.wired_devices = lambda: []
+network.connected = lambda: (Path(os.environ['HOME']) / 'network-ready').exists()
+sys.argv = ['network.py', '--first-use']
+raise SystemExit(network.main())
+''')
+ (binaries / 'sudo').chmod(0o700)
+ ENV['PATH'] = str(binaries) + os.pathsep + ENV['PATH']
CONF = BASE / 'tmux.conf'
CONF.write_text('set -g automatic-rename off\n')
+launch = [str(HN), '-L', PREFIX, '--port', str(PORT), '-f', str(CONF)]
+if '--os-required-sign-in' in sys.argv:
+ # Use the actual OS launcher and onboarding script. Only installed paths
+ # and the account adapter point at this disposable fixture.
+ ENV['HARNESS_TUI_TMUX_CONF'] = str(CONF)
+ launcher = BASE / 'os-launcher'
+ source = (ROOT.parent / 'os/root/usr/bin/hn').read_text()
+ source = source.replace('. /usr/lib/harness-os/runtime-path', 'harness_runtime=' + shlex.quote(str(BASE)))
+ source = source.replace('export HARNESS_CLI=/usr/bin/harness', 'export HARNESS_CLI=' + shlex.quote(ENV['HARNESS_CLI']))
+ source = source.replace("export HARNESS_CLI_ARGS='[]'", 'export HARNESS_CLI_ARGS=' + shlex.quote(ENV['HARNESS_CLI_ARGS']))
+ source = source.replace('/usr/bin/python3 /usr/lib/harness-os/onboarding.py',
+ shlex.join([sys.executable, str(ROOT.parent / 'os/onboarding.py')]))
+ launcher.write_text(source)
+ launcher.chmod(0o700)
+ launch = [str(launcher)]
OUTPUT = Path(os.environ['HN_WORKSPACE_OUTPUT']) if os.environ.get('HN_WORKSPACE_OUTPUT') else None
if OUTPUT:
OUTPUT.mkdir(parents=True, exist_ok=True)
@@ -65,6 +104,8 @@ elif args[:2] in (['remote-password', 'set'], ['remote-password', 'clear']):
emit({'ok': True})
elif args == ['link', 'list']:
print('No machines linked yet.')
+elif args == ['logout']:
+ (home / 'account.json').write_text(json.dumps({'loggedIn': False}))
elif args and args[0] == 'login':
record('start')
if '--qr' in args: emit({'type': 'qr', 'url': 'https://example.test/login/fixture', 'expiresIn': 120})
@@ -575,19 +616,101 @@ try:
else:
raise AssertionError('mock startup timeout')
command = shlex.join(['env', '-u', 'TMUX', '-u', 'TMUX_PANE', '-u', 'HN_SOCKET',
- *[f'{k}={v}' for k, v in ENV.items()], str(HN), '-L', PREFIX,
- '--port', str(PORT), '-f', str(CONF)])
+ *[f'{k}={v}' for k, v in ENV.items()], *launch])
tmux('-f', '/dev/null', 'new-session', '-d', '-s', 'test', '-x', '170', '-y', '44', command)
started = True
+ if '--os-required-sign-in' in sys.argv:
+ shown('Connect to Wi-Fi')
+ keys('Escape', 'C-b', 'c')
+ shown('Connect to Wi-Fi')
+ assert 'Sign in to Harness' not in screen()
+ assert 'Alpha task terminal' not in screen()
+ snapshot('os-network-before-sign-in')
+ (BASE / 'network-ready').touch()
+ shown('Sign in to Harness')
+ shown('Continue with email')
+ assert 'Alpha task terminal' not in screen(), 'required sign-in covers saved work'
+ assert 'Keep using locally' not in screen()
+ keys('Escape', 'C-b', 'c')
+ shown('Sign in to Harness')
+ snapshot('required-sign-in')
+ if '--os-required-sign-in' in sys.argv:
+ hn('os-action', 'wifi')
+ shown('New terminal terminal')
+ assert 'Alpha task terminal' not in screen() and 'Beta task terminal' not in screen()
+ network_pane = value('#{pane_id}')
+ tabs = hn('list-windows', '-F', '#{window_id}').splitlines()
+ keys('C-b', 'c')
+ for action in ('new', 'terminal', 'connect'):
+ hn('os-action', action)
+ assert hn('list-windows', '-F', '#{window_id}').splitlines() == tabs
+ snapshot('os-wifi-during-required-sign-in')
+ hn('kill-pane', '-t', network_pane)
+ shown('Sign in to Harness')
+ for cols, rows in [(80, 24), (40, 12), (170, 44)]:
+ tmux('resize-window', '-t', 'test', '-x', str(cols), '-y', str(rows))
+ wait(lambda: value('#{client_width}x#{client_height}') == f'{cols}x{rows}', 'sign-in follows terminal resize')
+ # The resize is acknowledged before the frame is painted. Let the redraw
+ # settle before reading mouse coordinates or recording the terminal.
+ time.sleep(.25)
+ shown('Sign in to Harness')
+ shown('Continue with Google')
+ shown('Continue with your phone')
+ snapshot(f'required-sign-in-{cols}x{rows}')
+ click_text('Continue with Google')
+ shown('Finish signing in in your browser')
+ keys('Escape')
+ shown('Continue with Google')
+ wait(lambda: login_events() == ['start', 'cancel'], 'Escape cancels the attempt, not required sign-in')
+ click_text('Continue with email')
+ shown('Finish signing in in your browser')
+ snapshot('required-sign-in-browser')
+ (BASE / 'approve').touch()
+ wait(lambda: 'commit' in login_events(), 'successful required sign-in')
shown('Alpha task terminal')
shown('Beta task terminal')
- shown('Sign in')
+ (BASE / 'approve').unlink()
+ (BASE / 'login-events').unlink()
+ print('PASS required sign-in: saved work stays covered; cancel retries; email returns to saved panes', flush=True)
+ if '--os-required-sign-in' in sys.argv:
+ # Simulate the completed first workspace. The real OS launcher now skips
+ # initial networking so subsequent signed-in launches can work offline.
+ state = BASE / '.local/state/harness-os'
+ state.mkdir(parents=True, exist_ok=True)
+ (state / 'onboarded').touch()
+ (BASE / 'network-ready').unlink()
local, remote = api()['local'], api()['remote']
panes = hn('list-panes', '-F', '#{pane_id}').splitlines()
assert len(panes) == 2, panes
alpha, beta = panes
workspace = value('#{window_id}')
snapshot('workspace')
+ if '--required-sign-in' in sys.argv or '--os-required-sign-in' in sys.argv:
+ hn('signout', '-y')
+ shown('Sign in to Harness')
+ shown('Continue with Google')
+ if '--os-required-sign-in' in sys.argv:
+ for action in ('new', 'terminal', 'connect'):
+ hn('os-action', action)
+ shown('Sign in to Harness')
+ assert len(hn('list-panes', '-F', '#{pane_id}').splitlines()) == 2
+ keys('Escape')
+ shown('Sign in to Harness')
+ snapshot('required-sign-in-after-signout')
+ tmux('set-window-option', '-t', TARGET, 'remain-on-exit', 'on')
+ keys('C-c')
+ wait(lambda: tmux('display-message', '-p', '-t', TARGET, '#{pane_dead}').strip() == '1', 'Ctrl+C detaches from sign-in')
+ tmux('respawn-pane', '-k', '-t', 'test', command)
+ shown('Sign in to Harness')
+ snapshot('required-sign-in-on-relaunch')
+ # An account established outside this TUI, with no network available, also opens work.
+ (BASE / 'account.json').write_text(json.dumps({'loggedIn': True, 'offline': True}))
+ tmux('respawn-pane', '-k', '-t', 'test', command)
+ shown('Alpha task terminal')
+ assert 'Sign in to Harness' not in screen()
+ snapshot('signed-in-offline-relaunch')
+ print('PASS required sign-in: sign-out, quit/relaunch, saved local work, and signed-in offline launch', flush=True)
+ sys.exit(0)
if '--machine-prompts' in sys.argv:
machine_prompt_journey()
sys.exit(0)
@@ -617,15 +740,13 @@ try:
machine_prompt_journey()
side_bar_machines_journey()
- # Local use is complete before any sign-in. The tiny footer entry explains the benefit,
- # then lets the user return without starting an authentication request.
- click_text('Sign in', row=43)
- shown('Connect computers')
- shown('Keep using locally')
- snapshot('optional-sign-in')
- click_text('Keep using locally')
+ # Once signed in, Account is a dismissible management panel.
+ hn('account')
+ shown('Connect a machine')
+ snapshot('account')
+ keys('Escape')
assert not login_events()
- wait(lambda: 'Continue with Google' not in screen(), 'back to local workspace')
+ wait(lambda: 'Connect a machine' not in screen(), 'back to workspace')
# The title's agent and model labels act on the captured pane even if external focus changes.
x, y = map(int, value('#{pane_left} #{pane_top}', alpha).split())
@@ -723,7 +844,9 @@ try:
assert next(t for t in api()['desk']['tabs'] if t['id'] == 'remote')['name'] == 'Remote'
hn('select-window', '-t', workspace)
- # A phone approval is explicit. Closing its UI cancels the driver, and reopening never
+ # Runtime expiry requires sign-in again, as Desktop does. A phone approval is explicit.
+ (BASE / 'account.json').write_text(json.dumps({'loggedIn': False}))
+ # Closing its UI cancels the driver, and reopening never
# accepts a previously selected row as consent to a different account.
hn('account')
click_text('Continue with your phone')
@@ -737,6 +860,8 @@ try:
(BASE / 'approve').touch()
# The phone that approved is signed in to the account: no second question here.
wait(lambda: 'commit' in login_events(), 'a phone approval commits without another step')
+ wait(lambda: 'Sign in to Harness' not in screen(), 'sign-in restores the workspace')
+ hn('account')
shown('Connect a machine')
assert json.loads((BASE / 'account.json').read_text())['loggedIn']
snapshot('signed-in')