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
Mobile: a Harness OS computer signs in to GitHub and checks for updates; Set up Intern 3; Settings ▸ Experimental; omp takes a first task (#1947)
tony496s50cd5eb924d6
diff --git a/mobile/RELEASE.md b/mobile/RELEASE.mdindex c1f1fdde3..f7aa058db 100644--- a/mobile/RELEASE.md+++ b/mobile/RELEASE.md@@ -142,9 +142,10 @@ may lack symbolicated stacks until the matching symbols are supplied.| `1.0.8 (71)` | 2026-10-20 | TestFlight. A + after Find's tab chips opens a new harness in a tab of its own; a held New Harness stops asking once Cancel is pressed, and a launch back to work says what it waited on; a locked Harness OS computer set up on its hotspot in one stay; a spoken sign-in code for devices with no screen; parked machines rechecked less often and not in the background; counts flushed on background, first open, new accounts and testers measured. 1.0.7 had been approved, so it went up as 1.0.8. Built (by another session) from `feat/mobile-ios-android` at `7849fd00`. Approved and on sale on the App Store: released 2026-10-20 22:09 UTC (App Store Connect: 1.0.8 `READY_FOR_SALE`, build 71) || `1.0.9 (72)` | 2026-10-21 | TestFlight, then submitted as 1.0.9. The system banner shows while the app is open, and agent questions and turn tiers reach phones over the relay; faster terminal typing over P2P; Change agent hands over the conversation and can switch a busy Claude harness; a Harness OS computer's Version page, its update's restart and Unlock after one; Set up a device under Add computer; a desk tab renamed or closed by holding its chip in Find. Built from `feat/mobile-ios-android` at `9c329760`, the merge of local `main` with origin's #1499 || `1.0.10 (73)` | 2026-10-23 | TestFlight. The phone's first session: task chips, one suggestion with a Send button, the keyboard over its task and a mic that sends the prompt, and Desktop's engine choice; a Harness OS computer signed out, its password changed, SSH turned on; Version lists releases and takes a newer OS release only; a pasted image waits for its transcode before uploading. 1.0.9 had been submitted, so it went up as 1.0.10. Built from `feat/mobile-ios-android` at `3c024672` |+| `1.0.11 (74)` | 2026-10-26 | TestFlight. Claude Code scroll keeps up with the finger. 1.0.10 is approved, so it went up as 1.0.11 to carry refreshed App Store screenshots. Built from `feat/mobile-ios-android` at `13b9b38b` |-`pubspec.yaml` is now at `1.0.10+74`, the next build number. Build 73 (1.0.10) is the last build, for both-TestFlight and Play (54 went up outside this record, 53 went to Play only); do not upload any of them again. 1.0.1 to 1.0.8 are approved and 1.0.9 is submitted, so new builds go up as 1.0.10 until it is submitted or approved too. Check App Store Connect before uploading if another release has happened meanwhile.+`pubspec.yaml` is now at `1.0.11+75`, the next build number. Build 74 (1.0.11) is the last TestFlight build and+build 73 (1.0.10) the last Play build (54 went up outside this record, 53 went to Play only); do not upload any of them again. 1.0.1 to 1.0.10 are approved, so new builds go up as 1.0.11 until it is submitted or approved too. Check App Store Connect before uploading if another release has happened meanwhile.### Why the app is iPhone-onlydiff --git a/mobile/integration_test/add_device_unlock_test.dart b/mobile/integration_test/add_device_unlock_test.dartindex f5aaf97d9..dbe032ea9 100644--- a/mobile/integration_test/add_device_unlock_test.dart+++ b/mobile/integration_test/add_device_unlock_test.dart@@ -8,7 +8,7 @@ import 'package:harness_mobile/phone/add_device/add_device_page.dart';import 'package:harness_mobile/phone/add_device/setup_hotspot.dart';import 'package:harness_mobile/shared/theme/app_theme.dart' as grid;-/// Set up a device that is locked as it starts, in the real app on a simulator, against a stand-in+/// Set up Intern 3 for a computer locked as it starts, in the real app on a simulator, against a stand-in/// device on the Mac (`fake_device.py`, which runs the startup's own page,/// os/root/usr/lib/harness-os/unlock/http, until "harness" opens it). A screenshot each step.///diff --git a/mobile/lib/core/first_task.dart b/mobile/lib/core/first_task.dartindex f0b65c528..a50652872 100644--- a/mobile/lib/core/first_task.dart+++ b/mobile/lib/core/first_task.dart@@ -12,7 +12,7 @@ const firstTaskIdeas = [/// `FIRST_PROMPT_ARGS` (cli/src/lib/engineLaunch.ts). A machine refuses a first message for any/// other engine (`PROMPT_UNSUPPORTED`). test/first_task_test.dart holds the two lists to the same/// answer: one missing here is an engine whose first task New drops without a word.-const kFirstTaskEngines = {'claude', 'codex', 'opencode', 'hermes'};+const kFirstTaskEngines = {'claude', 'codex', 'opencode', 'omp', 'hermes'};/// Whether a harness on [engine] can start on a first task.bool takesFirstTask(String engine) => kFirstTaskEngines.contains(engine);diff --git a/mobile/lib/core/startup.dart b/mobile/lib/core/startup.dartindex 8513bebd5..329e97f08 100644--- a/mobile/lib/core/startup.dart+++ b/mobile/lib/core/startup.dart@@ -3,6 +3,7 @@ import 'dart:async';import '../logging/startup_trace.dart';import '../phone/phone_name_store.dart';import '../phone/voice_language_store.dart';+import '../settings/experimental_features.dart';import '../shared/theme/appearance_prefs_store.dart';import '../stats/harness_stats.dart';import '../terminal/terminal_font_store.dart';@@ -28,6 +29,7 @@ Future<void> loadPersistedSettings({HarnessStats? stats,VoiceLanguageStore? voiceLanguage,PhoneNameStore? phoneName,+ ExperimentalFeaturesStore? experiments,}) async {// What the OS calls this phone, asked now so it is on hand by the first// `terminal_open`; not awaited — a slow answer must not hold the first frame,@@ -75,5 +77,11 @@ Future<void> loadPersistedSettings({// The person's own name for this phone; read late, the first terminal it// took would introduce it by the OS's name instead.StartupTrace.time('prefs.phoneName', (phoneName ?? phoneNameStore).load),+ // What Settings ▸ Experimental turned on; read late, a way in that is on would appear a frame+ // after the screen it belongs to.+ StartupTrace.time(+ 'prefs.experiments',+ (experiments ?? experimentalFeaturesStore).load,+ ),]);}diff --git a/mobile/lib/demo/sample_notifier.dart b/mobile/lib/demo/sample_notifier.dartindex 9394db8ca..14ad83712 100644--- a/mobile/lib/demo/sample_notifier.dart+++ b/mobile/lib/demo/sample_notifier.dart@@ -72,7 +72,7 @@ class SampleApiClient extends ApiClient {@overrideFuture<Map<String, dynamic>?> me() async => null;- /// Set up a device, in the sample: a ticket no backend ever sees (the device is a stand-in too).+ /// Set up Intern 3, in the sample: a ticket no backend ever sees (the device is a stand-in too).@overrideFuture<Map<String, dynamic>> boxTicket() async => {'ticket': 'sample-ticket',diff --git a/mobile/lib/phone/add_device/add_device_page.dart b/mobile/lib/phone/add_device/add_device_page.dartindex 0b581a2d8..d13887f95 100644--- a/mobile/lib/phone/add_device/add_device_page.dart+++ b/mobile/lib/phone/add_device/add_device_page.dart@@ -15,7 +15,7 @@ import '../tty.dart';import '../tty_controls.dart';import 'setup_hotspot.dart';-/// Settings ▸ Set up a device: a Harness with no screen (a box, a mini PC) put on the person's+/// Settings ▸ Set up Intern 3: a Harness with no screen (a box, a mini PC) put on the person's/// Wi-Fi and signed in to this phone's account, through the device's own setup hotspot.////// ticket (while this phone still has the Internet) → pick `Harness-XXXX` from the Wi-Fi list@@ -820,7 +820,7 @@ class _AddDevicePageState extends State<AddDevicePage> {),children: [const TtyText(- 'Set up a device',+ 'Set up Intern 3',size: TtySize.display,weight: FontWeight.w600,),diff --git a/mobile/lib/phone/change_wifi_page.dart b/mobile/lib/phone/change_wifi_page.dartindex aa54d80fe..cf418a1d2 100644--- a/mobile/lib/phone/change_wifi_page.dart+++ b/mobile/lib/phone/change_wifi_page.dart@@ -202,7 +202,7 @@ class _ChangeWifiPageState extends State<ChangeWifiPage> {_Step.moving,error:'$_name has not come back. If it lost its Wi-Fi, it opens its own "Harness-…" '- 'Wi-Fi in a few minutes: then use Settings ▸ Set up a device near it.',+ 'Wi-Fi in a few minutes: then use Settings ▸ Set up Intern 3 near it.',);}} finally {diff --git a/mobile/lib/phone/computer_github_page.dart b/mobile/lib/phone/computer_github_page.dartnew file mode 100644index 000000000..c66a9c07b--- /dev/null+++ b/mobile/lib/phone/computer_github_page.dart@@ -0,0 +1,280 @@+import 'dart:async';++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';+import 'package:url_launcher/url_launcher.dart';++import 'package:harness_mobile/state/app_state.dart';++import 'phone_sheet.dart';+import 'settings_row.dart';+import 'tty.dart';+import 'tty_controls.dart';++/// Computers ▸ a Harness OS computer ▸ GitHub: the account its agents clone, push and open pull+/// requests with, signed in from here (CLI osDevice.ts `github`). The computer runs GitHub's device+/// sign-in and answers its code; the code is entered on GitHub's page, in this phone's browser —+/// the computer needs no screen. Signed in, git there uses the account too (`gh auth setup-git`).+class ComputerGithubPage extends StatefulWidget {+ const ComputerGithubPage({+ super.key,+ required this.notifier,+ required this.machineId,+ this.openPage,+ });++ final AppNotifier notifier;+ final String machineId;++ /// Opens GitHub's page; the phone's browser unless a test says otherwise.+ final Future<void> Function(Uri url)? openPage;++ @override+ State<ComputerGithubPage> createState() => _ComputerGithubPageState();+}++class _ComputerGithubPageState extends State<ComputerGithubPage> {+ Map<String, dynamic>? _state;+ bool _busy = true;+ String _error = '';++ /// Asking again while a code waits to be entered, to see the sign-in through.+ Timer? _follow;++ /// Back from GitHub's page in the browser: asked at once. The ask that was under way when the app+ /// went behind the browser can hang on the connection Android closed, for its whole timeout.+ late final AppLifecycleListener _back;++ /// Each ask's number: an answer only counts while no later ask was sent ([_ask]).+ int _asks = 0;++ AppNotifier get _app => widget.notifier;+ String get _name =>+ _app.stateOf(widget.machineId)?.machine.displayName ?? 'The computer';+ String? get _login => _state?['login'] as String?;+ Map? get _waiting => _state?['signingIn'] as Map?;++ /// The GitHub CLI was gone and is being put back, for the sign-in that follows (os/setup.py install-gh).+ bool get _installing => _state?['installing'] == true;++ @override+ void initState() {+ super.initState();+ _back = AppLifecycleListener(+ onResume: () {+ if (_waiting != null || _installing) {+ unawaited(_ask('status', quiet: true));+ }+ },+ );+ unawaited(_ask('status'));+ }++ @override+ void dispose() {+ _back.dispose();+ _follow?.cancel();+ super.dispose();+ }++ Future<void> _ask(String state, {bool quiet = false}) async {+ final ask = ++_asks;+ if (!quiet) {+ setState(() {+ _busy = true;+ _error = '';+ });+ }+ final reply = await _app.osDevice(+ widget.machineId,+ {'action': 'github', 'state': state},+ // Following a sign-in, briefly: the next look comes 3 s later anyway.+ timeout: Duration(seconds: quiet ? 10 : 40),+ );+ if (!mounted || ask != _asks) return;+ setState(() {+ _busy = false;+ if (reply.containsKey('login')) {+ _state = reply;+ _error = '';+ } else if (!quiet) {+ _error =+ reply['message'] as String? ??+ 'Could not reach $_name. Pull down to try again.';+ }+ });+ _follow?.cancel();+ if (_waiting != null || _installing) {+ _follow = Timer(+ const Duration(seconds: 3),+ () => unawaited(_ask('status', quiet: true)),+ );+ }+ }++ /// The code copied, then GitHub's page opened: it is pasted there.+ Future<void> _openGithub() async {+ final waiting = _waiting;+ if (waiting == null) return;+ await Clipboard.setData(ClipboardData(text: waiting['code'] as String));+ final url = Uri.parse(+ waiting['url'] as String? ?? 'https://github.com/login/device',+ );+ final open =+ widget.openPage ??+ (Uri url) async {+ await launchUrl(url, mode: LaunchMode.externalApplication);+ };+ await open(url);+ }++ Future<void> _signOut() async {+ final confirmed = await confirmPhoneAction(+ context,+ icon: LucideIcons.logOut300,+ title: 'Sign $_name out of GitHub?',+ message:+ 'Its agents can no longer push or open pull requests as @$_login, nor clone private '+ 'repositories.',+ confirmLabel: 'Sign out',+ );+ if (confirmed && mounted) await _ask('sign_out');+ }++ @override+ Widget build(BuildContext context) {+ final tty = Tty.of(context);+ Text say(String text, {Color? color}) =>+ Text(text, style: tty.style(color: color ?? tty.dim));+ final login = _login;+ final waiting = _waiting;+ final failed = _state?['signInError'] as String?;+ return Scaffold(+ backgroundColor: tty.ground,+ body: SafeArea(+ bottom: false,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Align(+ alignment: Alignment.centerLeft,+ child: TtyBackButton(+ onPressed: () => Navigator.of(context).maybePop(),+ ),+ ),+ Expanded(+ child: RefreshIndicator(+ onRefresh: () => _ask('status'),+ child: ListView(+ padding: EdgeInsets.fromLTRB(+ Tty.origin,+ 8,+ Tty.origin,+ MediaQuery.paddingOf(context).bottom + 24,+ ),+ children: [+ const TtyText(+ 'GitHub',+ size: TtySize.display,+ weight: FontWeight.w600,+ ),+ const SizedBox(height: 8),+ if (_error.isNotEmpty)+ say(_error, color: tty.red)+ else if (_state == null)+ const Center(+ child: CircularProgressIndicator(strokeWidth: 2),+ )+ else if (login != null) ...[+ say(+ 'Agents on $_name clone, push and open pull requests as @$login.',+ ),+ const SizedBox(height: 12),+ SettingsGroup(+ children: [+ SettingsRow(+ key: const Key('github-account'),+ title: 'Account',+ value: '@$login',+ ),+ ],+ ),+ const SizedBox(height: 20),+ TtyPrimaryButton(+ key: const Key('github-sign-out'),+ label: 'Sign out of GitHub',+ busy: _busy,+ busyLabel: 'Signing out…',+ onPressed: () => unawaited(_signOut()),+ ),+ ] else if (waiting != null) ...[+ say(+ 'Enter this code on GitHub\'s page, then allow it. $_name signs in '+ 'as soon as you do.',+ ),+ const SizedBox(height: 16),+ Center(+ child: SelectableText(+ waiting['code'] as String,+ key: const Key('github-code'),+ style: tty.style(+ size: TtySize.display,+ weight: FontWeight.w600,+ color: tty.text,+ ),+ ),+ ),+ const SizedBox(height: 20),+ TtyPrimaryButton(+ key: const Key('github-open'),+ label: 'Copy code and open GitHub',+ onPressed: () => unawaited(_openGithub()),+ ),+ const SizedBox(height: 12),+ say('Waiting for GitHub…'),+ ] else if (_installing) ...[+ say(+ 'The GitHub CLI was not on $_name, so it is installing it now. The '+ 'code to enter on GitHub shows here once it is done — a minute or two.',+ ),+ const SizedBox(height: 20),+ const Center(+ key: Key('github-installing'),+ child: CircularProgressIndicator(strokeWidth: 2),+ ),+ ] else ...[+ say(+ _state?['missing'] == true+ ? 'Sign $_name in to GitHub so its agents can clone private repositories, '+ 'push and open pull requests — with a Swarm too. The GitHub CLI is '+ 'not on it: signing in installs it first.'+ : 'Sign $_name in to GitHub so its agents can clone private repositories, '+ 'push and open pull requests — with a Swarm too.',+ ),+ if (failed != null) ...[+ const SizedBox(height: 8),+ say(+ 'The last sign-in did not finish: $failed',+ color: tty.red,+ ),+ ],+ const SizedBox(height: 20),+ TtyPrimaryButton(+ key: const Key('github-sign-in'),+ label: 'Sign in to GitHub',+ busy: _busy,+ busyLabel: 'Asking GitHub…',+ onPressed: () => unawaited(_ask('sign_in')),+ ),+ ],+ ],+ ),+ ),+ ),+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/lib/phone/computer_version_page.dart b/mobile/lib/phone/computer_version_page.dartindex 635117556..0100f8d96 100644--- a/mobile/lib/phone/computer_version_page.dart+++ b/mobile/lib/phone/computer_version_page.dart@@ -67,6 +67,12 @@ class _ComputerVersionPageState extends State<ComputerVersionPage> {/// How long an update gets before the page stops waiting and says so.static const _updateFor = Duration(minutes: 6);+ /// A check for updates asked from here (or found under way), followed until the computer is done.+ bool _checking = false;++ /// How long a check gets: the computer bounds its own at 6 minutes (CLI osDevice.ts CHECK_TIMEOUT_MS).+ static const _checkFor = Duration(minutes: 7);+AppNotifier get _app => widget.notifier;String get _id => widget.machineId;String get _name => _app.stateOf(_id)?.machine.displayName ?? 'The computer';@@ -260,10 +266,69 @@ class _ComputerVersionPageState extends State<ComputerVersionPage> {}Future<void> _refresh() async {- if (_started.isEmpty) _finished = '';+ if (_started.isEmpty && !_checking) _finished = '';setState(() => _asking = true);await _app.refreshOsStatus(_id, force: true);- if (mounted) setState(() => _asking = false);+ if (!mounted) return;+ setState(() => _asking = false);+ // A check already under way there (asked before this page opened): followed to its end.+ if (_checkingThere() && !_checking) unawaited(_followCheck());+ }++ bool _checkingThere() =>+ (_app.osStatus[_id]?['update'] as Map?)?['checking'] == true;++ /// Check for updates now instead of at the computer's next check (every 15 minutes, a new Harness OS+ /// once a day): the OS release too. Answered at once; followed until the computer is done.+ Future<void> _check() async {+ setState(() {+ _checking = true;+ _finished = '';+ });+ final reply = await _app.osDevice(_id, {'action': 'check_update'});+ if (!mounted) return;+ if (reply['started'] != true) {+ setState(() {+ _checking = false;+ _finishedWell = false;+ _finished = 'Could not ask $_name to check. Try again.';+ });+ return;+ }+ await _followCheck();+ }++ Future<void> _followCheck() async {+ setState(() => _checking = true);+ final deadline = DateTime.now().add(_checkFor);+ while (mounted && DateTime.now().isBefore(deadline)) {+ await Future<void>.delayed(const Duration(seconds: 3));+ if (!mounted) return;+ final before = _app.osStatus[_id];+ await _app.refreshOsStatus(_id, force: true);+ if (!mounted) return;+ // Its own fresh answer, saying the check is over.+ if (identical(before, _app.osStatus[_id]) || _checkingThere()) continue;+ final update = _app.osStatus[_id]?['update'];+ final error = update is Map ? update['checkError'] as String? : null;+ setState(() {+ _checking = false;+ _finishedWell = error == null;+ _finished =+ error ??+ (_app.updateAvailable(_id) || _app.updateRestarts(_id)+ ? 'A new version is ready.'+ : '$_name is up to date.');+ });+ return;+ }+ if (!mounted) return;+ setState(() {+ _checking = false;+ _finishedWell = false;+ _finished =+ '$_name has not said the check is done. Pull down to ask it again.';+ });}Future<void> _update() async {@@ -451,7 +516,20 @@ class _ComputerVersionPageState extends State<ComputerVersionPage> {const SizedBox(height: 20),// Restarted and locked, or offline: nothing to update until it is back. An// encrypted one is unlocked from here.- if (online && _started.isEmpty)+ // Nothing waiting: where Up to date was, ask it to check now (a daemon that can).+ if (online &&+ _started.isEmpty &&+ !available &&+ !restartRequired &&+ _app.osFeature(_id, 'check_update'))+ TtyPrimaryButton(+ key: const Key('version-check'),+ label: 'Check for updates',+ busy: _checking,+ busyLabel: 'Checking…',+ onPressed: () => unawaited(_check()),+ )+ else if (online && _started.isEmpty)TtyPrimaryButton(key: const Key('version-update'),label: restartRequired && !availablediff --git a/mobile/lib/phone/machine_actions.dart b/mobile/lib/phone/machine_actions.dartindex 26b0007a2..040c64f42 100644--- a/mobile/lib/phone/machine_actions.dart+++ b/mobile/lib/phone/machine_actions.dart@@ -8,6 +8,7 @@ import 'package:harness_mobile/widgets/rename_agent_dialog.dart'show showMachineRenameDialog;import 'change_wifi_page.dart';+import 'computer_github_page.dart';import 'computer_password_page.dart';import 'computer_ssh_page.dart';import 'computer_version_page.dart';@@ -45,7 +46,7 @@ Future<void> signOutComputer(title: 'Sign out $name?',message:'It signs out of this account and forgets its Wi-Fi, then opens its own Wi-Fi "$hotspot" '- 'to be set up again — with Set up a device, on this account or another. Its harnesses, '+ 'to be set up again — with Set up Intern 3, on this account or another. Its harnesses, ''projects and files stay on it.',confirmLabel: 'Sign out',);@@ -57,7 +58,7 @@ Future<void> signOutComputer(SnackBar(content: Text(reply['started'] == true- ? '$name is signing out. Set it up again from Set up a device, near it.'+ ? '$name is signing out. Set it up again from Set up Intern 3, near it.': 'Could not reach $name. Try again.',),),@@ -73,7 +74,8 @@ Future<void> signOutComputer(/// offered only where it answers.////// Read at the tap, not when the row was drawn, so a computer that got linked in between gets the-/// sheet for what it is now.+/// sheet for what it is now — and read again while it is open: its Harness OS status is asked as it+/// opens, and its Version, GitHub, SSH… rows come with the answer.void openMachineActions(BuildContext context,AppNotifier notifier,@@ -81,6 +83,27 @@ void openMachineActions() {final machine = notifier.stateOf(machineId);if (machine == null) return;+ // Asked as the sheet opens; the rows below follow the answer.+ if (phoneMachineStatusOf(machine) == PhoneMachineStatus.ready) {+ unawaited(notifier.refreshOsStatus(machineId));+ }+ final rows = _machineRows(context, notifier, machineId);+ showPhoneSheet(+ context,+ title: machine.machine.displayName,+ rebuildOn: notifier,+ rows: () => _machineRows(context, notifier, machineId) ?? rows!,+ );+}++/// The sheet's rows for the computer as it is now; null once it is gone from the account.+PhoneSheetRows? _machineRows(+ BuildContext context,+ AppNotifier notifier,+ String machineId,+) {+ final machine = notifier.stateOf(machineId);+ if (machine == null) return null;final status = phoneMachineStatusOf(machine);final retrying = notifier.machineRetrying(machineId);final removing = notifier.machineRemoving(machineId);@@ -213,6 +236,20 @@ void openMachineActions(),),),+ if (notifier.osFeature(machineId, 'github'))+ PhoneSheetAction(+ icon: LucideIcons.gitPullRequest300,+ label: 'GitHub',+ chevron: true,+ onTap: () => Navigator.of(context).push(+ phoneRoute(+ (_) => ComputerGithubPage(+ notifier: notifier,+ machineId: machineId,+ ),+ ),+ ),+ ),if (notifier.osFeature(machineId, 'ssh'))PhoneSheetAction(icon: LucideIcons.terminal300,@@ -250,14 +287,7 @@ void openMachineActions(remove,];}- // Asked as the sheet opens; the rows above come from the last answer, and a new one rebuilds them- // the next time.- if (status == PhoneMachineStatus.ready) {- unawaited(notifier.refreshOsStatus(machineId));- }- showPhoneSheet(- context,- title: machine.machine.displayName,+ return (actions: actions,// Their own card, below a gap: the rows that end something stand apart from the ones that// only look or ask.diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dartindex 5c00aa066..11350742d 100644--- a/mobile/lib/phone/machines_tab.dart+++ b/mobile/lib/phone/machines_tab.dart@@ -335,7 +335,7 @@ class _Body extends StatelessWidget {(word, color) = ('trying…', tty.faint);} else if (notifier.isNewMachine(machineId) &&status == PhoneMachineStatus.ready) {- // Just set up from this phone (Set up a device): which one it is, among the rest. Not green:+ // Just set up from this phone (Set up Intern 3): which one it is, among the rest. Not green:// beside the green Start it read as a second button. Gone once Start is pressed: its spinner// says enough.(word, color) = (@@ -536,13 +536,13 @@ class _ConnectBarState extends State<_ConnectBar> {label: 'Add computer',onPressed: widget.onSetUp,),- // A Harness with no screen, or one locked as it starts: Settings' Set up a device,+ // A Harness with no screen, or one locked as it starts: Settings' Set up Intern 3,// here too, where the computers are.const SizedBox(height: 4),Center(child: TtyTextButton(key: const ValueKey('machines-set-up-device'),- label: 'Set up a device',+ label: 'Set up Intern 3',onPressed: () => Navigator.of(context).push(phoneRoute((_) => AddDevicePage(notifier: widget.notifier),diff --git a/mobile/lib/phone/phone_search_actions.dart b/mobile/lib/phone/phone_search_actions.dartindex d541b3fd8..78701bfdf 100644--- a/mobile/lib/phone/phone_search_actions.dart+++ b/mobile/lib/phone/phone_search_actions.dart@@ -1,6 +1,8 @@import 'package:flutter/widgets.dart';+import 'package:harness_mobile/settings/experimental_features.dart';import 'package:harness_mobile/state/app_state.dart';+import 'package:harness_mobile/swarm/swarm_page.dart';import 'agent_index.dart';import 'agents_list_page.dart';@@ -48,6 +50,16 @@ List<PhoneCommand> phoneSearchCommands(Navigator.of(context).push(phoneRoute((_) => AgentsListPage(notifier: notifier))),),+ // Swarm's way in while it is built: only for a phone that turned it on in Settings ▸+ // Experimental. Read here, on every filter, so turning it off takes it out of the next search.+ if (experimentalFeaturesStore.isOn(PhoneExperiment.swarm))+ PhoneCommand(+ id: 'swarm.open',+ title: 'Swarm',+ detail: 'Experimental · your Swarms',+ run: () =>+ Navigator.of(context).push(phoneRoute((_) => const SwarmPage())),+ ),PhoneCommand(id: 'app.settings',title: 'Settings',diff --git a/mobile/lib/phone/phone_sheet.dart b/mobile/lib/phone/phone_sheet.dartindex 8dabaff82..9060ebbe4 100644--- a/mobile/lib/phone/phone_sheet.dart+++ b/mobile/lib/phone/phone_sheet.dart@@ -88,6 +88,12 @@ class PhoneSheetSection {void expand() => _expanded = true;}+/// A sheet's rows: its first card, then the cards after it ([showPhoneSheet]).+typedef PhoneSheetRows = ({+ List<PhoneSheetAction> actions,+ List<PhoneSheetSection> sections,+});+/// The `⋯` menu on a phone page: a title line, then its actions in inset cards.////// The desktop reaches the same actions through a right-click menu, which a phone has no gesture@@ -106,6 +112,11 @@ class PhoneSheetSection {/// [onShown] is handed the sheet's route as it is pushed, for a page that may have to take the/// sheet down itself: its rows are read once, as it opens, and something that ends under it — a/// Change agent — would otherwise leave it saying what is no longer true.+///+/// [rows], with [rebuildOn]: the rows read again each time [rebuildOn] changes, in place of+/// [actions] and [sections] — for a sheet whose rows wait on an answer asked as it opens (a+/// computer's Harness OS status, `machine_actions.dart`), which would otherwise only show the+/// next time it is opened.Future<void> showPhoneSheet(BuildContext context, {required String title,@@ -113,20 +124,32 @@ Future<void> showPhoneSheet(List<PhoneSheetSection> sections = const [],String? titleBranch,void Function(Route<void> route)? onShown,+ Listenable? rebuildOn,+ PhoneSheetRows Function()? rows,}) {+ Widget menu(BuildContext sheetContext) {+ final now = rows?.call() ?? (actions: actions, sections: sections);+ return _TmuxMenu(+ title: title,+ branch: titleBranch,+ actions: now.actions,+ sections: now.sections,+ onAction: (action) {+ Navigator.of(sheetContext).pop();+ action.onTap();+ },+ );+ }+final route = phoneSheetRoute<void>(context,builder: (sheetContext) => SafeArea(- child: _TmuxMenu(- title: title,- branch: titleBranch,- actions: actions,- sections: sections,- onAction: (action) {- Navigator.of(sheetContext).pop();- action.onTap();- },- ),+ child: rebuildOn == null+ ? menu(sheetContext)+ : ListenableBuilder(+ listenable: rebuildOn,+ builder: (_, _) => menu(sheetContext),+ ),),);onShown?.call(route);diff --git a/mobile/lib/phone/settings_page.dart b/mobile/lib/phone/settings_page.dartindex e4182b08c..c4bedd091 100644--- a/mobile/lib/phone/settings_page.dart+++ b/mobile/lib/phone/settings_page.dart@@ -11,6 +11,7 @@ import 'package:harness_mobile/demo/sample_mode.dart'show SampleMode, SampleSession, openSampleMode;import 'package:harness_mobile/core/device_name.dart';import 'package:harness_mobile/notify/system_notices.dart';+import 'package:harness_mobile/settings/experimental_features.dart';import 'package:harness_mobile/measurement/product_measurement.dart';import 'package:harness_mobile/shared/widgets/app_dialog.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';@@ -77,10 +78,19 @@ import 'voice_language_store.dart';/// rail footer — on a phone there is no rail, so this is the only way to reach either.class SettingsPage extends StatelessWidget {- const SettingsPage({super.key, required this.notifier, this.large = true});+ const SettingsPage({+ super.key,+ required this.notifier,+ this.large = true,+ this.experiments,+ });final AppNotifier notifier;+ /// What Experimental switches: [experimentalFeaturesStore] unless a test hands in its own, so a+ /// tap there never writes to the developer's own state file.+ final ExperimentalFeaturesStore? experiments;+/// The tab's big title. Off when the page is pushed from a terminal's menu, where it needs the/// back chevron a large header does not draw.final bool large;@@ -133,7 +143,12 @@ class SettingsPage extends StatelessWidget {weight: FontWeight.w600,),),- Expanded(child: _Body(notifier: notifier)),+ Expanded(+ child: _Body(+ notifier: notifier,+ experiments: experiments ?? experimentalFeaturesStore,+ ),+ ),],),),@@ -145,9 +160,10 @@ class SettingsPage extends StatelessWidget {}class _Body extends StatelessWidget {- const _Body({required this.notifier});+ const _Body({required this.notifier, required this.experiments});final AppNotifier notifier;+ final ExperimentalFeaturesStore experiments;@overrideWidget build(BuildContext context) => ListView(@@ -235,7 +251,7 @@ class _Body extends StatelessWidget {// this account through its setup hotspot.SettingsRow(key: const Key('settings-add-device'),- title: 'Set up a device',+ title: 'Set up Intern 3',onTap: () => Navigator.of(context).push(phoneRoute((_) => AddDevicePage(notifier: notifier)),),@@ -268,6 +284,15 @@ class _Body extends StatelessWidget {SettingsGroup(children: [_VoiceLanguageRow()]),const SettingsCaption('Appearance'),SettingsGroup(children: [_PaletteRow(), _TextSizeRow()]),+ // The desktop's Labs ▸ Experimental, and in the same place: after how the app looks, before+ // Help. Features still being built, each off until turned on here.+ const SettingsCaption('Experimental'),+ SettingsGroup(+ children: [+ for (final experiment in PhoneExperiment.values)+ _ExperimentRow(experiment: experiment, store: experiments),+ ],+ ),const SettingsCaption('Help'),SettingsGroup(children: [@@ -638,6 +663,43 @@ class _NotificationsRowState extends State<_NotificationsRow>}}+/// One [PhoneExperiment] and its switch. The whole row toggles it, as a phone's own settings do;+/// the switch only shows which way it is.+class _ExperimentRow extends StatelessWidget {+ const _ExperimentRow({required this.experiment, required this.store});++ final PhoneExperiment experiment;+ final ExperimentalFeaturesStore store;++ @override+ Widget build(BuildContext context) => ValueListenableBuilder(+ valueListenable: store,+ builder: (context, _, _) {+ AppTheme.watch(context);+ final on = store.isOn(experiment);+ void toggle(bool next) {+ HapticFeedback.selectionClick();+ unawaited(store.set(experiment, next));+ }++ // One control to a screen reader: "Swarm, switch, off", not a button and a switch.+ return MergeSemantics(+ child: SettingsRow(+ key: ValueKey('settings-experiment-${experiment.id}'),+ title: experiment.label,+ detail: experiment.description,+ trailing: Switch.adaptive(+ value: on,+ activeTrackColor: Tty.of(context).green,+ onChanged: toggle,+ ),+ onTap: () => toggle(!on),+ ),+ );+ },+ );+}+/// What this phone is called on another screen's "took control" banner —/// the name the OS gives it until the person types their own here.class _PhoneNameRow extends StatelessWidget {diff --git a/mobile/lib/phone/unlock_computer_page.dart b/mobile/lib/phone/unlock_computer_page.dartindex 19c8f123d..a73809183 100644--- a/mobile/lib/phone/unlock_computer_page.dart+++ b/mobile/lib/phone/unlock_computer_page.dart@@ -288,11 +288,11 @@ class _UnlockComputerPageState extends State<UnlockComputerPage> {_show(_Step.starting,// Unlocked and still not online: signed out (a sign-out keeps it on the account's list,- // offline), or off its Wi-Fi. Either way its hotspot is back for Set up a device.+ // offline), or off its Wi-Fi. Either way its hotspot is back for Set up Intern 3.error:'$_name is unlocked but has not come online''${_newWifi == null ? '' : ' on "$_newWifi"'}. If it was signed out, or its Wi-Fi is '- 'wrong, it is waiting on "${widget.hotspotName}" to be set up: use Set up a device.',+ 'wrong, it is waiting on "${widget.hotspotName}" to be set up: use Set up Intern 3.',);}});@@ -528,7 +528,7 @@ class _UnlockComputerPageState extends State<UnlockComputerPage> {if (_error.isNotEmpty) ...[TtyPrimaryButton(key: const Key('unlock-set-up'),- label: 'Set up a device',+ label: 'Set up Intern 3',onPressed: () => Navigator.of(context).pushReplacement(phoneRoute((_) => AddDevicePage(notifier: _app)),),diff --git a/mobile/lib/settings/experimental_features.dart b/mobile/lib/settings/experimental_features.dartnew file mode 100644index 000000000..c41ee9927--- /dev/null+++ b/mobile/lib/settings/experimental_features.dart@@ -0,0 +1,79 @@+import 'dart:convert';++import 'package:flutter/foundation.dart';++import 'package:harness_mobile/core/harness_file_store.dart';+import 'package:harness_mobile/core/local_key_value_store.dart';++/// A feature this phone tries before everybody gets it: Settings ▸ Experimental, the desktop's+/// section of the same name (`desktop/lib/settings/experimental_features.dart`). Every one is off+/// until turned on.+///+/// ⚠️ **This phone's choice, not the account's.** The desktop's experiments are columns the backend+/// keeps for the account (`backend/src/lib/experimentalSettings.ts`), so one more of those is a+/// migration and a backend release. These exist to try a feature on one phone while it is being+/// built (owner, 2026-10-26), so they live in this phone's state file.+enum PhoneExperiment {+ /// Swarm on the phone, while its screens are built. Its way in, the Swarm command in Find, is+ /// offered only while this is on (`phone/phone_search_actions.dart`).+ swarm('swarm', 'Swarm', 'Open your Swarms from Find. Still taking shape.');++ const PhoneExperiment(this.id, this.label, this.description);++ /// Stable across releases: it is what the state file remembers.+ final String id;+ final String label, description;+}++/// Which [PhoneExperiment]s are on, remembered across launches. Loaded by `loadPersistedSettings()`+/// before the first frame, so a way in that is on never appears a frame late.+class ExperimentalFeaturesStore extends ValueNotifier<Set<PhoneExperiment>> {+ ExperimentalFeaturesStore({LocalKeyValueStore? storage})+ : _storage = storage ?? HarnessFileStore.shared,+ super(const {});++ static const _key = 'experimental_features';++ final LocalKeyValueStore _storage;++ /// Ids this build does not know, kept so a write does not drop an experiment a newer build of+ /// the app turned on (a TestFlight build, then the store's older one).+ Set<String> _unknown = const {};++ bool isOn(PhoneExperiment experiment) => value.contains(experiment);++ Future<void> load() async {+ try {+ final saved = await _storage.read(_key);+ if (saved == null) return;+ final decoded = jsonDecode(saved);+ if (decoded is! List) return;+ final ids = decoded.whereType<String>().toSet();+ final known = {+ for (final experiment in PhoneExperiment.values) experiment.id,+ };+ _unknown = ids.difference(known);+ value = {+ for (final experiment in PhoneExperiment.values)+ if (ids.contains(experiment.id)) experiment,+ };+ } on Exception {+ // Everything stays off; only the memory is missing.+ }+ }++ Future<void> set(PhoneExperiment experiment, bool on) async {+ if (isOn(experiment) == on) return;+ value = on+ ? {...value, experiment}+ : {...value.where((other) => other != experiment)};+ final ids = [..._unknown, for (final other in value) other.id]..sort();+ try {+ await _storage.write(_key, jsonEncode(ids));+ } on Exception {+ // Kept in memory for this run.+ }+ }+}++final experimentalFeaturesStore = ExperimentalFeaturesStore();diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dartindex 5ef712c6c..6fda1f981 100644--- a/mobile/lib/state/app_state.dart+++ b/mobile/lib/state/app_state.dart@@ -6160,7 +6160,8 @@ class AppNotifier extends ChangeNotifier {osStatus[machineId]?['harnessOs'] == true;/// What a Harness OS computer's daemon does for a phone beyond its update and Wi-Fi, as its status- /// says (CLI osDevice.ts `features`): `sign_out`, `password`, `ssh`. An older one says none.+ /// says (CLI osDevice.ts `features`): `sign_out`, `password`, `ssh`, `github`, `check_update`. An older+ /// one says none.bool osFeature(String machineId, String feature) {final features = osStatus[machineId]?['features'];return features is List && features.contains(feature);@@ -6257,7 +6258,7 @@ class AppNotifier extends ChangeNotifier {}/// Signed out from here: no Unlock for it any more. Its unlock would open the disk of a computer- /// that is set up again — with a sign-in, Set up a device — before it is online anywhere.+ /// that is set up again — with a sign-in, Set up Intern 3 — before it is online anywhere.void forgetHarnessOs(String machineId) {if (harnessOsComputers.remove(machineId) == null) return;_saveHarnessOs();@@ -7082,7 +7083,7 @@ class AppNotifier extends ChangeNotifier {/// `backend/src/routes/machines.ts` refuses anything longer.static const machineNameMaxLength = 40;- /// Computers this phone just set up (Settings ▸ Set up a device): Computers marks them "new" until+ /// Computers this phone just set up (Settings ▸ Set up Intern 3): Computers marks them "new" until/// one is opened. This run only.final Set<String> _newMachines = {};diff --git a/mobile/lib/swarm/swarm_page.dart b/mobile/lib/swarm/swarm_page.dartnew file mode 100644index 000000000..96015e3b5--- /dev/null+++ b/mobile/lib/swarm/swarm_page.dart@@ -0,0 +1,54 @@+import 'package:flutter/material.dart';++import 'package:harness_mobile/phone/tty.dart';+import 'package:harness_mobile/phone/tty_controls.dart';+import 'package:harness_mobile/settings/experimental_features.dart';+import 'package:harness_mobile/shared/theme/app_theme.dart';++/// Swarm on the phone: where its screens go as they are built.+///+/// Reached only from the Swarm command in Find, which is offered only while Settings ▸+/// Experimental ▸ Swarm is on ([PhoneExperiment.swarm]). Until the first screen lands, this page+/// says so, and where the switch is.+class SwarmPage extends StatelessWidget {+ const SwarmPage({super.key});++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ final tty = Tty.of(context);+ return Scaffold(+ backgroundColor: tty.ground,+ body: SafeArea(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Align(+ alignment: Alignment.centerLeft,+ child: TtyBackButton(+ onPressed: () => Navigator.of(context).maybePop(),+ ),+ ),+ Padding(+ padding: const EdgeInsets.fromLTRB(Tty.origin, 8, Tty.origin, 0),+ child: TtyText(+ PhoneExperiment.swarm.label,+ size: TtySize.display,+ weight: FontWeight.w600,+ ),+ ),+ Padding(+ padding: const EdgeInsets.fromLTRB(Tty.origin, 16, Tty.origin, 0),+ child: Text(+ 'Swarm on the phone is still being built. '+ 'Turn it off in Settings ▸ Experimental.',+ key: const ValueKey('swarm-building'),+ style: tty.style(color: tty.faint, size: TtySize.row),+ ),+ ),+ ],+ ),+ ),+ );+ }+}diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yamlindex 9a2eae8fb..89a6847ef 100644--- a/mobile/pubspec.yaml+++ b/mobile/pubspec.yaml@@ -2,7 +2,7 @@ name: harness_mobiledescription: "Harness viewer for iOS and Android."publish_to: 'none'-version: 1.0.10+74+version: 1.0.11+75environment:sdk: ^3.13.0diff --git a/mobile/test/agent_handoff_test.dart b/mobile/test/agent_handoff_test.dartindex 89a36be74..6d0ace004 100644--- a/mobile/test/agent_handoff_test.dart+++ b/mobile/test/agent_handoff_test.dart@@ -266,7 +266,7 @@ void main() {});test('handed over to exactly the engines that take a first message', () {- for (final engine in ['claude', 'codex', 'opencode', 'hermes']) {+ for (final engine in ['claude', 'codex', 'opencode', 'omp', 'hermes']) {expect(supportsAgentHandoff(engine), isTrue, reason: engine);}for (final engine in ['cursor', 'pi', 'amp', 'terminal']) {diff --git a/mobile/test/computer_github_page_test.dart b/mobile/test/computer_github_page_test.dartnew file mode 100644index 000000000..0498548b2--- /dev/null+++ b/mobile/test/computer_github_page_test.dart@@ -0,0 +1,192 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/auth/auth_session.dart';+import 'package:harness_mobile/core/config.dart';+import 'package:harness_mobile/core/models.dart';+import 'package:harness_mobile/phone/computer_github_page.dart';+import 'package:harness_mobile/state/app_state.dart';++/// A Harness OS computer answering `os_device` `github` as CLI osDevice.ts does: signed out, then a+/// code while its sign-in waits, then the account once [enter] says the code was entered.+class _App extends AppNotifier {+ _App({this.login})+ : super(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ ) {+ machines = [box];+ machineStates['box'] = MachineState(box)..nodeOnline = true;+ }++ static const box = Machine(+ machineId: 'box',+ authMode: MachineAuthMode.remote,+ name: 'Harness-BD19',+ );++ String? login;+ bool waiting = false;++ /// The GitHub CLI gone: Sign in installs it first, until [installed].+ bool missing = false;+ bool installing = false;+ final asked = <String>[];++ void enter() {+ waiting = false;+ login = 'octo';+ }++ void installed() {+ missing = installing = false;+ waiting = true;+ }++ @override+ Future<Map<String, dynamic>> osDevice(+ String machineId,+ Map<String, dynamic> payload, {+ Duration timeout = const Duration(seconds: 25),+ }) async {+ if (payload['action'] != 'github') return {'error': 'BAD_REQUEST'};+ final state = payload['state'] as String;+ asked.add(state);+ if (state == 'sign_in' && missing) installing = true;+ if (installing || missing) {+ return {+ 'login': null,+ if (installing) 'installing': true else 'missing': true,+ };+ }+ if (state == 'sign_in' && login == null) waiting = true;+ if (state == 'sign_out') login = null;+ return {+ 'login': login,+ if (waiting)+ 'signingIn': {+ 'code': 'AB12-CD34',+ 'url': 'https://github.com/login/device',+ },+ };+ }+}++void main() {+ Future<(_App, List<Uri>)> pump(WidgetTester tester, {String? login}) async {+ final app = _App(login: login);+ addTearDown(app.dispose);+ final opened = <Uri>[];+ await tester.pumpWidget(+ MaterialApp(+ home: ComputerGithubPage(+ notifier: app,+ machineId: 'box',+ openPage: (url) async => opened.add(url),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return (app, opened);+ }++ testWidgets(+ 'signs in with a code entered on GitHub\'s page, the code copied for it',+ (tester) async {+ String? copied;+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ SystemChannels.platform,+ (call) async {+ if (call.method == 'Clipboard.setData') {+ copied = (call.arguments as Map)['text'] as String;+ }+ return null;+ },+ );+ final (app, opened) = await pump(tester);+ expect(find.byKey(const Key('github-sign-in')), findsOneWidget);++ await tester.tap(find.byKey(const Key('github-sign-in')));+ await tester.pumpAndSettle();+ expect(find.text('AB12-CD34'), findsOneWidget);++ await tester.tap(find.byKey(const Key('github-open')));+ await tester.pumpAndSettle();+ expect(copied, 'AB12-CD34');+ expect(opened, [Uri.parse('https://github.com/login/device')]);++ // Entered on GitHub: the page follows the sign-in on its own, to the account.+ app.enter();+ await tester.pump(const Duration(seconds: 3));+ await tester.pumpAndSettle();+ expect(find.text('@octo'), findsOneWidget);+ expect(find.byKey(const Key('github-sign-out')), findsOneWidget);+ expect(app.asked.first, 'status');+ expect(app.asked, contains('sign_in'));+ },+ );++ testWidgets(+ 'a computer without the GitHub CLI installs it, then shows the code',+ (tester) async {+ final app = _App()..missing = true;+ addTearDown(app.dispose);+ await tester.pumpWidget(+ MaterialApp(+ home: ComputerGithubPage(notifier: app, machineId: 'box'),+ ),+ );+ await tester.pumpAndSettle();+ expect(+ find.textContaining('signing in installs it first'),+ findsOneWidget,+ );++ await tester.tap(find.byKey(const Key('github-sign-in')));+ await tester.pump();+ await tester.pump();+ expect(find.byKey(const Key('github-installing')), findsOneWidget);++ // Installed on the computer: the page, following it, comes to the code.+ app.installed();+ await tester.pump(const Duration(seconds: 3));+ await tester.pump();+ expect(find.text('AB12-CD34'), findsOneWidget);+ },+ );++ testWidgets('back from GitHub\'s page, it asks at once', (tester) async {+ final (app, _) = await pump(tester);+ await tester.tap(find.byKey(const Key('github-sign-in')));+ await tester.pump();+ await tester.pump();+ expect(find.text('AB12-CD34'), findsOneWidget);++ // Behind the browser while the code is entered, then back.+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.hidden);+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.paused);+ app.enter();+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.hidden);+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive);+ tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed);+ await tester.pump();+ await tester.pump();+ expect(find.text('@octo'), findsOneWidget);+ });++ testWidgets('signs out, once asked', (tester) async {+ final (app, _) = await pump(tester, login: 'octo');+ expect(find.text('@octo'), findsOneWidget);++ await tester.tap(find.byKey(const Key('github-sign-out')));+ await tester.pumpAndSettle();+ expect(find.text('Sign Harness-BD19 out of GitHub?'), findsOneWidget);+ await tester.tap(find.text('Sign out'));+ await tester.pumpAndSettle();++ expect(app.asked.last, 'sign_out');+ expect(find.byKey(const Key('github-sign-in')), findsOneWidget);+ });+}diff --git a/mobile/test/first_task_test.dart b/mobile/test/first_task_test.dartindex 8d2774d6c..82be32849 100644--- a/mobile/test/first_task_test.dart+++ b/mobile/test/first_task_test.dart@@ -54,6 +54,8 @@ void main() {if (e.value) e.key,}, kFirstTaskEngines);expect(takesFirstTask('hermes'), isTrue);+ // The CLI's omp takes one too (the desktop's list has it): New dropped its task here.+ expect(takesFirstTask('omp'), isTrue);// Every engine the phone offers is in the CLI's table, one way or the other.for (final engine in allEngines) {expect(entries.keys, contains(engine.id), reason: engine.id);diff --git a/mobile/test/phone_edge/find_behavior_test.dart b/mobile/test/phone_edge/find_behavior_test.dartindex a40a85923..47bdee98a 100644--- a/mobile/test/phone_edge/find_behavior_test.dart+++ b/mobile/test/phone_edge/find_behavior_test.dart@@ -9,7 +9,9 @@ import 'package:harness_mobile/phone/settings_page.dart';import 'package:harness_mobile/phone/terminal_search.dart';import 'package:harness_mobile/phone/tty_controls.dart' show TtyFieldMic;import 'package:harness_mobile/phone/voice_input_controller.dart';+import 'package:harness_mobile/settings/experimental_features.dart';import 'package:harness_mobile/state/app_state.dart';+import 'package:harness_mobile/swarm/swarm_page.dart';import '../voice_fakes.dart';import 'edge_fixture.dart';@@ -269,6 +271,27 @@ void main() {await close(tester, app);});+ testWidgets('Swarm is a command only while its experiment is on', (+ tester,+ ) async {+ // In memory only: the value, not the store's write, so nothing reaches the state file.+ addTearDown(() => experimentalFeaturesStore.value = const {});+ final (:app, :closes, opened: _, voice: _, stt: _) = await openFind(tester);+ await tester.enterText(find.byType(TextField), 'swarm');+ await frames(tester);+ expect(find.text('Swarm', findRichText: true), findsNothing);++ experimentalFeaturesStore.value = {PhoneExperiment.swarm};+ await tester.enterText(find.byType(TextField), 'swar');+ await frames(tester);+ await tester.tap(find.text('Swarm', findRichText: true).last);+ await frames(tester, count: 6);+ expect(closes, isNotEmpty);+ expect(find.byType(SwarmPage), findsOneWidget);+ expect(find.byKey(const ValueKey('swarm-building')), findsOneWidget);+ await close(tester, app);+ });+testWidgets('a pull left that does not go far enough settles back', (tester,) async {diff --git a/mobile/test/phone_edge/settings_behavior_test.dart b/mobile/test/phone_edge/settings_behavior_test.dartindex de6b5363c..2d2fd7060 100644--- a/mobile/test/phone_edge/settings_behavior_test.dart+++ b/mobile/test/phone_edge/settings_behavior_test.dart@@ -7,9 +7,11 @@ import 'package:harness_mobile/phone/machines_tab.dart';import 'package:harness_mobile/phone/privacy_policy.dart';import 'package:harness_mobile/phone/settings_page.dart';import 'package:harness_mobile/phone/welcome/how_it_works.dart';+import 'package:harness_mobile/settings/experimental_features.dart';import 'package:harness_mobile/state/app_state.dart';import 'package:package_info_plus/package_info_plus.dart';+import '../voice_fakes.dart' show MemoryKeyValueStore;import 'edge_fixture.dart';/// Settings as somebody goes through it: every row that opens something, opened and put away.@@ -34,6 +36,7 @@ void main() {bool sample = false,CurrentUserProfile? user,ProductMeasurement? usage,+ ExperimentalFeaturesStore? experiments,}) async {setPhone(tester, largePhone);final app = edgeApp(productMeasurement: usage);@@ -44,7 +47,11 @@ void main() {name: 'Ada Lovelace',email: '[email protected]',);- final page = SettingsPage(notifier: app, large: large);+ final page = SettingsPage(+ notifier: app,+ large: large,+ experiments: experiments,+ );await tester.pumpWidget(phoneApp(Builder(@@ -227,6 +234,45 @@ void main() {await close(tester, app);});+ testWidgets(+ 'Experimental: Swarm is off until switched, by the row or its switch',+ (tester) async {+ final storage = MemoryKeyValueStore();+ final experiments = ExperimentalFeaturesStore(storage: storage);+ final app = await openSettings(tester, experiments: experiments);+ final row = find.byKey(const ValueKey('settings-experiment-swarm'));+ await tester.scrollUntilVisible(+ row,+ 200,+ scrollable: find.byType(Scrollable).last,+ );+ expect(find.text('experimental'), findsOneWidget);+ expect(+ find.descendant(of: row, matching: find.text('Swarm')),+ findsOneWidget,+ );+ Switch toggle() => tester.widget<Switch>(+ find.descendant(of: row, matching: find.byType(Switch)),+ );+ expect(toggle().value, isFalse);++ // Anywhere on the row turns it on, and the choice is written for the next launch.+ await tester.tap(find.descendant(of: row, matching: find.text('Swarm')));+ await frames(tester);+ expect(toggle().value, isTrue);+ expect(experiments.isOn(PhoneExperiment.swarm), isTrue);+ expect(storage.values['experimental_features'], '["swarm"]');++ // The switch itself turns it off again.+ await tester.tap(find.descendant(of: row, matching: find.byType(Switch)));+ await frames(tester);+ expect(toggle().value, isFalse);+ expect(experiments.isOn(PhoneExperiment.swarm), isFalse);+ expect(storage.values['experimental_features'], '[]');+ await close(tester, app);+ },+ );+testWidgets('inside the sample: the way out, and no sample to try', (tester,) async {diff --git a/mobile/test/phone_sheet_rebuild_test.dart b/mobile/test/phone_sheet_rebuild_test.dartnew file mode 100644index 000000000..36018499c--- /dev/null+++ b/mobile/test/phone_sheet_rebuild_test.dart@@ -0,0 +1,47 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/phone/phone_sheet.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';++/// A sheet whose rows wait on an answer asked as it opens — a computer's Harness OS status, which+/// brings its GitHub and SSH rows: they show while it is open, not only the next time.+void main() {+ testWidgets('a sheet reads its rows again when what they come from changes', (+ tester,+ ) async {+ final answered = ValueNotifier(false);+ addTearDown(answered.dispose);+ PhoneSheetAction row(String label) =>+ PhoneSheetAction(icon: LucideIcons.wifi300, label: label, onTap: () {});+ await tester.pumpWidget(+ MaterialApp(+ home: Builder(+ builder: (context) => TextButton(+ onPressed: () => showPhoneSheet(+ context,+ title: 'Harness-BD19',+ rebuildOn: answered,+ rows: () => (+ actions: [+ row('Rename…'),+ if (answered.value) ...[row('GitHub'), row('SSH')],+ ],+ sections: const [],+ ),+ ),+ child: const Text('open'),+ ),+ ),+ ),+ );+ await tester.tap(find.text('open'));+ await tester.pumpAndSettle();+ expect(find.text('Rename…'), findsOneWidget);+ expect(find.text('GitHub'), findsNothing);++ answered.value = true;+ await tester.pumpAndSettle();+ expect(find.text('GitHub'), findsOneWidget);+ expect(find.text('SSH'), findsOneWidget);+ });+}diff --git a/mobile/test/settings/experimental_features_test.dart b/mobile/test/settings/experimental_features_test.dartnew file mode 100644index 000000000..78ee54468--- /dev/null+++ b/mobile/test/settings/experimental_features_test.dart@@ -0,0 +1,136 @@+import 'package:flutter/widgets.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/core/snapshot_store.dart';+import 'package:harness_mobile/core/startup.dart';+import 'package:harness_mobile/phone/phone_name_store.dart';+import 'package:harness_mobile/phone/voice_language_store.dart';+import 'package:harness_mobile/settings/experimental_features.dart';+import 'package:harness_mobile/shared/theme/appearance_prefs_store.dart';+import 'package:harness_mobile/stats/harness_stats.dart';+import 'package:harness_mobile/terminal/terminal_font_store.dart';+import 'package:harness_mobile/terminal/terminal_theme_store.dart';++import '../voice_fakes.dart';++/// Counts writes, so a test can say a choice that changed nothing wrote nothing.+class _CountingStore extends MemoryKeyValueStore {+ int writes = 0;++ @override+ Future<void> write(String key, String value) {+ writes++;+ return super.write(key, value);+ }+}++void main() {+ late _CountingStore storage;+ setUp(() => storage = _CountingStore());++ test('every experiment is off until turned on', () async {+ final store = ExperimentalFeaturesStore(storage: storage);+ await store.load();+ expect(store.value, isEmpty);+ expect(store.isOn(PhoneExperiment.swarm), isFalse);+ });++ test('turned on, it is remembered and restored next time', () async {+ final store = ExperimentalFeaturesStore(storage: storage);+ await store.set(PhoneExperiment.swarm, true);+ expect(store.isOn(PhoneExperiment.swarm), isTrue);+ expect(storage.values['experimental_features'], '["swarm"]');++ final next = ExperimentalFeaturesStore(storage: storage);+ await next.load();+ expect(next.isOn(PhoneExperiment.swarm), isTrue);+ });++ test('turned off again, the next launch has it off', () async {+ final store = ExperimentalFeaturesStore(storage: storage);+ await store.set(PhoneExperiment.swarm, true);+ await store.set(PhoneExperiment.swarm, false);+ expect(store.isOn(PhoneExperiment.swarm), isFalse);++ final next = ExperimentalFeaturesStore(storage: storage);+ await next.load();+ expect(next.isOn(PhoneExperiment.swarm), isFalse);+ });++ test(+ 'a switch to where it already is writes nothing and tells nobody',+ () async {+ final store = ExperimentalFeaturesStore(storage: storage);+ var told = 0;+ store.addListener(() => told++);+ await store.set(PhoneExperiment.swarm, false);+ expect(storage.writes, 0);+ expect(told, 0);++ await store.set(PhoneExperiment.swarm, true);+ await store.set(PhoneExperiment.swarm, true);+ expect(storage.writes, 1);+ expect(told, 1);+ },+ );++ test(+ 'an experiment a newer build turned on survives this build\'s write',+ () async {+ storage.values['experimental_features'] = '["later_feature","swarm"]';+ final store = ExperimentalFeaturesStore(storage: storage);+ await store.load();+ expect(store.value, {PhoneExperiment.swarm});++ await store.set(PhoneExperiment.swarm, false);+ expect(storage.values['experimental_features'], '["later_feature"]');+ },+ );++ for (final (what, saved) in const [+ ('not JSON', 'swarm'),+ ('not a list', '{"swarm":true}'),+ ('a list of other things', '[1,true,null]'),+ ]) {+ test('a saved value that is $what leaves everything off', () async {+ storage.values['experimental_features'] = saved;+ final store = ExperimentalFeaturesStore(storage: storage);+ await store.load();+ expect(store.value, isEmpty);+ });+ }++ test('a storage that fails keeps the choice for this run', () async {+ final store = ExperimentalFeaturesStore(storage: _FailingStore());+ await store.load();+ expect(store.value, isEmpty);+ await store.set(PhoneExperiment.swarm, true);+ expect(store.isOn(PhoneExperiment.swarm), isTrue);+ });++ test('the app loads it before the first frame', () async {+ storage.values['experimental_features'] = '["swarm"]';+ final experiments = ExperimentalFeaturesStore(storage: storage);+ final prefs = MemoryKeyValueStore();+ await loadPersistedSettings(+ terminalFont: TerminalFontStore(storage: prefs),+ terminalTheme: TerminalThemeStore(storage: prefs),+ appearance: AppearancePrefsStore(storage: prefs),+ stats: HarnessStats(store: MemorySnapshotStore()),+ voiceLanguage: VoiceLanguageStore(+ storage: prefs,+ preferredLocales: const [Locale('en', 'US')],+ ),+ phoneName: PhoneNameStore(storage: prefs),+ experiments: experiments,+ );+ expect(experiments.isOn(PhoneExperiment.swarm), isTrue);+ });+}++class _FailingStore extends MemoryKeyValueStore {+ @override+ Future<String?> read(String key) async => throw Exception('disk');++ @override+ Future<void> write(String key, String value) async => throw Exception('disk');+}