The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
feat(mobile): restore QR sign-in on welcome
tony81cab507d349
diff --git a/mobile/lib/phone/connectors_page.dart b/mobile/lib/phone/connectors_page.dartindex 5e3d2345b..a6bee70bc 100644--- a/mobile/lib/phone/connectors_page.dart+++ b/mobile/lib/phone/connectors_page.dart@@ -467,145 +467,166 @@ class _ConnectorsPageState extends State<ConnectorsPage>resizeToAvoidBottomInset: false,body: SafeArea(bottom: false,- child: RefreshIndicator(- onRefresh: _refresh,- child: ListView(- padding: EdgeInsets.fromLTRB(- Tty.origin,- 12,- Tty.origin,- MediaQuery.paddingOf(context).bottom + 24,- ),- children: [- const TtyText(- 'Connectors',- size: TtySize.display,- weight: FontWeight.w600,- ),- const SizedBox(height: 8),- Text(- 'Services your agents can use. Sign in here once: every computer of your account '- 'gets the connection.',- style: tty.style(color: tty.dim),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ // Pushed from Settings ▸ Connectors: back above the title, fixed while the list scrolls,+ // as Settings and Computers have it when pushed.+ Align(+ alignment: Alignment.centerLeft,+ child: TtyBackButton(+ onPressed: () => Navigator.of(context).maybePop(),),- if (_notice.isNotEmpty) ...[- const SizedBox(height: 12),- Text(_notice, style: tty.style(color: tty.dim)),- ],- // Agents read their tools when they start: one already running gets a connection- // made since only on a restart. Always here, for the harness last opened.- if (lastOpened != null) ...[- const SizedBox(height: 12),- SettingsGroup(+ ),+ Expanded(+ child: RefreshIndicator(+ onRefresh: _refresh,+ child: ListView(+ padding: EdgeInsets.fromLTRB(+ Tty.origin,+ 8,+ Tty.origin,+ MediaQuery.paddingOf(context).bottom + 24,+ ),children: [- SettingsRow(- key: const Key('connectors-restart'),- leading: const Icon(LucideIcons.refreshCw300, size: 20),- title: 'Restart "${lastOpened.$2.displayName}"',- detail:- 'Restart to use the new tools from your connectors.',- onTap: () => _restartThere(lastOpened),+ const TtyText(+ 'Connectors',+ size: TtySize.display,+ weight: FontWeight.w600,),- ],- ),- ],- if (cards == null && _loading) ...[- const SizedBox(height: 24),- const Center(child: CircularProgressIndicator()),- ] else if (_machineId == null) ...[- const SizedBox(height: 16),- Text(- 'No computer of yours is online. Start Harness on a computer signed in to your '- 'account, then pull to refresh.',- style: tty.style(color: tty.dim),- ),- ] else if (cards != null) ...[- // At the top, not under the connected list: a long one pushed both off the screen.- // Which computer signs in matters only when it cannot: any of them gets the connection.- if (_app.connectorMachines.length > 1) ...[- const SizedBox(height: 8),- // A long host name gives way, never "Change".- Row(- children: [- Flexible(- child: Text(- 'Through ${_machineName(_machineId)}',- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: tty.style(color: tty.dim),- ),- ),- TtyTextButton(- key: const Key('connectors-computer'),- label: 'Change',- onPressed: _pickMachine,- ),+ const SizedBox(height: 8),+ Text(+ 'Services your agents can use. Sign in here once: every computer of your account '+ 'gets the connection.',+ style: tty.style(color: tty.dim),+ ),+ if (_notice.isNotEmpty) ...[+ const SizedBox(height: 12),+ Text(_notice, style: tty.style(color: tty.dim)),],- ),- ],- const SizedBox(height: 12),- TextField(- key: const Key('connectors-search'),- decoration: const InputDecoration(- hintText: 'Search connectors',- prefixIcon: Icon(LucideIcons.search300),- ),- onChanged: (value) => setState(() => _query = value.trim()),- ),- const SettingsCaption('Connected'),- if (connected.isEmpty)- Text(- query.isEmpty ? 'Nothing connected yet.' : 'No match.',- style: tty.style(color: tty.dim),- )- else- SettingsGroup(- children: [- for (final card in connected)- SettingsRow(- leading: _ConnectorMark(- code: card.code,- name: card.name,+ // Agents read their tools when they start: one already running gets a connection+ // made since only on a restart. Always here, for the harness last opened.+ if (lastOpened != null) ...[+ const SizedBox(height: 12),+ SettingsGroup(+ children: [+ SettingsRow(+ key: const Key('connectors-restart'),+ leading: const Icon(+ LucideIcons.refreshCw300,+ size: 20,+ ),+ title: 'Restart "${lastOpened.$2.displayName}"',+ detail: 'Restart to use the new tools from your connectors.',+ onTap: () => _restartThere(lastOpened),),- title: card.name,- detail: card.needsAttention- ? 'Connect again'- : card.description,- value: card.needsAttention- ? 'Reconnect'- : 'Connected',- onTap: () => _manage(card),- ),+ ],+ ),],- ),- SettingsCaption('Available ${available.length}'),- SettingsGroup(- children: [- for (final card in available)- SettingsRow(- leading: _ConnectorMark(- code: card.code,- name: card.name,+ if (cards == null && _loading) ...[+ const SizedBox(height: 24),+ const Center(child: CircularProgressIndicator()),+ ] else if (_machineId == null) ...[+ const SizedBox(height: 16),+ Text(+ 'No computer of yours is online. Start Harness on a computer signed in to your '+ 'account, then pull to refresh.',+ style: tty.style(color: tty.dim),+ ),+ ] else if (cards != null) ...[+ // At the top, not under the connected list: a long one pushed both off the screen.+ // Which computer signs in matters only when it cannot: any of them gets the connection.+ if (_app.connectorMachines.length > 1) ...[+ const SizedBox(height: 8),+ // A long host name gives way, never "Change".+ Row(+ children: [+ Flexible(+ child: Text(+ 'Through ${_machineName(_machineId)}',+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: tty.style(color: tty.dim),+ ),+ ),+ TtyTextButton(+ key: const Key('connectors-computer'),+ label: 'Change',+ onPressed: _pickMachine,+ ),+ ],+ ),+ ],+ const SizedBox(height: 12),+ TextField(+ key: const Key('connectors-search'),+ decoration: const InputDecoration(+ hintText: 'Search connectors',+ prefixIcon: Icon(LucideIcons.search300),),- title: card.name,- detail: card.reason.isNotEmpty- ? card.reason- : card.description,- value: _busy.contains(card.code)- ? 'Signing in…'- : card.reason.isNotEmpty- ? null- : 'Add',- onTap:- card.reason.isNotEmpty || _busy.contains(card.code)- ? null- : () => unawaited(_connect(card)),+ onChanged: (value) =>+ setState(() => _query = value.trim()),),+ const SettingsCaption('Connected'),+ if (connected.isEmpty)+ Text(+ query.isEmpty+ ? 'Nothing connected yet.'+ : 'No match.',+ style: tty.style(color: tty.dim),+ )+ else+ SettingsGroup(+ children: [+ for (final card in connected)+ SettingsRow(+ leading: _ConnectorMark(+ code: card.code,+ name: card.name,+ ),+ title: card.name,+ detail: card.needsAttention+ ? 'Connect again'+ : card.description,+ value: card.needsAttention+ ? 'Reconnect'+ : 'Connected',+ onTap: () => _manage(card),+ ),+ ],+ ),+ SettingsCaption('Available ${available.length}'),+ SettingsGroup(+ children: [+ for (final card in available)+ SettingsRow(+ leading: _ConnectorMark(+ code: card.code,+ name: card.name,+ ),+ title: card.name,+ detail: card.reason.isNotEmpty+ ? card.reason+ : card.description,+ value: _busy.contains(card.code)+ ? 'Signing in…'+ : card.reason.isNotEmpty+ ? null+ : 'Add',+ onTap:+ card.reason.isNotEmpty ||+ _busy.contains(card.code)+ ? null+ : () => unawaited(_connect(card)),+ ),+ ],+ ),+ ],],),- ],- ],- ),+ ),+ ),+ ],),),);diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dartindex 41f43b801..3fdd35fea 100644--- a/mobile/lib/phone/machines_tab.dart+++ b/mobile/lib/phone/machines_tab.dart@@ -35,8 +35,14 @@ class MachinesTab extends StatelessWidget {required this.notifier,this.large = true,this.fromTerminal = false,+ this.fromSettings = false,});+ /// The ↻ beside the title — hidden, its code kept (owner, 2026-10-13): a pull on the list reads+ /// it again, a failed read has its own Try again, and with no computer connected the list is read+ /// again by itself ([AppNotifier.deafMachineListInterval]). Settings has its place.+ static const _showRefresh = false;+final AppNotifier notifier;/// The tab's big title. Off when this is PUSHED — from Settings or a swipe left on the terminal —@@ -47,6 +53,10 @@ class MachinesTab extends StatelessWidget {/// same swipe the other way, as on the New Harness form.final bool fromTerminal;+ /// Pushed from Settings ▸ Computers: no Settings at the top right — back is the way there, and+ /// Settings again over this list would stack Settings on Settings.+ final bool fromSettings;+@overrideWidget build(BuildContext context) => ListenableBuilder(listenable: notifier,@@ -86,16 +96,18 @@ class MachinesTab extends StatelessWidget {),// What a pull on the list does, for whoever does not know to pull — or has// nothing to pull: the empty and failed states draw no list.- _RefreshButton(- busy:- notifier.machinesRefreshing || notifier.machinesLoading,- trailing: !large,- onPressed: () => unawaited(notifier.retryMachines()),- ),- // Large, this is the home screen while no computer is ready — locked, or off —- // and nothing else on it leads to Settings or Sign out. Pushed (small) — from- // Settings, or by the terminal's swipe left — back is the way out.- if (large) PhoneSettingsButton(notifier: notifier),+ if (_showRefresh)+ _RefreshButton(+ busy:+ notifier.machinesRefreshing ||+ notifier.machinesLoading,+ trailing: fromSettings,+ onPressed: () => unawaited(notifier.retryMachines()),+ ),+ // Settings, top right, wherever this list stands (owner, 2026-10-13): the home+ // screen while no computer is ready — where nothing else leads to Settings or+ // Sign out — and pushed from home or the terminal. Not when Settings pushed it.+ if (!fromSettings) PhoneSettingsButton(notifier: notifier),],),Expanded(@@ -413,6 +425,13 @@ class _ConnectBar extends StatefulWidget {/// Add computer: "On your computer, go to", pushed over this list.final VoidCallback onSetUp;+ /// "Or scan the QR code on your computer" under Add computer — hidden, its code kept (owner,+ /// 2026-10-13). Signed in here, a computer on the same account turns up and is trusted by itself+ /// (the device key log), and one that still wants a code reads "locked" in the list, whose+ /// Unlock page leads with "Scan its code": the line only repeated that, and under Add computer it+ /// read as a second way to add one.+ static const offerScan = false;+@overrideState<_ConnectBar> createState() => _ConnectBarState();}@@ -465,9 +484,12 @@ class _ConnectBarState extends State<_ConnectBar> {),child: Padding(// SafeArea leaves the foot to this page: the bar keeps clear of the home indicator itself.+ // Without the scan's line under the button, the gap under it is the one over it.padding: EdgeInsets.only(top: 12,- bottom: MediaQuery.paddingOf(context).bottom,+ bottom:+ MediaQuery.paddingOf(context).bottom ++ (_ConnectBar.offerScan ? 0 : 12),),child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,@@ -500,17 +522,18 @@ class _ConnectBarState extends State<_ConnectBar> {// A desktop from before shows its Add Phone QR code rather than an address: the// camera pairs with it. "QR code", not "Add Phone code" — a desktop menu's name// read as a noun stack under a button named for the other side.- Center(- child: TtyTextButton(- key: const ValueKey('machines-connect-computer'),- label: _scanning- ? 'Scanning…'- : 'Or scan the QR code on your computer',- size: TtySize.meta,- color: tty.faint,- onPressed: _scanning ? null : () => unawaited(_scan()),+ if (_ConnectBar.offerScan)+ Center(+ child: TtyTextButton(+ key: const ValueKey('machines-connect-computer'),+ label: _scanning+ ? 'Scanning…'+ : 'Or scan the QR code on your computer',+ size: TtySize.meta,+ color: tty.faint,+ onPressed: _scanning ? null : () => unawaited(_scan()),+ ),),- ),],),),diff --git a/mobile/lib/phone/settings_page.dart b/mobile/lib/phone/settings_page.dartindex 7e110a2fc..e0646c2ed 100644--- a/mobile/lib/phone/settings_page.dart+++ b/mobile/lib/phone/settings_page.dart@@ -174,7 +174,13 @@ class _Body extends StatelessWidget {SettingsRow(title: 'Computers',onTap: () => Navigator.of(context).push(- phoneRoute((_) => MachinesTab(notifier: notifier, large: false)),+ phoneRoute(+ (_) => MachinesTab(+ notifier: notifier,+ large: false,+ fromSettings: true,+ ),+ ),),),// Which computer's tabs this phone shows — the desktop's Profiles. Beside Computers: itdiff --git a/mobile/lib/phone/welcome/onboarding_copy.dart b/mobile/lib/phone/welcome/onboarding_copy.dartindex 1cea8938a..8329ff758 100644--- a/mobile/lib/phone/welcome/onboarding_copy.dart+++ b/mobile/lib/phone/welcome/onboarding_copy.dart@@ -3,7 +3,8 @@////// ```/// ① Welcome Manage all your agents on all your computers from your phone.-/// [Continue with Google] [Continue with Apple] Continue with email+/// [Scan QR code] [Continue with Google] [Continue with Apple]+/// Scan QR code → the camera: How to get the QR code, its steps, Use email instead/// ② Your computer On your computer, go to [autonomous.ai/go ⇪]/// under the picture: Looking for your computer▌/// under the link: (1) Install Harness (2) Sign in, Use you@…@@ -28,9 +29,18 @@ abstract final class OnboardingCopy {static const welcome ='Manage all your agents on all your computers from your phone.';- /// ① The quiet line under the accounts.+ /// ① The first of the three ways in: the camera, for the code a signed-in computer's Add Phone+ /// shows, which signs this phone in to that computer's account with nothing to type.+ static const scanQrCode = 'Scan QR code';++ /// An emailed code. Not on the welcome any more (owner, 2026-10-12: three ways in, nothing else);+ /// the camera's "Use email instead" leads to it.static const continueWithEmail = 'Continue with email';+ /// ① Under the picture, when the camera read a computer's own sign-in code (its "Scan with your+ /// phone"): this phone needs an account before it can approve one.+ static const signInFirst = 'Sign in first, then approve your computer.';+/// ② The headline over the address.static const goToHeadline = 'On your computer, go to';diff --git a/mobile/lib/phone/welcome/onboarding_frame.dart b/mobile/lib/phone/welcome/onboarding_frame.dartindex c8be08589..0f1415cce 100644--- a/mobile/lib/phone/welcome/onboarding_frame.dart+++ b/mobile/lib/phone/welcome/onboarding_frame.dart@@ -11,7 +11,8 @@ import 'set_up_computer.dart' show StepsTimeline, goToSteps;/// which every screen after signing in shares (its wait, and the computer joining), so the picture/// stays put from one to the next.enum OnboardingLayout {- /// ① A headline of up to three lines; the two accounts and the quiet line at the foot.+ /// ① A headline of up to three lines; Scan QR code, the two accounts and the quiet line at the+ /// foot.welcome,/// ② The headline, the link and the steps on the computer under it — "Not you? Sign out" under@@ -34,9 +35,9 @@ enum OnboardingLayout {/// └──────────────────┘/// Looking for your computer▌ status///-/// [ Continue with Google ] actions, at the foot+/// [ Scan QR code ] actions, at the foot+/// [ Continue with Google ]/// [ Continue with Apple ]-/// Continue with email/// ```////// ⚠️ **Every slot is measured the same way on every screen of a [layout]**, whatever it holds — the@@ -118,10 +119,10 @@ class OnboardingFrame extends StatelessWidget {);final quiet = math.max(44.0, scaler.scale(quietSize) * 1.45);final (head, foot) = switch (layout) {- // The headline's three lines; the two accounts and the quiet line under them.+ // The headline's three lines; the three ways in and the quiet line under them.OnboardingLayout.welcome => (math.max(3 * line, 2 * line + _underGap + button),- 2 * button + _buttonGap + quiet + 8,+ 3 * button + 2 * _buttonGap + quiet + 8,),// Two lines of headline, the link and the steps; one quiet line.OnboardingLayout.goTo => (diff --git a/mobile/lib/phone/welcome/phone_welcome.dart b/mobile/lib/phone/welcome/phone_welcome.dartindex b3d28eb30..854cac52a 100644--- a/mobile/lib/phone/welcome/phone_welcome.dart+++ b/mobile/lib/phone/welcome/phone_welcome.dart@@ -10,10 +10,13 @@ import 'package:harness_mobile/state/app_state.dart';import '../exit_app.dart';import '../tty.dart';import '../tty_controls.dart';+import 'connect_code.dart';import 'email_sign_in.dart';import 'onboarding_copy.dart';import 'onboarding_frame.dart';import 'onboarding_picture.dart';+import 'scan_to_connect.dart';+import 'set_up_computer.dart' show ComputerSteps;import 'sign_in_provider_button.dart';/// The phone's first screen, signed out: ① Welcome — the promise, and signing in right there.@@ -28,9 +31,10 @@ import 'sign_in_provider_button.dart';/// │ all lit, a phone │/// └─────────────────────┘///+/// [ ⊞ Scan QR code ] → the camera ([ScanToConnectPage]) → Use email instead/// [ G Continue with Google ]/// [ Continue with Apple ]-/// Continue with email → Your email → Check your email+/// (Cancel here while an account's page is up)/// ```////// Signing in is all there is to do here, and it moves on by itself: signed in, the app swaps this@@ -38,10 +42,12 @@ import 'sign_in_provider_button.dart';/// the computer's session when it has one (`docs/research/2026-10-11-phone-onboarding`, agreed with/// the owner 2026-10-12).///-/// ⚠️ **Google first, and nothing else on the screen** (owner, 2026-10-12): no camera, no sample, no-/// "Is Harness on your computer?", no tips. The QR the desktop shows only gets the app now — the-/// account does the rest, its device key log making every computer signed in to it trust this phone-/// — so the camera this screen used to open on (2026-10-09) has nothing left to read here.+/// ⚠️ **Three ways in, nothing else** (owner, 2026-10-12): **Scan QR code** first, the screen's one+/// filled button — its camera reads the code a signed-in computer's Add Phone shows ([ConnectCode]):+/// its sign-in code signs this phone in to that computer's account with nothing to type, and its+/// pairing code is held for that computer ([AppNotifier.pendingPairing]) — then Google and Apple.+/// No sample, no "Is Harness on your computer?", no tips. An emailed code is the camera's "Use+/// email instead", and where a scan without a sign-in code ends up.////// ⚠️ **The foot never changes height.** While an account's page is up, the quiet line under the/// buttons becomes Cancel; why it did not finish is said under the picture — so the picture, in@@ -52,6 +58,7 @@ class PhoneWelcome extends StatefulWidget {required this.notifier,this.sendCode,this.signIn,+ this.scanCamera,});final AppNotifier notifier;@@ -60,11 +67,14 @@ class PhoneWelcome extends StatefulWidget {final Future<void> Function(String email)? sendCode;final Future<void> Function(String email, String code)? signIn;+ /// Stands in for the camera on Scan QR code's page, in tests and renders. Null opens the real one.+ final Widget? scanCamera;+@overrideState<PhoneWelcome> createState() => _PhoneWelcomeState();}-enum _Step { hello, email, code }+enum _Step { hello, scan, email, code }class _PhoneWelcomeState extends State<PhoneWelcome> {_Step _step = _Step.hello;@@ -75,7 +85,14 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {String? _sentTo;bool _busy = false;+ /// Between a scan and the session it signs in: the camera's page says so.+ bool _signingInWithScan = false;+String? _error;++ /// A line under the picture that is neither a failure nor a sign-out: what to do next.+ String? _notice;+int _resendIn = 0;Timer? _resendTimer;@@ -105,15 +122,101 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}}- /// To [step], with nothing said on it unless [error] is: a step's failure belongs to the step- /// it happened on.- void _go(_Step step, {String? error}) {+ /// A code a signed-in computer's Add Phone showed. Its pairing code is held until that computer+ /// shows up ([AppNotifier.pendingPairing]); its sign-in code signs the phone in there and then.+ /// Without one — an older computer's code — or when it has expired, the account's email is+ /// filled in and a code sent, so signing in is the four digits.+ Future<void> _onScanned(ConnectCode code) async {+ final notifier = widget.notifier;+ final machineId = code.machineId, pairCode = code.pairCode;+ if (machineId != null && pairCode != null) {+ notifier.pendingPairing = (machineId: machineId, code: pairCode);+ }+ _email.text = code.email;+ final signIn = code.signIn;+ if (signIn != null) {+ setState(() => _signingInWithScan = true);+ try {+ // ⚠️ [AppNotifier.signInWithScan] does nothing while another sign-in is under way — an+ // account's page let go of on the way here — so that one is waited out first, or the scan+ // would be dropped without a word under a camera that reads one code only.+ if (!await _signInFree()) throw StateError('Another sign-in is under way');+ if (!mounted || _step != _Step.scan) return;+ await notifier.signInWithScan(signIn);+ // In, or going in: the app swaps this screen for home. Still out and nothing under way is+ // a scan that was dropped all the same, and the email is the way on.+ if (!mounted ||+ notifier.signingIn ||+ notifier.status != AppStatus.unauthenticated) {+ return;+ }+ } catch (_) {+ // Expired, spent, or a backend that predates it: the emailed code is the way on.+ } finally {+ if (mounted) setState(() => _signingInWithScan = false);+ }+ if (!mounted) return;+ }+ unawaited(_emailCodeFromScan());+ }++ /// The scan could not sign the phone in by itself, so the email in it is sent a code instead.+ /// When even that cannot go — the address does not pass, the network is down — the email step+ /// takes over with the reason under its field: the camera's page shows no errors, and its camera+ /// reads nothing more after one code.+ Future<void> _emailCodeFromScan() async {+ // Gone from the camera meanwhile: the person chose another way.+ if (_step != _Step.scan) return;+ setState(() => _signingInWithScan = true);+ final sent = await _sendCode();+ if (!mounted) return;+ setState(() => _signingInWithScan = false);+ if (sent || _step != _Step.scan) return;+ _go(_Step.email, error: _error);+ }++ /// A computer's own sign-in code — its "Scan with your phone" — read before this phone has an+ /// account to approve it with. Held for the sign-in this phone does first+ /// ([AppNotifier.pendingComputerSignIn]); the home screen asks for the approval once it is in.+ void _onComputerSignInCode(SignInCode code) {+ widget.notifier.pendingComputerSignIn = code.code;+ _go(_Step.hello, notice: OnboardingCopy.signInFirst);+ }++ /// Waits, briefly, for a sign-in already under way to let go — an account's page just cancelled —+ /// so the scan's own finds the way clear. False when it did not.+ Future<bool> _signInFree() async {+ final notifier = widget.notifier;+ if (!notifier.signingIn) return true;+ final free = Completer<void>();+ void check() {+ if (!notifier.signingIn && !free.isCompleted) free.complete();+ }++ notifier.addListener(check);+ try {+ await free.future.timeout(const Duration(seconds: 3));+ return true;+ } on TimeoutException {+ return false;+ } finally {+ notifier.removeListener(check);+ }+ }++ /// To [step], with nothing said on it unless [error] or [notice] is: a step's failure belongs to+ /// the step it happened on.+ void _go(_Step step, {String? error, String? notice}) {// Leaving for another way in takes the account's page with it: whatever it came back with// would sign the phone in behind the step the person chose instead.if (step != _step) widget.notifier.cancelProviderSignIn();+ // Back at the camera, a computer's sign-in code read there before is let go: the next code+ // read is the one the person means.+ if (step == _Step.scan) widget.notifier.pendingComputerSignIn = null;setState(() {_step = step;_error = error;+ _notice = notice;});if (step == _Step.email) _emailFocus.requestFocus();if (step == _Step.code) _codeFocus.requestFocus();@@ -230,9 +333,14 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {headline: OnboardingCopy.welcome,headlineKey: const ValueKey('welcome-headline'),picture: const OnboardingPicture(scene: OnboardingScene.welcome),- status: switch ((_error, notifier.signedOutReason)) {- (final error?, _) => _Said(error, error: true),- (null, final reason?) => _Said(reason),+ status: switch ((_error, _notice, notifier.signedOutReason)) {+ (final error?, _, _) => _Said(error, error: true),+ (null, final notice?, _) => _Said(+ notice,+ key: const ValueKey('welcome-notice'),+ icon: LucideIcons.monitorSmartphone300,+ ),+ (null, null, final reason?) => _Said(reason),_ => null,},actions: _Accounts(@@ -242,9 +350,21 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {waitingOn: notifier.signInProvider,entering: entering,onCancel: notifier.cancelProviderSignIn,- onEmail: () => _go(_Step.email),+ onScan: () => _go(_Step.scan),),),+ _Step.scan => ScanToConnectPage(+ camera: widget.scanCamera,+ onCode: (code) => unawaited(_onScanned(code)),+ // Taken, not ignored: a phone pointed at a computer's own sign-in QR has a person+ // behind it, and a camera that did nothing was all they used to get.+ onSignInCode: _onComputerSignInCode,+ signingIn: _signingInWithScan,+ // Where the code is on the computer — the same steps as the camera on Computers.+ steps: const ComputerSteps(account: null),+ onUseEmail: () => _go(_Step.email),+ onBack: () => _go(_Step.hello),+ ),_Step.email => SignInForm(onBack: () => _go(_backFrom(_Step.email)),title: 'Your email',@@ -318,14 +438,14 @@ class _PhoneWelcomeState extends State<PhoneWelcome> {}}-/// The welcome's foot: Google, then Apple ([SignInProviderButton]), and the quiet line under them —-/// "Continue with email", or Cancel while an account's page is up. One slot for both, so the foot-/// is the same height whatever it says.+/// The welcome's foot: Scan QR code — the screen's one filled button — then Google and Apple+/// ([SignInProviderButton]), and under them the quiet line's slot: Cancel while an account's page+/// is up, empty otherwise, so the foot is the same height whatever it holds.class _Accounts extends StatelessWidget {const _Accounts({required this.onProvider,required this.onCancel,- required this.onEmail,+ required this.onScan,this.waitingOn,this.entering = false,});@@ -340,19 +460,26 @@ class _Accounts extends StatelessWidget {/// left to cancel.final bool entering;final VoidCallback onCancel;- final VoidCallback onEmail;++ /// "Scan QR code": the camera.+ final VoidCallback onScan;@overrideWidget build(BuildContext context) {- final tty = Tty.of(context);final waiting = waitingOn != null && !entering;return Column(mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.stretch,children: [+ TtyPrimaryButton(+ key: const ValueKey('welcome-scan'),+ icon: LucideIcons.qrCode300,+ label: OnboardingCopy.scanQrCode,+ // Not while an account's page is up, or past it: the scan would sign in behind it.+ onPressed: onProvider == null ? null : onScan,+ ),for (final provider in SignInProvider.values) ...[- if (provider != SignInProvider.values.first)- const SizedBox(height: 10),+ const SizedBox(height: 10),SignInProviderButton(provider: provider,onPressed: onProvider == null ? null : () => onProvider!(provider),@@ -361,37 +488,38 @@ class _Accounts extends StatelessWidget {: null,),],- Center(- child: waiting- ? TtyTextButton(- key: const ValueKey('welcome-cancel'),- label: 'Cancel',- size: TtySize.meta,- onPressed: onCancel,- )- : TtyTextButton(- key: const ValueKey('welcome-email-way'),- label: OnboardingCopy.continueWithEmail,- size: TtySize.meta,- color: tty.faint,- // Not while an account's page is up, or past it: the email would sign in- // behind it.- onPressed: onProvider == null ? null : onEmail,- ),- ),+ if (waiting)+ Center(+ child: TtyTextButton(+ key: const ValueKey('welcome-cancel'),+ label: 'Cancel',+ size: TtySize.meta,+ onPressed: onCancel,+ ),+ )+ else+ // The quiet line's room, held: Cancel takes it without the foot growing.+ const SizedBox(height: 44),],);}}/// A line under the picture, in the status line's place: why an account's sign-in did not finish-/// (the terminal's red ✗), or why a phone that was signed in is back here (the sign-out mark in its-/// yellow — not red: the person did nothing wrong, and signing in again is the whole of what to do).+/// (the terminal's red ✗), why a phone that was signed in is back here (the sign-out mark in its+/// yellow — not red: the person did nothing wrong, and signing in again is the whole of what to do),+/// or what to do next ([icon] in place of the sign-out mark).class _Said extends StatelessWidget {- const _Said(this.text, {this.error = false});+ const _Said(+ this.text, {+ super.key,+ this.error = false,+ this.icon = LucideIcons.logOut300,+ });final String text;final bool error;+ final IconData icon;@overrideWidget build(BuildContext context) {@@ -400,7 +528,9 @@ class _Said extends StatelessWidget {return Semantics(liveRegion: true,child: Text.rich(- key: ValueKey(error ? 'welcome-error' : 'welcome-signed-out'),+ key: key == null+ ? ValueKey(error ? 'welcome-error' : 'welcome-signed-out')+ : null,TextSpan(children: [if (error)@@ -410,11 +540,7 @@ class _Said extends StatelessWidget {alignment: PlaceholderAlignment.middle,child: Padding(padding: const EdgeInsets.only(right: 6),- child: Icon(- LucideIcons.logOut300,- size: 14,- color: tty.yellow,- ),+ child: Icon(icon, size: 14, color: tty.yellow),),),TextSpan(text: text),diff --git a/mobile/lib/phone/welcome/scan_to_connect.dart b/mobile/lib/phone/welcome/scan_to_connect.dartindex 29b665eca..2d5bb92e2 100644--- a/mobile/lib/phone/welcome/scan_to_connect.dart+++ b/mobile/lib/phone/welcome/scan_to_connect.dart@@ -15,12 +15,11 @@ import '../tty.dart';import '../tty_controls.dart';import 'connect_code.dart';-/// Where Add Phone… is on the computer, for somebody who has never opened it — under Connect your-/// computer's "Click Add Phone" (`set_up_computer.dart`). The Mac keeps it in the Harness menu; the-/// desktop app's Linux menu strip has no row for it, so there it is the command palette's-/// (`navigation.commands`, Ctrl+Shift+P, finds the "Add phone" command). A line each: one line-/// wrapped in the middle of the Linux half.-const kAddPhoneWhere = 'Mac: Harness menu\nLinux: Ctrl+Shift+P → add phone';+/// Where Add Phone is on the computer, for somebody who has never opened it — under the camera's+/// "Click "Add Phone"" (`set_up_computer.dart`): the Mac's menu path, Harness menu → Add Phone…+/// (owner, 2026-10-12). Linux has no Harness menu; there it is the phone icon in the window's tab+/// row, top right (desktop #1257), and the command palette.+const kAddPhoneWhere = 'Harness menu → Add Phone';/// **Connect computer**: the camera, reading the code the desktop app shows in Add Phone/// ([ConnectCode]). The scan signs the phone in; [signingIn] says so while it does.@@ -30,15 +29,19 @@ const kAddPhoneWhere = 'Mac: Harness menu\nLinux: Ctrl+Shift+P → add phone';/// ┌──────────────────────────────┐/// │ [ camera view ] │/// └──────────────────────────────┘-/// Scan the code on your computer+/// How to get the QR code ([steps]; "Signing in…" over them while it does)+/// (1) Open Harness on your computer+/// (2) Click "Add Phone"+/// Harness menu → Add Phone///-/// Can’t scan? Sign in another way ([fallbackLabel])+/// Use email instead ([fallbackLabel])/// ```////// ⚠️ **Only the scan here (owner, 2026-10-08).** What has to happen on the computer first — get/// Harness, open it, sign in, open Add Phone, and where that is — is said by the page this one is-/// opened from, or under its title ([steps]): the camera at the top and its title are the page. Centred in the room left, the camera had put every word at the foot of the screen under an-/// empty band.+/// opened from, or under the camera ([steps]): the camera at the top and the words under it are the+/// page. Centred in the room left, the camera had put every word at the foot of the screen under+/// an empty band.////// The camera runs only while this page is up. A code that is not ours is ignored, so a stray QR/// in frame does nothing. A camera refused says where to turn it on, with a link to this app's@@ -55,7 +58,7 @@ class ScanToConnectPage extends StatefulWidget {this.camera,this.onSignInCode,this.acceptConnectCodes = true,- this.title = 'Scan the code on your computer',+ this.title,this.step,this.steps,});@@ -68,7 +71,11 @@ class ScanToConnectPage extends StatefulWidget {/// Whether an Add Phone QR ([ConnectCode]) is one this page takes.final bool acceptConnectCodes;- final String title;+ /// Under the camera. Null leaves it to [steps] (owner, 2026-10-12): the camera itself says to+ /// scan, and the steps say where the code is. With no steps either — a page that has said them+ /// already (Unlock, pairing) — it reads "Scan the code on your computer". "Signing in…" takes its+ /// place while a scan signs in.+ final String? title;/// Under the title, quieter: where the code is on the computer, when the page it is opened from/// has not said so already. Null says nothing more.@@ -97,8 +104,17 @@ class ScanToConnectPage extends StatefulWidget {State<ScanToConnectPage> createState() => _ScanToConnectPageState();}+/// What stands under the camera when nothing else says what to do: no title, and no steps.+const _scanTitle = 'Scan the code on your computer';+class _ScanToConnectPageState extends State<ScanToConnectPage>with WidgetsBindingObserver {+ /// The line under the camera: "Signing in…" while a scan signs in; else the caller's title; else,+ /// with no steps to say what to do, [_scanTitle]. Null draws none — the steps lead.+ String? get _heading => widget.signingIn+ ? 'Signing in…'+ : widget.title ?? (widget.steps == null ? _scanTitle : null);+/// Set once a code of ours is read: the camera keeps reporting it every frame.bool _done = false;@@ -278,14 +294,15 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- Text(- widget.signingIn ? 'Signing in…' : widget.title,- textAlign: TextAlign.center,- style: tty.style(- size: TtySize.title,- weight: FontWeight.w600,+ if (_heading case final title?)+ Text(+ title,+ textAlign: TextAlign.center,+ style: tty.style(+ size: TtySize.title,+ weight: FontWeight.w600,+ ),),- ),if (widget.step case final step?) ...[const SizedBox(height: 6),Text(@@ -296,7 +313,7 @@ class _ScanToConnectPageState extends State<ScanToConnectPage>),],if (widget.steps case final steps?) ...[- const SizedBox(height: 24),+ if (_heading != null) const SizedBox(height: 24),steps,],],diff --git a/mobile/lib/phone/welcome/set_up_computer.dart b/mobile/lib/phone/welcome/set_up_computer.dartindex 1967e46a1..1eee8ad76 100644--- a/mobile/lib/phone/welcome/set_up_computer.dart+++ b/mobile/lib/phone/welcome/set_up_computer.dart@@ -22,10 +22,11 @@ typedef ComputerStep = ({String title, String? note});/// The first step on the computer, for the camera.///-/// ⚠️ **"On your computer" is said once, by the title over the steps** — "On your computer, go to",-/// "Scan the code on your computer" — not again in each step under it (owner, 2026-10-12: three-/// times on one screen read as noise).-const _openHarness = 'Open Harness';+/// ⚠️ **"On your computer" is said once on a screen** (owner, 2026-10-12: three times on one screen+/// read as noise) — by the title over ②'s steps ("On your computer, go to"), and under the camera+/// by this first step: the camera has no title of its own, and "Open Harness" on its own, on a+/// phone already in Harness, read as opening this app.+const _openHarness = 'Open Harness on your computer';/// The steps under "On your computer, go to"'s link: get Harness from it, and sign in — with/// [account], the phone's, when there is one to name. Signed in with this account, the computer@@ -36,21 +37,21 @@ List<ComputerStep> goToSteps(String? account) => [_signIn(account),];-/// The steps under the camera opened from Computers ▸ "Or scan the QR code on your computer", which-/// pairs a phone by Add Phone's code — where the page it came from says none of them-/// ([ScanToConnectPage.steps]): open Harness, sign in — with [account], when there is one to name —-/// then Add Phone and where it is.+/// The steps under the camera that reads Add Phone's code — the welcome's Scan QR code, and+/// Computers' "Or scan the QR code on your computer" — where the page it came from says none of+/// them ([ScanToConnectPage.steps]): open Harness on the computer, then Add Phone and where it is.////// ⚠️ **One set for the camera (owner, 2026-10-12).** It used to be two: signed out "Click Add/// Phone ③ Scan the QR code", signed in "Sign in on your computer ③ Not showing up? Click Add/// Phone" — steps that changed under one button, and on the camera "Not showing up?" was asked of/// somebody already scanning. Both halves hold either way: Add Phone asks a computer that is not/// signed in to sign in before it shows a code, and a computer that turns up by itself is paired-/// just as well by its code. The scan is the camera's own title, so it is not a step of its own.+/// just as well by its code. The scan is the camera itself, so it is not a step of its own.+/// Two steps, signing in not among them (owner, 2026-10-12): the desktop now has its person sign+/// in before anything else, Add Phone included. [account] is kept for the callers that pass it.List<ComputerStep> computerSteps(String? account) => [(title: _openHarness, note: null),- _signIn(account),- (title: 'Click Add Phone', note: kAddPhoneWhere),+ (title: 'Click "Add Phone"', note: kAddPhoneWhere),];/// Signing in on the computer — with [account], the phone's, when there is one to name. Null signed@@ -58,7 +59,12 @@ List<ComputerStep> computerSteps(String? account) => [ComputerStep _signIn(String? account) =>(title: 'Sign in', note: account == null ? null : 'Use $account');-/// The steps on the computer under the camera ([computerSteps]) as a [StepsTimeline].+/// Over the camera's steps: what they are for — how the code comes up on the computer, so they+/// are not read as more to do on the phone. The camera above them is what says to scan.+const _howToGetCode = 'How to get the QR code';++/// The steps on the computer under the camera ([computerSteps]) as a [StepsTimeline], under a+/// quiet line that says what they are for.class ComputerSteps extends StatelessWidget {const ComputerSteps({super.key, required this.account});@@ -66,8 +72,24 @@ class ComputerSteps extends StatelessWidget {final String? account;@override- Widget build(BuildContext context) =>- StepsTimeline(steps: computerSteps(account));+ Widget build(BuildContext context) {+ final tty = Tty.of(context);+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Semantics(+ header: true,+ child: Text(+ _howToGetCode,+ style: tty.style(color: tty.faint, size: TtySize.meta),+ ),+ ),+ const SizedBox(height: 12),+ StepsTimeline(steps: computerSteps(account)),+ ],+ );+ }}/// Steps as a timeline — each number in a ring, a thread down to the next:diff --git a/mobile/test/phone_edge/welcome_behavior_test.dart b/mobile/test/phone_edge/welcome_behavior_test.dartindex 3b2d5f4da..efb00d82c 100644--- a/mobile/test/phone_edge/welcome_behavior_test.dart+++ b/mobile/test/phone_edge/welcome_behavior_test.dart@@ -80,6 +80,7 @@ void main() {signIn: (_, code) async {if (code != '4242') throw Exception('That code is not right.');},+ scanCamera: const SizedBox.expand(),),),);@@ -87,9 +88,11 @@ void main() {return (app: app, sent: sent);}- /// The welcome's quiet line, under the accounts.+ /// The emailed code's way in: Scan QR code, then the camera's "Use email instead".Future<void> toEmail(WidgetTester tester) async {- await tester.tap(find.byKey(const ValueKey('welcome-email-way')));+ await tester.tap(find.byKey(const ValueKey('welcome-scan')));+ await frames(tester);+ await tester.tap(find.text('Use email instead'));await frames(tester);}diff --git a/mobile/test/phone_edge/welcome_layout_test.dart b/mobile/test/phone_edge/welcome_layout_test.dartindex 3017c6907..292be1fc6 100644--- a/mobile/test/phone_edge/welcome_layout_test.dart+++ b/mobile/test/phone_edge/welcome_layout_test.dart@@ -45,6 +45,7 @@ void main() {signIn: (_, _) async => throw Exception('That code has expired. Ask for a new one and try again within ten minutes.',),+ scanCamera: const SizedBox.expand(),);/// Home as the shell mounts it, for an account with no computer yet.@@ -70,7 +71,10 @@ void main() {final app = edgeApp(noMachines: true);addTearDown(app.dispose);await pump(tester, welcome(app), scale, brightness);- await tapInView(tester, find.byKey(const ValueKey('welcome-email-way')));+ // The emailed code's way in: Scan QR code, then the camera's "Use email instead".+ await tapInView(tester, find.byKey(const ValueKey('welcome-scan')));+ await frames(tester);+ await tapInView(tester, find.text('Use email instead'));await frames(tester);await tester.enterText(find.byType(TextField),diff --git a/mobile/test/phone_welcome_first_screen_test.dart b/mobile/test/phone_welcome_first_screen_test.dartindex 79580a069..c922f3612 100644--- a/mobile/test/phone_welcome_first_screen_test.dart+++ b/mobile/test/phone_welcome_first_screen_test.dart@@ -12,8 +12,9 @@ import 'package:harness_mobile/phone/welcome/scan_to_connect.dart';import 'package:harness_mobile/phone/welcome/sign_in_provider_button.dart';import 'package:harness_mobile/state/app_state.dart';-/// The first screen: ① Welcome — the promise, the two accounts, the emailed code under them, and-/// nothing else (`docs/research/2026-10-11-phone-onboarding`).+/// The first screen: ① Welcome — the promise, Scan QR code and the two accounts, and nothing else+/// (`docs/research/2026-10-11-phone-onboarding`; owner, 2026-10-12). The emailed code is the+/// camera's "Use email instead".void main() {group('ConnectCode', () {test('reads the desktop app\'s link, all of it in the fragment', () {@@ -81,6 +82,7 @@ void main() {notifier: notifier,sendCode: (email) async => sent.add(email),signIn: (email, code) async => signedIn.add((email, code)),+ scanCamera: const SizedBox.expand(),),),),@@ -91,13 +93,17 @@ void main() {Rect picture(WidgetTester tester) =>tester.getRect(find.byType(OnboardingPicture));+ TtyPrimaryButton scan(WidgetTester tester) => tester.widget<TtyPrimaryButton>(+ find.byKey(const ValueKey('welcome-scan')),+ );+SignInProviderButton account(WidgetTester tester, SignInProvider provider) =>tester.widgetList<SignInProviderButton>(find.byType(SignInProviderButton)).firstWhere((button) => button.provider == provider);testWidgets(- 'the promise, the two accounts, the emailed code — and nothing else',+ 'the promise, Scan QR code and the two accounts — and nothing else',(tester) async {await pump(tester);expect(find.text(OnboardingCopy.welcome), findsOneWidget);@@ -105,10 +111,16 @@ void main() {tester.widget<OnboardingPicture>(find.byType(OnboardingPicture)).scene,OnboardingScene.welcome,);+ expect(find.text(OnboardingCopy.scanQrCode), findsOneWidget);expect(find.text('Continue with Google'), findsOneWidget);expect(find.text('Continue with Apple'), findsOneWidget);- expect(find.text(OnboardingCopy.continueWithEmail), findsOneWidget);- // Google first.+ // The emailed code is the camera's, not this screen's.+ expect(find.text(OnboardingCopy.continueWithEmail), findsNothing);+ // Scan QR code first, then Google, then Apple.+ expect(+ tester.getTopLeft(find.text(OnboardingCopy.scanQrCode)).dy,+ lessThan(tester.getTopLeft(find.text('Continue with Google')).dy),+ );expect(tester.getTopLeft(find.text('Continue with Google')).dy,lessThan(tester.getTopLeft(find.text('Continue with Apple')).dy),@@ -137,26 +149,19 @@ void main() {await tester.pump();expect(find.text('Waiting for Google…'), findsOneWidget);expect(find.byKey(const ValueKey('welcome-cancel')), findsOneWidget);- expect(find.byKey(const ValueKey('welcome-email-way')), findsNothing);- // The other account waits it out.+ // The other account, and the camera, wait it out.expect(account(tester, SignInProvider.apple).onPressed, isNull);+ expect(scan(tester).onPressed, isNull);// The foot is the same height whatever it says: the picture has not moved.expect(picture(tester), before);- // Past the page, going in: nothing left to cancel, and the email cannot sign in behind it.+ // Past the page, going in: nothing left to cancel, and a scan cannot sign in behind it.notifier.status = AppStatus.bootstrapping;notifier.notifyListeners();await tester.pump();expect(find.text('Signing in…'), findsOneWidget);expect(find.byKey(const ValueKey('welcome-cancel')), findsNothing);- expect(- tester- .widget<TtyTextButton>(- find.byKey(const ValueKey('welcome-email-way')),- )- .onPressed,- isNull,- );+ expect(scan(tester).onPressed, isNull);expect(picture(tester), before);},);@@ -181,7 +186,11 @@ void main() {tester,) async {await pump(tester);- await tester.tap(find.text(OnboardingCopy.continueWithEmail));+ // Through the camera: Scan QR code, then its "Use email instead".+ await tester.tap(find.byKey(const ValueKey('welcome-scan')));+ await tester.pump();+ expect(find.byType(ScanToConnectPage), findsOneWidget);+ await tester.tap(find.text('Use email instead'));await tester.pump();expect(find.text('Your email'), findsOneWidget);