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): swipe left opens Computers, New Harness in Find

tony2a9d44dfbf18
diff --git a/mobile/lib/phone/find_models.dart b/mobile/lib/phone/find_models.dart
index 40853f5bd..7eaebf885 100644
--- a/mobile/lib/phone/find_models.dart
+++ b/mobile/lib/phone/find_models.dart
@@ -155,7 +155,8 @@ class _FindModelsState extends State<FindModels> {
// Find's list: down from the field at the top, the same rows as every other mode.
return ListView(
padding: EdgeInsets.zero,
- keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
+ // A scroll keeps the keyboard, as in the harness list (`phone_search_results.dart`).
+ keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual,
children: rows,
);
},
diff --git a/mobile/lib/phone/machines_tab.dart b/mobile/lib/phone/machines_tab.dart
index d58752041..07d09b02f 100644
--- a/mobile/lib/phone/machines_tab.dart
+++ b/mobile/lib/phone/machines_tab.dart
@@ -28,21 +28,30 @@ import 'settings_page.dart' show PhoneSettingsButton;
/// 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, this.large = true});
+ const MachinesTab({
+ super.key,
+ required this.notifier,
+ this.large = true,
+ this.fromTerminal = false,
+ });
final AppNotifier notifier;
- /// The tab's big title. Off when this is PUSHED — from Settings — where it draws the back chevron
- /// above its title instead, as Settings itself does.
+ /// The tab's big title. Off when this is PUSHED — from Settings or a swipe left on the terminal —
+ /// where it draws the back chevron above its title instead, as Settings itself does.
final bool large;
+ /// Pushed by a swipe left on the terminal: a swipe right ANYWHERE goes back — the way home is the
+ /// same swipe the other way, as on the New Harness form.
+ final bool fromTerminal;
+
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: notifier,
builder: (context, _) {
AppTheme.watch(context);
final tty = Tty.of(context);
- return Scaffold(
+ final page = Scaffold(
backgroundColor: tty.ground,
body: SafeArea(
bottom: false,
@@ -82,8 +91,8 @@ class MachinesTab extends StatelessWidget {
onPressed: () => unawaited(notifier.retryMachines()),
),
// Large, this is the home screen while no computer is ready — locked, or off —
- // and nothing else on it leads to Settings or Sign out. Pushed (small), it came
- // FROM Settings, and back is the way there.
+ // and nothing else on it leads to Settings or Sign out. Pushed (small) — from
+ // Settings, or by the terminal's swipe left — back is the way out.
if (large) PhoneSettingsButton(notifier: notifier),
],
),
@@ -92,7 +101,39 @@ class MachinesTab extends StatelessWidget {
),
),
);
+ return fromTerminal ? _SwipeBack(child: page) : page;
+ },
+ );
+}
+
+/// A swipe right anywhere on [child] pops it — not only the system's sliver of left edge, which a
+/// thumb in the middle of the screen never finds. The New Harness form's reach and flick.
+class _SwipeBack extends StatefulWidget {
+ const _SwipeBack({required this.child});
+
+ final Widget child;
+
+ @override
+ State<_SwipeBack> createState() => _SwipeBackState();
+}
+
+class _SwipeBackState extends State<_SwipeBack> {
+ /// How far right the drag under way has gone.
+ double _swiped = 0;
+
+ @override
+ Widget build(BuildContext context) => GestureDetector(
+ // Translucent: the rows under the finger still take their taps; the list scrolls on the other
+ // axis.
+ behavior: HitTestBehavior.translucent,
+ onHorizontalDragStart: (_) => _swiped = 0,
+ onHorizontalDragUpdate: (details) => _swiped += details.primaryDelta ?? 0,
+ onHorizontalDragEnd: (details) {
+ if (_swiped >= 64 || (details.primaryVelocity ?? 0) >= 300) {
+ unawaited(Navigator.of(context).maybePop());
+ }
},
+ child: widget.child,
);
}
diff --git a/mobile/lib/phone/new_agent_page.dart b/mobile/lib/phone/new_agent_page.dart
index e601d7636..d05663308 100644
--- a/mobile/lib/phone/new_agent_page.dart
+++ b/mobile/lib/phone/new_agent_page.dart
@@ -22,6 +22,7 @@ import 'new_agent_draft.dart';
import 'new_agent_model_sheet.dart';
import 'phone_status.dart';
import 'new_agent_chooser.dart';
+import 'settings_page.dart' show PhoneSettingsButton;
import 'tty.dart';
import 'tty_controls.dart';
import 'voice_input_controller.dart';
@@ -724,8 +725,8 @@ class _NewAgentPageState extends State<NewAgentPage> {
return Scaffold(
backgroundColor: tty.ground,
body: SafeArea(
- // ⚠️ **A swipe right ANYWHERE goes back to Focus.** New is a swipe left from the terminal
- // (Snapchat's layout), and the way home is the same swipe the other way — not only the
+ // ⚠️ **A swipe right ANYWHERE goes back to Focus.** New comes in from the right (Find's
+ // New Harness), and the way home is the same swipe the other way — not only the
// system's sliver of left edge, which a thumb in the middle of the screen never finds.
child: GestureDetector(
behavior: HitTestBehavior.translucent,
@@ -743,8 +744,18 @@ class _NewAgentPageState extends State<NewAgentPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
+ // The way back where a thumb looks for it — Find's button is a tap, not a swipe, so
+ // the swipe right alone was a way out nobody was shown. Above the title, as on
+ // Computers and Settings.
+ Align(
+ alignment: Alignment.centerLeft,
+ child: TtyBackButton(
+ onPressed: () => Navigator.of(context).maybePop(),
+ ),
+ ),
Padding(
- padding: const EdgeInsets.fromLTRB(Tty.origin, 8, 4, 0),
+ // No right padding: Settings' box puts its glyph on the gutter itself.
+ padding: const EdgeInsets.fromLTRB(Tty.origin, 0, 0, 0),
child: Row(
children: [
Expanded(
@@ -763,8 +774,8 @@ class _NewAgentPageState extends State<NewAgentPage> {
size: TtySize.meta,
),
),
- // No Cancel: a swipe right goes back, the way a swipe left came in.
- const SizedBox(height: 44),
+ // Settings at the top right, as on Computers — its box keeps the row 44 tall.
+ PhoneSettingsButton(notifier: widget.notifier),
],
),
),
diff --git a/mobile/lib/phone/phone_search_results.dart b/mobile/lib/phone/phone_search_results.dart
index a5052467c..a4c9eff8c 100644
--- a/mobile/lib/phone/phone_search_results.dart
+++ b/mobile/lib/phone/phone_search_results.dart
@@ -265,9 +265,8 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {
/// The desk's tabs as the chips offer them: none off the plain list, and none where the desk has
/// no tabs or has not answered — and then no chips are drawn at all.
- List<DeskTabFilter> _tabs(PhoneSearchController search) => _plain(search)
- ? deskTabFilters(widget.notifier)
- : const [];
+ List<DeskTabFilter> _tabs(PhoneSearchController search) =>
+ _plain(search) ? deskTabFilters(widget.notifier) : const [];
/// The picked tab among [tabs]; null is All.
DeskTabFilter? _tab(List<DeskTabFilter> tabs) =>
@@ -465,7 +464,10 @@ class PhoneSearchResultsState extends State<PhoneSearchResults> {
}
items.add(() => const SizedBox(height: 24));
return ListView.builder(
- keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
+ // ⚠️ **A scroll keeps the keyboard.** Scrolling is looking through what the query found, not
+ // done with the query — put away on every drag, the next letter meant tapping the field
+ // again. A row picked ([_tap]) or the return key is what puts the keys away.
+ keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.manual,
padding: EdgeInsets.zero,
itemCount: items.length,
itemBuilder: (context, i) => items[i](),
diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dart
index 8ea24a7ae..644674e43 100644
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@ -38,11 +38,11 @@ import 'package:harness_mobile/widgets/terminal_panel.dart';
import 'agent_model_sections.dart';
import 'agent_model_sheet.dart';
-import 'agents_page.dart' show openNewAgent;
import 'daemon_chip.dart';
import 'daemon_scope.dart';
import 'delete_agent.dart';
import 'held_height.dart';
+import 'machines_tab.dart';
import 'phone_sheet.dart';
import 'phone_status.dart';
import 'settings_page.dart';
@@ -106,7 +106,7 @@ class TerminalPage extends StatefulWidget {
/// SIGWINCH to three remote shells at once.
final bool isActive;
- /// Whether a sideways swipe on the terminal opens Find (right) or a new agent (left).
+ /// Whether a sideways swipe on the terminal opens Find (right) or Computers (left).
///
/// Off for a page inside a pager of agents (`AgentSwipeHost` with neighbours), where the sideways
/// axis is the pager's: the terminal's own detector sits deeper and would win every drag.
@@ -1204,14 +1204,14 @@ class _TerminalPageState extends State<TerminalPage>
/// terminal still under a reader ([_AnchoredTerminal.reading]).
final _scrollback = ValueNotifier<({int above, int total})?>(null);
- /// How far left a drag has gone, for the swipe that opens a new agent.
+ /// How far left a drag has gone, for the swipe that opens Computers.
double _swipedLeft = 0;
/// Whether the drag under way is pulling Find in — it then drives the slide.
bool _swipingFind = false;
- /// A sideways drag this far left opens a new agent on letting go.
- static const double _newAgentReach = 64;
+ /// A sideways drag this far left opens Computers on letting go.
+ static const double _computersReach = 64;
/// A sideways fling at least this fast counts whatever distance it covered.
static const double _swipeFlick = 300;
@@ -1222,7 +1222,7 @@ class _TerminalPageState extends State<TerminalPage>
}
/// A drag's first move right pulls Find in, and from then on Find follows the finger; a drag
- /// that starts left is counted toward a new agent instead.
+ /// that starts left is counted toward Computers instead.
void _onSwipeUpdate(DragUpdateDetails details) {
final dx = details.primaryDelta ?? 0;
if (!_swipingFind) {
@@ -1242,7 +1242,7 @@ class _TerminalPageState extends State<TerminalPage>
/// Let go: Find stays if it was flung or is a third of the way out, and goes back otherwise. A
/// third, not half: Find is the whole screen wide, and half of it is a long reach for a thumb.
- /// A drag left far enough, or flung, opens a new agent.
+ /// A drag left far enough, or flung, opens Computers.
void _onSwipeEnd(DragEndDetails details) {
final velocity = details.primaryVelocity ?? 0;
if (_swipingFind) {
@@ -1255,8 +1255,8 @@ class _TerminalPageState extends State<TerminalPage>
}
return;
}
- if (_swipedLeft >= _newAgentReach || velocity <= -_swipeFlick) {
- unawaited(_newAgentHere());
+ if (_swipedLeft >= _computersReach || velocity <= -_swipeFlick) {
+ unawaited(_openComputers());
}
}
@@ -1279,18 +1279,21 @@ class _TerminalPageState extends State<TerminalPage>
return lines.reversed.join('\n');
}
- /// A new agent, on the machine of the one on screen — the form slides in from the right, the way
- /// a swipe left asks for.
+ /// Computers — the page Settings ▸ Computers opens — slid in from the right, the way a swipe left
+ /// asks for. A new harness is Find's `New Harness` now (see `terminal_search.dart`).
///
/// Rebuilt on the way back, as after every page pushed over this one: its chrome reads whether it
/// is the top route.
- Future<void> _newAgentHere() async {
+ Future<void> _openComputers() async {
dismissKeyboardForSwipe();
- await openNewAgent(
- context,
- widget.notifier,
- widget.machineId,
- voice: widget.voice,
+ await Navigator.of(context).push(
+ phoneRoute(
+ (_) => MachinesTab(
+ notifier: widget.notifier,
+ large: false,
+ fromTerminal: true,
+ ),
+ ),
);
if (mounted) setState(() {});
}
@@ -1903,8 +1906,8 @@ class _TerminalPageState extends State<TerminalPage>
const SizedBox.expand(),
// ⚠️ **VoiceOver's way in, and the only one.** xterm draws the terminal without a
// single semantics node, and VoiceOver keeps one-finger swipes for itself — so without
- // this, a VoiceOver user could neither hear what the agent last said nor reach Find or a
- // new harness, which the sideways swipes are the only way to. One node under everything,
+ // this, a VoiceOver user could neither hear what the agent last said nor reach Find or
+ // Computers, which the sideways swipes are the only way to. One node under everything,
// painting nothing and taking no touches: the agent's name, the last lines on its screen,
// and the two swipes as actions (VoiceOver's rotor, "Actions").
Positioned.fill(
@@ -1915,8 +1918,8 @@ class _TerminalPageState extends State<TerminalPage>
customSemanticsActions: widget.sideSwipes
? {
const CustomSemanticsAction(label: 'Find'): _openSearch,
- const CustomSemanticsAction(label: 'New harness'): () =>
- unawaited(_newAgentHere()),
+ const CustomSemanticsAction(label: 'Computers'): () =>
+ unawaited(_openComputers()),
}
: null,
child: const SizedBox.expand(),
@@ -1966,7 +1969,7 @@ class _TerminalPageState extends State<TerminalPage>
// ⚠️ **The two sideways swipes live here, on the
// terminal and nowhere else** — Snapchat's layout:
// right pulls Find in from the left edge, left opens
- // a new agent. The terminal scrolls vertically and
+ // Computers. The terminal scrolls vertically and
// selects only with a mouse, so the horizontal axis
// is free; the key bar below scrolls its hints
// sideways and keeps that for itself.
diff --git a/mobile/lib/phone/terminal_search.dart b/mobile/lib/phone/terminal_search.dart
index f0401c865..fb1a18cc0 100644
--- a/mobile/lib/phone/terminal_search.dart
+++ b/mobile/lib/phone/terminal_search.dart
@@ -259,8 +259,9 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
}
/// `+`: away first, then the new-agent form. Null while no machine can take one.
- /// `+ New Harness` — in the project the query matched when there is one; else on the machine of
- /// the harness on screen, as a swipe left does; else the command's first ready machine.
+ /// `+ New Harness` and the button at the foot — in the project the query matched when there is
+ /// one (the row only); else on the machine of the harness on screen; else the command's first
+ /// ready machine.
void Function(({String machineId, String folder, String label})? place)?
_newAgent() {
final showing = widget.showing;
@@ -447,6 +448,8 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
builder: (context, _) {
final newAgent = _newAgent();
final hasText = _controller.text.isNotEmpty;
+ // `:` — the models of the harness on screen, not harnesses: no New Harness under them.
+ final models = _search.isModelMode && widget.showing != null;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -506,7 +509,7 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
),
const SizedBox(height: 4),
Expanded(
- child: switch ((_search.isModelMode, widget.showing)) {
+ child: switch ((models, widget.showing)) {
// `:` — the models the harness on screen can run on.
(true, final showing?) => FindModels(
notifier: widget.notifier,
@@ -528,6 +531,29 @@ class _TerminalSearchOverlayState extends State<TerminalSearchOverlay>
),
},
),
+ // ⚠️ **Stuck to the foot, outside the list.** The list's own `+ New Harness` row
+ // comes after every harness on the account — a few hundred rows down, where no
+ // thumb goes. This one is always in reach, riding the keyboard while it is up. On
+ // the machine of the harness on screen, as that row does with nothing typed.
+ //
+ // ⚠️ **Kept while a keyboard is up.** It was hidden with the keys once, and on an
+ // iPhone that meant never: Find raises the keyboard as it opens, a scroll keeps
+ // it (see `phone_search_results.dart`), and the iPhone's keys have no button to
+ // put them away — so the button never came back.
+ if (newAgent != null && !models)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ Tty.origin,
+ 8,
+ Tty.origin,
+ 8,
+ ),
+ child: TtyPrimaryButton(
+ key: const ValueKey('find-new-harness'),
+ label: 'New Harness',
+ onPressed: () => newAgent(null),
+ ),
+ ),
// Over the home indicator while the keyboard is down; on the keys once it is up.
SizedBox(height: widget.bottomInset),
],
diff --git a/mobile/lib/phone/welcome/focus_hints.dart b/mobile/lib/phone/welcome/focus_hints.dart
index 687c9033d..07ea3885d 100644
--- a/mobile/lib/phone/welcome/focus_hints.dart
+++ b/mobile/lib/phone/welcome/focus_hints.dart
@@ -61,14 +61,14 @@ class FocusHintsSeen {
}
/// Focus's first-time hints: the three things a phone can do here that nothing on screen says —
-/// swipe right for your harnesses, swipe left for a new one, the mic to talk. Laid over the
+/// swipe right for your harnesses, swipe left for your computers, the mic to talk. Laid over the
/// terminal once, in the terminal's own type; any touch puts them away for good.
///
/// ```
/// tap the title ─ rename, restart, paste…
///
/// → swipe right swipe left ←
-/// all your harnesses start a new one
+/// all your harnesses your computers
///
/// talk to it
/// ( mic )
@@ -160,8 +160,8 @@ class _FocusHintsState extends State<FocusHints> {
child: IgnorePointer(
child: Semantics(
label:
- 'Tips: swipe right for all your harnesses, swipe left to start '
- 'one, tap the title for its menu, the mic to talk.',
+ 'Tips: swipe right for all your harnesses, swipe left for your '
+ 'computers, tap the title for its menu, the mic to talk.',
child: Material(
color: tty.ground.withValues(alpha: 0.95),
child: Stack(
@@ -190,7 +190,7 @@ class _FocusHintsState extends State<FocusHints> {
alignment: Alignment.centerRight,
child: hint(
'swipe left ←',
- 'start a new one',
+ 'your computers',
align: TextAlign.right,
),
),
diff --git a/mobile/lib/phone/welcome/how_it_works.dart b/mobile/lib/phone/welcome/how_it_works.dart
index 44eef3e12..53f5dd701 100644
--- a/mobile/lib/phone/welcome/how_it_works.dart
+++ b/mobile/lib/phone/welcome/how_it_works.dart
@@ -50,7 +50,7 @@ class HowItWorksPage extends StatelessWidget {
static const _gestures = [
('swipe right', 'all your harnesses'),
- ('swipe left', 'start a new harness'),
+ ('swipe left', 'your computers'),
('tap the title', 'rename, restart, paste'),
('hold the title', 'back to the last harness'),
('esc', 'stop what it is doing'),