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
refactor(mobile): the app shell stops carrying the desktop's screens and menu
dee037e7010effd
diff --git a/mobile/README.md b/mobile/README.mdindex 63d6ef3a8..e2bbf8c11 100644--- a/mobile/README.md+++ b/mobile/README.md@@ -81,8 +81,8 @@ installs nothing.## Keeping in step with `../desktop`The shared half of `lib/` was **vendored** from `desktop/lib/`, not rewritten, and outside-`lib/phone/` and `lib/p2p/` the two trees are byte-identical apart from the package name and six-files. So a fix that belongs on both sides can be carried across with `diff`:+`lib/phone/` and `lib/p2p/` the two trees are byte-identical apart from the package name and the+files below. So a fix that belongs on both sides can be carried across with `diff`:```bash# What has drifted, ignoring the package rename@@ -93,13 +93,15 @@ cd mobile/lib && for f in $(find . -name '*.dart' | sed 's|^\./||'); dodone```-The six that are expected to differ, and why:+The files expected to differ, and why:| File | Why ||---|---|| `main.dart` | mounts `PhoneShell` and the p2p transport, not `SwarmScreen` |-| `app_shell.dart` | no managed window: `window_manager` ships for macOS/Windows/Linux only |-| `widgets/update_notice.dart` | same — it was wrapped in a window drag area |-| `screens/login_screen.dart`, `widgets/bootstrapping_screen.dart`, `widgets/engine_identity.dart` | assets are this package's own, so they no longer name a `package:` to load from |+| `app_shell.dart` | no managed window: `window_manager` ships for macOS/Windows/Linux only; and no application menu, update band, provisioning screens or desktop sign-in |+| `widgets/engine_identity.dart` | assets are this package's own, so it no longer names a `package:` to load from |-`lib/core/desktop_window.dart` and `lib/widgets/window_chrome.dart` have no copy here at all.+`lib/core/desktop_window.dart` and `lib/widgets/window_chrome.dart` have no copy here at all, and+neither have the desktop screens a phone can never reach: the sign-in and boot screens (the phone+has `PhoneWelcome` and `PhoneBoot`), first-run provisioning, the update notice, the firmware+flasher, the layout palette and the shortcuts sheet.diff --git a/mobile/lib/app_shell.dart b/mobile/lib/app_shell.dartindex fcac59582..7be281744 100644--- a/mobile/lib/app_shell.dart+++ b/mobile/lib/app_shell.dart@@ -1,35 +1,20 @@-import 'dart:async';-import 'dart:ui' show AppExitResponse;-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';import 'package:flutter_riverpod/flutter_riverpod.dart';import 'analytics/analytics_lifecycle.dart';import 'core/crash_log.dart';-import 'screens/login_screen.dart';import 'state/app_state.dart';import 'viewer/viewer_services.dart';import 'ws/terminal_transport_plugin.dart';import 'shared/theme/app_theme.dart' as grid;import 'shared/theme/appearance_prefs_store.dart';-import 'terminal/terminal_font_store.dart';-import 'widgets/bootstrapping_screen.dart';-import 'widgets/layout_palette.dart';-import 'widgets/environment_preflight_screen.dart';-import 'widgets/environment_setup_screen.dart';-import 'widgets/flash_firmware_dialog.dart';import 'core/startup.dart';import 'logging/app_log.dart';import 'logging/install.dart';import 'logging/startup_trace.dart';import 'shortcuts/app_keymap.dart';-import 'widgets/shortcuts_sheet.dart';-import 'widgets/update_notice.dart';-/// The screen an app puts up once someone is signed in — the desktop's swarm of-/// panes, or the phone's one-agent-at-a-time shell. It is the only thing the two-/// entry points disagree about; everything below is shared.+/// A screen the app puts up for one of its states — signed in, signed out, starting.typedef AuthenticatedScreenBuilder = Widget Function(AppNotifier app);/// Everything both entry points do before their first frame: file logs, the@@ -43,13 +28,11 @@ typedef AuthenticatedScreenBuilder = Widget Function(AppNotifier app);Future<void> startHarness({required AuthenticatedScreenBuilder authenticatedScreen,- /// The signed-out screen, when the platform has its own — the phone's welcome. Null keeps- /// [LoginScreen].- AuthenticatedScreenBuilder? signedOutScreen,+ /// The signed-out screen — the phone's welcome.+ required AuthenticatedScreenBuilder signedOutScreen,- /// The screen while the app starts, when the platform has its own. Null keeps- /// [BootstrappingScreen], which speaks of a window and a local service — the desktop's.- AuthenticatedScreenBuilder? bootScreen,+ /// The screen while the app starts.+ required AuthenticatedScreenBuilder bootScreen,/// A viewer build's second wire to each machine (see/// [TerminalTransportPlugin]); the desktop passes none.@@ -103,13 +86,13 @@ class HarnessApp extends StatelessWidget {super.key,this.keymap,required this.authenticatedScreen,- this.signedOutScreen,- this.bootScreen,+ required this.signedOutScreen,+ required this.bootScreen,});final AppKeymap? keymap;final AuthenticatedScreenBuilder authenticatedScreen;- final AuthenticatedScreenBuilder? signedOutScreen;- final AuthenticatedScreenBuilder? bootScreen;+ final AuthenticatedScreenBuilder signedOutScreen;+ final AuthenticatedScreenBuilder bootScreen;@overrideWidget build(BuildContext context) {@@ -227,150 +210,54 @@ class _GridTokenScope extends StatelessWidget {}}-/// Carries "Check for Updates…" from the macOS application menu into Dart.+/// Which screen the app's state calls for.///-/// The item is installed natively (MainFlutterWindow.swift) so the rest of the-/// menu bar keeps coming from the nib; all this side does is act on the tap.-const _appMenuChannel = MethodChannel('harness/app_menu');--class RootShell extends ConsumerStatefulWidget {+/// ⚠️ **What a desktop window also had here, and why it is gone.** The macOS application menu+/// (`harness/app_menu`: check for updates, flash firmware, layouts, shortcuts, terminal font+/// size), the update band, and the two first-run provisioning screens. No iOS or Android runner+/// registers that channel, and a viewer build never provisions or self-updates:+/// `AppNotifier.bootstrap` skips both whenever it has a [ViewerServices], which it always does on+/// a phone (`kViewerMode`).+class RootShell extends ConsumerWidget {const RootShell({super.key,required this.authenticatedScreen,- this.signedOutScreen,- this.bootScreen,+ required this.signedOutScreen,+ required this.bootScreen,});final AuthenticatedScreenBuilder authenticatedScreen;- final AuthenticatedScreenBuilder? signedOutScreen;- final AuthenticatedScreenBuilder? bootScreen;-- @override- ConsumerState<RootShell> createState() => _RootShellState();-}--class _RootShellState extends ConsumerState<RootShell>- with WidgetsBindingObserver {- bool _menuDialogOpen = false;+ final AuthenticatedScreenBuilder signedOutScreen;+ final AuthenticatedScreenBuilder bootScreen;@override- void initState() {- super.initState();- WidgetsBinding.instance.addObserver(this);- _appMenuChannel.setMethodCallHandler(_onAppMenu);- }-- @override- void dispose() {- WidgetsBinding.instance.removeObserver(this);- _appMenuChannel.setMethodCallHandler(null);- super.dispose();- }-- @override- Future<AppExitResponse> didRequestAppExit() async {- // Save the final arrangement, with a bound so an unavailable disk cannot- // trap the user in the app. Input and tab switching never wait for disk.- await ref- .read(appStateProvider)- .flushPaneLayout()- .timeout(const Duration(seconds: 1), onTimeout: () {});- return AppExitResponse.exit;- }-- Future<void> _onAppMenu(MethodCall call) async {- if (!mounted) return;- switch (call.method) {- case 'checkForUpdates':- final app = ref.read(appStateProvider);- await _menuDialog(() async {- final result = await app.checkForUpdates();- if (!mounted) return;- await showUpdateCheckDialog(context, app, result);- });- case 'flashFirmware':- await _menuDialog(() => showFlashFirmwareDialog(context));- case 'showLayout':- if (advanceLayoutPalette()) return;- await _menuDialog(- () => showLayoutPalette(context, ref.read(appStateProvider)),- );- case 'showShortcuts':- await _menuDialog(() => showShortcutsSheet(context));- case 'increaseTerminalFontSize':- await terminalFontStore.increaseSize();- case 'decreaseTerminalFontSize':- await terminalFontStore.decreaseSize();- case 'resetTerminalFontSize':- await terminalFontStore.reset();- }- }-- Future<void> _menuDialog(Future<void> Function() action) async {- if (_menuDialogOpen || ModalRoute.isCurrentOf(context) == false) return;- // Reserve before the first frame too: held menu shortcuts can arrive- // before the new dialog has changed the route's current state.- _menuDialogOpen = true;- try {- await action();- } finally {- _menuDialogOpen = false;- }- }-- Widget _signedOut(AppNotifier app) =>- widget.signedOutScreen?.call(app) ?? LoginScreen(notifier: app);-- @override- Widget build(BuildContext context) {+ Widget build(BuildContext context, WidgetRef ref) {final app = ref.watch(appStateProvider);return ListenableBuilder(listenable: app,- builder: (context, _) {- final Widget screen;- switch (app.status) {- case AppStatus.bootstrapping:- // `bootstrapping` covers two unrelated moments: the app starting- // cold, and a sign-in the user just began. The second keeps- // LoginScreen, which carries the wait as a state of its own- // button; swapping the window for a separate screen there was a- // hard cut in the middle of a flow, and it is why that button's- // spinner was almost never seen.- //- // ⚠️ Keyed on `signingIn`, NOT on `pendingAuthorizeUrl`. The URL- // only exists for the middle stretch of the flow — the CLI has to- // start before it can print one, and it is cleared again while- // the post-login restore is still running — so keying on it blew- // the user's own screen away twice per sign-in: once on the click- // and again on success.- screen = app.signingIn- ? _signedOut(app)- : widget.bootScreen?.call(app) ??- BootstrappingScreen(statusMessage: app.bootStatusMessage);- case AppStatus.checkingEnvironment:- screen = EnvironmentPreflightScreen(- readiness: app.environmentReadiness,- );- case AppStatus.preparingEnvironment:- screen = EnvironmentSetupScreen(notifier: app);- case AppStatus.unauthenticated:- screen = _signedOut(app);- case AppStatus.authenticated:- screen = widget.authenticatedScreen(app);- }- // The band takes a row of its own rather than floating over one. As an- // overlay it landed on the screen's own head — covering the controls- // along the top edge, which is the one strip that must stay reachable.- return Column(- children: [- if (app.hasAvailableUpdate &&- app.status != AppStatus.bootstrapping &&- app.status != AppStatus.checkingEnvironment &&- app.status != AppStatus.preparingEnvironment)- UpdateNotice(notifier: app),- Expanded(child: screen),- ],- );+ builder: (context, _) => switch (app.status) {+ // `bootstrapping` covers two unrelated moments: the app starting+ // cold, and a sign-in the user just began. The second keeps the+ // signed-out screen, which carries the wait as a state of its own+ // button; swapping the window for a separate screen there was a+ // hard cut in the middle of a flow, and it is why that button's+ // spinner was almost never seen.+ //+ // ⚠️ Keyed on `signingIn`, NOT on `pendingAuthorizeUrl`. The URL+ // only exists for the middle stretch of the flow — the CLI has to+ // start before it can print one, and it is cleared again while+ // the post-login restore is still running — so keying on it blew+ // the user's own screen away twice per sign-in: once on the click+ // and again on success.+ AppStatus.bootstrapping =>+ app.signingIn ? signedOutScreen(app) : bootScreen(app),+ // Provisioning a computer for the harness CLI — a state only a desktop build enters (see+ // above). Named so the switch stays exhaustive, and drawn as the boot screen should it+ // ever be reached.+ AppStatus.checkingEnvironment ||+ AppStatus.preparingEnvironment => bootScreen(app),+ AppStatus.unauthenticated => signedOutScreen(app),+ AppStatus.authenticated => authenticatedScreen(app),},);}diff --git a/mobile/lib/auth/cli_login.dart b/mobile/lib/auth/cli_login.dartindex 4a3690c94..7f6fdbc82 100644--- a/mobile/lib/auth/cli_login.dart+++ b/mobile/lib/auth/cli_login.dart@@ -60,7 +60,7 @@ class CliLogin implements SignInClient {return CliAuthStatus.fromJson(jsonDecode(line) as Map<String, dynamic>);}- /// Runs `harness login --force --json`. This is only ever reached from [LoginScreen], i.e. the app+ /// Runs `harness login --force --json`. This is only ever reached from the desktop's `LoginScreen`, i.e. the app/// has already decided this computer is signed out — so a stale-but-present session file on disk/// must not short-circuit into a silent refresh attempt (`loginCommand`'s `readAuthSession() &&/// !force` branch), which just re-reports the same failure forever instead of opening a fresh SSOdiff --git a/mobile/lib/flash/flasher.dart b/mobile/lib/flash/flasher.dartdeleted file mode 100644index 19be36d5b..000000000--- a/mobile/lib/flash/flasher.dart+++ /dev/null@@ -1,195 +0,0 @@-import 'dart:async';-import 'dart:convert';-import 'dart:io';--import '../core/harness_cli_runner.dart';-import '../core/serial_port_lease.dart';--/// What a line of flasher output is.-///-/// The script prints a flat stream; the shape is carried by the prefix. `>> `-/// opens a step, an indented line details the step in progress, and anything on-/// stderr is trouble. Nothing here re-orders or drops a line — the raw log stays-/// the record, and this only decides what the UI emphasises.-enum FlashLineKind { step, detail, warning, error }--class FlashLine {- final String text;- final FlashLineKind kind;-- const FlashLine(this.text, this.kind);-- /// The step title without its `>> ` marker, for the step list.- String get title => text.startsWith('>> ') ? text.substring(3) : text;-}--/// Outcome of a finished run.-class FlashResult {- final int exitCode;- final bool cancelled;-- const FlashResult({required this.exitCode, this.cancelled = false});-- bool get ok => exitCode == 0 && !cancelled;-}--/// What `--detect-only` found.-class FlashProbe {- /// Ports the script recognised as an ESP32-S3.- final List<String> ports;-- /// Set when it refused for a reason the user can act on.- final String? problem;-- /// Everything it printed, kept for the log pane.- final List<FlashLine> log;-- const FlashProbe({required this.ports, required this.log, this.problem});-- bool get found => ports.isNotEmpty;-}--/// Runs the published flasher through the installed `harness` CLI.-///-/// The app deliberately does NOT fetch or cache `flash-circle.sh` itself.-/// `harness flash` already owns which script to run and how to get it, and the-/// script owns every number that decides whether a board survives the write —-/// the chip, the app offset, the otadata region, the sha256 checks. A second-/// copy of any of that here is a bricked board the day the two disagree. This-/// class owns one thing: turning that command's output into something a window-/// can draw.-class Flasher {- Flasher({this.startProcess = harnessCliStart});-- /// Overridden in tests.- final Future<Process> Function(List<String> arguments) startProcess;-- Process? _running;- bool _cancelled = false;-- bool get isRunning => _running != null;-- /// Looks for a plugged-in board without touching it.- ///- /// `--detect-only` returns before the script would stop the Harness daemon,- /// so opening the dialog costs nothing: no daemon bounce, no write, no- /// download.- Future<FlashProbe> probe() async {- final log = <FlashLine>[];- final ports = <String>[];- String? problem;-- final code = await _run(['flash', '--detect-only'], (line) {- log.add(line);- final text = line.text;- const marker = '>> board: ';- if (text.startsWith(marker)) {- ports.add(text.substring(marker.length).trim());- } else if (text.startsWith('more than one ESP32-S3')) {- problem = 'more than one board is connected';- } else if (text.contains('no permission')) {- problem = 'no permission to open the serial port';- }- });-- if (code != 0 && problem == null) {- problem = _errorFrom(log) ?? 'could not look for a board';- }- return FlashProbe(ports: ports, log: log, problem: problem);- }-- /// Writes the latest release to [port], or to whatever the script picks.- ///- /// `--yes` is not optional. The script asks for confirmation on `/dev/tty`,- /// and an app launched from Finder has none — without it the run dies with- /// "not a terminal" before writing anything. The dialog's Flash button IS- /// that confirmation.- Future<FlashResult> flash({String? port, void Function(FlashLine)? onLine}) {- final command = ['flash', '--yes'];- if (port != null && port.isNotEmpty) command.addAll(['--port', port]);- // Held for the WHOLE run, not just the write. The script stops the daemon itself and starts it- // again at the end; between those two the port belongs to esptool, and the app's own daemon- // supervisor — a five-second timer that restarts anything it finds missing — would otherwise take- // it back and kill the flash a few tens of kilobytes in.- return SerialPortLease.hold(() async {- final code = await _run(command, (line) => onLine?.call(line));- return FlashResult(exitCode: code, cancelled: _cancelled);- });- }-- /// Asks a running flash to stop, and lets it unwind.- ///- /// SIGTERM, never SIGKILL. The script arms- /// `trap start_harness_after_flash EXIT INT TERM`, and that trap is the only- /// thing that brings the Harness daemon back after the script stopped it to- /// free the serial port. Killing it outright leaves the computer with no- /// daemon and the dial dark — worse than never having flashed at all.- void cancel() {- final process = _running;- if (process == null) return;- _cancelled = true;- process.kill(ProcessSignal.sigterm);- }-- Future<int> _run(- List<String> command,- void Function(FlashLine) onLine,- ) async {- if (_running != null) throw StateError('a flash is already running');- _cancelled = false;- final process = await startProcess(command);- _running = process;- try {- final pumps = <Future<void>>[- _pump(process.stdout, onLine, stderr: false),- _pump(process.stderr, onLine, stderr: true),- ];- final code = await process.exitCode;- // Drain first: the last lines can still be in flight when the process- // has already gone, and losing them loses the reason it failed.- await Future.wait(pumps);- return code;- } finally {- _running = null;- }- }-- Future<void> _pump(- Stream<List<int>> source,- void Function(FlashLine) onLine, {- required bool stderr,- }) {- return source- .transform(utf8.decoder)- .transform(const LineSplitter())- .forEach((raw) => onLine(classifyFlashLine(raw, stderr: stderr)));- }-- static String? _errorFrom(List<FlashLine> log) {- for (final line in log.reversed) {- if (line.kind == FlashLineKind.error) {- return line.text.replaceFirst(RegExp(r'^error:\s*'), '');- }- }- return null;- }-}--/// Decides what a raw output line is.-///-/// Pure, so the rule can be tested without spawning anything.-FlashLine classifyFlashLine(String raw, {required bool stderr}) {- final text = raw.trimRight();- if (text.startsWith('error:')) return FlashLine(text, FlashLineKind.error);- if (text.startsWith('>> ')) return FlashLine(text, FlashLineKind.step);- // Indented lines detail the running step. On stderr they are the script's- // warnings — same shape, but they must not read as routine.- if (stderr) return FlashLine(text, FlashLineKind.warning);- return FlashLine(text, FlashLineKind.detail);-}--/// Starts `harness flash` with the managed runtime. [HarnessCliRunner] also-/// puts the legacy launcher directory on PATH for the child script, so the-/// flasher can stop and restart its daemon reliably without zsh.-Future<Process> harnessCliStart(List<String> arguments) =>- HarnessCliRunner().start(arguments);diff --git a/mobile/lib/screens/email_code_form.dart b/mobile/lib/screens/email_code_form.dartdeleted file mode 100644index 684ed9a43..000000000--- a/mobile/lib/screens/email_code_form.dart+++ /dev/null@@ -1,216 +0,0 @@-import 'dart:async';--import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../theme/app_theme.dart' show AppColors;-import 'login_text_field.dart';--/// A phone's sign-in: an email, then the code sent to it — both in the app.-///-/// Replaces the "Sign in" button that handed a phone to the browser, which could not always bring-/// it back (Google Play review: "127.0.0.1 took too long to respond") — see-/// `viewer/email_code_api.dart`. One field at a time, in the login card, so the step the person is-/// on is the only thing asking for input.-class EmailCodeForm extends StatefulWidget {- const EmailCodeForm({- super.key,- required this.sendCode,- required this.signIn,- });-- /// Emails a code to the address given — `AppNotifier.sendLoginCode`.- final Future<void> Function(String email) sendCode;-- /// Trades the code for a session and goes in — `AppNotifier.signInWithCode`.- /// Both throw a reason fit to show under the field.- final Future<void> Function(String email, String code) signIn;-- /// How long before the same address can be sent another code — long enough- /// that a slow inbox is not answered with a second email, short enough that- /// a lost one is not a wait.- static const resendAfter = Duration(seconds: 30);-- /// The account API's codes are four digits (the companion app's pin field).- static const codeLength = 4;-- @override- State<EmailCodeForm> createState() => _EmailCodeFormState();-}--class _EmailCodeFormState extends State<EmailCodeForm> {- final _email = TextEditingController();- final _code = TextEditingController();-- /// The address the code went to; null while the email is still being asked.- String? _sentTo;- bool _busy = false;- String? _error;- int _resendIn = 0;- Timer? _resendTimer;-- @override- void dispose() {- _resendTimer?.cancel();- _email.dispose();- _code.dispose();- super.dispose();- }-- Future<void> _sendCode() async {- final email = _email.text.trim();- if (!email.contains('@')) {- setState(() => _error = 'Enter the email of your Autonomous account.');- return;- }- await _run(- () => widget.sendCode(email),- onDone: () {- _sentTo = email;- _code.clear();- _startResendCountdown();- },- );- }-- Future<void> _signIn() async {- final email = _sentTo, code = _code.text.trim();- if (email == null) return;- if (code.isEmpty) {- setState(() => _error = 'Enter the code from the email.');- return;- }- await _run(() => widget.signIn(email, code));- }-- /// One request at a time, its failure shown under the field in the- /// service's own words.- Future<void> _run(- Future<void> Function() request, {- VoidCallback? onDone,- }) async {- if (_busy) return;- setState(() {- _busy = true;- _error = null;- });- String? error;- try {- await request();- } catch (e) {- error = e.toString();- }- if (!mounted) return;- setState(() {- _busy = false;- _error = error;- if (error == null) onDone?.call();- });- }-- void _startResendCountdown() {- _resendTimer?.cancel();- _resendIn = EmailCodeForm.resendAfter.inSeconds;- _resendTimer = Timer.periodic(const Duration(seconds: 1), (timer) {- if (!mounted) return timer.cancel();- setState(() => _resendIn--);- if (_resendIn <= 0) timer.cancel();- });- }-- void _changeEmail() => setState(() {- _resendTimer?.cancel();- _sentTo = null;- _error = null;- _code.clear();- });-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final sentTo = _sentTo;- final text = Theme.of(context).textTheme;- return AutofillGroup(- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- if (sentTo == null) ...[- Text(- 'Sign in with the email of your Autonomous account.',- textAlign: TextAlign.center,- style: text.bodySmall,- ),- const SizedBox(height: 12),- LoginTextField(- key: const Key('login-email'),- controller: _email,- hint: '[email protected]',- keyboard: TextInputType.emailAddress,- autofill: AutofillHints.email,- enabled: !_busy,- onSubmitted: _sendCode,- ),- ] else ...[- Text(- 'We emailed a sign-in code to $sentTo.',- textAlign: TextAlign.center,- style: text.bodySmall,- ),- const SizedBox(height: 12),- LoginTextField(- key: const Key('login-code'),- controller: _code,- hint: 'Sign-in code',- keyboard: TextInputType.number,- autofill: AutofillHints.oneTimeCode,- enabled: !_busy,- onSubmitted: _signIn,- maxDigits: EmailCodeForm.codeLength,- ),- ],- if (_error case final error?) ...[- const SizedBox(height: 8),- Semantics(- liveRegion: true,- child: Text(- error,- textAlign: TextAlign.center,- style: text.bodySmall?.copyWith(color: AppColors.danger),- ),- ),- ],- const SizedBox(height: 12),- FilledButton(- onPressed: _busy ? null : (sentTo == null ? _sendCode : _signIn),- child: _busy- ? const SizedBox.square(- dimension: grid.AppControl.iconSize,- child: CircularProgressIndicator(strokeWidth: 2),- )- : Text(sentTo == null ? 'Email me a code' : 'Sign in'),- ),- if (sentTo != null) _codeActions(),- ],- ),- );- }-- Widget _codeActions() => Wrap(- alignment: WrapAlignment.center,- children: [- TextButton(- onPressed: _busy || _resendIn > 0- ? null- : () => _run(- () => widget.sendCode(_sentTo!),- onDone: _startResendCountdown,- ),- child: Text(_resendIn > 0 ? 'Resend in ${_resendIn}s' : 'Resend code'),- ),- TextButton(- onPressed: _busy ? null : _changeEmail,- child: const Text('Use a different email'),- ),- ],- );-}diff --git a/mobile/lib/screens/login_screen.dart b/mobile/lib/screens/login_screen.dartdeleted file mode 100644index 0099c0379..000000000--- a/mobile/lib/screens/login_screen.dart+++ /dev/null@@ -1,441 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../state/app_state.dart';-import '../widgets/login_relay_diagram.dart';-import '../widgets/welcome_workspace_preview.dart';-import 'email_code_form.dart';--/// The sign-in screen.-///-/// Lead with the work: real agents together in one workspace. A static-/// example explains a swarm before sign-in; the privacy guarantee stays in the-/// quiet footer. The preview never creates agents or sends them a task.-///-/// **All four states live here**, in one card, rather than the two screens this-/// used to be. Pressing Sign in swapped the whole 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 SSO page cannot be embedded, and that is not a preference.**-/// `auth.autonomous.ai`'s Google sign-in uses Google's popup-based Identity-/// Services flow — a real popup window that posts its result back to its-/// opener — which a single-window embedded webview cannot satisfy. The system-/// browser handles it natively, so `AppNotifier.login` launches it there and-/// this screen tracks the wait, returning on its own once-/// `harness login --force --json` reports success. (This note came from the screen-/// that used to own the waiting state; it is the reason the flow leaves the-/// app at all, so it outlives the widget it was written on.)-class LoginScreen extends StatelessWidget {- final AppNotifier notifier;- const LoginScreen({super.key, required this.notifier});-- /// 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.- 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;- final compact = MediaQuery.sizeOf(context).height < 640;- final gap = compact ? 16.0 : 24.0;-- return 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: 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: Column(- mainAxisSize: MainAxisSize.min,- children: [- const _AppMark(),- SizedBox(height: gap),- Text(- 'All your harnesses, on one screen',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.titleLarge,- ),- const SizedBox(height: 8),- Text(- 'Work with Claude Code, Codex and other agents side by side. '- 'Start with one harness and add panes as your work grows.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- SizedBox(height: gap),- const WelcomeWorkspacePreview(),- SizedBox(height: gap),- // A phone never goes to the browser to sign in — see- // `viewer/email_code_api.dart` for the review that- // failed on it.- if (notifier.signsInWithEmailCode)- EmailCodeForm(- sendCode: notifier.sendLoginCode,- signIn: (email, code) => notifier.signInWithCode(- email: email,- code: code,- ),- )- else- _Action(notifier: notifier, waiting: waiting),- if (notifier.lastError != null) ...[- const SizedBox(height: 16),- _ErrorTile(- message: notifier.lastError!,- // The form above IS the way on for a phone; a retry- // here would start the browser sign-in it replaced.- onRetry: notifier.signsInWithEmailCode- ? null- : notifier.login,- ),- ],- SizedBox(height: gap),- const _Seal(),- ],- ),- ),- ),- ),- ),- ],- ),- );- }-}--/// The button, and what it becomes while the browser is open.-///-/// One widget for both because they are one control in two states: the label-/// changes, a spinner replaces the glyph, and Cancel appears beside it. Nothing-/// moves position, so the wait reads as *this button is working* rather than as-/// a new screen.-class _Action extends StatefulWidget {- const _Action({required this.notifier, required this.waiting});-- final AppNotifier notifier;- final bool waiting;-- @override- State<_Action> createState() => _ActionState();-}--class _ActionState extends State<_Action> {- AppNotifier get notifier => widget.notifier;- final _signInFocus = FocusNode(debugLabel: 'Sign in');- String? _copiedUrl;- String? _copyFailureUrl;- bool _copying = false;-- @override- void didUpdateWidget(covariant _Action oldWidget) {- super.didUpdateWidget(oldWidget);- if (oldWidget.waiting && !widget.waiting) {- WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted && ModalRoute.of(context)?.isCurrent != false) {- _signInFocus.requestFocus();- }- });- }- }-- @override- void dispose() {- _signInFocus.dispose();- super.dispose();- }-- Future<void> _copyLink() async {- final url = notifier.pendingAuthorizeUrl;- if (url == null || !notifier.signingIn || _copying) return;- setState(() => _copying = true);- var copied = false;- try {- await Clipboard.setData(ClipboardData(text: url));- copied = true;- } catch (_) {- // Keep recovery in the same sign-in if the OS clipboard is unavailable.- }- if (!mounted) return;- setState(() {- _copying = false;- if (notifier.signingIn && notifier.pendingAuthorizeUrl == url) {- _copiedUrl = copied ? url : null;- _copyFailureUrl = copied ? null : url;- }- });- }-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);-- if (!widget.waiting) {- return Column(- children: [- FilledButton.icon(- focusNode: _signInFocus,- autofocus: true,- onPressed: notifier.login,- icon: const Icon(Icons.login, size: grid.AppControl.iconSize),- label: const Text('Sign in'),- ),- const SizedBox(height: 12),- Text(- 'Sign in through your browser to continue.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- ],- );- }-- final url = notifier.pendingAuthorizeUrl;- final message =- notifier.loginBrowserError ??- (url != null && _copyFailureUrl == url- ? 'Couldn’t copy the link. Try opening your browser again.'- : null);- return Column(- children: [- FilledButton.icon(- // Disabled, not hidden: the control the user just pressed has to stay- // where they left it, saying what it is doing.- onPressed: null,- icon: const SizedBox(- width: grid.AppControl.iconSize,- height: grid.AppControl.iconSize,- child: CircularProgressIndicator(strokeWidth: 2),- ),- label: Text(url == null ? 'Signing in…' : 'Waiting for your browser'),- ),- const SizedBox(height: 12),- Semantics(- liveRegion: true,- child: Text(- message ??- (url == null- ? 'Your workspace will open when sign-in is complete.'- : 'Finish signing in in your browser, then return here.'),- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- ),- if (url != null || notifier.canCancelLogin) ...[- const SizedBox(height: 12),- Wrap(- spacing: 8,- runSpacing: 8,- alignment: WrapAlignment.center,- children: [- if (url != null) ...[- OutlinedButton.icon(- onPressed: notifier.openingLoginBrowser- ? null- : notifier.openLoginBrowser,- icon: const Icon(Icons.open_in_new, size: 16),- label: Text(- notifier.openingLoginBrowser- ? 'Opening browser…'- : 'Open browser',- ),- ),- TextButton.icon(- onPressed: _copying ? null : _copyLink,- icon: Icon(- _copiedUrl == url ? Icons.check : Icons.content_copy,- size: 16,- ),- label: Semantics(- liveRegion: true,- child: Text(- _copiedUrl == url ? 'Link copied' : 'Copy link',- ),- ),- ),- ],- if (notifier.canCancelLogin)- TextButton(- autofocus: true,- onPressed: notifier.cancelLogin,- style: TextButton.styleFrom(- foregroundColor: grid.AppPalette.textSecondary,- ),- child: const Text('Cancel'),- ),- ],- ),- ],- ],- );- }-}--/// A failure the user can act on.-///-/// The old screen printed the raw error in `Colors.red` with no container and-/// no way forward. Two things changed: the colour is a token that resolves per-/// theme, and there is a retry — the house rule is that every empty, loading-/// and error state offers a way on.-class _ErrorTile extends StatelessWidget {- const _ErrorTile({required this.message, required this.onRetry});-- final String message;-- /// Null leaves the button off — see where the tile is built.- final VoidCallback? onRetry;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- // Error INK on a surface, not `dangerFill`, which is tuned to carry white- // lettering on top of it and is far too dark to read *as* text.- final danger = grid.AppTheme.pick(- const Color(0xFFB3261E),- const Color(0xFFF2544B),- );-- return Container(- width: double.infinity,- decoration: BoxDecoration(- color: grid.AppCard.inset,- // Radius 8 inside a 14 card — a child is never rounder than its parent.- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- padding: const EdgeInsets.all(16),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Icon(Icons.error_outline, size: 16, color: danger),- const SizedBox(width: 8),- Expanded(- child: Text(- 'Could not sign in',- style: Theme.of(context).textTheme.labelMedium- ?.copyWith(color: danger),- ),- ),- ],- ),- const SizedBox(height: 4),- SelectableText(message, style: Theme.of(context).textTheme.bodySmall),- if (onRetry case final retry?) ...[- const SizedBox(height: 12),- Align(- alignment: Alignment.centerLeft,- child: OutlinedButton(- onPressed: retry,- child: const Text('Try again'),- ),- ),- ],- ],- ),- );- }-}--/// The quiet line at the foot of the card.-///-/// It says the guarantee in words anyone has — the cipher names that used to-/// sit here (`Ed25519 · ChaCha20-Poly1305`) were true, and unreadable to almost-/// everyone who saw them; they belong on a security page, not on the one screen-/// standing between someone and their work.-class _Seal extends StatelessWidget {- const _Seal();-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Column(- children: [- Divider(height: 1, color: grid.AppPalette.divider),- const SizedBox(height: 16),- Row(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Icon(Icons.lock_outline, size: 13, color: grid.AppPalette.teal),- const SizedBox(width: 8),- Text(- 'End-to-end encrypted',- style: Theme.of(context).textTheme.labelSmall- ?.copyWith(color: grid.AppPalette.textFaint),- ),- ],- ),- ],- );- }-}--/// 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,- ),- );- }-}diff --git a/mobile/lib/screens/login_text_field.dart b/mobile/lib/screens/login_text_field.dartdeleted file mode 100644index 82173e18f..000000000--- a/mobile/lib/screens/login_text_field.dart+++ /dev/null@@ -1,55 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--/// One field of the phone's sign-in form — the email, or the emailed code.-///-/// [maxDigits] makes it a code field: digits only, no more than that many, and-/// the last one typed submits — there is nothing left to wait for.-class LoginTextField extends StatelessWidget {- const LoginTextField({- super.key,- required this.controller,- required this.hint,- required this.keyboard,- required this.autofill,- required this.enabled,- required this.onSubmitted,- this.maxDigits,- });-- final TextEditingController controller;- final String hint;- final TextInputType keyboard;- final String autofill;- final bool enabled;- final VoidCallback onSubmitted;- final int? maxDigits;-- @override- Widget build(BuildContext context) {- final digits = maxDigits;- return TextField(- controller: controller,- autofocus: true,- enabled: enabled,- keyboardType: keyboard,- autofillHints: [autofill],- autocorrect: false,- textAlign: TextAlign.center,- textInputAction: TextInputAction.go,- inputFormatters: [- if (digits != null) ...[- FilteringTextInputFormatter.digitsOnly,- LengthLimitingTextInputFormatter(digits),- ],- ],- decoration: InputDecoration(hintText: hint),- onChanged: digits == null- ? null- : (value) {- if (value.length == digits) onSubmitted();- },- onSubmitted: (_) => onSubmitted(),- );- }-}diff --git a/mobile/lib/shared/widgets/app_menu.dart b/mobile/lib/shared/widgets/app_menu.dartdeleted file mode 100644index ac97e2d95..000000000--- a/mobile/lib/shared/widgets/app_menu.dart+++ /dev/null@@ -1,337 +0,0 @@-import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import '../theme/app_theme.dart';--/// The measurements one [AppMenuItem] is built from.-///-/// TWO sizes exist in this app, deliberately, and the distinction is worth-/// stating because two sizes is otherwise exactly the drift this file was-/// written to end:-///-/// [compact] — a CONTEXT menu. A short list of actions on the thing you just-/// right-clicked or pressed ⋯ on: the machine and agent menus, the account-/// menu. macOS sets these tight, and they are read in a glance.-///-/// [roomy] — a PICKER's list. The menu IS the control: it is the only place-/// the choices are ever shown, it is read down rather than glanced at, and it-/// is often long enough to scroll. macOS gives a popup button's list more room-/// than a context menu for the same reason.-///-/// A third size would be drift. Reach for one of these two.-@immutable-class AppMenuRowMetrics {- const AppMenuRowMetrics({- required this.fontSize,- required this.noteSize,- required this.iconSize,- required this.padding,- required this.extent,- });-- final double fontSize;- final double noteSize;- final double iconSize;- final EdgeInsets padding;-- /// The height a row of this size actually lays out at.- ///- /// ⚠️ MEASURED, not derived, and the difference has already cost a bug. Adding- /// the paddings up for [compact] gives 33.6; a laid-out row measures 34.0,- /// because the line box rounds up to the font's own metrics rather than taking- /// `fontSize × height` literally. Over seven rows that 0.4 became 2.8 — enough- /// to overflow a panel sized from the arithmetic and hang a scrollbar on it.- ///- /// `app_select_field_test.dart` measures a real row against this to 0.1, so a- /// padding that moves without this moving fails a test rather than quietly- /// mis-sizing every panel.- final double extent;-- /// What a row with a [AppMenuItem.detail] line lays out at instead.- ///- /// [extent] plus the second line's own box — [noteSize] × 1.25, rounded up- /// the same way a line box rounds, plus the 2px that separates the two lines.- /// Stated rather than derived at the call site for the same reason [extent]- /// is: a panel sized by arithmetic that disagrees with the layout by half a- /// pixel per row wears a scrollbar it does not need.- double get detailExtent => extent + noteSize * 1.25 + 2;-- /// A context menu's row: the macOS control scale.- static const compact = AppMenuRowMetrics(- fontSize: 13,- noteSize: 11.5,- iconSize: 16,- padding: EdgeInsets.symmetric(horizontal: 9, vertical: 8),- extent: 34,- );-- /// A picker's row — one step up on every axis at once, which is the only way- /// to change a platform convention without breaking the proportions inside it.- static const roomy = AppMenuRowMetrics(- fontSize: 14,- noteSize: 12.5,- iconSize: 18,- padding: EdgeInsets.symmetric(horizontal: 11, vertical: 10),- extent: 40,- );-}--/// The height one [AppMenuItem] occupies.-///-/// Stated so a caller that has to SIZE a panel — see [AppSelectField] — can do-/// the arithmetic up front instead of discovering at runtime that its list-/// overflows by a few pixels and wears a scrollbar for no reason.-///-/// ⚠️ MEASURED, not derived, and the difference matters. Adding the paddings up-///-/// outer 1 × 2 = 2 · inner 8 × 2 = 16 · line 13 × 1.2 = 15.6 → 33.6-///-/// gives 33.6, which is WRONG: a laid-out row measures 34.0, because the line-/// box rounds up to the font's own metrics rather than taking `fontSize ×-/// height` literally. Over seven rows that 0.4 becomes 2.8 — the width of the-/// mistake that put a scrollbar on the engine picker in the first place.-///-/// `app_select_field_test.dart` measures a real row against this to 0.1, so if-/// a padding moves and this does not, a test says so.-const double kMenuRowExtent = 34.0;-// (kept as the compact row's extent; see AppMenuRowMetrics.compact.extent)--/// One row in an [AppMenu] panel.-///-/// The panel itself is no longer built here: it lives on [AppMenu] in-/// `app_theme.dart`, and `menuTheme` hands it to every `MenuAnchor` in the app,-/// so a menu that passes no style gets the same surface as one that does. The-/// hand-written `appMenuStyle()` this file used to export was the second of four-/// disagreeing recipes — see that class.-///-/// Hand-rolled rather than a [MenuItemButton] because the app has no-/// `menuButtonTheme`, so a bare one takes Material's M3 defaults and lands-/// wrong on four counts at once: radius 0, 14pt text, a grey 8% hover, and a-/// ripple every other menu here has turned off.-///-/// Stateful for its own hover: the glyph has to climb to [AppPalette.textPrimary]-/// under the pointer. An icon that stays dim while the cursor sits on it reads-/// as decoration, and nothing above this row tracks hover per-row to do it.-class AppMenuItem extends StatefulWidget {- const AppMenuItem({- super.key,- this.icon,- required this.label,- required this.onPressed,- this.danger = false,- this.selected = false,- this.note,- this.detail,- this.leading,- this.trailing,- this.focusNode,- this.metrics = AppMenuRowMetrics.compact,- });-- /// The leading glyph. Null for a row in a list that PICKS one of several — the- /// slot is still reserved, so labels line up whether a row is ticked or not.- final IconData? icon;- final String label;-- /// A quieter qualifier after the label — a face name beside "System". Set- /// apart by ink rather than by a separator character, so it reads as an aside- /// instead of as part of the name.- final String? note;-- /// A mark at the row's far end, after [note] — a state the row has rather- /// than a word about it.- ///- /// For a fact that repeats down a list, where the same short phrase on every- /// other row turns the column into noise the eye has to re-read. A glyph is- /// scanned once. Give it a [Tooltip]: a mark carries no meaning to a reader- /// meeting it for the first time, and there is nowhere else in a menu row to- /// put the sentence.- final Widget? trailing;- final FocusNode? focusNode;-- /// A quiet SECOND LINE under the label, for a row whose label alone does not- /// say what picking it does — "Most tokens read in the last 24h" under- /// "Input tokens", "That, plus…" under a role.- ///- /// Distinct from [note], which sits *beside* the label and qualifies the same- /// noun ("System — SF Pro"). A sentence cannot go there: a menu is as wide as- /// its button, and the qualifier would arrive clipped to its first three- /// words. So this row grows a line instead of the panel growing a column.- ///- /// It makes the row taller, which is why a caller that has to SIZE a panel- /// asks [AppMenuRowMetrics.detailExtent] rather than [AppMenuRowMetrics.extent].- final String? detail;-- /// A mark that belongs to the ROW's subject rather than to its action — an- /// engine's logo, say. It gets a slot of its own AFTER the tick's, so the tick- /// still has somewhere to go and a picked row's label does not shift sideways- /// from an unpicked one's.- final Widget? leading;-- /// Which of the two row sizes this is. Defaults to a context menu's; a picker- /// passes [AppMenuRowMetrics.roomy].- final AppMenuRowMetrics metrics;-- /// This row is the current choice.- ///- /// Marked THREE ways, never by one: an accent wash, a heavier label, and a- /// tick in the leading slot. Colour alone fails anyone who cannot separate- /// these two greys, and a tick alone is easy to miss in a long list.- final bool selected;-- final VoidCallback onPressed;-- /// Tints the row red and gives it a red hover wash — for the row that- /// destroys something.- final bool danger;-- @override- State<AppMenuItem> createState() => _AppMenuItemState();-}--class _AppMenuItemState extends State<AppMenuItem> {- bool _hovered = false;-- @override- Widget build(BuildContext context) {- // Lives in the MenuAnchor's overlay, so it watches for itself.- AppTheme.watch(context);- final error = Theme.of(context).colorScheme.error;- // A danger row is already red at rest, so it deepens rather than climbs.- final tint = widget.danger- ? error- : (_hovered || widget.selected- ? AppPalette.textPrimary- : AppPalette.textSecondary);- // The tick takes the leading slot when this row is the choice; otherwise the- // row's own glyph does, and a row with neither keeps the slot EMPTY.- //- // ⚠️ Empty means an empty box, not `Icons.check_box_outline_blank`. That- // glyph draws a real outlined square — which turns a pick-one menu into what- // reads as a checkbox list, and puts a border somewhere §1 does not allow- // one. It shipped that way once; this comment is why it will not again.- final glyph = widget.selected ? LucideIcons.check300 : widget.icon;-- return Padding(- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),- child: Material(- color: Colors.transparent,- borderRadius: BorderRadius.circular(8),- child: InkWell(- focusNode: widget.focusNode,- onTap: widget.onPressed,- onHover: (hovered) => setState(() => _hovered = hovered),- borderRadius: BorderRadius.circular(8),- hoverColor: widget.danger- ? error.withValues(alpha: 0.09)- : AppSurface.hoverFill,- focusColor: AppSurface.hoverFill,- splashFactory: NoSplash.splashFactory,- child: Ink(- decoration: BoxDecoration(- color: widget.selected- ? AppSurface.accentWash- : Colors.transparent,- borderRadius: BorderRadius.circular(8),- ),- padding: widget.metrics.padding,- child: Row(- children: [- // Fixed slot: these glyphs differ in width, and without it every- // label would start at a slightly different column — and a- // ticked row would sit a few pixels off an unticked one.- SizedBox(- width: widget.metrics.iconSize,- child: glyph == null- ? null- : Icon(glyph, size: widget.metrics.iconSize, color: tint),- ),- const SizedBox(width: 9),- if (widget.leading != null) ...[- SizedBox(- width: widget.metrics.iconSize,- child: Center(child: widget.leading),- ),- const SizedBox(width: 9),- ],- Flexible(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisSize: MainAxisSize.min,- children: [- Text(- widget.label,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: widget.danger ? error : AppPalette.textPrimary,- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: widget.metrics.fontSize,- height: 1.2,- fontWeight: widget.selected- ? AppFont.semibold- : AppFont.medium,- ),- ),- if (widget.detail case final detail?) ...[- const SizedBox(height: 2),- Text(- detail,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: AppPalette.textSecondary,- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: widget.metrics.noteSize,- height: 1.25,- ),- ),- ],- ],- ),- ),- if (widget.note != null) ...[- const SizedBox(width: 8),- Flexible(- child: Text(- widget.note!,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: AppPalette.textFaint,- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: widget.metrics.noteSize,- height: 1.2,- ),- ),- ),- ],- if (widget.trailing != null) ...[- const SizedBox(width: 8),- widget.trailing!,- ],- ],- ),- ),- ),- ),- );- }-}--/// The rule that sets a destructive row apart from the ordinary ones.-class AppMenuDivider extends StatelessWidget {- const AppMenuDivider({super.key});-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- return Padding(- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 5),- child: Divider(height: 1, thickness: 1, color: AppPalette.divider),- );- }-}diff --git a/mobile/lib/shared/widgets/app_select_field.dart b/mobile/lib/shared/widgets/app_select_field.dartdeleted file mode 100644index 8a51d216d..000000000--- a/mobile/lib/shared/widgets/app_select_field.dart+++ /dev/null@@ -1,469 +0,0 @@-import 'dart:math' as math;--import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--import '../theme/app_theme.dart';-import 'app_menu.dart';--/// One choice in an [AppSelectField].-@immutable-class SelectOption<T> {- const SelectOption({- required this.value,- required this.label,- this.note,- this.detail,- this.leading,- this.trailing,- });-- final T value;- final String label;-- /// A sentence UNDER the label, for a list whose labels alone do not say what- /// picking one does.- ///- /// Distinct from [note], which sits beside the label and qualifies the same- /// noun. A sentence cannot go there: the closed field is only as wide as the- /// control, so it would arrive clipped mid-clause. Shown in the OPEN menu- /// only, which is where it is needed — while choosing, not after.- final String? detail;-- /// A mark shown before the label, in the row AND in the closed control — an- /// engine's logo, a colour swatch. Built fresh per use rather than shared, so- /// the same option can appear in both places.- final Widget Function()? leading;-- /// A short qualifier shown after the label in quieter ink — "SF Pro" beside- /// "System", or a warning that a saved choice is no longer installed.- final String? note;-- /// A mark at the row's far end. Built fresh per use, like [leading].- ///- /// For a state that recurs down the list, where the same words on several- /// rows read as noise. Only in the open list: the closed control shows the- /// chosen option's [note], and a glyph there would have to explain itself- /// with no room to.- final Widget Function()? trailing;-}--/// A control that picks one of a list, replacing [DropdownButtonFormField].-///-/// Material's dropdown is unusable here: it renders its own popup, anchors it-/// *over* the field rather than under it, forces the panel to the field's width,-/// and comes out square-cornered and edge-to-edge no matter what `borderRadius`,-/// `elevation` or `dropdownColor` you hand it — while ignoring BOTH `menuTheme`-/// and `popupMenuTheme`, so it cannot be made to match any other menu in the-/// app. Built on [MenuAnchor] instead, it takes [AppMenu]'s panel like every-/// other menu here and its rows are the app's own [AppMenuItem].-///-/// ⚠️ There is no disabled row, deliberately. A choice that is visible but-/// silently does nothing is worse than a choice that is absent — so a caller-/// with an unavailable option should drop it from [options] rather than hope-/// for a greyed-out row. The exception worth making is the option that is-/// currently SELECTED but no longer available: that one stays, with a [note]-/// saying why, because a picker that silently forgets the user's setting is the-/// same failure wearing a different hat.-class AppSelectField<T> extends StatefulWidget {- const AppSelectField({- super.key,- required this.value,- required this.options,- required this.onChanged,- this.width,- this.height = AppControl.height,- this.trigger,- });-- final T value;- final List<SelectOption<T>> options;- final ValueChanged<T> onChanged;-- /// Fixed width, so a column of these lines up on one right edge. Null lets it- /// take whatever its parent gives.- final double? width;- final double height;-- /// An alternate compact trigger, such as the agent picker's More button.- /// Selection, keyboard navigation and menu rows remain shared.- final Widget? trigger;-- @override- State<AppSelectField<T>> createState() => _AppSelectFieldState<T>();-}--class _AppSelectFieldState<T> extends State<AppSelectField<T>> {- final _controller = MenuController();- final _fieldFocus = FocusNode(debugLabel: 'Select field');- final _optionFocus = <T, FocusNode>{};- ({T value})? _pendingFocus;- String _prefix = '';- Duration? _lastTyped;- bool _focusScheduled = false;- bool _hovered = false;- bool _focused = false;-- FocusNode _focusFor(T value) => _optionFocus.putIfAbsent(- value,- () => FocusNode(debugLabel: 'Select option'),- );-- SelectOption<T>? get _currentOption =>- widget.options- .where((option) => option.value == widget.value)- .firstOrNull ??- widget.options.firstOrNull;-- @override- void didUpdateWidget(AppSelectField<T> oldWidget) {- super.didUpdateWidget(oldWidget);- final values = widget.options.map((option) => option.value).toSet();- var lostFocus = false;- for (final value in _optionFocus.keys.toList()) {- if (values.contains(value)) continue;- final node = _optionFocus.remove(value)!;- lostFocus |= node.hasFocus || _pendingFocus?.value == value;- node.dispose();- }- if (!_controller.isOpen || !lostFocus) return;- _prefix = '';- _lastTyped = null;- final next = _currentOption;- if (next == null) {- _controller.close();- } else {- _focusOption(next);- }- }-- @override- void dispose() {- _fieldFocus.dispose();- for (final node in _optionFocus.values) {- node.dispose();- }- super.dispose();- }-- void _open() {- if (widget.options.isEmpty || _controller.isOpen) return;- _prefix = '';- _lastTyped = null;- _controller.open();- // Unopened controls need no per-option focus nodes. Mount them with the- // menu, including any match typed before its first frame.- setState(() {});- _focusOption(_currentOption!, afterLayout: true);- }-- void _focusOption(SelectOption<T> option, {bool afterLayout = false}) {- _pendingFocus = (value: option.value);- final node = _focusFor(option.value);- if (!afterLayout &&- !_focusScheduled &&- node.parent != null &&- node.context?.mounted == true) {- node.requestFocus();- Scrollable.ensureVisible(node.context!);- return;- }- // Opening and typing can happen before the menu's first frame. Keep the- // newest match, rather than restoring the old selection after it mounts.- if (_focusScheduled) return;- _focusScheduled = true;- WidgetsBinding.instance.addPostFrameCallback((_) {- _focusScheduled = false;- if (!mounted || !_controller.isOpen) return;- final pending = _pendingFocus;- if (pending == null) return;- final node = _optionFocus[pending.value];- if (node?.context == null) return;- node!.requestFocus();- Scrollable.ensureVisible(node.context!);- });- }-- int get _highlightedIndex {- final focused = widget.options.indexWhere(- (option) => _optionFocus[option.value]?.hasPrimaryFocus == true,- );- if (focused >= 0) return focused;- final pending = _pendingFocus;- return pending == null- ? -1- : widget.options.indexWhere((option) => option.value == pending.value);- }-- void _choose(SelectOption<T> option) {- _controller.close();- _fieldFocus.requestFocus();- if (option.value != widget.value) widget.onChanged(option.value);- }-- KeyEventResult _typeAhead(FocusNode _, KeyEvent event) {- if (!_controller.isOpen || event is KeyUpEvent) {- return KeyEventResult.ignored;- }- final keyboard = HardwareKeyboard.instance;- if (keyboard.isMetaPressed ||- keyboard.isControlPressed ||- keyboard.isAltPressed) {- return KeyEventResult.ignored;- }- if (!keyboard.isShiftPressed) {- if (event.logicalKey == LogicalKeyboardKey.escape) {- _controller.close();- _fieldFocus.requestFocus();- return KeyEventResult.handled;- }- if (event.logicalKey == LogicalKeyboardKey.enter ||- event.logicalKey == LogicalKeyboardKey.numpadEnter) {- final index = _highlightedIndex;- if (index >= 0) _choose(widget.options[index]);- return KeyEventResult.handled;- }- }- final text = event.character?.toLowerCase();- if (text == null ||- text.isEmpty ||- text.runes.any((r) => r < 32 || r == 127)) {- _prefix = '';- return KeyEventResult.ignored;- }- if (_lastTyped == null ||- event.timeStamp < _lastTyped! ||- event.timeStamp - _lastTyped! > const Duration(seconds: 1)) {- _prefix = '';- }- if (text == ' ' && _prefix.isEmpty) return KeyEventResult.ignored;- _lastTyped = event.timeStamp;- final continuing = _prefix.isNotEmpty && _prefix != text;- _prefix = continuing ? _prefix + text : text;- final current = _highlightedIndex;- final start = current < 0 ? 0 : current + (continuing ? 0 : 1);- for (var offset = 0; offset < widget.options.length; offset++) {- final option = widget.options[(start + offset) % widget.options.length];- if (option.label.trimLeft().toLowerCase().startsWith(_prefix)) {- _focusOption(option);- break;- }- }- return KeyEventResult.handled;- }-- Widget _typingRegion(Widget child, {Key? key}) => Focus(- key: key,- canRequestFocus: false,- skipTraversal: true,- onKeyEvent: _typeAhead,- child: child,- );-- /// How tall this panel may draw.- ///- /// ⚠️ NOT [AppControl.menuMaxHeight]. That token's 240 is for a menu that- /// opens UPWARD and places itself by summing the height it is about to take;- /// this one hangs below its field, so it is free to be as tall as its own- /// list. Left at 240, a seven-item picker overflowed by five pixels and grew- /// a scrollbar to show them — furniture that says "there is more here" when- /// there is not.- ///- /// The ceiling is still real: past it a long list scrolls instead of running- /// off the window.- double get _panelHeight => math.min(- // A row with a detail line is TALLER, and the difference has to be counted- // per row rather than assumed for all of them: a list where only some- // options carry a sentence would otherwise be measured wrong in whichever- // direction the guess went, and a panel that disagrees with its layout by a- // few pixels wears a scrollbar it does not need.- widget.options.fold<double>(- 0,- (total, option) =>- total +- (option.detail == null- ? AppMenuRowMetrics.roomy.extent- : AppMenuRowMetrics.roomy.detailExtent),- ) +- AppMenu.panelPadding.vertical,- _maxPanelHeight,- );-- static const double _maxPanelHeight = 380;-- /// A floor under the panel's width, on top of the field's own.- ///- /// A field can be narrow — the font picker's is 188 — while its list holds- /// names that are not. The panel is where the choosing happens, so it is- /// allowed to be wider than the box it drops out of; the reverse, a panel- /// narrower than its control, is what reads as an unrelated box.- static const double _minPanelWidth = 240;-- @override- Widget build(BuildContext context) {- AppTheme.watch(context);- final selected = widget.options.where((o) => o.value == widget.value);- final current = selected.isEmpty ? null : selected.first;-- // The panel is measured against the FIELD, not against its own contents: a- // menu narrower than the control it drops out of reads as an unrelated box- // that happened to open nearby. `widget.width` covers a fixed-size field;- // the incoming constraint covers one that fills its parent — the case in a- // dialog, and the one that was missed.- return LayoutBuilder(- builder: (context, constraints) => _anchor(- current,- widget.width ??- (constraints.maxWidth.isFinite ? constraints.maxWidth : null),- ),- );- }-- Widget _anchor(SelectOption<T>? current, double? panelWidth) {- return MenuAnchor(- controller: _controller,- childFocusNode: _fieldFocus,- onClose: () {- _prefix = '';- _lastTyped = null;- _pendingFocus = null;- },- // Below the control, by the app's one menu gap — and the panel takes its- // fill, rim and radius from [AppMenu], the app's single panel recipe.- alignmentOffset: const Offset(0, AppControl.menuGap),- // ⚠️ The width is set on the ROWS, not with `MenuStyle.minimumSize`.- //- // `minimumSize` does widen the panel, but `MenuAnchor` lays its children- // out loose, so the rows keep their intrinsic width and sit in a wider box- // — measured at 173 inside a panel asked for 240, which reads as a menu- // with a mysterious margin down one side. Sizing the row makes the panel- // follow it, and the hover pill then spans the width a person is aiming- // at.- style: AppMenu.style(maxHeight: _panelHeight),- menuChildren: [- for (final option in widget.options)- _typingRegion(- SizedBox(- width: math.max(panelWidth ?? 0, _minPanelWidth),- child: AppMenuItem(- // No glyph of its own: the leading slot belongs to the tick,- // and stays empty (not a blank checkbox) on rows without it.- // `selected` also carries the wash and the heavier label, so the- // choice is marked three ways rather than by a tick alone.- // A picker's list, not a context menu's: this menu IS the- // control, it is read down rather than glanced at, and it is the- // only place these choices are ever shown.- metrics: AppMenuRowMetrics.roomy,- focusNode: _controller.isOpen ? _focusFor(option.value) : null,- selected: option.value == widget.value,- label: option.label,- note: option.note,- detail: option.detail,- leading: option.leading?.call(),- trailing: option.trailing?.call(),- onPressed: () => _choose(option),- ),- ),- key: ValueKey(option.value),- ),- ],- builder: (context, controller, _) => _typingRegion(- MouseRegion(- cursor: SystemMouseCursors.click,- onEnter: (_) => setState(() => _hovered = true),- onExit: (_) => setState(() => _hovered = false),- child: CallbackShortcuts(- bindings: {- const SingleActivator(LogicalKeyboardKey.arrowDown): _open,- const SingleActivator(LogicalKeyboardKey.arrowUp): _open,- },- child: InkWell(- focusNode: _fieldFocus,- onFocusChange: (value) => setState(() => _focused = value),- onTap: () => controller.isOpen ? controller.close() : _open(),- splashFactory: NoSplash.splashFactory,- hoverColor: Colors.transparent,- focusColor: Colors.transparent,- borderRadius: BorderRadius.circular(AppControl.radius),- child: AnimatedContainer(- duration: AppMotion.hover,- curve: AppMotion.curve,- width: widget.width,- height: widget.height,- padding: const EdgeInsets.only(left: 10, right: 8),- decoration: BoxDecoration(- color: _hovered || _focused || controller.isOpen- ? AppSurface.recessHover- : AppSurface.recess,- borderRadius: BorderRadius.circular(AppControl.radius),- border: Border.all(- color: _focused- ? AppPalette.accentOnSurface- : Colors.transparent,- ),- ),- child:- widget.trigger ??- Row(- children: [- Expanded(- child: Row(- children: [- if (current?.leading != null) ...[- current!.leading!(),- const SizedBox(width: 8),- ],- Flexible(- child: Text(- current?.label ?? '—',- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: AppControl.fontSize,- fontWeight: AppControl.fontWeight,- letterSpacing: AppFont.trackingFor(- AppControl.fontSize,- ),- color: AppPalette.textPrimary,- ),- ),- ),- if (current?.note != null) ...[- const SizedBox(width: 8),- Flexible(- child: Text(- current!.note!,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: 11.5,- color: AppPalette.textFaint,- ),- ),- ),- ],- ],- ),- ),- const SizedBox(width: 6),- Icon(- Icons.expand_more_rounded,- size: AppControl.iconSize,- color: _hovered || controller.isOpen- ? AppPalette.textPrimary- : AppPalette.textSecondary,- ),- ],- ),- ),- ),- ),- ),- ),- );- }-}diff --git a/mobile/lib/shared/widgets/command_row.dart b/mobile/lib/shared/widgets/command_row.dartdeleted file mode 100644index d75db9803..000000000--- a/mobile/lib/shared/widgets/command_row.dart+++ /dev/null@@ -1,57 +0,0 @@-import 'package:flutter/material.dart';--import '../../theme/app_theme.dart';-import '../theme/app_theme.dart' as grid;--/// A single-line shell command with a copy affordance: tap anywhere on the row to copy, the trailing-/// icon flips to a checkmark for a moment to confirm. Shared by any screen that hands the user a-/// command to run themselves (`harness_join_guide_screen.dart`, `environment_setup_screen.dart`).-class CommandRow extends StatelessWidget {- final String command;- final bool copied;- final VoidCallback onCopy;-- const CommandRow({- super.key,- required this.command,- required this.copied,- required this.onCopy,- });-- @override- Widget build(BuildContext context) {- return InkWell(- onTap: onCopy,- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- child: Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),- decoration: BoxDecoration(- color: AppColors.background,- border: Border.all(color: AppColors.border),- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- child: Row(- children: [- Text('\$ ', style: TextStyle(color: AppColors.mutedStrong)),- Expanded(- child: SelectableText(- command,- style: TextStyle(- color: AppColors.text,- fontFamily: AppFonts.mono,- fontSize: 13,- ),- ),- ),- Icon(- copied ? Icons.check : Icons.copy,- size: 16,- color: copied ? AppColors.success : AppColors.mutedStrong,- ),- ],- ),- ),- );- }-}diff --git a/mobile/lib/shortcuts/key_cap.dart b/mobile/lib/shortcuts/key_cap.dartdeleted file mode 100644index 216503250..000000000--- a/mobile/lib/shortcuts/key_cap.dart+++ /dev/null@@ -1,105 +0,0 @@-import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import 'app_shortcuts.dart';--/// One key, drawn as a key.-///-/// A chord printed as running text (`⇧⌘]`) is three glyphs the eye has to-/// separate before it can read them; drawn as caps it is three objects and-/// reads at a glance. It also gives the right-hand column a shape, which is-/// what a list of shortcuts is scanned by.-///-/// A recessed well, not a bordered box: §1 puts depth in the fill, and-/// [grid.AppSurface.wellFill] is an overlay, so a cap keeps its edge on a-/// raised card and on a recessed one without being picked for either.-class KeyCap extends StatelessWidget {- const KeyCap(this.label, {super.key});-- final String label;-- /// Square at a single glyph, so ⌘ and W sit in caps of the same size and the- /// column stays a column. A longer label ("esc", "1 – 9") grows past it.- static const double _minWidth = 22;- static const double height = 22;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Container(- constraints: const BoxConstraints(minWidth: _minWidth),- height: height,- padding: const EdgeInsets.symmetric(horizontal: 6),- decoration: BoxDecoration(- color: grid.AppSurface.wellFill,- borderRadius: BorderRadius.circular(6),- ),- // `Center(widthFactor: 1)`, never `Container(alignment:)` — a cap has to- // be the width of the glyph on it, and an Align given a bounded width- // FILLS it (`shrinkWrapWidth` is false unless a factor is set or the- // constraint is infinite). The chord's Wrap bounds its children, so the- // plain alignment blew every cap out to the whole row: one cap per line,- // and a label squeezed to a character per line beside it.- child: Center(- widthFactor: 1,- child: label == '⇥' || label == '↵' || label == '⏎'- ? Semantics(- label: label == '⇥' ? 'Tab' : 'Return',- child: Icon(- label == '⇥' ? Icons.keyboard_tab : Icons.keyboard_return,- size: 14,- color: grid.AppPalette.textPrimary,- ),- )- : Text(- label,- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 11.5,- height: 1,- // Tabular so ⌘1 – ⌘9 and ⌘W keep the same cap width.- fontFeatures: const [FontFeature.tabularFigures()],- ),- ),- ),- );- }-}--/// A whole chord — `⇧` `⌘` `]` — and, where an action has more than one, the-/// alternates after an "or".-///-/// The alternates are printed rather than hidden: `⌃⇥` is the chord people-/// arrive already knowing, and a screen that only lists `⌘]` teaches them the-/// app doesn't have the key they are about to press.-class KeyChordView extends StatelessWidget {- const KeyChordView({super.key, required this.chords});-- final List<KeyChord> chords;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Wrap(- spacing: 4,- runSpacing: 4,- crossAxisAlignment: WrapCrossAlignment.center,- children: [- for (var i = 0; i < chords.length; i++) ...[- if (i > 0)- Padding(- padding: const EdgeInsets.symmetric(horizontal: 2),- child: Text(- 'or',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 10.5,- ),- ),- ),- for (final key in chords[i]) KeyCap(key),- ],- ],- );- }-}diff --git a/mobile/lib/shortcuts/keymap_settings.dart b/mobile/lib/shortcuts/keymap_settings.dartdeleted file mode 100644index d63b50533..000000000--- a/mobile/lib/shortcuts/keymap_settings.dart+++ /dev/null@@ -1,101 +0,0 @@-import 'package:flutter/material.dart';-import 'package:url_launcher/url_launcher.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_select_field.dart';-import 'app_keymap.dart';-import 'keymap.dart';--Future<void> openKeyboardConfig(BuildContext context) async {- final store = KeymapTheme.of(context, listen: false)?.store;- if (store == null) return;- try {- final file = await store.ensureFile();- if (!await launchUrl(file.uri)) {- throw StateError(- 'No editor is associated with .jsonc files. Open ${file.path} in your editor.',- );- }- } catch (error) {- if (context.mounted) {- ScaffoldMessenger.maybeOf(context)?.showSnackBar(- SnackBar(content: Text('Couldn’t open keyboard config. $error')),- );- }- }-}--class KeymapSettings extends StatelessWidget {- const KeymapSettings({- super.key,- required this.contextKind,- required this.onContextChanged,- });- final KeymapContext contextKind;- final ValueChanged<KeymapContext> onContextChanged;-- @override- Widget build(BuildContext context) {- final keymap = KeymapTheme.of(context);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Wrap(- spacing: 12,- runSpacing: 8,- crossAxisAlignment: WrapCrossAlignment.center,- children: [- AppSelectField<KeymapContext>(- value: contextKind,- width: 160,- options: const [- SelectOption(- value: KeymapContext.workspace,- label: 'Workspace',- ),- SelectOption(- value: KeymapContext.terminal,- label: 'Agent input',- ),- SelectOption(value: KeymapContext.picker, label: 'Search'),- ],- onChanged: onContextChanged,- ),- if (keymap?.store != null)- TextButton.icon(- onPressed: () => openKeyboardConfig(context),- icon: const Icon(Icons.edit_outlined, size: 16),- label: const Text('Edit keyboard config'),- style: TextButton.styleFrom(- foregroundColor: grid.AppPalette.textPrimary,- ),- ),- ],- ),- if (keymap?.path != null) ...[- const SizedBox(height: 8),- Text(- 'Saves apply automatically. Invalid edits keep your last working shortcuts.',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 12,- ),- ),- const SizedBox(height: 4),- SelectableText(- keymap!.path!,- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11),- ),- ],- if (keymap?.error != null) ...[- const SizedBox(height: 8),- SelectableText(- keymap!.error!,- style: const TextStyle(color: Colors.orangeAccent, fontSize: 12),- ),- ],- const SizedBox(height: 16),- ],- );- }-}diff --git a/mobile/lib/shortcuts/shortcuts_list.dart b/mobile/lib/shortcuts/shortcuts_list.dartdeleted file mode 100644index a0598204e..000000000--- a/mobile/lib/shortcuts/shortcuts_list.dart+++ /dev/null@@ -1,360 +0,0 @@-import 'dart:math' as math;--import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import 'app_shortcuts.dart';-import 'app_keymap.dart';-import 'keymap.dart';-import 'key_cap.dart';--/// Every shortcut, grouped and printed — in the two shapes the app needs.-///-/// [ShortcutsList] is the column the ⌘/ sheet draws inside a 420px dialog.-/// [ShortcutsDeck] is the same rows as cards across the Settings pane, which-/// is four times that wide.-///-/// Two layouts, one set of rows: both build from [shortcutRows], so the sheet-/// and the settings screen cannot disagree about what a key does, and neither-/// can drift from what the keys actually do.--/// The sheet's body: one column, group headers, no card chrome — it is already-/// inside a dialog, and a card in a card is one surface too many.-class ShortcutsList extends StatelessWidget {- const ShortcutsList({super.key, this.contextKind = KeymapContext.workspace});- final KeymapContext contextKind;-- @override- Widget build(BuildContext context) {- final rows = effectiveShortcutRows(context, contextKind);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- for (final group in ShortcutGroup.values) ...[- _GroupHeader(label: group.label),- for (final row in rows.where((row) => row.group == group))- _ShortcutRowView(row: row),- ],- const SizedBox(height: 14),- // The one thing users will otherwise file a bug about.- const ShortcutsNote(),- ],- );- }-}--/// The Settings pane's body: one card per group, laid out across the width the-/// pane actually has.-///-/// The list this replaced was built for the sheet and clamped to 460px, which-/// left two thirds of a settings window empty and every group in one long-/// column. Cards let the groups sit side by side, so the whole set is one-/// screenful — which is the only reason to open this screen rather than the-/// sheet.-class ShortcutsDeck extends StatelessWidget {- const ShortcutsDeck({super.key, this.contextKind = KeymapContext.workspace});- final KeymapContext contextKind;-- /// Narrower than this and a label wraps under its own keycaps. Public so the- /// deck's tests can render a card at exactly the width it is least able to- /// fit a chord in, which is the only width the overflow ever showed up at.- static const double minCardWidth = 280;- static const double _gap = 12;-- /// Past three columns the cards are wider than the deck needs and the eye- /// has to travel the full window to read one group.- static const int _maxColumns = 3;-- /// The deck stops growing here — a shortcut row is a label and a chord, and- /// stretching that across a maximised display puts a metre of nothing- /// between them.- static const double maxWidth = 1040;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final rows = effectiveShortcutRows(context, contextKind);- final cards = <Widget>[- for (final group in ShortcutGroup.values)- _ShortcutCard(- title: group.label,- rows: rows.where((row) => row.group == group).toList(),- ),- const _TerminalCard(),- ];-- return LayoutBuilder(- builder: (context, constraints) {- final width = math.min(constraints.maxWidth, maxWidth);- final columns = ((width + _gap) / (minCardWidth + _gap)).floor().clamp(- 1,- _maxColumns,- );-- // Dealt round-robin rather than split into runs, so the cards keep- // reading left to right in declaration order across the first row.- // Columns then end at their own heights instead of every card in a row- // stretching to the tallest — which is what a plain grid would do, and- // what would leave a three-row card padded out to match a nine-row one.- final lanes = List.generate(columns, (_) => <Widget>[]);- for (var i = 0; i < cards.length; i++) {- lanes[i % columns].add(cards[i]);- }-- return ConstrainedBox(- constraints: const BoxConstraints(maxWidth: maxWidth),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- for (var lane = 0; lane < lanes.length; lane++) ...[- if (lane > 0) const SizedBox(width: _gap),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- for (var i = 0; i < lanes[lane].length; i++) ...[- if (i > 0) const SizedBox(height: _gap),- lanes[lane][i],- ],- ],- ),- ),- ],- ],- ),- );- },- );- }-}--/// One group as a raised block — the same recipe a setting is stated in one-/// pane over, so Settings reads as one screen rather than four.-class _ShortcutCard extends StatelessWidget {- const _ShortcutCard({required this.title, required this.rows});-- final String title;- final List<ShortcutRow> rows;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Container(- decoration: BoxDecoration(- color: grid.AppGlass.surfaceFill,- borderRadius: BorderRadius.circular(14),- boxShadow: grid.AppGlass.cardShadow,- ),- padding: const EdgeInsets.fromLTRB(6, 14, 6, 10),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(12, 0, 12, 6),- child: Row(- crossAxisAlignment: CrossAxisAlignment.baseline,- textBaseline: TextBaseline.alphabetic,- children: [- Expanded(child: _CardTitle(title)),- Text(- '${rows.length}',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 10.5,- fontFeatures: const [FontFeature.tabularFigures()],- ),- ),- ],- ),- ),- for (final row in rows)- _ShortcutRowView(row: row, padding: _rowPadding),- ],- ),- );- }-- static const _rowPadding = EdgeInsets.symmetric(horizontal: 12, vertical: 5);-}--/// The keys this app does not take, and who has them.-///-/// Recessed, not raised: it is the one card here that is *not* a list of things-/// you can press in this app, and reading as a well rather than a block is what-/// says so before the title does.-class _TerminalCard extends StatelessWidget {- const _TerminalCard();-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Container(- decoration: BoxDecoration(- color: grid.AppSurface.recess,- borderRadius: BorderRadius.circular(14),- ),- padding: const EdgeInsets.fromLTRB(6, 14, 6, 12),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const Padding(- padding: EdgeInsets.fromLTRB(12, 0, 12, 6),- child: _CardTitle('Agent input'),- ),- for (final key in kTerminalOwnedKeys)- Padding(- padding: _ShortcutCard._rowPadding,- child: Row(- children: [- Expanded(- child: Text(- key.label,- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 12.5,- ),- ),- ),- const SizedBox(width: 16),- KeyChordView(chords: [key.chord]),- ],- ),- ),- const Padding(- padding: EdgeInsets.fromLTRB(12, 8, 12, 0),- child: ShortcutsNote(bare: true),- ),- ],- ),- );- }-}--class _CardTitle extends StatelessWidget {- const _CardTitle(this.label);-- final String label;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Text(- label.toUpperCase(),- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 10.5,- letterSpacing: 0.08 * 10.5,- fontWeight: grid.AppFont.medium,- ),- );- }-}--/// Why the app takes so few keys — the sentence that turns "these shortcuts are-/// missing" into "those keys belong to the agent".-class ShortcutsNote extends StatelessWidget {- const ShortcutsNote({super.key, this.bare = false});-- /// Inside the terminal card the wash would be a second surface on a surface,- /// and the card's own recess already says the same thing. The sheet, which- /// has nothing around it, keeps the wash.- final bool bare;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final text = Text(- 'Harness shortcuts control your workspace. Other input goes to the '- 'focused agent, where prompt editing and cancellation follow that '- 'coding agent’s behavior.',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11.5,- height: 1.5,- ),- );- if (bare) return text;- return Container(- padding: const EdgeInsets.fromLTRB(11, 10, 11, 10),- decoration: BoxDecoration(- color: grid.AppSurface.accentWash,- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- child: text,- );- }-}--class _GroupHeader extends StatelessWidget {- const _GroupHeader({required this.label});-- final String label;-- @override- Widget build(BuildContext context) {- return Padding(- padding: const EdgeInsets.only(top: 14, bottom: 6),- child: _CardTitle(label),- );- }-}--/// One shortcut: what it does on the left, the keys that do it on the right.-class _ShortcutRowView extends StatelessWidget {- const _ShortcutRowView({required this.row, this.padding});-- final ShortcutRow row;- final EdgeInsets? padding;-- /// Between the label and its keycaps.- static const double _gutter = 16;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Padding(- padding: padding ?? const EdgeInsets.symmetric(vertical: 3),- // [KeyChordView] is a Wrap, but a Row hands an INFLEXIBLE child unbounded- // width — so it never had the chance to wrap, and a chord wider than the- // space left simply overflowed the card. Capping it at the row gives the- // Wrap something to wrap inside.- //- // It took a flaky test to find: the widest chord ("Focus the previous- // pane", 246.5px) fits the 268px row of a three-column deck with 5.5px to- // spare, and only overflows — by 6.5px — once a card lands on- // [ShortcutsDeck.minCardWidth] exactly. So the deck looked fine at every- // width anyone had tried, and CI failed on a layout nobody could see.- child: LayoutBuilder(- builder: (context, constraints) => Row(- crossAxisAlignment: CrossAxisAlignment.center,- children: [- Expanded(- child: Text(- row.label,- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 12.5,- ),- ),- ),- const SizedBox(width: _gutter),- ConstrainedBox(- constraints: BoxConstraints(- maxWidth: math.max(0, constraints.maxWidth - _gutter),- ),- child: row.chords.isEmpty- ? Text(- 'Unassigned',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 11.5,- ),- )- : KeyChordView(chords: row.chords),- ),- ],- ),- ),- );- }-}diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dartindex 14faf37cc..3cd6c7680 100644--- a/mobile/lib/state/app_state.dart+++ b/mobile/lib/state/app_state.dart@@ -536,7 +536,7 @@ class AppNotifier extends ChangeNotifier {Timer? _environmentRecheckTimer;/// Whether a stuck step is being auto-polled right now — drives the "Checking automatically…"- /// caption on [EnvironmentSetupScreen] alongside its Recheck button.+ /// caption on the desktop's `EnvironmentSetupScreen` alongside its Recheck button.bool get environmentRecheckPending => _environmentRecheckTimer != null;/// Whether a provisioning run (initial or a per-step recheck) is in flight — lets the setup@@ -1913,8 +1913,8 @@ class AppNotifier extends ChangeNotifier {config = _store.config;}// Forced, not read from persisted config: staging is a dev-only- // escape hatch with no UI to reach it anymore (see login_screen.dart- // history) — a stale `stag` value saved before that removal must+ // escape hatch with no UI to reach it anymore (see the desktop's+ // login_screen.dart history) — a stale `stag` value saved before that removal must// never silently resurrect it._autonomousEnv = 'prod';api = _newApiClient();@@ -2565,7 +2565,7 @@ class AppNotifier extends ChangeNotifier {static const _signedOutMessage ='You were signed out on this computer. Sign in again to reconnect.';- /// The session went away while the app was already running — send the user to [LoginScreen] with a+ /// The session went away while the app was already running — send the user to the signed-out screen with a/// reason, and stop the background work that can only fail from here.////// Cold start already handles this: [bootstrap] asks the CLI whether it is signed in. The hole thisdiff --git a/mobile/lib/widgets/bootstrapping_screen.dart b/mobile/lib/widgets/bootstrapping_screen.dartdeleted file mode 100644index 791bdf2b5..000000000--- a/mobile/lib/widgets/bootstrapping_screen.dart+++ /dev/null@@ -1,158 +0,0 @@-import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import 'login_relay_diagram.dart';--/// The quiet bridge between opening Harness and reaching the user's workspace.-///-/// Bootstrap does not expose truthful percentage progress, so this screen names-/// the current operation without inventing steps or a completion estimate. It-/// shares the sign-in and pre-flight visual language so startup feels like one-/// product instead of a framework spinner between two designed screens.-class BootstrappingScreen extends StatelessWidget {- const BootstrappingScreen({super.key, this.statusMessage});-- final String? statusMessage;-- static const double _cardWidth = 420;- static const String _fallbackStatus = 'Opening Harness…';-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final reduceMotion = MediaQuery.disableAnimationsOf(context);- final status = statusMessage ?? _fallbackStatus;-- return Scaffold(- backgroundColor: grid.AppPalette.panelBg,- body: Stack(- children: [- const Positioned.fill(child: LoginAurora()),- Center(- child: SingleChildScrollView(- padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 24),- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: _cardWidth),- child: Container(- width: double.infinity,- padding: const EdgeInsets.all(32),- decoration: BoxDecoration(- color: grid.AppGlass.surfaceFill,- borderRadius: BorderRadius.circular(grid.AppCard.radius),- boxShadow: grid.AppCard.shadow,- ),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- const _BootAppMark(),- const SizedBox(height: 20),- Text(- 'Getting Harness ready',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.titleLarge,- ),- const SizedBox(height: 8),- Text(- 'Connecting this window to the local Harness service.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- const SizedBox(height: 24),- Semantics(- key: const Key('boot-status'),- container: true,- liveRegion: true,- label: 'Harness startup status',- value: status,- child: ExcludeSemantics(- child: Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(- horizontal: 16,- vertical: 14,- ),- decoration: BoxDecoration(- color: grid.AppCard.inset,- borderRadius: BorderRadius.circular(- grid.AppCard.insetRadius,- ),- border: Border.all(color: grid.AppCard.insetHair),- ),- child: Row(- mainAxisAlignment: MainAxisAlignment.center,- mainAxisSize: MainAxisSize.min,- children: [- TickerMode(- key: const Key('boot-status-ticker'),- enabled: !reduceMotion,- child: const SizedBox(- width: 18,- height: 18,- child: CircularProgressIndicator(- strokeWidth: 2,- ),- ),- ),- const SizedBox(width: 12),- Flexible(- child: AnimatedSwitcher(- duration: reduceMotion- ? Duration.zero- : const Duration(milliseconds: 180),- child: Text(- status,- key: ValueKey(status),- textAlign: TextAlign.center,- style: Theme.of(context)- .textTheme- .labelLarge,- ),- ),- ),- ],- ),- ),- ),- ),- const SizedBox(height: 16),- Text(- 'This usually takes a few seconds.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.labelSmall- ?.copyWith(color: grid.AppPalette.textSecondary),- ),- ],- ),- ),- ),- ),- ),- ],- ),- );- }-}--class _BootAppMark extends StatelessWidget {- const _BootAppMark();-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Container(- width: 56,- height: 56,- decoration: BoxDecoration(- color: grid.AppCard.inset,- borderRadius: BorderRadius.circular(12),- ),- alignment: Alignment.center,- child: Image.asset(- 'assets/app_icon.png',- width: 36,- height: 36,- filterQuality: FilterQuality.medium,- ),- );- }-}diff --git a/mobile/lib/widgets/environment_preflight_screen.dart b/mobile/lib/widgets/environment_preflight_screen.dartdeleted file mode 100644index 8180c9884..000000000--- a/mobile/lib/widgets/environment_preflight_screen.dart+++ /dev/null@@ -1,124 +0,0 @@-import 'package:flutter/material.dart';--import '../bootstrap/environment_provisioner.dart';-import '../shared/theme/app_theme.dart' as grid;-import 'login_relay_diagram.dart';--/// The quiet read-only gate shown before either sign-in or environment setup.-///-/// This is deliberately not part of the environment setup wizard: a computer that-/// is already ready should never look as though it has entered an installer.-/// The ready state has no artificial dwell or action; it stays visible only-/// while the app asks the local Harness CLI whether this user is signed in.-class EnvironmentPreflightScreen extends StatelessWidget {- const EnvironmentPreflightScreen({super.key, required this.readiness});-- final EnvironmentReadiness readiness;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final ready = readiness.isReady;-- return Scaffold(- backgroundColor: grid.AppPalette.panelBg,- body: Stack(- children: [- const Positioned.fill(child: LoginAurora()),- Center(- child: SingleChildScrollView(- padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 24),- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 420),- child: Container(- width: double.infinity,- padding: const EdgeInsets.all(32),- decoration: BoxDecoration(- color: grid.AppGlass.surfaceFill,- borderRadius: BorderRadius.circular(14),- boxShadow: grid.AppCard.shadow,- ),- child: AnimatedSwitcher(- duration: const Duration(milliseconds: 180),- child: ready- ? const _ReadyContent(- key: ValueKey('environment-ready'),- )- : const _CheckingContent(- key: ValueKey('environment-checking'),- ),- ),- ),- ),- ),- ),- ],- ),- );- }-}--class _CheckingContent extends StatelessWidget {- const _CheckingContent({super.key});-- @override- Widget build(BuildContext context) => Column(- mainAxisSize: MainAxisSize.min,- children: [- const SizedBox(- width: 34,- height: 34,- child: CircularProgressIndicator(strokeWidth: 2.5),- ),- const SizedBox(height: 24),- Text(- 'Checking this computer',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.titleLarge,- ),- const SizedBox(height: 8),- Text(- 'Verifying the tools Harness needs. This check is read-only and nothing is being installed.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- ],- );-}--class _ReadyContent extends StatelessWidget {- const _ReadyContent({super.key});-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final success = grid.AppPalette.online;- return Column(- mainAxisSize: MainAxisSize.min,- children: [- Container(- width: 48,- height: 48,- decoration: BoxDecoration(- color: success.withValues(alpha: 0.12),- shape: BoxShape.circle,- ),- alignment: Alignment.center,- child: Icon(Icons.check_rounded, size: 28, color: success),- ),- const SizedBox(height: 20),- Text(- 'Environment ready',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.titleLarge,- ),- const SizedBox(height: 8),- Text(- 'All required tools passed verification.',- textAlign: TextAlign.center,- style: Theme.of(context).textTheme.bodySmall,- ),- ],- );- }-}diff --git a/mobile/lib/widgets/environment_setup_screen.dart b/mobile/lib/widgets/environment_setup_screen.dartdeleted file mode 100644index d374f4fa5..000000000--- a/mobile/lib/widgets/environment_setup_screen.dart+++ /dev/null@@ -1,868 +0,0 @@-import 'dart:io';--import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--import '../bootstrap/environment_provisioner.dart';-import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/command_row.dart';-import '../state/app_state.dart';-import '../theme/app_theme.dart';--/// One setup review with a direct install action. Launch probes stay read-only;-/// installation starts only after the user chooses the visible install action.-class EnvironmentSetupScreen extends StatefulWidget {- final AppNotifier notifier;-- const EnvironmentSetupScreen({super.key, required this.notifier});-- @override- State<EnvironmentSetupScreen> createState() => _EnvironmentSetupScreenState();-}--class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {- String? _copied;- final _scroll = ScrollController();- final _primaryFocus = FocusNode(debugLabel: 'Setup action');- final _bodyFocus = FocusNode(- debugLabel: 'Setup details',- skipTraversal: true,- );- final _manualFocus = FocusNode(debugLabel: 'Switch setup method');- EnvironmentSetupPhase? _lastPhase;- bool _actionWasAvailable = false;- bool _detailsOpen = false;-- @override- void dispose() {- _scroll.dispose();- _primaryFocus.dispose();- _bodyFocus.dispose();- _manualFocus.dispose();- super.dispose();- }-- Future<void> _copy(String value) async {- await Clipboard.setData(ClipboardData(text: value));- if (!mounted) return;- setState(() => _copied = value);- Future<void>.delayed(const Duration(milliseconds: 1400), () {- if (mounted && _copied == value) setState(() => _copied = null);- });- }-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final state = widget.notifier.environmentReadiness;- final phaseChanged = _lastPhase != state.phase;- final actionAvailable =- !widget.notifier.environmentSetupInFlight &&- const {- EnvironmentSetupPhase.review,- EnvironmentSetupPhase.chooseMethod,- EnvironmentSetupPhase.failed,- EnvironmentSetupPhase.waitingForTerminal,- EnvironmentSetupPhase.ready,- }.contains(state.phase);- if (phaseChanged || (actionAvailable && !_actionWasAvailable)) {- WidgetsBinding.instance.addPostFrameCallback((_) {- if (!mounted || ModalRoute.of(context)?.isCurrent == false) return;- if (widget.notifier.environmentReadiness.phase != state.phase) return;- if (phaseChanged && _scroll.hasClients) _scroll.jumpTo(0);- // A new next step should be usable with Enter. Keep an explicit choice- // to read/copy details or change methods when asynchronous updates land.- if (actionAvailable &&- !widget.notifier.environmentSetupInFlight &&- !_bodyFocus.hasFocus &&- !_manualFocus.hasFocus) {- _primaryFocus.requestFocus();- }- });- }- _lastPhase = state.phase;- _actionWasAvailable = actionAvailable;- final compact = MediaQuery.sizeOf(context).height < 640;- return Scaffold(- backgroundColor: AppColors.background,- body: SafeArea(- child: Padding(- padding: EdgeInsets.all(compact ? 16 : 24),- child: Center(- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 760),- child: Material(- color: AppColors.sidebar,- clipBehavior: Clip.antiAlias,- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(14),- side: BorderSide(color: AppColors.border),- ),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Flexible(- child: SingleChildScrollView(- controller: _scroll,- padding: EdgeInsets.all(compact ? 20 : 28),- child: Focus(- focusNode: _bodyFocus,- child: _body(state),- ),- ),- ),- _footer(state),- ],- ),- ),- ),- ),- ),- ),- );- }-- Widget _body(EnvironmentReadiness state) => switch (state.phase) {- EnvironmentSetupPhase.preflight => _preflight(state),- EnvironmentSetupPhase.review ||- EnvironmentSetupPhase.chooseMethod => _choose(state),- EnvironmentSetupPhase.installing ||- EnvironmentSetupPhase.waitingForTerminal ||- EnvironmentSetupPhase.verifying => _installing(state),- EnvironmentSetupPhase.failed => _failure(state),- EnvironmentSetupPhase.ready => _ready(state),- };-- Widget _heading(String eyebrow, String title, String lead) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- eyebrow.toUpperCase(),- style: TextStyle(- color: AppColors.accent,- fontSize: 11,- fontWeight: FontWeight.w700,- letterSpacing: 1.4,- ),- ),- const SizedBox(height: 6),- Text(- title,- style: const TextStyle(fontSize: 28, fontWeight: FontWeight.w600),- ),- const SizedBox(height: 8),- Text(lead, style: TextStyle(color: AppColors.textSoft, height: 1.55)),- const SizedBox(height: 16),- ],- );-- Widget _preflight(EnvironmentReadiness state) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _heading(- 'Getting started',- 'Checking this computer',- 'Checking the tools Harness needs to run your harnesses.',- ),- _checkList(state, checking: true),- ],- );-- Widget _choose(EnvironmentReadiness state) {- final mode = state.mode ?? EnvironmentSetupMode.automatic;- final items = _installItems(state);- final count = items.length;- final countLabel = '$count ${count == 1 ? 'tool' : 'tools'}';- final needsTerminal = items.any((item) => item.requiresTerminal);- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _heading(- 'Getting started',- 'Get this computer ready',- count == 0- ? 'Your tools are ready. Verify them to continue.'- : count == 1- ? 'Install this tool, then sign in to start your first harness.'- : 'Install these $countLabel, then sign in to start your first harness.',- ),- Row(- children: [- const Expanded(- child: Text(- 'Required tools',- style: TextStyle(fontWeight: FontWeight.w500),- ),- ),- TextButton(- style: TextButton.styleFrom(foregroundColor: AppColors.textSoft),- onPressed: () => widget.notifier.selectEnvironmentSetupMode(- mode == EnvironmentSetupMode.automatic- ? EnvironmentSetupMode.manual- : EnvironmentSetupMode.automatic,- ),- child: Text(- mode == EnvironmentSetupMode.automatic- ? 'Manual setup'- : 'Use automatic setup',- ),- ),- ],- ),- const SizedBox(height: 8),- if (mode == EnvironmentSetupMode.automatic) ...[- if (needsTerminal) ...[- _notice(- Icons.terminal,- 'Admin prompts stay in Terminal',- 'Complete any installation prompts there, then return to Harness.',- ),- const SizedBox(height: 16),- ],- _planList(items),- ] else- _manualList(items),- ],- );- }-- Widget _installing(EnvironmentReadiness state) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _heading(- 'Getting started',- state.phase == EnvironmentSetupPhase.waitingForTerminal- ? 'Finish setup in Terminal'- : state.phase == EnvironmentSetupPhase.verifying- ? 'Running final verification'- : 'Preparing this computer',- state.message ?? 'Installing only the missing required tools.',- ),- if (state.phase == EnvironmentSetupPhase.waitingForTerminal)- _notice(- Icons.lock_outline,- 'Harness cannot see your password',- 'Finish the prompts in Terminal, then return here. Harness checks progress automatically.',- ),- const SizedBox(height: 18),- _checkList(state, checking: true),- _logs(state),- ],- );-- Widget _failure(EnvironmentReadiness state) {- final failure = state.failure;- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _heading(- 'Setup needs attention',- failure?.title ?? 'Environment setup failed',- failure?.detail ?? state.message ?? 'Review the full error below.',- ),- _checkList(state),- if (failure?.command != null) ...[- const SizedBox(height: 16),- CommandRow(- command: failure!.command!,- copied: _copied == failure.command,- onCopy: () => _copy(failure.command!),- ),- ],- _logs(state),- ],- );- }-- Widget _ready(EnvironmentReadiness state) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _heading(- 'Setup complete',- 'This computer is ready',- 'Every required command passed. Continue to Harness sign-in.',- ),- _checkList(state),- ],- );-- Widget _checkList(EnvironmentReadiness state, {bool checking = false}) =>- _Panel(- child: Column(- children: [- const _CheckSectionLabel('Host dependencies'),- _CheckRow(- label: 'System tools & writable home',- detail: Platform.isMacOS- ? 'Shell, curl, tar, sed, awk, shasum · Xcode or Command Line Tools'- : 'Shell, curl, tar, sed, awk, sha256sum · writable home',- status: _systemStatus(state),- checking:- checking && state.phase == EnvironmentSetupPhase.preflight,- ),- _CheckRow(- label: Platform.isMacOS- ? 'Homebrew & tmux terminal backend'- : 'tmux terminal backend',- detail: 'Required for every terminal session',- status: state.steps[EnvironmentStep.tmux],- ),- if (Platform.isLinux)- _CheckRow(- label: 'Native image clipboard',- detail: _linuxClipboardDetail,- status: state.steps[EnvironmentStep.clipboard],- ),- const _CheckSectionLabel('Harness components'),- _CheckRow(- label: 'Managed Node 20+ & Harness CLI',- detail: '~/.harness/runtime · harness version',- status: state.steps[EnvironmentStep.harness],- ),- ],- ),- );-- EnvironmentStepStatus? _systemStatus(EnvironmentReadiness state) {- if (state.systemReady) return EnvironmentStepStatus.ready;- if (state.phase == EnvironmentSetupPhase.preflight) return null;- if (state.phase == EnvironmentSetupPhase.waitingForTerminal &&- state.terminalSetup == EnvironmentTerminalSetup.linuxHost) {- return EnvironmentStepStatus.needsTerminal;- }- if (state.phase == EnvironmentSetupPhase.installing) {- return EnvironmentStepStatus.running;- }- return EnvironmentStepStatus.failed;- }-- String? get _linuxClipboardPackage {- if ((Platform.environment['WAYLAND_DISPLAY'] ?? '').isNotEmpty) {- return 'wl-clipboard';- }- if ((Platform.environment['DISPLAY'] ?? '').isNotEmpty) return 'xclip';- return null;- }-- String get _linuxClipboardDetail => switch (_linuxClipboardPackage) {- 'wl-clipboard' => 'wl-copy · provided by wl-clipboard',- 'xclip' => 'xclip · required for native image paste',- _ => 'Not applicable · image paste uses file-path fallback',- };-- bool _needsInstall(EnvironmentStepStatus? status) =>- status != EnvironmentStepStatus.ready &&- status != EnvironmentStepStatus.notApplicable;-- List<_InstallItem> _installItems(EnvironmentReadiness state) {- final items = <_InstallItem>[];- final tmuxStatusMissing = _needsInstall(state.steps[EnvironmentStep.tmux]);- final tmuxMissing =- state.tmuxBinaryReady == false ||- (state.tmuxBinaryReady == null && tmuxStatusMissing);-- if (Platform.isMacOS) {- if (!state.systemReady) {- items.add(- const _InstallItem(- title: 'Apple developer tools',- detail: 'Xcode or Command Line Tools',- command: '/usr/bin/xcrun --find clang || { if [ -x /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild ]; then sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer; else xcode-select --install; fi; }',- requiresTerminal: true,- ),- );- }- final homebrewMissing =- state.homebrewReady == false ||- (state.homebrewReady == null && tmuxStatusMissing);- if (homebrewMissing) {- items.add(- const _InstallItem(- title: 'Homebrew',- detail: 'Required package manager for tmux',- command: '/bin/bash -c "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',- requiresTerminal: true,- ),- );- }- if (tmuxMissing) {- items.add(- const _InstallItem(- title: 'tmux',- detail: 'Required for every terminal session',- command: 'eval "\$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)" && brew install tmux',- ),- );- }- } else if (Platform.isLinux) {- final packages = <String>{...state.missingLinuxPackages};- if (!state.systemReady && packages.isEmpty) {- packages.addAll(const [- 'bash',- 'curl',- 'tar',- 'sed',- 'gawk',- 'coreutils',- ]);- }- if (_needsInstall(state.steps[EnvironmentStep.clipboard]) &&- _linuxClipboardPackage != null) {- packages.add(_linuxClipboardPackage!);- }- if (tmuxMissing) packages.add('tmux');- if (packages.isNotEmpty) {- final names = packages.join(', ');- items.add(- _InstallItem(- title: 'Linux host dependencies',- detail: '$names · one apt transaction',- command: 'sudo apt-get install -y ${packages.join(' ')}',- requiresTerminal: true,- ),- );- }- }-- if (_needsInstall(state.steps[EnvironmentStep.harness])) {- items.add(- const _InstallItem(- title: 'Managed Node 20+ & Harness CLI',- detail: '~/.harness only',- command: kHarnessDesktopInstallCommand,- ),- );- }- return items;- }-- Widget _planList(List<_InstallItem> items) {- if (items.isEmpty) {- return _notice(- Icons.check_circle_outline,- 'Nothing left to install',- 'Every dependency is ready. Continue to final verification.',- );- }- final stacked = MediaQuery.textScalerOf(context).scale(1) > 1.25;- return _Panel(- child: Column(- children: [- for (var index = 0; index < items.length; index++)- ListTile(- dense: true,- leading: CircleAvatar(- radius: 14,- backgroundColor: AppColors.hover,- child: Text(- '${index + 1}',- style: const TextStyle(fontSize: 11),- ),- ),- title: Text(- items[index].title,- style: const TextStyle(fontSize: 13),- ),- subtitle: stacked- ? Text(- items[index].detail,- style: TextStyle(color: AppColors.textSoft, fontSize: 11),- )- : null,- trailing: stacked- ? null- : ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 280),- child: Text(- items[index].detail,- maxLines: 2,- overflow: TextOverflow.ellipsis,- textAlign: TextAlign.end,- style: TextStyle(color: AppColors.muted, fontSize: 11),- ),- ),- ),- ],- ),- );- }-- Widget _manualList(List<_InstallItem> items) => Column(- children: [- if (items.isEmpty)- _notice(- Icons.check_circle_outline,- 'Nothing left to install',- 'Every dependency is ready. Continue to final verification.',- ),- for (var index = 0; index < items.length; index++)- Padding(- padding: const EdgeInsets.only(bottom: 10),- child: _Panel(- padding: const EdgeInsets.all(14),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- '${index + 1} · ${items[index].title}',- style: const TextStyle(- fontSize: 12,- fontWeight: FontWeight.w600,- ),- ),- const SizedBox(height: 9),- CommandRow(- command: items[index].command,- copied: _copied == items[index].command,- onCopy: () => _copy(items[index].command),- ),- ],- ),- ),- ),- ],- );-- Widget _logs(EnvironmentReadiness state) {- if (state.output.isEmpty) return const SizedBox.shrink();- final diagnostics = state.output.join('\n');- return Container(- width: double.infinity,- margin: const EdgeInsets.only(top: 18),- decoration: BoxDecoration(- color: AppColors.background,- border: Border.all(color: AppColors.border),- borderRadius: BorderRadius.circular(10),- ),- child: ExpansionTile(- initiallyExpanded: _detailsOpen,- maintainState: true,- expandedCrossAxisAlignment: CrossAxisAlignment.stretch,- expansionAnimationStyle: AnimationStyle.noAnimation,- onExpansionChanged: (open) => setState(() => _detailsOpen = open),- title: Row(- children: [- const Expanded(- child: Text(- 'Setup details',- style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600),- ),- ),- TextButton.icon(- onPressed: () => _copy(diagnostics),- icon: const Icon(Icons.copy, size: 14),- label: Text(- _copied == diagnostics ? 'Copied' : 'Copy diagnostics',- ),- ),- ],- ),- children: [- Divider(height: 1, color: AppColors.border),- ConstrainedBox(- constraints: const BoxConstraints(maxHeight: 210),- child: SingleChildScrollView(- reverse: true,- padding: const EdgeInsets.all(14),- child: SelectableText(- diagnostics,- style: TextStyle(- fontFamily: AppFonts.mono,- fontSize: 11,- height: 1.55,- color: AppColors.textSoft,- ),- ),- ),- ),- ],- ),- );- }-- Widget _notice(IconData icon, String title, String detail) {- final tone = AppColors.accent;- return Container(- padding: const EdgeInsets.all(14),- decoration: BoxDecoration(- color: tone.withValues(alpha: 0.07),- border: Border.all(color: tone.withValues(alpha: 0.35)),- borderRadius: BorderRadius.circular(10),- ),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Icon(icon, size: 18, color: tone),- const SizedBox(width: 11),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: const TextStyle(- fontSize: 12,- fontWeight: FontWeight.w600,- ),- ),- const SizedBox(height: 4),- Text(- detail,- style: TextStyle(- color: AppColors.textSoft,- fontSize: 12,- height: 1.45,- ),- ),- ],- ),- ),- ],- ),- );- }-- Widget _footer(EnvironmentReadiness state) {- final busy = widget.notifier.environmentSetupInFlight;- final mode = state.mode ?? EnvironmentSetupMode.automatic;- final missingCount = _installItems(state).length;- final manual = mode == EnvironmentSetupMode.manual;- String? label;- VoidCallback? action;- IconData? icon;- switch (state.phase) {- case EnvironmentSetupPhase.review || EnvironmentSetupPhase.chooseMethod:- label = manual- ? 'Check again'- : missingCount == 0- ? 'Verify and continue'- : 'Install $missingCount ${missingCount == 1 ? 'tool' : 'tools'}';- icon = manual ? Icons.refresh : Icons.download_outlined;- action = manual- ? widget.notifier.retryEnvironmentSetup- : widget.notifier.startEnvironmentSetup;- case EnvironmentSetupPhase.failed:- label = 'Retry';- action = manual- ? widget.notifier.retryEnvironmentSetup- : widget.notifier.startEnvironmentSetup;- case EnvironmentSetupPhase.ready:- label = 'Continue to sign in';- action = widget.notifier.continueAfterEnvironmentSetup;- case EnvironmentSetupPhase.waitingForTerminal:- label = 'Recheck now';- icon = Icons.refresh;- action = () => widget.notifier.recheckEnvironmentStep(- state.steps[EnvironmentStep.clipboard] ==- EnvironmentStepStatus.needsTerminal- ? EnvironmentStep.clipboard- : EnvironmentStep.tmux,- );- default:- break;- }- final actions = Wrap(- alignment: WrapAlignment.end,- crossAxisAlignment: WrapCrossAlignment.center,- spacing: 8,- runSpacing: 8,- children: [- if (state.phase == EnvironmentSetupPhase.failed && !manual)- TextButton(- focusNode: _manualFocus,- onPressed: busy- ? null- : () {- widget.notifier.selectEnvironmentSetupMode(- EnvironmentSetupMode.manual,- );- widget.notifier.showEnvironmentMethodChoice();- },- child: const Text('Switch to Manual'),- ),- if (label != null)- FilledButton.icon(- focusNode: _primaryFocus,- autofocus: true,- onPressed: busy ? null : action,- icon: icon == null ? null : Icon(icon, size: 16),- label: Text(label),- )- else if (busy)- const SizedBox(- width: 18,- height: 18,- child: CircularProgressIndicator(strokeWidth: 2),- ),- ],- );- final next = Text(- 'Next: sign in and start a harness.',- style: TextStyle(color: AppColors.textSoft, fontSize: 11),- );- return Container(- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),- decoration: BoxDecoration(- color: AppColors.sidebar,- border: Border(top: BorderSide(color: AppColors.border)),- ),- child: LayoutBuilder(- builder: (context, constraints) {- if (constraints.maxWidth < 600 ||- MediaQuery.textScalerOf(context).scale(1) > 1.25) {- return Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [next, const SizedBox(height: 12), actions],- );- }- return Row(- children: [- Expanded(child: next),- const SizedBox(width: 12),- actions,- ],- );- },- ),- );- }-}--class _InstallItem {- final String title;- final String detail;- final String command;- final bool requiresTerminal;-- const _InstallItem({- required this.title,- required this.detail,- required this.command,- this.requiresTerminal = false,- });-}--class _Panel extends StatelessWidget {- final Widget child;- final EdgeInsetsGeometry padding;- const _Panel({required this.child, this.padding = EdgeInsets.zero});-- @override- Widget build(BuildContext context) => Container(- width: double.infinity,- padding: padding,- clipBehavior: Clip.antiAlias,- decoration: BoxDecoration(- color: AppColors.surface,- border: Border.all(color: AppColors.border),- borderRadius: BorderRadius.circular(11),- ),- child: child,- );-}--class _CheckSectionLabel extends StatelessWidget {- final String label;- const _CheckSectionLabel(this.label);-- @override- Widget build(BuildContext context) => Container(- width: double.infinity,- padding: const EdgeInsets.fromLTRB(16, 11, 16, 8),- decoration: BoxDecoration(- color: AppColors.background.withValues(alpha: 0.28),- border: Border(bottom: BorderSide(color: AppColors.border)),- ),- child: Text(- label.toUpperCase(),- style: TextStyle(- color: AppColors.textSoft,- fontSize: 10,- fontWeight: FontWeight.w700,- letterSpacing: 1.1,- ),- ),- );-}--class _CheckRow extends StatelessWidget {- final String label;- final String detail;- final EnvironmentStepStatus? status;- final bool checking;- const _CheckRow({- required this.label,- required this.detail,- required this.status,- this.checking = false,- });-- @override- Widget build(BuildContext context) {- final color = switch (status) {- EnvironmentStepStatus.ready => AppColors.success,- EnvironmentStepStatus.failed => AppColors.danger,- EnvironmentStepStatus.needsTerminal => AppColors.warning,- EnvironmentStepStatus.running => AppColors.accent,- EnvironmentStepStatus.notApplicable => AppColors.muted,- _ => AppColors.muted,- };- return Container(- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),- decoration: BoxDecoration(- border: Border(bottom: BorderSide(color: AppColors.border)),- ),- child: Row(- children: [- if (checking || status == EnvironmentStepStatus.running)- SizedBox(- width: 16,- height: 16,- child: CircularProgressIndicator(strokeWidth: 2, color: color),- )- else- Icon(- status == EnvironmentStepStatus.ready- ? Icons.check_circle- : status == EnvironmentStepStatus.failed- ? Icons.cancel_outlined- : status == EnvironmentStepStatus.notApplicable- ? Icons.remove_circle_outline- : Icons.circle_outlined,- size: 17,- color: color,- ),- const SizedBox(width: 12),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- label,- style: const TextStyle(- fontSize: 13,- fontWeight: FontWeight.w500,- ),- ),- const SizedBox(height: 3),- Text(- detail,- style: TextStyle(color: AppColors.muted, fontSize: 11),- ),- ],- ),- ),- Text(switch (status) {- EnvironmentStepStatus.ready => 'Ready',- EnvironmentStepStatus.failed => 'Missing',- EnvironmentStepStatus.needsTerminal => 'Terminal',- EnvironmentStepStatus.running => 'Working',- EnvironmentStepStatus.notApplicable => 'Not applicable',- _ => checking ? 'Checking' : 'Required',- }, style: TextStyle(color: color, fontSize: 11)),- ],- ),- );- }-}diff --git a/mobile/lib/widgets/flash_firmware_dialog.dart b/mobile/lib/widgets/flash_firmware_dialog.dartdeleted file mode 100644index 103f6e871..000000000--- a/mobile/lib/widgets/flash_firmware_dialog.dart+++ /dev/null@@ -1,813 +0,0 @@-import 'dart:async';--import 'package:flutter/material.dart';-import 'package:flutter/services.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import '../flash/flasher.dart';-import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';--/// Writes firmware to the plugged-in dial, and shows the flasher's own output-/// while it happens.-Future<void> showFlashFirmwareDialog(BuildContext context, {Flasher? flasher}) {- return showAppDialog<void>(- context: context,- // A half-written image is a board that will not boot. The dialog refuses to- // leave while the write is in flight; PopScope below does the same for the- // Escape key and the window's own close.- barrierDismissible: false,- builder: (context) => _FlashDialog(flasher: flasher ?? Flasher()),- );-}--enum _Phase { probing, ready, noBoard, flashing, done, failed }--class _FlashDialog extends StatefulWidget {- const _FlashDialog({required this.flasher});-- final Flasher flasher;-- @override- State<_FlashDialog> createState() => _FlashDialogState();-}--class _FlashDialogState extends State<_FlashDialog> {- final List<FlashLine> _log = [];- final ScrollController _logScroll = ScrollController();-- _Phase _phase = _Phase.probing;- List<String> _ports = const [];- String? _port;- String? _problem;-- /// Step titles in the order the script announced them, and which one is live.- final List<String> _steps = [];- bool _stepFailed = false;-- Stopwatch? _elapsed;- Timer? _ticker;-- @override- void initState() {- super.initState();- unawaited(_probe());- }-- @override- void dispose() {- _ticker?.cancel();- _logScroll.dispose();- super.dispose();- }-- Future<void> _probe() async {- setState(() {- _phase = _Phase.probing;- _log.clear();- _steps.clear();- _problem = null;- });- final probe = await widget.flasher.probe();- if (!mounted) return;- setState(() {- _log- ..clear()- ..addAll(probe.log);- _ports = probe.ports;- _port = probe.ports.length == 1 ? probe.ports.first : null;- _problem = probe.problem;- _phase = probe.found ? _Phase.ready : _Phase.noBoard;- });- }-- Future<void> _flash() async {- setState(() {- _phase = _Phase.flashing;- _log.clear();- _steps.clear();- _stepFailed = false;- _problem = null;- _elapsed = Stopwatch()..start();- });- _ticker = Timer.periodic(- const Duration(seconds: 1),- (_) => mounted ? setState(() {}) : null,- );-- final result = await widget.flasher.flash(port: _port, onLine: _onLine);- _ticker?.cancel();- _elapsed?.stop();- if (!mounted) return;- setState(() {- if (!result.ok) _stepFailed = true;- _phase = result.ok ? _Phase.done : _Phase.failed;- if (!result.ok) {- _problem = result.cancelled- ? 'Stopped. Harness has been started again.'- : _lastTrouble() ?? 'The flasher exited with ${result.exitCode}.';- }- });- }-- void _onLine(FlashLine line) {- if (!mounted) return;- setState(() {- _log.add(line);- if (line.kind == FlashLineKind.step) _steps.add(line.title);- });- // Follow the tail the way a terminal does.- WidgetsBinding.instance.addPostFrameCallback((_) {- if (_logScroll.hasClients) {- _logScroll.jumpTo(_logScroll.position.maxScrollExtent);- }- });- }-- String? _lastTrouble() {- for (final line in _log.reversed) {- if (line.kind == FlashLineKind.error ||- line.kind == FlashLineKind.warning) {- return line.text.trim().replaceFirst(RegExp(r'^error:\s*'), '');- }- }- return null;- }-- /// The version the script said it wrote, once it has said so.- String? get _version {- for (final line in _log) {- final match = RegExp(r'^>> release: \S+ (\S+)').firstMatch(line.text);- if (match != null) return match.group(1);- }- return null;- }-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return PopScope(- canPop: _phase != _Phase.flashing,- child: Dialog(- // See the note on the other two dialogs: `dialogTheme` owns the- // fill, the radius and the absence of a rim.- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 540),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(18, 17, 18, 0),- child: _header(),- ),- Flexible(- child: SingleChildScrollView(- padding: const EdgeInsets.fromLTRB(18, 14, 18, 0),- child: _body(),- ),- ),- _actions(),- ],- ),- ),- ),- );- }-- // ---------------------------------------------------------------- header-- Widget _header() {- final (- IconData? icon,- Color tone,- String title,- String sub,- ) = switch (_phase) {- _Phase.probing => (- null,- grid.AppPalette.accentOnSurface,- 'Looking for the dial…',- 'Checking the USB ports on this Mac.',- ),- _Phase.ready => (- LucideIcons.zap300,- grid.AppPalette.accentOnSurface,- 'Flash firmware to the dial',- 'Writes the latest circle release over USB.',- ),- _Phase.noBoard => (- LucideIcons.usb300,- grid.AppPalette.warn,- 'No dial found',- _problem ??- 'Plug the dial into this Mac with a USB cable, then look '- 'again.',- ),- _Phase.flashing => (- null,- grid.AppPalette.accentOnSurface,- _version == null- ? 'Flashing the dial…'- : 'Flashing $_version → ${_port ?? 'the dial'}',- 'Don’t unplug the dial.',- ),- _Phase.done => (- LucideIcons.circleCheck300,- grid.AppPalette.online,- _version == null- ? 'The dial is flashed'- : 'circle $_version is on the dial',- 'Harness is running again. Your machines are back.',- ),- _Phase.failed => (- LucideIcons.triangleAlert300,- grid.AppPalette.dangerFill,- 'Flash failed',- _problem ?? 'Nothing else was changed. Harness has been started again.',- ),- };-- return Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Container(- width: 34,- height: 34,- decoration: BoxDecoration(- color: tone.withValues(alpha: 0.13),- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- alignment: Alignment.center,- child: icon == null- ? SizedBox(- width: 17,- height: 17,- child: CircularProgressIndicator(strokeWidth: 2, color: tone),- )- : Icon(icon, size: 18, color: tone),- ),- const SizedBox(width: 12),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 15,- fontWeight: grid.AppFont.semibold,- ),- ),- const SizedBox(height: 3),- Text(- sub,- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 12.5,- height: 1.5,- ),- ),- ],- ),- ),- ],- );- }-- // ------------------------------------------------------------------ body-- Widget _body() {- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- if (_phase == _Phase.ready) ...[- _facts(),- if (_ports.length > 1) _portPicker(),- _daemonNotice(),- ],- if (_phase == _Phase.done) _facts(),- if (_phase == _Phase.flashing || _phase == _Phase.failed) ...[- _stepList(),- if (_phase == _Phase.flashing) ...[- const SizedBox(height: 13),- // Indeterminate on purpose. esptool prints a percentage, but it is- // the percentage of ONE write — following it would run the bar to- // full and drop it back to zero several times over.- LinearProgressIndicator(- minHeight: 2,- backgroundColor: grid.AppGlass.hair,- color: grid.AppPalette.accentOnSurface,- ),- ],- ],- if (_log.isNotEmpty && _phase != _Phase.ready) _logPane(),- ],- );- }-- Widget _facts() {- final done = _phase == _Phase.done;- return Column(- children: [- _fact('Board', _port ?? 'the dial'),- const SizedBox(height: 7),- if (done) ...[- _fact('Flashed', _version ?? 'circle'),- const SizedBox(height: 7),- _fact('Took', _formatElapsed(), tone: grid.AppPalette.textSecondary),- ] else- // Not a version number: --detect-only returns before the script- // resolves the release, so nothing here knows it yet, and inventing- // one would be a guess presented as a fact.- _fact('Will install', 'circle · latest'),- ],- );- }-- Widget _fact(String label, String value, {Color? tone}) {- grid.AppTheme.watch(context);- return Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- SizedBox(- width: 104,- child: Text(- label,- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11.5),- ),- ),- Expanded(- child: Text(- value,- style: TextStyle(- color: tone ?? grid.AppPalette.textSecondary,- fontSize: 11.5,- fontFamily: grid.AppFont.mono,- fontFamilyFallback: grid.AppFont.monoFallback,- ),- ),- ),- ],- );- }-- Widget _portPicker() {- return Padding(- padding: const EdgeInsets.only(top: 13),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- 'More than one board is connected — pick one:',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 12,- ),- ),- const SizedBox(height: 7),- for (final port in _ports)- _PortChoice(- port: port,- selected: port == _port,- onTap: () => setState(() => _port = port),- ),- ],- ),- );- }-- Widget _daemonNotice() {- return Container(- margin: const EdgeInsets.only(top: 13),- padding: const EdgeInsets.fromLTRB(11, 10, 11, 10),- decoration: BoxDecoration(- color: grid.AppPalette.warn.withValues(alpha: 0.09),- border: Border.all(color: grid.AppPalette.warn.withValues(alpha: 0.24)),- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Icon(- LucideIcons.triangleAlert300,- size: 14,- color: grid.AppPalette.warn,- ),- const SizedBox(width: 9),- Expanded(- child: RichText(- text: TextSpan(- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11.5,- height: 1.5,- ),- children: [- TextSpan(- text: 'Harness stops while flashing. ',- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontWeight: grid.AppFont.semibold,- ),- ),- const TextSpan(- text:- 'The flasher has to close the serial port, so your '- 'machines go offline for about a minute and come back '- 'on their own.',- ),- ],- ),- ),- ),- ],- ),- );- }-- Widget _stepList() {- return Column(- children: [- for (var i = 0; i < _steps.length; i++)- _StepRow(- label: _steps[i],- state: i < _steps.length - 1- ? _StepState.done- : _stepFailed- ? _StepState.failed- : _phase == _Phase.flashing- ? _StepState.running- : _StepState.done,- ),- ],- );- }-- Widget _logPane() {- return Container(- margin: const EdgeInsets.only(top: 13),- decoration: BoxDecoration(- border: Border.all(color: grid.AppGlass.hair),- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- clipBehavior: Clip.antiAlias,- child: Column(- children: [- Container(- padding: const EdgeInsets.fromLTRB(10, 7, 10, 7),- color: grid.AppPalette.windowBg,- child: Row(- children: [- Icon(- LucideIcons.squareTerminal300,- size: 13,- color: grid.AppPalette.textFaint,- ),- const SizedBox(width: 8),- Text(- 'Output',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11.5,- ),- ),- const Spacer(),- Text(- 'flash-circle.sh',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 11.5,- ),- ),- ],- ),- ),- Container(- constraints: const BoxConstraints(maxHeight: 170),- width: double.infinity,- color: grid.AppPalette.windowBg,- child: SingleChildScrollView(- controller: _logScroll,- padding: const EdgeInsets.fromLTRB(11, 9, 11, 9),- child: SelectableText.rich(- TextSpan(- children: [- for (final line in _log)- TextSpan(- text: '${line.text}\n',- style: TextStyle(color: _inkFor(line.kind)),- ),- ],- ),- style: TextStyle(- fontSize: 11,- height: 1.62,- fontFamily: grid.AppFont.mono,- fontFamilyFallback: grid.AppFont.monoFallback,- ),- ),- ),- ),- ],- ),- );- }-- Color _inkFor(FlashLineKind kind) => switch (kind) {- FlashLineKind.step => grid.AppPalette.textPrimary,- FlashLineKind.detail => grid.AppPalette.textSecondary,- FlashLineKind.warning => grid.AppPalette.warn,- FlashLineKind.error => grid.AppPalette.dangerFill,- };-- // --------------------------------------------------------------- actions-- Widget _actions() {- final children = <Widget>[];-- if (_log.isNotEmpty && _phase != _Phase.probing) {- children.add(- _DialogButton(- label: 'Copy log',- onPressed: () => unawaited(- Clipboard.setData(- ClipboardData(text: _log.map((l) => l.text).join('\n')),- ),- ),- ),- );- }- children.add(const Spacer());-- switch (_phase) {- case _Phase.probing:- children.add(- _DialogButton(- label: 'Cancel',- onPressed: () => Navigator.pop(context),- ),- );- case _Phase.ready:- children- ..add(- _DialogButton(- label: 'Cancel',- kind: _ButtonKind.ghost,- onPressed: () => Navigator.pop(context),- ),- )- ..add(const SizedBox(width: 8))- ..add(- _DialogButton(- key: const Key('flash-start-button'),- label: 'Flash',- kind: _ButtonKind.primary,- // The script asks for confirmation on a terminal it does not- // have here, so it runs with --yes. THIS is the confirmation.- onPressed: _port == null && _ports.length > 1- ? null- : () => unawaited(_flash()),- ),- );- case _Phase.noBoard:- children- ..add(- _DialogButton(- label: 'Close',- kind: _ButtonKind.ghost,- onPressed: () => Navigator.pop(context),- ),- )- ..add(const SizedBox(width: 8))- ..add(- _DialogButton(- label: 'Look again',- kind: _ButtonKind.primary,- onPressed: () => unawaited(_probe()),- ),- );- case _Phase.flashing:- children.add(- _DialogButton(- key: const Key('flash-stop-button'),- label: 'Stop',- kind: _ButtonKind.ghost,- onPressed: widget.flasher.cancel,- ),- );- case _Phase.done:- children.add(- _DialogButton(- label: 'Done',- kind: _ButtonKind.primary,- onPressed: () => Navigator.pop(context),- ),- );- case _Phase.failed:- children- ..add(- _DialogButton(- label: 'Close',- kind: _ButtonKind.ghost,- onPressed: () => Navigator.pop(context),- ),- )- ..add(const SizedBox(width: 8))- ..add(- _DialogButton(- label: 'Try again',- kind: _ButtonKind.primary,- onPressed: () => unawaited(_flash()),- ),- );- }-- return Container(- margin: const EdgeInsets.only(top: 14),- padding: const EdgeInsets.fromLTRB(18, 12, 18, 12),- decoration: BoxDecoration(- border: Border(top: BorderSide(color: grid.AppGlass.hair)),- ),- child: Row(children: children),- );- }-- String _formatElapsed() {- final seconds = (_elapsed?.elapsed.inSeconds ?? 0);- final minutes = seconds ~/ 60;- return '$minutes:${(seconds % 60).toString().padLeft(2, '0')}';- }-}--enum _StepState { done, running, failed }--class _StepRow extends StatelessWidget {- const _StepRow({required this.label, required this.state});-- final String label;- final _StepState state;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final (Widget mark, Color ink) = switch (state) {- _StepState.done => (- Icon(- LucideIcons.circleCheck300,- size: 14,- color: grid.AppPalette.online,- ),- grid.AppPalette.textSecondary,- ),- _StepState.running => (- SizedBox(- width: 13,- height: 13,- child: CircularProgressIndicator(- strokeWidth: 2,- color: grid.AppPalette.accentOnSurface,- ),- ),- grid.AppPalette.textPrimary,- ),- _StepState.failed => (- Icon(- LucideIcons.triangleAlert300,- size: 14,- color: grid.AppPalette.dangerFill,- ),- grid.AppPalette.textPrimary,- ),- };-- return Padding(- padding: const EdgeInsets.symmetric(vertical: 3),- child: Row(- children: [- SizedBox(width: 16, child: Center(child: mark)),- const SizedBox(width: 9),- Expanded(- child: Text(- label,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(color: ink, fontSize: 12.5),- ),- ),- ],- ),- );- }-}--enum _ButtonKind { quiet, ghost, primary }--class _DialogButton extends StatelessWidget {- const _DialogButton({- super.key,- required this.label,- required this.onPressed,- this.kind = _ButtonKind.quiet,- });-- final String label;- final VoidCallback? onPressed;- final _ButtonKind kind;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final primary = kind == _ButtonKind.primary;- return TextButton(- onPressed: onPressed,- style: TextButton.styleFrom(- minimumSize: const Size(0, 28),- padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 5),- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- visualDensity: VisualDensity.standard,- backgroundColor: primary- ? grid.AppPalette.accentOnSurface- : Colors.transparent,- foregroundColor: primary- ? grid.AppPalette.windowBg- : grid.AppPalette.textSecondary,- disabledForegroundColor: grid.AppPalette.textFaint,- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(7),- side: kind == _ButtonKind.ghost- ? BorderSide(color: grid.AppGlass.hair)- : BorderSide.none,- ),- textStyle: TextStyle(- fontSize: 12,- fontWeight: primary ? grid.AppFont.semibold : grid.AppFont.regular,- ),- ),- child: Text(label),- );- }-}--/// One selectable serial port, when more than one board is plugged in.-class _PortChoice extends StatelessWidget {- const _PortChoice({- required this.port,- required this.selected,- required this.onTap,- });-- final String port;- final bool selected;- final VoidCallback onTap;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final accent = grid.AppPalette.accentOnSurface;- return InkWell(- onTap: onTap,- borderRadius: BorderRadius.circular(7),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),- child: Row(- children: [- Container(- width: 13,- height: 13,- decoration: BoxDecoration(- shape: BoxShape.circle,- border: Border.all(- color: selected ? accent : grid.AppPalette.textFaint,- width: 1.5,- ),- ),- alignment: Alignment.center,- child: selected- ? Container(- width: 6,- height: 6,- decoration: BoxDecoration(- shape: BoxShape.circle,- color: accent,- ),- )- : null,- ),- const SizedBox(width: 9),- Text(- port,- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 12,- fontFamily: grid.AppFont.mono,- fontFamilyFallback: grid.AppFont.monoFallback,- ),- ),- ],- ),- ),- );- }-}diff --git a/mobile/lib/widgets/layout_palette.dart b/mobile/lib/widgets/layout_palette.dartdeleted file mode 100644index 8dfff1d58..000000000--- a/mobile/lib/widgets/layout_palette.dart+++ /dev/null@@ -1,545 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';-import '../state/app_state.dart';-import '../shortcuts/app_keymap.dart';-import '../shortcuts/keymap.dart';-import '../state/pane_preset.dart';-import '../theme/app_theme.dart';--/// ⌘S — pick the shape of the grid.-///-/// Shapes are DRAWN, not listed. "Two over one" and "one over two" are the same-/// four words in a different order, and nobody reads a layout name twice; the-/// little diagram is the whole interface and the label only confirms it.-///-/// Every card describes a distinct concrete arrangement. Automatic defaults-/// resolve to the matching card, instead of adding a duplicate picture.-/// Set while the palette is up, so a second ⌘S can be answered rather than-/// stacking a route.-///-/// It used to be a bool and a bare return. That stopped the palette fading the-/// window to black under a held key — each press laid another dialog and another-/// 30% barrier over the last — but it left ⌘S meaning "open" once and nothing-/// ever after, which is the one thing a person holding a key does not expect.-///-/// THE SAME KEY WALKS THE STRIP. ⌘S opens it, ⌘S again steps to the next shape,-/// Enter takes it. That is how every cycling chord on this OS behaves, and it-/// means the shape can be chosen without the hand leaving the chord it arrived-/// on.-bool Function()? _layoutPaletteAdvance;--/// Advance the visible palette without opening another route behind a dialog.-bool advanceLayoutPalette() => _layoutPaletteAdvance?.call() ?? false;--Future<void> showLayoutPalette(BuildContext context, AppNotifier notifier) {- if (advanceLayoutPalette()) {- return Future<void>.value();- }- return showAppDialog<void>(- context: context,- builder: (context) => _LayoutPalette(notifier: notifier),- ).whenComplete(() => _layoutPaletteAdvance = null);-}--/// The strip's geometry, in one place.-///-/// Both the [Wrap] that draws the shapes and the keys that walk them read these.-/// They used to be literals in the build method alone, which is why the arrow-/// keys could not tell a row from a column: nothing outside the layout knew how-/// many shapes fitted on a line.-/// Where [at] lands after one press, on a strip [n] long.-///-/// BOTH AXES WRAP. The strip is short and every shape is on screen, so running-/// off one end and appearing at the other cannot be mistaken for a jump to-/// somewhere unseen — and a key that dies at the edge is one people stop-/// trusting, which is the same argument the window's own pane ring rests on.-///-/// Vertical keeps the COLUMN: down from the second shape lands under it, not-/// at the start of the next line. A last row shorter than the others clamps,-/// because there is no shape under that column to land on.-int layoutPaletteMove(int at, int n, int dx, int dy, int perRow) {- if (n <= 1) return 0;- if (dx != 0) return (at + dx + n) % n;- final rows = (n / perRow).ceil();- if (rows <= 1) return at; // one line has no up and no down- final col = at % perRow;- final row = at ~/ perRow;- final target = ((row + dy + rows) % rows) * perRow + col;- return target >= n ? n - 1 : target;-}--class _Strip {- /// Wide enough that a diagram stays readable — see the note on the Wrap.- static const shape = 108.0;- static const diagram = 86.0;- static const gap = 10.0;- static const sidePadding = 14.0;-- /// The dialog's own width, which changes with how many shapes there are.- static double width(int choices) {- final columns = choices > 4 ? 3 : choices.clamp(1, 4);- return sidePadding * 2 + shape * columns + gap * (columns - 1);- }-- /// How many shapes sit on one line. The same arithmetic Wrap does.- static int perRow(int choices, double width, double shape) {- final room = width - sidePadding * 2;- final fits = ((room + gap) / (shape + gap)).floor();- return fits.clamp(1, choices < 1 ? 1 : choices);- }-}--class _LayoutPalette extends StatefulWidget {- const _LayoutPalette({required this.notifier});-- final AppNotifier notifier;-- @override- State<_LayoutPalette> createState() => _LayoutPaletteState();-}--class _LayoutPaletteState extends State<_LayoutPalette> {- /// An EXPLICIT node, requested after the first frame.- ///- /// `autofocus: true` alone was not enough: it only takes the focus when the- /// enclosing scope has none to give, and by the time this is laid out the- /// route that opened it has already settled focus somewhere. The symptom was- /// precise — ⌘S opened the palette and cycled it, because that chord is a- /// global binding, while the arrow keys did nothing at all, because those are- /// read HERE and nothing here was listening.- final FocusNode _keys = FocusNode(debugLabel: 'layout-palette');- final _shapeKeys = List.generate(6, (_) => GlobalKey());- int _perRow = 1;- bool _revealPending = false;-- @override- void initState() {- super.initState();- WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted) _keys.requestFocus();- });- // Registered here rather than by the opener, so the hook cannot outlive the- // widget it steps: a stale callback would move a cursor on a palette that- // is no longer on screen, and the next ⌘S would find the strip already- // walked.- _layoutPaletteAdvance = _advance;- }-- @override- void dispose() {- if (_layoutPaletteAdvance == _advance) _layoutPaletteAdvance = null;- _keys.dispose();- super.dispose();- }-- /// Advance one choice with the configured Layout key, without applying it.- bool _advance() {- if (!mounted || ModalRoute.isCurrentOf(context) == false) return false;- final count = widget.notifier.panes.length;- final choices = PanePreset.forCount(count);- if (choices.isEmpty) return true;- // presetFor is keyed on the PANE COUNT, not on how many shapes that count- // offers — the two are different numbers and only one of them is a key.- final at = _cursorIn(choices, _currentChoice(count));- _select((at + 1) % choices.length);- return true;- }-- /// Which shape the arrow keys are resting on, which is NOT the same as the- /// one in use: moving the cursor must not rearrange the grid under someone- /// still looking at the choices. Applying is Enter, a digit, or a click.- int? _cursor;-- void _select(int index) {- if (_cursor == index) return;- setState(() => _cursor = index);- if (_revealPending) return;- _revealPending = true;- WidgetsBinding.instance.addPostFrameCallback((_) {- _revealPending = false;- if (!mounted || ModalRoute.isCurrentOf(context) == false) return;- final target = _shapeKeys[_cursor!].currentContext;- if (target != null) {- Scrollable.ensureVisible(- target,- alignmentPolicy: ScrollPositionAlignmentPolicy.keepVisibleAtEnd,- );- }- });- }-- /// Where the cursor is, read from state rather than from a captured local.- ///- /// Two keys can land inside one frame — an arrow and the Enter that takes it- /// — and a value closed over at build time would still hold the position- /// BEFORE the arrow moved, so the palette would apply the shape the cursor- /// had just left. Reading it here means the answer is always current.- ///- /// It starts on the shape already in use, so the first arrow press steps off- /// that one rather than jumping to the top of the list.- int _cursorIn(List<PanePreset> choices, PanePreset? current) {- if (choices.isEmpty) return 0;- final start = _cursor ?? choices.indexOf(current ?? choices.first);- return start.clamp(0, choices.length - 1);- }-- PanePreset? _currentChoice(int count) {- final notifier = widget.notifier;- final preset = notifier.presetFor(count);- if (preset == null || PanePreset.forCount(count).contains(preset)) {- return preset;- }- final actual = notifier.activeSwarm.arranged?.tiles;- if (actual != null && actual.length == count) {- return PanePreset.matchingChoice(count, actual);- }- final viewport = MediaQuery.sizeOf(context);- final resolved =- preset == PanePreset.splitLong && viewport.height > viewport.width- ? PanePreset.rows- : preset;- return PanePreset.matchingChoice(- count,- resolved.tilesFor(count, columns: notifier.gridColumns),- );- }-- @override- Widget build(BuildContext context) {- final notifier = widget.notifier;- grid.AppTheme.watch(context);- final count = notifier.panes.length;- final choices = PanePreset.forCount(count);- final current = _currentChoice(count);- final cursor = _cursorIn(choices, current);- final textScale = MediaQuery.textScalerOf(context).scale(11.5) / 11.5;- final shapeWidth = (_Strip.shape * textScale).clamp(_Strip.shape, 216.0);- final paletteWidth =- _Strip.width(choices.length) * textScale.clamp(1.0, 2.0);-- return KeymapRegion(- contextKind: KeymapContext.workspace,- actions: {- 'pane.layout': () {- _advance();- },- },- child: Dialog(- backgroundColor: grid.AppGlass.surfaceFill,- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(13),- side: BorderSide(color: grid.AppGlass.hair),- ),- child: Focus(- focusNode: _keys,- autofocus: true,- onKeyEvent: (node, event) {- // Repeats count: holding an arrow should walk the list, the way it- // does in every other list on this OS.- if (event is! KeyDownEvent && event is! KeyRepeatEvent) {- return KeyEventResult.ignored;- }- // The keymap handles configured chords before this local handler.- // Modified digits/arrows must not fall through as a plain selection.- final keyboard = HardwareKeyboard.instance;- if (keyboard.isMetaPressed ||- keyboard.isControlPressed ||- keyboard.isAltPressed ||- keyboard.isShiftPressed) {- return KeyEventResult.ignored;- }- if (choices.isEmpty) return KeyEventResult.ignored;-- void apply(PanePreset preset) {- notifier.setPreset(count, preset);- Navigator.of(context).pop();- }-- final at = _cursorIn(choices, current);- final direction = _direction(event.logicalKey);- if (direction != null) {- _select(- layoutPaletteMove(- at,- choices.length,- direction.$1,- direction.$2,- _perRow,- ),- );- return KeyEventResult.handled;- }- if (_isCommit(event.logicalKey)) {- apply(choices[at]);- return KeyEventResult.handled;- }- final index = _digit(event.logicalKey);- if (index == null || index > choices.length) {- return KeyEventResult.ignored;- }- apply(choices[index - 1]);- return KeyEventResult.handled;- },- child: ConstrainedBox(- // Wide enough that four shapes still get a diagram big enough to read- // and a label that is not ellipsised into a guess.- constraints: BoxConstraints(maxWidth: paletteWidth),- child: LayoutBuilder(- builder: (context, constraints) {- // Read the same available width the Wrap uses, including text- // scaling and a window narrower than the preferred palette.- _perRow = _Strip.perRow(- choices.length,- constraints.maxWidth,- shapeWidth,- );- return SingleChildScrollView(- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(18, 16, 18, 12),- child: Text(- choices.isEmpty ? 'Layout' : 'Layout · $count panes',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11.5,- letterSpacing: 0.9,- fontWeight: grid.AppFont.medium,- ),- ),- ),- if (choices.isEmpty)- Padding(- padding: const EdgeInsets.fromLTRB(18, 0, 18, 20),- child: Text(- 'One tile has no layout to choose. Open another and the '- 'shapes appear here.',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 12.5,- height: 1.45,- ),- ),- )- else ...[- Padding(- padding: const EdgeInsets.fromLTRB(- _Strip.sidePadding,- 0,- _Strip.sidePadding,- 6,- ),- // Wrapped, not a Row: a big grid offers five column counts,- // and five diagrams squeezed across one line are five things- // nobody can tell apart. 108px keeps a shape readable.- child: Wrap(- spacing: _Strip.gap,- runSpacing: _Strip.gap,- children: [- for (var i = 0; i < choices.length; i++)- SizedBox(- key: _shapeKeys[i],- width: shapeWidth,- child: _ShapeButton(- preset: choices[i],- count: count,- index: i + 1,- selected: choices[i] == current,- cursor: i == cursor,- onTap: () {- notifier.setPreset(count, choices[i]);- Navigator.of(context).pop();- },- ),- ),- ],- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(18, 6, 18, 14),- child: Text(- 'Arrows to move · Enter or 1–${choices.length} to apply.\n'- 'Changing layout resets pane sizes.',- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11,- height: 1.4,- ),- ),- ),- ],- ],- ),- );- },- ),- ),- ),- ),- );- }-- /// Which way an arrow moves the cursor.- /// Which way a key points, as (dx, dy).- ///- /// hjkl beside the arrows, unmodified, for the reason the window binds both: a- /// hand that reaches for one and a hand that reaches for the other are two- /// hands on the same keyboard. Bare letters are safe HERE and nowhere else in- /// this app — a dialog is not a pty, and no shell is waiting behind it.- ///- /// UP AND DOWN ARE VERTICAL. They used to be a second spelling of left and- /// right — every key stepped the list by one — on the reasoning that a- /// vertical key would do nothing on a single-row palette. What that actually- /// produced was `j` walking sideways, which is worse than a key that waits:- /// the motion did not match the arrow on the cap.- static (int, int)? _direction(LogicalKeyboardKey key) => switch (key) {- LogicalKeyboardKey.arrowLeft || LogicalKeyboardKey.keyH => (-1, 0),- LogicalKeyboardKey.arrowRight || LogicalKeyboardKey.keyL => (1, 0),- LogicalKeyboardKey.arrowUp || LogicalKeyboardKey.keyK => (0, -1),- LogicalKeyboardKey.arrowDown || LogicalKeyboardKey.keyJ => (0, 1),- _ => null,- };-- static bool _isCommit(LogicalKeyboardKey key) =>- key == LogicalKeyboardKey.enter ||- key == LogicalKeyboardKey.numpadEnter ||- key == LogicalKeyboardKey.space;-- static int? _digit(LogicalKeyboardKey key) {- const digits = [- LogicalKeyboardKey.digit1,- LogicalKeyboardKey.digit2,- LogicalKeyboardKey.digit3,- LogicalKeyboardKey.digit4,- LogicalKeyboardKey.digit5,- LogicalKeyboardKey.digit6,- ];- final index = digits.indexOf(key);- return index < 0 ? null : index + 1;- }-}--class _ShapeButton extends StatelessWidget {- const _ShapeButton({- required this.preset,- required this.count,- required this.index,- required this.selected,- required this.cursor,- required this.onTap,- });-- final PanePreset preset;- final int count;- final int index;-- /// The shape the grid is in now.- final bool selected;-- /// Where the arrow keys are resting. Drawn as a ring rather than as the- /// selected fill, so "what I am about to pick" never looks like "what is- /// already in use" — the two are different answers and both are on screen.- final bool cursor;- final VoidCallback onTap;-- @override- Widget build(BuildContext context) {- return GestureDetector(- onTap: onTap,- child: Container(- padding: const EdgeInsets.fromLTRB(10, 10, 10, 8),- decoration: BoxDecoration(- color: selected- ? grid.AppSurface.accentWash- : grid.AppSurface.hoverFill,- borderRadius: BorderRadius.circular(10),- border: Border.all(- color: selected ? AppColors.accent : grid.AppGlass.hair,- ),- ),- // Paint focus over the fixed border so moving the highlight does not- // change the diagram's bounds or the height of the wrapped row.- foregroundDecoration: cursor- ? BoxDecoration(- borderRadius: BorderRadius.circular(10),- border: Border.all(color: AppColors.accent, width: 2),- )- : null,- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- SizedBox(- width: _Strip.diagram,- height: _Strip.diagram * 3 / 4,- child: CustomPaint(painter: _ShapePainter(preset, count)),- ),- const SizedBox(height: 8),- Text(- preset.label,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: selected- ? grid.AppPalette.textPrimary- : grid.AppPalette.textSecondary,- fontSize: 11.5,- ),- ),- const SizedBox(height: 2),- Text(- '$index',- style: TextStyle(- fontFamily: grid.AppFont.mono,- fontSize: 9.5,- color: grid.AppPalette.textSecondary,- ),- ),- ],- ),- ),- );- }-}--/// The diagram: [PanePreset.tiles], drawn.-///-/// It paints the shape's own description rather than a picture of it, and-/// `pane_preset_test` measures the real grid against the same list — so an-/// illustration that lies about the layout fails a test instead of misleading-/// someone into picking the wrong shape.-class _ShapePainter extends CustomPainter {- const _ShapePainter(this.preset, this.count);-- final PanePreset preset;- final int count;-- @override- void paint(Canvas canvas, Size size) {- final fill = Paint()..color = AppColors.accent.withValues(alpha: 0.55);- for (final unit in preset.tilesFor(count)) {- // Dense layouts must still draw every pane. A fixed 3px inset erased- // short rows entirely once the diagram contained more than 21 rows.- final gapX = (unit.width * size.width * .12).clamp(0.0, 1.5);- final gapY = (unit.height * size.height * .12).clamp(0.0, 1.5);- final rect = Rect.fromLTRB(- unit.left * size.width + gapX,- unit.top * size.height + gapY,- unit.right * size.width - gapX,- unit.bottom * size.height - gapY,- );- canvas.drawRRect(- RRect.fromRectAndRadius(rect, const Radius.circular(2)),- fill,- );- }- }-- @override- bool shouldRepaint(_ShapePainter old) =>- old.preset != preset || old.count != count;-}diff --git a/mobile/lib/widgets/login_relay_diagram.dart b/mobile/lib/widgets/login_relay_diagram.dartdeleted file mode 100644index 70cb9abda..000000000--- a/mobile/lib/widgets/login_relay_diagram.dart+++ /dev/null@@ -1,718 +0,0 @@-import 'dart:math' as math;--import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;--/// The sign-in screen's one picture: three machines you own, feeding one-/// window, through a middle that cannot read what it carries.-///-/// **The animation is the explanation, not decoration.** A packet leaves a-/// machine as a bare grey dot — plaintext, on hardware you control — and-/// crosses the hub, where it *becomes* a glowing sealed block and keeps that-/// halo for the rest of the trip. Nothing else in the frame moves on its own:-/// every motion here is a consequence of a packet, which is why the eye is-/// never pulled toward a part of the diagram that has nothing to say. An-/// earlier pass had a rotating rim light on the hub and a sheen sweeping the-/// whole window; both were cut for exactly that reason — they animated a thing-/// that wasn't doing anything, and the sweep reacted across four panes when-/// only one had received anything.-///-/// One clock drives all of it ([_period]), with each lane offset by-/// [_laneStagger]. That is what makes six moving parts read as one instrument-/// rather than six effects arguing; it is also why the aurora's period is an-/// exact multiple of the packet period, so the two never drift into a beat-/// against each other.-class LoginRelayDiagram extends StatefulWidget {- const LoginRelayDiagram({super.key});-- /// The drawing's own aspect, so the caller can size it without guessing.- static const double aspectRatio = 440 / 140;-- @override- State<LoginRelayDiagram> createState() => _LoginRelayDiagramState();-}--/// The shared heartbeat. Every lane, halo and pane flash is a phase of this.-const Duration _period = Duration(milliseconds: 3200);--/// How far apart the three lanes fire: one third of the cycle each, so the-/// three packets are spread evenly around it rather than travelling as a clump.-///-/// **This is not a taste setting.** At the 0.075 it started on, the lanes were-/// so close together that all three were almost always in the same state, and-/// the arithmetic is unforgiving: half of every cycle had NO sealed packet on-/// screen at all, and only 4% of frames showed a grey dot and a glowing block-/// at the same time. The seal is the one beat the whole drawing exists to make,-/// and someone opening the app landed on a frame without it every other time.-///-/// At a third, no frame is ever without a sealed packet, and 76% of them carry-/// both states at once — which is what actually explains the mechanism: plain-/// on one lane, sealed on another, side by side.-const double _laneStagger = 1 / 3;--class _LoginRelayDiagramState extends State<LoginRelayDiagram>- with SingleTickerProviderStateMixin {- late final AnimationController _clock = AnimationController(- vsync: this,- duration: _period,- );-- @override- void didChangeDependencies() {- super.didChangeDependencies();- // Same contract as `Pulse`: Reduce Motion parks the clock rather than- // slowing it. The value it parks at is deliberate — see [_reducedPhase].- //- // `TickerMode` is checked for a second reason, and it is load-bearing: the- // loop below runs forever, and an endless animation makes `pumpAndSettle`- // hang for every test that walks through sign-in. The widget test- // framework disables tickers exactly so that cannot wedge a suite, so- // honouring it is what lets this screen loop for a real user while staying- // testable. It is also what stops the clock behind a pushed route.- final stilled =- MediaQuery.disableAnimationsOf(context) ||- !TickerMode.valuesOf(context).enabled;- if (stilled) {- _clock- ..stop()- ..value = _reducedPhase;- } else if (!_clock.isAnimating) {- _clock.repeat();- }- }-- /// Where the frame stops for someone who asked for less motion.- ///- /// Mid-crossing, *after* the seal: the still frame still shows a grey dot on- /// one lane and a glowing block on another, so the picture keeps making its- /// point instead of becoming a diagram of nothing happening. Freezing at 0- /// would hide the packets entirely, which is the one thing this drawing- /// exists to show.- ///- /// The value is tied to [_laneStagger] and has to be rechecked with it: at a- /// third-of-a-cycle stagger this frame reads SEALED / RAW / just-landed- /// across the three lanes, which is the whole story in one picture. Push it- /// to 0.60 and the second lane is mid-seal rather than plain, so the contrast- /// the frame is chosen for goes away.- static const double _reducedPhase = 0.52;-- @override- void dispose() {- _clock.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- // Colours are resolved HERE, in build, not inside the painter: the painter- // is handed plain values so it never reads a theme-dependent getter from a- // paint callback, which runs outside the element that depends on the theme.- final palette = _DiagramPalette(- // `guide`, not `divider`, and the token file draws the line itself: a- // divider only has to be findable at a seam the eye is already looking- // at, while a guide is a long thin run the eye has to FOLLOW — which is- // exactly what these lanes are. It also lands at the same weight in both- // themes (1.45 light / 1.48 dark, measured with tool/contrast.py), where- // divider is a step fainter in light (1.14) than dark (1.25) and left- // the whole diagram looking washed out on the white palette.- wire: grid.AppPalette.guide,- nodeFill: grid.AppCard.inset,- hubFill: grid.AppSurface.accentWash,- accent: grid.AppPalette.accentOnSurface,- raw: grid.AppPalette.textFaint,- ink: grid.AppPalette.textSecondary,- // ⚠️ NOT `textFaint`. This colour carries "we can't read this" — the- // privacy claim the whole drawing exists to make — and faint measured- // 3.33:1 light / 3.18:1 dark against the hub, under the 4.5:1 WCAG 1.4.3- // asks of body text. `textSecondary` puts it at 6.21 / 6.82. A sentence- // this load-bearing does not get to be decorative grey.- faint: grid.AppPalette.textSecondary,- online: grid.AppPalette.online,- isDark: grid.AppTheme.isDark,- );- final labels = _DiagramLabels(- nodes: const ['MacBook', 'Server', 'Cloud'],- // Said the way anyone reads it. The cipher names that used to sit on this- // screen (Ed25519, ChaCha20-Poly1305) were true and unreadable to almost- // everyone who saw them; they belong on a security page.- //- // "we" is doing real work here and is worth keeping. The headline- // promises the READER sees everything; this line is about a different- // subject entirely — us — and without the pronoun the two collapse into- // one confused claim about who can read what. The card's subhead used to- // repeat this as "cannot open it" and was cut for that reason: the- // sentence belongs on the middle of the diagram, pointing at the thing it- // is about, not four lines below it in prose.- //- // Kept short on purpose: at 9.5px this lands ~80px against a 115px budget- // inside the hub, and the longer "we can't read any of it" spends all but- // 12px of that — one wider user-chosen font and it ellipsises. A claim- // that truncates is worse than a shorter claim.- hub: "we can't read this",- );-- return RepaintBoundary(- child: AspectRatio(- aspectRatio: LoginRelayDiagram.aspectRatio,- child: AnimatedBuilder(- animation: _clock,- builder: (context, _) => CustomPaint(- painter: _RelayPainter(- t: _clock.value,- palette: palette,- labels: labels,- ),- size: Size.infinite,- ),- ),- ),- );- }-}--/// Every colour the painter needs, already resolved for the current theme.-class _DiagramPalette {- const _DiagramPalette({- required this.wire,- required this.nodeFill,- required this.hubFill,- required this.accent,- required this.raw,- required this.ink,- required this.faint,- required this.online,- required this.isDark,- });-- final Color wire;- final Color nodeFill;- final Color hubFill;- final Color accent;- final Color raw;- final Color ink;- final Color faint;- final Color online;-- /// Glow has to be tuned per theme rather than scaled from one value: on a- /// white page it can only ever be a tint before it turns to haze, while on- /// charcoal it has room to actually emit. One alpha for both either vanishes- /// in light or blooms in dark.- ///- /// The light numbers were raised after measuring rather than after looking:- /// at the first pass's 0.22/0.55 the halo landed at 1.38:1 and 2.38:1 against- /// the card, where dark had 2.01 and 4.56 — so the beat the whole diagram is- /// built around was ~45% fainter on the white palette and read as a flat blue- /// square. 0.44 now matches dark's ring almost exactly (1.97 vs 2.01).- ///- /// The core deliberately does NOT match: 0.78 gives 3.65 against dark's 4.56,- /// and closing that gap means a nearly opaque accent disc, which stops- /// reading as light and starts reading as a sticker. White has less headroom- /// for glow than charcoal does, and pretending otherwise is how a "matched"- /// pair ends up looking wrong in one theme.- double get haloAlpha => isDark ? 0.42 : 0.44;- double get haloCoreAlpha => isDark ? 0.9 : 0.78;- double get flowAlpha => isDark ? 0.95 : 0.85;-- final bool isDark;-}--class _DiagramLabels {- const _DiagramLabels({required this.nodes, required this.hub});- final List<String> nodes;- final String hub;-}--/// The drawing, in its own 440×140 space; the canvas is scaled to fit so every-/// number below is the one from the layout rather than a fraction to re-derive.-class _RelayPainter extends CustomPainter {- _RelayPainter({required this.t, required this.palette, required this.labels});-- final double t;- final _DiagramPalette palette;- final _DiagramLabels labels;-- static const Size _design = Size(440, 140);-- // Node boxes, hub, and the three lanes between them.- static const Rect _hub = Rect.fromLTWH(258, 34, 158, 72);- static const List<Rect> _nodes = [- Rect.fromLTWH(24, 20, 94, 28),- Rect.fromLTWH(24, 56, 94, 28),- Rect.fromLTWH(24, 92, 94, 28),- ];- static const List<Rect> _panes = [- Rect.fromLTWH(270, 46, 64, 14),- Rect.fromLTWH(340, 46, 64, 14),- Rect.fromLTWH(270, 64, 64, 14),- Rect.fromLTWH(340, 64, 64, 14),- ];-- @override- void paint(Canvas canvas, Size size) {- final scale = size.width / _design.width;- canvas.save();- canvas.scale(scale);-- final lanes = _lanes();- _paintWires(canvas, lanes);- _paintHub(canvas);- _paintNodes(canvas);- _paintPackets(canvas, lanes);-- canvas.restore();- }-- /// The three curves, built once per paint and reused for the wire, the- /// travelling energy and the packet's position — so all three cannot drift- /// apart the way three hand-typed copies of the same path would.- List<Path> _lanes() {- Path lane(double fromY) {- final p = Path()..moveTo(118, fromY);- if (fromY == 70) {- p.lineTo(258, 70);- } else {- p.cubicTo(180, fromY, 200, 70, 258, 70);- }- return p;- }-- return [lane(34), lane(70), lane(106)];- }-- void _paintWires(Canvas canvas, List<Path> lanes) {- final wire = Paint()- ..style = PaintingStyle.stroke- ..strokeWidth = 1.5- ..color = palette.wire;- for (final lane in lanes) {- canvas.drawPath(lane, wire);- }-- // Energy running the wire, gated to its own packet so a lane is only lit- // while something is actually on it.- for (var i = 0; i < lanes.length; i++) {- final phase = _phaseFor(i);- final visible = _flowOpacity(phase);- if (visible <= 0) continue;-- final metric = lanes[i].computeMetrics().first;- final head = (phase / _travelEnd).clamp(0.0, 1.0) * metric.length;- final tail = math.max(0.0, head - 34);- if (head - tail < 0.5) continue;-- final segment = metric.extractPath(tail, head);- canvas.drawPath(- segment,- Paint()- ..style = PaintingStyle.stroke- ..strokeWidth = 2.2- ..strokeCap = StrokeCap.round- ..shader = _gradientAlong(- metric.getTangentForOffset(tail)!.position,- metric.getTangentForOffset(head)!.position,- palette.accent,- palette.flowAlpha * visible,- ),- );- }- }-- void _paintHub(Canvas canvas) {- canvas.drawRRect(- RRect.fromRectAndRadius(_hub, const Radius.circular(10)),- Paint()..color = palette.hubFill,- );-- // Four panes — the four terminals the app really runs at once. Each lights- // when its own packet lands, then settles back; nothing else here moves.- for (var i = 0; i < _panes.length; i++) {- final phase = _phaseFor(i);- final alpha = _paneAlpha(phase);- canvas.drawRRect(- RRect.fromRectAndRadius(_panes[i], const Radius.circular(4)),- Paint()..color = palette.accent.withValues(alpha: alpha),- );- }-- // The eye and its caption are laid out as ONE centred group inside the hub- // rather than at two hand-typed coordinates. Typed positions were wrong- // twice — first printing the caption left of the hub across the incoming- // wires, then running it off the right edge with the eye sitting on top of- // it — because the caption's width is not a number anyone can guess: it- // changes with the copy, the theme's font and the user's chosen family.- // Measuring it and centring the pair is the only version that cannot drift.- const eyeWidth = 17.0;- const gap = 6.0;- const padding = 10.0;- // Bounded by the hub it sits in, not by trust that the string is short:- // this label is the one piece of prose in the drawing, and prose grows —- // a longer translation, a wider chosen font, a bigger UI size. Giving the- // painter a hard ceiling means the worst case is an ellipsis inside the- // box rather than a sentence printed across the wires outside it.- final caption = _layOutText(- labels.hub,- fontSize: 9.5,- color: palette.faint,- maxWidth: _hub.width - eyeWidth - gap - padding * 2,- );- final groupWidth = eyeWidth + gap + caption.width;- final left = _hub.center.dx - groupWidth / 2;- const centreY = 92.0;-- _paintBlindfold(canvas, Offset(left, centreY));- caption.paint(- canvas,- Offset(left + eyeWidth + gap, centreY - caption.height / 2),- );- }-- /// A struck-through eye: the one mark that says "cannot look" without asking- /// the reader to know a word like *relay* or *zero-knowledge*.- ///- /// Drawn from [at], its left edge at that point's x and its centre on its y,- /// so the caller can place it in a row with the caption beside it.- void _paintBlindfold(Canvas canvas, Offset at) {- final stroke = Paint()- ..style = PaintingStyle.stroke- // Thinner as well as smaller: at 1.6 the strike-through read as heavy as- // the hub's own panes, which made a supporting mark compete with the- // thing it annotates.- ..strokeWidth = 1.25- ..strokeCap = StrokeCap.round- ..strokeJoin = StrokeJoin.round- ..color = palette.accent;-- final x = at.dx;- final y = at.dy;- final eye = Path()- ..moveTo(x, y)- ..relativeCubicTo(3, -3.7, 9.5, -3.7, 12.5, 0)- ..relativeCubicTo(-3, 3.7, -9.5, 3.7, -12.5, 0)- ..close();- canvas.drawPath(eye, stroke);- canvas.drawCircle(Offset(x + 6.25, y), 1.7, stroke);- canvas.drawLine(Offset(x - 2, y + 5), Offset(x + 14.5, y - 5), stroke);- }-- void _paintNodes(Canvas canvas) {- for (var i = 0; i < _nodes.length; i++) {- final r = _nodes[i];- canvas.drawRRect(- RRect.fromRectAndRadius(r, const Radius.circular(8)),- Paint()..color = palette.nodeFill,- );- // The "this machine is up" dot. It breathes on the shared clock and- // lands at full strength when the drawing comes to rest — a dot held at- // half alpha reads as *offline*, which is the opposite of what it means.- final breath = 0.5 + 0.5 * math.sin(t * 2 * math.pi);- canvas.drawCircle(- Offset(r.left + 14, r.center.dy),- 3,- Paint()..color = palette.online.withValues(alpha: 0.55 + 0.45 * breath),- );- _paintText(- canvas,- labels.nodes[i],- Offset(r.left + 26, r.center.dy),- fontSize: 10.5,- color: palette.ink,- );- }- }-- /// Where a packet is at phase 1.0 — it arrives before the cycle ends so the- /// pane it lit has time to settle before the next one leaves.- static const double _travelEnd = 0.72;-- /// The stretch of the crossing where a packet turns from plaintext into a- /// sealed block. Centred on the hub's left edge, so the change happens at- /// the boundary it is about.- static const double _sealStart = 0.26;- static const double _sealEnd = 0.38;-- void _paintPackets(Canvas canvas, List<Path> lanes) {- for (var i = 0; i < lanes.length; i++) {- final phase = _phaseFor(i);- if (phase <= 0 || phase >= 1) continue;-- final travel = (phase / _travelEnd).clamp(0.0, 1.0);- final metric = lanes[i].computeMetrics().first;- final pos = metric.getTangentForOffset(travel * metric.length)!.position;-- final sealed = ((phase - _sealStart) / (_sealEnd - _sealStart)).clamp(- 0.0,- 1.0,- );- final fade = _packetOpacity(phase);- if (fade <= 0) continue;-- // The halo: ignites at the seal, overshoots, then rides along. This is- // the beat the whole picture is built around — encryption drawn as a- // light source rather than written as a word.- if (sealed > 0) {- final overshoot = sealed < 1 ? 1 + 0.5 * math.sin(sealed * math.pi) : 1;- final r = 13.0 * overshoot;- canvas.drawCircle(- pos,- r,- Paint()- ..shader = RadialGradient(- colors: [- palette.accent.withValues(- alpha: palette.haloCoreAlpha * sealed * fade,- ),- palette.accent.withValues(- alpha: palette.haloAlpha * sealed * fade,- ),- palette.accent.withValues(alpha: 0),- ],- stops: const [0, 0.45, 1],- ).createShader(Rect.fromCircle(center: pos, radius: r)),- );- }-- if (sealed < 1) {- // Plaintext: a bare, unremarkable grey dot.- canvas.drawCircle(- pos,- 4,- Paint()..color = palette.raw.withValues(alpha: (1 - sealed) * fade),- );- }- if (sealed > 0) {- // Ciphertext: a hard-edged block, rotating into place as it forms.- canvas.save();- canvas.translate(pos.dx, pos.dy);- canvas.rotate((1 - sealed) * -math.pi / 4);- final s = 4.5 * (0.6 + 0.4 * sealed);- canvas.drawRRect(- RRect.fromRectAndRadius(- Rect.fromCenter(center: Offset.zero, width: s * 2, height: s * 2),- const Radius.circular(1.5),- ),- Paint()..color = palette.accent.withValues(alpha: sealed * fade),- );- canvas.restore();- }- }- }-- /// This lane's position in the cycle, wrapped into `[0, 1)`.- double _phaseFor(int lane) => (t - lane * _laneStagger) % 1.0;-- /// Packets fade in as they leave and out once they have landed, so nothing- /// pops at the seam of the loop.- double _packetOpacity(double phase) {- if (phase < 0.06) return phase / 0.06;- if (phase < _travelEnd) return 1;- if (phase < 0.88) return 1 - (phase - _travelEnd) / (0.88 - _travelEnd);- return 0;- }-- double _flowOpacity(double phase) {- if (phase < 0.04) return 0;- if (phase < 0.12) return (phase - 0.04) / 0.08;- if (phase < 0.66) return 1;- if (phase < 0.78) return 1 - (phase - 0.66) / 0.12;- return 0;- }-- /// A pane rests low, spikes as its packet lands, then settles a step above- /// where it started — the window keeps what it received.- double _paneAlpha(double phase) {- const rest = 0.16;- const peak = 0.72;- const settled = 0.30;- if (phase < 0.66) return rest;- if (phase < 0.74) {- return rest + (peak - rest) * ((phase - 0.66) / 0.08);- }- if (phase < 1) {- return peak + (settled - peak) * ((phase - 0.74) / 0.26);- }- return rest;- }-- /// Lay a label out once, so a caller can both measure and place it.- ///- /// Anything positioned relative to text has to know its width, and a width- /// guessed from a character count is wrong the moment the copy, the theme- /// font, or the user's chosen family changes.- TextPainter _layOutText(- String text, {- required double fontSize,- required Color color,- double? maxWidth,- }) {- return TextPainter(- text: TextSpan(- text: text,- style: TextStyle(- fontFamily: grid.AppFont.sans,- fontFamilyFallback: grid.AppFont.sansFallback,- fontSize: fontSize,- color: color,- letterSpacing: grid.AppFont.trackingFor(fontSize),- height: 1.0,- ),- ),- textDirection: TextDirection.ltr,- // The drawing is scaled as a unit, so text inside it must not also take- // the platform's scaler — that would grow the labels past the boxes they- // sit in while the boxes stayed put.- textScaler: TextScaler.noScaling,- maxLines: 1,- ellipsis: '…',- )..layout(maxWidth: maxWidth ?? double.infinity);- }-- void _paintText(- Canvas canvas,- String text,- Offset at, {- required double fontSize,- required Color color,- }) {- final painter = _layOutText(text, fontSize: fontSize, color: color);- painter.paint(canvas, Offset(at.dx, at.dy - painter.height / 2));- }-- @override- bool shouldRepaint(covariant _RelayPainter old) =>- old.t != t ||- old.palette.accent != palette.accent ||- old.palette.isDark != palette.isDark;-}--/// A left-to-right gradient between two points on the canvas, used to give the-/// travelling energy a lit head and a dark tail.-Shader _gradientAlong(Offset from, Offset to, Color color, double alpha) {- return LinearGradient(- colors: [- color.withValues(alpha: 0),- color.withValues(alpha: alpha),- ],- ).createShader(Rect.fromPoints(from, to));-}--/// The atmosphere behind the sign-in card: two very low-alpha blobs drifting-/// on a multiple of the diagram's own clock.-///-/// It is what makes the window read as *lit* rather than printed, and it is-/// the piece that carries the design into the corners of a 1280×800 window-/// that the card itself leaves empty. Alphas are tuned per theme for the same-/// reason the packet halo is: on a near-white panel this can only ever be a-/// tint before it turns to haze, while charcoal has room for it to glow.-///-/// The period is an exact multiple of [_period] so the two never drift into a-/// beat against each other — the whole screen stays one instrument.-class LoginAurora extends StatefulWidget {- const LoginAurora({super.key});-- @override- State<LoginAurora> createState() => _LoginAuroraState();-}--class _LoginAuroraState extends State<LoginAurora>- with SingleTickerProviderStateMixin {- late final AnimationController _drift = AnimationController(- vsync: this,- duration: _period * 4,- );-- @override- void didChangeDependencies() {- super.didChangeDependencies();- final stilled =- MediaQuery.disableAnimationsOf(context) ||- !TickerMode.valuesOf(context).enabled;- if (stilled) {- _drift- ..stop()- ..value = 0.5;- } else if (!_drift.isAnimating) {- _drift.repeat();- }- }-- @override- void dispose() {- _drift.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final dark = grid.AppTheme.isDark;- final a = grid.AppPalette.accentOnSurface.withValues(- alpha: dark ? 0.10 : 0.055,- );- final b = grid.AppPalette.teal.withValues(alpha: dark ? 0.07 : 0.045);-- return IgnorePointer(- child: RepaintBoundary(- child: AnimatedBuilder(- animation: _drift,- builder: (context, _) => CustomPaint(- painter: _AuroraPainter(t: _drift.value, a: a, b: b),- size: Size.infinite,- ),- ),- ),- );- }-}--class _AuroraPainter extends CustomPainter {- _AuroraPainter({required this.t, required this.a, required this.b});-- final double t;- final Color a;- final Color b;-- @override- void paint(Canvas canvas, Size size) {- // A full sine over the cycle, so the loop closes on itself with no jump.- final phase = math.sin(t * 2 * math.pi);- _blob(- canvas,- Offset(- size.width * (0.28 + 0.04 * phase),- size.height * (0.30 + 0.05 * phase),- ),- size.shortestSide * (0.62 + 0.05 * phase),- a,- );- _blob(- canvas,- Offset(- size.width * (0.74 - 0.04 * phase),- size.height * (0.72 - 0.05 * phase),- ),- size.shortestSide * (0.56 - 0.05 * phase),- b,- );- }-- /// A soft radial pool. Drawn as a gradient rather than a blurred circle:- /// `MaskFilter.blur` at this radius is a real per-frame cost on a surface- /// that covers the whole window, and a gradient gets the same falloff free.- void _blob(Canvas canvas, Offset centre, double radius, Color color) {- canvas.drawCircle(- centre,- radius,- Paint()- ..shader = RadialGradient(- colors: [color, color.withValues(alpha: 0)],- stops: const [0, 1],- ).createShader(Rect.fromCircle(center: centre, radius: radius)),- );- }-- @override- bool shouldRepaint(covariant _AuroraPainter old) =>- old.t != t || old.a != a || old.b != b;-}diff --git a/mobile/lib/widgets/shortcuts_sheet.dart b/mobile/lib/widgets/shortcuts_sheet.dartdeleted file mode 100644index 3ea5b1c1f..000000000--- a/mobile/lib/widgets/shortcuts_sheet.dart+++ /dev/null@@ -1,93 +0,0 @@-import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';-import '../shortcuts/shortcuts_list.dart';-import '../shortcuts/keymap.dart';-import '../shortcuts/keymap_settings.dart';--/// The ⌘/ sheet — [ShortcutsList] in a dialog.-///-/// The list itself is shared with Settings ▸ Keyboard shortcuts, so the two can-/// never disagree about what a key does.-Future<void> showShortcutsSheet(BuildContext context) {- return showAppDialog<void>(- context: context,- builder: (context) => const _ShortcutsSheet(),- );-}--class _ShortcutsSheet extends StatefulWidget {- const _ShortcutsSheet();-- @override- State<_ShortcutsSheet> createState() => _ShortcutsSheetState();-}--class _ShortcutsSheetState extends State<_ShortcutsSheet> {- KeymapContext _contextKind = KeymapContext.workspace;-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Dialog(- // No backgroundColor, no shape: `dialogTheme` supplies both, at- // AppGlass.surfaceFill and AppCard.radius (12). The rim this used to- // carry is gone with them — §1 allows exactly one border in the app and- // it belongs to the menu panel, not to a dialog.- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 420),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(18, 17, 18, 4),- child: Text(- 'Keyboard shortcuts',- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 15,- fontWeight: grid.AppFont.semibold,- ),- ),- ),- Flexible(- child: SingleChildScrollView(- padding: const EdgeInsets.fromLTRB(18, 8, 18, 16),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- KeymapSettings(- contextKind: _contextKind,- onContextChanged: (value) =>- setState(() => _contextKind = value),- ),- ShortcutsList(contextKind: _contextKind),- ],- ),- ),- ),- Container(- width: double.infinity,- padding: const EdgeInsets.fromLTRB(18, 12, 18, 12),- decoration: BoxDecoration(- border: Border(top: BorderSide(color: grid.AppGlass.hair)),- ),- child: Align(- alignment: Alignment.centerRight,- child: TextButton(- onPressed: () => Navigator.of(context).pop(),- style: TextButton.styleFrom(- foregroundColor: grid.AppPalette.textSecondary,- ),- child: const Text('Close'),- ),- ),- ),- ],- ),- ),- );- }-}diff --git a/mobile/lib/widgets/swarm_icon.dart b/mobile/lib/widgets/swarm_icon.dartdeleted file mode 100644index 9028036ec..000000000--- a/mobile/lib/widgets/swarm_icon.dart+++ /dev/null@@ -1,14 +0,0 @@-import 'package:flutter/cupertino.dart';--/// Four agents sharing one workspace. Native menus use the corresponding-/// `square.grid.2x2` symbol in SwarmTitlebar.swift.-class SwarmIcon extends StatelessWidget {- const SwarmIcon({super.key, this.size = 19, this.color});-- final double size;- final Color? color;-- @override- Widget build(BuildContext context) =>- Icon(CupertinoIcons.square_grid_2x2, size: size, color: color);-}diff --git a/mobile/lib/widgets/update_notice.dart b/mobile/lib/widgets/update_notice.dartdeleted file mode 100644index 85f9d49fc..000000000--- a/mobile/lib/widgets/update_notice.dart+++ /dev/null@@ -1,534 +0,0 @@-import 'dart:async';--import 'package:flutter/material.dart';-import 'package:lucide_icons_flutter/lucide_icons.dart';--import '../core/app_version.dart';-import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';-import '../shared/widgets/skeleton.dart';-import '../state/app_state.dart';-import '../update/desktop_updater.dart';-import '../update/manual_update_check.dart';--/// "18.4 MB" — a download the user is about to authorise, in the unit they-/// think in. Bytes are what the manifest carries; nobody reads 19293798.-String formatDownloadSize(int bytes) {- if (bytes <= 0) return '';- const mb = 1024 * 1024;- if (bytes >= mb) return '${(bytes / mb).toStringAsFixed(1)} MB';- return '${(bytes / 1024).round()} KB';-}--/// The band across the top of the app when a newer build is out.-///-/// It carries three states off one flag pair on [AppNotifier]: an offer, the-/// install running, and a failed install. The failure keeps the offer alive —-/// nothing was changed on disk, so the only honest thing to show is a way to-/// try again.-class UpdateNotice extends StatelessWidget {- final AppNotifier notifier;-- const UpdateNotice({super.key, required this.notifier});-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final update = notifier.availableUpdate;- if (update == null) return const SizedBox.shrink();-- final installing = notifier.isInstallingUpdate;- final error = notifier.updateError;- final failed = error != null && !installing;-- // Amber for a failure, the accent wash otherwise. Deliberately NOT green:- // green is "machine online" everywhere else in this window, and a second- // meaning for it here would make the rail's dots ambiguous.- // ⚠️ COMPOSITED OVER THE WINDOW, NOT LEFT TRANSLUCENT. Both tints below are- // washes — 8% and 10% — and this band is the one strip of the app that does- // NOT sit inside a Scaffold: it takes a row of its own directly under- // MaterialApp's home, so there is no surface behind it to tint. Left as-is- // the wash lands on the bare window, which is still the platform's dark- // ground, and the banner stays black while the whole app around it goes- // light. Blending against the window colour keeps the designed tint and- // gives it something to be a tint OF.- final wash = failed- ? grid.AppPalette.warn.withValues(alpha: 0.10)- : grid.AppSurface.accentWash;- final tint = Color.alphaBlend(wash, grid.AppPalette.windowBg);- final rule = failed- ? grid.AppPalette.warn.withValues(alpha: 0.28)- : grid.AppPalette.accentOnSurface.withValues(alpha: 0.24);- final markColor = failed- ? grid.AppPalette.warn- : grid.AppPalette.accentOnSurface;-- final String message;- if (failed) {- message = error;- } else if (installing) {- message = 'Installing Harness ${update.version}…';- } else {- message = 'Harness ${update.version} is available';- }-- return Material(- color: Colors.transparent,- child: DecoratedBox(- decoration: BoxDecoration(- color: tint,- border: Border(bottom: BorderSide(color: rule)),- ),- child: Stack(- children: [- Padding(- padding: const EdgeInsets.fromLTRB(14, 7, 10, 7),- child: Row(- children: [- SizedBox(- width: 16,- height: 16,- child: installing- ? CircularProgressIndicator(- strokeWidth: 2,- color: grid.AppPalette.accentOnSurface,- )- : Icon(- failed- ? LucideIcons.triangleAlert300- : LucideIcons.arrowDownToLine300,- size: 16,- color: markColor,- ),- ),- const SizedBox(width: 10),- // ONE expanding child, holding the whole message. A- // Flexible text beside a Spacer splits the free space- // between them, which leaves the actions stranded- // mid-band instead of anchored to the right edge.- //- // Inside it the sentence yields before the size does: a- // truncated sentence still leaves both readable, whereas- // wrapping one would push the buttons out of the band.- Expanded(- child: Row(- children: [- Flexible(- child: Text(- message,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 12.5,- ),- ),- ),- if (!installing && !failed && update.size > 0) ...[- const SizedBox(width: 8),- Text(- '· ${formatDownloadSize(update.size)}',- style: TextStyle(- color: grid.AppPalette.textFaint,- fontSize: 11.5,- ),- ),- ],- ],- ),- ),- const SizedBox(width: 12),- if (failed) ...[- _NoticeAction(- label: 'Dismiss',- onPressed: notifier.dismissUpdateError,- ),- const SizedBox(width: 6),- _NoticeAction(- key: const Key('retry-update-button'),- label: 'Try again',- kind: _ActionKind.ghost,- onPressed: () =>- unawaited(notifier.installAvailableUpdate()),- ),- ] else ...[- _NoticeAction(- key: const Key('skip-update-button'),- label: 'Skip this version',- onPressed: installing- ? null- : notifier.skipAvailableUpdate,- ),- const SizedBox(width: 6),- _NoticeAction(- key: const Key('install-update-button'),- label: 'Update',- kind: _ActionKind.primary,- onPressed: installing- ? null- : () => unawaited(notifier.installAvailableUpdate()),- ),- ],- ],- ),- ),- // Indeterminate on purpose: downloadAndStage() resolves once, with- // no byte counter to read, so a percentage here would be invented.- if (installing)- Positioned(- left: 0,- right: 0,- bottom: 0,- child: LinearProgressIndicator(- minHeight: 2,- backgroundColor: Colors.transparent,- color: grid.AppPalette.accentOnSurface,- ),- ),- ],- ),- ),- );- }-}--enum _ActionKind { quiet, ghost, primary }--class _NoticeAction extends StatelessWidget {- final String label;- final VoidCallback? onPressed;- final _ActionKind kind;-- const _NoticeAction({- super.key,- required this.label,- required this.onPressed,- this.kind = _ActionKind.quiet,- });-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final primary = kind == _ActionKind.primary;- return TextButton(- onPressed: onPressed,- style: TextButton.styleFrom(- minimumSize: const Size(0, 26),- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- visualDensity: VisualDensity.standard,- backgroundColor: primary- ? grid.AppPalette.accentOnSurface- : Colors.transparent,- foregroundColor: primary- ? grid.AppPalette.windowBg- : grid.AppPalette.textSecondary,- disabledForegroundColor: grid.AppPalette.textFaint,- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(7),- side: kind == _ActionKind.ghost- ? BorderSide(color: grid.AppGlass.hair)- : BorderSide.none,- ),- textStyle: TextStyle(- fontSize: 12,- fontWeight: primary ? grid.AppFont.semibold : grid.AppFont.regular,- ),- ),- child: Text(label),- );- }-}--/// Opens the result of a manual check from the Harness menu. It never downloads-/// a release until the user chooses the primary action.-Future<void> showUpdateCheckDialog(- BuildContext context,- AppNotifier notifier,- ManualUpdateCheck result,-) {- final update = result.update;- if (update == null) {- return showAppDialog<void>(- context: context,- builder: (context) => const _UpdateDialog(- icon: LucideIcons.circleCheck300,- tone: _DialogTone.ok,- title: 'You’re up to date',- body: 'This copy of Harness already has the latest version.',- ),- );- }- return showAppDialog<void>(- context: context,- barrierDismissible: false,- builder: (dialogContext) {- var installing = false;- return StatefulBuilder(- builder: (context, setState) => _UpdateDialog(- icon: LucideIcons.arrowDownToLine300,- title: installing- ? 'Installing Harness ${update.version}…'- : 'Harness ${update.version} is available',- body: installing- ? 'Don’t quit Harness. It will restart on its own.'- : result.isSkipped- ? 'You skipped this version earlier. You can still install it.'- : 'Download and install it now? Harness will restart when it '- 'finishes.',- busy: installing,- update: installing ? null : update,- actions: installing- ? const []- : [- _DialogAction(- key: const Key('close-update-dialog-button'),- label: 'Close',- onPressed: () async {- Navigator.of(dialogContext).pop();- },- ),- _DialogAction(- label: result.isSkipped- ? 'Not now'- : 'Skip ${update.version}',- onPressed: () async {- if (!result.isSkipped) {- await notifier.skipAvailableUpdate();- }- if (dialogContext.mounted) {- Navigator.of(dialogContext).pop();- }- },- ),- _DialogAction(- label: 'Update',- primary: true,- onPressed: () async {- setState(() => installing = true);- final installed = await notifier.installAvailableUpdate();- // A successful install never returns — the process is- // replaced. Reaching here means it failed, and the banner- // behind this dialog is already showing why.- if (!dialogContext.mounted || installed) return;- Navigator.of(dialogContext).pop();- },- ),- ],- ),- );- },- );-}--enum _DialogTone { accent, ok }--class _DialogAction {- final Key? key;- final String label;- final bool primary;- final Future<void> Function() onPressed;-- const _DialogAction({- this.key,- required this.label,- required this.onPressed,- this.primary = false,- });-}--class _UpdateDialog extends StatelessWidget {- final IconData icon;- final String title;- final String body;- final _DialogTone tone;- final bool busy;- final UpdateInfo? update;- final List<_DialogAction> actions;-- const _UpdateDialog({- required this.icon,- required this.title,- required this.body,- this.tone = _DialogTone.accent,- this.busy = false,- this.update,- this.actions = const [],- });-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final mark = tone == _DialogTone.ok- ? grid.AppPalette.online- : grid.AppPalette.accentOnSurface;-- return Dialog(- // No backgroundColor, no shape: `dialogTheme` supplies both, at- // AppGlass.surfaceFill and AppCard.radius (12). The rim this used to- // carry is gone with them — §1 allows exactly one border in the app and- // it belongs to the menu panel, not to a dialog.- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 372),- child: Padding(- padding: const EdgeInsets.fromLTRB(18, 18, 18, 14),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Container(- width: 34,- height: 34,- decoration: BoxDecoration(- color: mark.withValues(alpha: 0.13),- borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),- ),- alignment: Alignment.center,- child: busy- ? SizedBox(- width: 17,- height: 17,- child: CircularProgressIndicator(- strokeWidth: 2,- color: mark,- ),- )- : Icon(icon, size: 18, color: mark),- ),- const SizedBox(height: 12),- Text(- title,- style: TextStyle(- color: grid.AppPalette.textPrimary,- fontSize: 15,- fontWeight: grid.AppFont.semibold,- ),- ),- const SizedBox(height: 5),- Text(- body,- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 12.5,- height: 1.5,- ),- ),- if (update != null) ...[- const SizedBox(height: 12),- Divider(height: 1, color: grid.AppGlass.hair),- const SizedBox(height: 10),- _Fact(label: 'Installed', value: _InstalledVersion()),- const SizedBox(height: 6),- _Fact(label: 'New version', value: Text(update!.version)),- if (update!.size > 0) ...[- const SizedBox(height: 6),- _Fact(- label: 'Download',- value: Text(formatDownloadSize(update!.size)),- ),- ],- ],- if (actions.isNotEmpty) ...[- const SizedBox(height: 15),- Row(- mainAxisAlignment: MainAxisAlignment.end,- children: [- for (final action in actions) ...[- if (action != actions.first) const SizedBox(width: 8),- _NoticeAction(- key: action.key,- label: action.label,- kind: action.primary- ? _ActionKind.primary- : _ActionKind.quiet,- onPressed: () => unawaited(action.onPressed()),- ),- ],- ],- ),- ],- if (actions.isEmpty && !busy) ...[- const SizedBox(height: 15),- Row(- mainAxisAlignment: MainAxisAlignment.end,- children: [- _NoticeAction(- label: 'Close',- kind: _ActionKind.ghost,- onPressed: () => Navigator.of(context).pop(),- ),- ],- ),- ],- ],- ),- ),- ),- );- }-}--/// One `label · value` line in the dialog's fact block.-class _Fact extends StatelessWidget {- final String label;- final Widget value;-- const _Fact({required this.label, required this.value});-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- return Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- SizedBox(- width: 96,- child: Text(- label,- style: TextStyle(color: grid.AppPalette.textFaint, fontSize: 11.5),- ),- ),- DefaultTextStyle(- style: TextStyle(- color: grid.AppPalette.textSecondary,- fontSize: 11.5,- fontFamily: grid.AppFont.mono,- fontFamilyFallback: grid.AppFont.monoFallback,- ),- child: value,- ),- ],- );- }-}--class _InstalledVersion extends StatefulWidget {- @override- State<_InstalledVersion> createState() => _InstalledVersionState();-}--class _InstalledVersionState extends State<_InstalledVersion> {- // Built once, not in `build`: `runningAppVersion` reads a file on Linux, and- // a future rebuilt per frame would put the placeholder back each time.- late final Future<String> _info = runningAppVersion();-- @override- Widget build(BuildContext context) => FutureBuilder<String>(- future: _info,- builder: (context, snapshot) {- final version = snapshot.data;- if (version == null) {- // Still reading: a blank measured against the ambient mono style the- // row sets, so it and the version it becomes are the same line.- // Answered with nothing: the dash, which is a value.- return snapshot.connectionState == ConnectionState.done- ? const Text('—')- : SkeletonText(- style: DefaultTextStyle.of(context).style,- width: 44,- );- }- return Text(version);- },- );-}diff --git a/mobile/lib/widgets/welcome_workspace_preview.dart b/mobile/lib/widgets/welcome_workspace_preview.dartdeleted file mode 100644index feaafdc94..000000000--- a/mobile/lib/widgets/welcome_workspace_preview.dart+++ /dev/null@@ -1,134 +0,0 @@-import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import 'engine_identity.dart';-import 'swarm_icon.dart';--/// A static example of the workspace. It never creates or contacts an agent.-class WelcomeWorkspacePreview extends StatelessWidget {- const WelcomeWorkspacePreview({super.key});-- @override- Widget build(BuildContext context) {- grid.AppTheme.watch(context);- final palette = grid.AppTheme.palette.value;- return Semantics(- image: true,- label: 'Example harness group: Claude Code and Codex working side by side.',- child: ExcludeSemantics(- child: Container(- decoration: BoxDecoration(- color: palette.workspace,- borderRadius: BorderRadius.circular(10),- border: Border.all(color: Colors.white12),- ),- clipBehavior: Clip.antiAlias,- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Container(- color: palette.tabBar,- padding: const EdgeInsets.symmetric(- horizontal: 12,- vertical: 10,- ),- child: const Row(- children: [- SwarmIcon(size: 14, color: Colors.white70),- SizedBox(width: 8),- Text(- 'Your project',- style: TextStyle(fontSize: 12, color: Colors.white),- ),- Spacer(),- Text(- '2 harnesses',- style: TextStyle(fontSize: 11, color: Colors.white70),- ),- ],- ),- ),- Padding(- padding: const EdgeInsets.all(8),- child: Row(- children: [- Expanded(- child: _AgentExample(- engine: 'claude',- title: 'Claude Code',- task: 'Build the feature',- color: palette.background,- ),- ),- const SizedBox(width: 8),- Expanded(- child: _AgentExample(- engine: 'codex',- title: 'Codex',- task: 'Review the changes',- color: palette.background,- ),- ),- ],- ),- ),- ],- ),- ),- ),- );- }-}--class _AgentExample extends StatelessWidget {- const _AgentExample({- required this.engine,- required this.title,- required this.task,- required this.color,- });- final String engine, title, task;- final Color color;-- @override- Widget build(BuildContext context) => Container(- padding: const EdgeInsets.all(12),- decoration: BoxDecoration(- color: color,- borderRadius: BorderRadius.circular(6),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- children: [- EngineMark(engine: engine, size: 17),- const SizedBox(width: 7),- Expanded(- child: Text(- title,- style: const TextStyle(- fontSize: 12,- color: Colors.white,- fontWeight: FontWeight.w500,- ),- ),- ),- ],- ),- const SizedBox(height: 14),- Text(task, style: const TextStyle(fontSize: 11, color: Colors.white70)),- const SizedBox(height: 10),- for (final width in [0.9, 0.65])- FractionallySizedBox(- widthFactor: width,- child: Container(- height: 3,- margin: const EdgeInsets.only(bottom: 5),- color: Colors.white24,- ),- ),- ],- ),- );-}diff --git a/mobile/test/screens_email_code_form_test.dart b/mobile/test/screens_email_code_form_test.dartdeleted file mode 100644index 83ddd15bb..000000000--- a/mobile/test/screens_email_code_form_test.dart+++ /dev/null@@ -1,98 +0,0 @@-import 'package:flutter/material.dart';-import 'package:flutter_test/flutter_test.dart';--import 'package:harness_mobile/screens/email_code_form.dart';--/// The phone's sign-in form: an email, then the four-digit code — no browser.-void main() {- late List<String> sentTo;- late List<(String, String)> signedIn;- Object? refuseCode;-- Future<void> pumpForm(WidgetTester tester) async {- sentTo = [];- signedIn = [];- refuseCode = null;- await tester.pumpWidget(- MaterialApp(- home: Scaffold(- body: EmailCodeForm(- sendCode: (email) async => sentTo.add(email),- signIn: (email, code) async {- if (refuseCode case final error?) throw error;- signedIn.add((email, code));- },- ),- ),- ),- );- }-- Future<void> askForCode(WidgetTester tester) async {- await tester.enterText(find.byKey(const Key('login-email')), ' [email protected] ');- await tester.tap(find.text('Email me a code'));- await tester.pump();- }-- testWidgets('an email is asked for, then its code signs in', (tester) async {- await pumpForm(tester);- await askForCode(tester);-- expect(sentTo, ['[email protected]']);- expect(find.text('We emailed a sign-in code to [email protected].'), findsOneWidget);-- // The fourth digit signs in on its own.- await tester.enterText(find.byKey(const Key('login-code')), '1234');- await tester.pump();- expect(signedIn, [('[email protected]', '1234')]);- await tester.pump(EmailCodeForm.resendAfter);- });-- testWidgets('something that is not an email is not sent', (tester) async {- await pumpForm(tester);- await tester.enterText(find.byKey(const Key('login-email')), 'nope');- await tester.tap(find.text('Email me a code'));- await tester.pump();-- expect(sentTo, isEmpty);- expect(- find.text('Enter the email of your Autonomous account.'),- findsOneWidget,- );- });-- testWidgets('a wrong code is said under the field, which stays', (- tester,- ) async {- await pumpForm(tester);- await askForCode(tester);- refuseCode = 'Invalid OTP';-- await tester.enterText(find.byKey(const Key('login-code')), '9999');- await tester.pump();-- expect(find.text('Invalid OTP'), findsOneWidget);- expect(find.byKey(const Key('login-code')), findsOneWidget);- await tester.pump(EmailCodeForm.resendAfter);- });-- testWidgets('a code can be sent again only after the wait', (tester) async {- await pumpForm(tester);- await askForCode(tester);- expect(find.text('Resend in 30s'), findsOneWidget);-- await tester.pump(EmailCodeForm.resendAfter);- await tester.tap(find.text('Resend code'));- await tester.pump();- expect(sentTo, ['[email protected]', '[email protected]']);- await tester.pump(EmailCodeForm.resendAfter);- });-- testWidgets('a different email goes back to the first step', (tester) async {- await pumpForm(tester);- await askForCode(tester);- await tester.tap(find.text('Use a different email'));- await tester.pump();- expect(find.byKey(const Key('login-email')), findsOneWidget);- });-}