Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(mobile): Machines is a row in the ⋯ sheet that opens the machines page

bubu-dudu902df4ee2424
diff --git a/mobile/lib/phone/machine_actions.dart b/mobile/lib/phone/machine_actions.dart
index edb139a6b..f409109bb 100644
--- a/mobile/lib/phone/machine_actions.dart
+++ b/mobile/lib/phone/machine_actions.dart
@@ -3,55 +3,14 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
-import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/state/app_state.dart';
import 'link_page.dart';
-import 'machine_index.dart';
import 'phone_navigation.dart';
import 'phone_sheet.dart';
import 'phone_status.dart';
import 'unlink_machine.dart';
-/// Every machine on the account as sheet rows, for the terminal's `⋯` menu — where machines are
-/// reached now that search lists agents only.
-///
-/// Each row carries its state as a word, and does what that state calls for: a password form, a
-/// sheet of actions, or — offline — nothing, drawn dimmed so its absence is not a mystery.
-List<PhoneSheetAction> machineSheetRows(
- BuildContext context,
- AppNotifier notifier,
-) => [
- for (final machine in visibleMachines(notifier))
- PhoneSheetAction(
- icon: LucideIcons.laptopMinimal300,
- label: machine.machine.displayName,
- value: _stateWord(machine),
- valueColor: _stateColor(machine),
- enabled: phoneMachineStatusOf(machine) != PhoneMachineStatus.offline,
- onTap: () =>
- openMachineActions(context, notifier, machine.machine.machineId),
- ),
-];
-
-/// Green for a machine that answers, yellow for one waiting on its password — the two states worth
-/// telling apart at a glance. The rest keep the row's faint colour.
-Color? _stateColor(MachineState machine) =>
- switch (phoneMachineStatusOf(machine)) {
- PhoneMachineStatus.ready => AppPalette.online,
- PhoneMachineStatus.needsPassword => AppPalette.warn,
- PhoneMachineStatus.connecting => AppPalette.accent,
- PhoneMachineStatus.offline => null,
- };
-
-String _stateWord(MachineState machine) =>
- switch (phoneMachineStatusOf(machine)) {
- PhoneMachineStatus.ready => 'Connected',
- PhoneMachineStatus.connecting => 'Connecting…',
- PhoneMachineStatus.needsPassword => 'Unlock',
- PhoneMachineStatus.offline => 'Offline',
- };
-
/// A machine that wants its password opens the form for it. One that is linked opens a sheet of
/// what can be done TO it — reload its agents, re-enter its password, unlink this phone.
///
diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dart
index ba3051cad..d52e0f08f 100644
--- a/mobile/lib/phone/machines_tab.dart
+++ b/mobile/lib/phone/machines_tab.dart
@@ -8,6 +8,7 @@ import 'package:harness_mobile/shared/widgets/empty_state.dart';
import 'package:harness_mobile/state/app_state.dart';
import 'link_page.dart';
+import 'machine_actions.dart';
import 'machine_index.dart';
import 'machine_tile.dart';
import 'phone_card.dart';
@@ -15,8 +16,6 @@ import 'phone_header.dart';
import 'phone_navigation.dart';
import 'phone_search_button.dart';
import 'phone_status.dart';
-import 'phone_sheet.dart';
-import 'unlink_machine.dart';
/// The machines on the account, grouped by what they need.
///
@@ -27,10 +26,14 @@ import 'unlink_machine.dart';
/// Harness that is not running — collect underneath, where they read as a to-do list rather than
/// as the thing standing between you and the machine you actually came for.
class MachinesTab extends StatelessWidget {
- const MachinesTab({super.key, required this.notifier});
+ const MachinesTab({super.key, required this.notifier, this.large = true});
final AppNotifier notifier;
+ /// The tab's big title. Off when this is PUSHED — from the terminal's `⋯` sheet — where it needs
+ /// the back chevron that a large header does not draw.
+ final bool large;
+
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: notifier,
@@ -47,7 +50,7 @@ class MachinesTab extends StatelessWidget {
// nothing about what it finds — a machine hunted for from here
// and an agent hunted for from there are one query.
PhoneHeader(
- large: true,
+ large: large,
title: 'Machines',
trailing: [
if (notifier.machines.isNotEmpty)
@@ -157,27 +160,10 @@ class _Body extends StatelessWidget {
);
return;
}
- // ⚠️ One row, and it is load-bearing rather than a menu waiting to grow. Unlinking asks for no
- // confirmation, so this sheet IS the confirmation: the step between a finger landing on a row
- // in a list and this phone losing its pairing. Collapsing it into the tap would leave nothing
- // between them.
- //
- // No "Re-enter password" here. A machine that is linked has a working password already, and the
- // way to replace one is to give this one up and enter the new one — the row below, then the row
- // the machine lands on in "Needs your attention".
- showPhoneSheet(
- context,
- title: state.machine.displayName,
- actions: [
- // No trailing `…`: this acts on the tap rather than opening anything.
- PhoneSheetAction(
- icon: LucideIcons.unlink300,
- label: 'Unlink this phone',
- destructive: true,
- onTap: () => unawaited(unlinkThisPhone(context, notifier, state)),
- ),
- ],
- );
+ // The same sheet the terminal's `⋯` used to open for a machine — reload its agents, re-enter its
+ // password, unlink this phone. One place decides what a machine offers, so a machine tapped here
+ // and a machine tapped from there cannot drift apart.
+ openMachineActions(context, notifier, state.machine.machineId);
}
}
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index 61868e3d8..ba4aee443 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -18,7 +18,7 @@ import 'package:harness_mobile/widgets/terminal_panel.dart';
import 'agents_page.dart' show openNewAgent;
import 'delete_agent.dart';
-import 'machine_actions.dart';
+import 'machines_tab.dart';
import 'phone_navigation.dart' show phoneRoute;
import 'phone_sheet.dart';
import 'phone_status.dart';
@@ -1041,23 +1041,26 @@ class _TerminalPageState extends State<TerminalPage>
title: '$agentName · $machineName',
// Two lines — the agent, then its machine — shown in full.
titleParts: [agentName, machineName],
- // Three groups, by what each row acts on: this agent, the app, and the machines. Machines
- // moved here from search, which now finds agents only.
+ // Two groups: what acts on THIS agent, and the two screens the app itself has. Machines is a
+ // door like Settings rather than a list of its own — the list belongs on the page behind it,
+ // where it has room for every machine and does not push the rest of this sheet down.
sections: [
PhoneSheetSection(
caption: 'Agent',
actions: [..._agentActions(agentName)],
),
- // Four machines, then "N more": the sheet has to stay short enough that App below is not
- // pushed off a small phone by an account with a rack of machines.
- PhoneSheetSection(
- caption: 'Machines',
- actions: machineSheetRows(context, widget.notifier),
- maxVisible: 4,
- ),
PhoneSheetSection(
caption: 'App',
actions: [
+ PhoneSheetAction(
+ icon: LucideIcons.laptopMinimal300,
+ label: 'Machines',
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) => MachinesTab(notifier: widget.notifier, large: false),
+ ),
+ ),
+ ),
PhoneSheetAction(
icon: LucideIcons.settings300,
label: 'Settings',