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.

Merge branch 'main' into feat/mobile-ios-android

Dev jacobe53fda116043
diff --cc mobile/lib/phone/terminal_page.dart
index 14bf67145,4452cb43d..c91073533
--- a/mobile/lib/phone/terminal_page.dart
+++ b/mobile/lib/phone/terminal_page.dart
@@@ -35,16 -43,24 +43,25 @@@ import 'held_height.dart'
import 'phone_sheet.dart';
import 'phone_status.dart';
import 'settings_page.dart';
- import 'status_pill.dart';
+ import 'session_work_page.dart';
import 'terminal_action_column.dart';
import 'terminal_chrome_scroll.dart';
- import 'terminal_header.dart';
- import 'terminal_header_action.dart';
import 'terminal_input_dock.dart';
+import 'terminal_paste.dart';
import 'terminal_search.dart';
+ import 'tty.dart';
+ import 'tty_controls.dart';
+ import 'question_keys.dart';
+ import 'voice_bar_line.dart';
+ import 'voice_mic_button.dart';
+ import 'phone_navigation.dart';
+ import 'phone_search_catalog.dart' show phoneAgentId;
+ import 'agent_index.dart';
+ import 'terminal_title.dart';
+ import 'welcome/focus_hints.dart';
+
+ import 'package:harness_mobile/demo/sample_mode.dart';
+
import 'voice_input_controller.dart';
/// One agent's terminal, filling the phone. The header says whose it is and whether it is live;
@@@ -1663,99 -2048,101 +2049,102 @@@ class _TerminalPageState extends State<
right: 0,
child: _SlideAway(
progress: _chrome.header,
- // Opaque: the terminal is underneath now, and the row has to
- // read as the same bar it was when the two were stacked.
- child: ColoredBox(
- color: AppPalette.windowBg,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- TerminalHeader(
- agent: agent,
- status: headerStatus,
- machineName: machine?.machine.displayName,
- trailing: [
- // Read-only is a state to get OUT of, so its way
- // out is a labelled button in the header rather
- // than a line in the actions sheet: the sheet is
- // where you go having decided to do something,
- // and this is the thing telling you that typing
- // will go nowhere until you do.
- // ⚠️ **Not while the band is up.** The band below
- // carries the same words and the same button, a
- // finger's width under this one, and two "Take
- // control"s stacked read as two different offers.
- // The band is the better of the two — it says WHY
- // typing stopped, and by whom — so this one gives
- // way to it.
- //
- // Kept for the states the band does not cover:
- // "Reconnect", for a stream that died with nobody
- // else involved. See [_ControlBanner]. Gone while
- // that stream is already coming back — see
- // `reconnecting` above.
- if (reclaim != null &&
- !blocked &&
- _reclaiming == null)
- _ReclaimButton(
- action: reclaim,
- // The same call the band's button makes — see
- // [_takeControl].
- onPressed: () =>
- unawaited(_takeControl()),
- ),
- // ⚠️ **No tabs mark here.** The account's tabs
- // are the first thing the floating Search button
- // opens, above the thumb — see
- // [TerminalSearchOverlay] — and a mark up here
- // for the same panel was a second door to it.
- // Null while the agent is not loaded: there is
- // nothing to act on yet, and a menu of actions
- // that all fail is worse than no menu.
- if (agent != null)
- TerminalHeaderAction(
- // Stood up, not laid flat: three dots in a
- // column is the narrower mark AND the one a
- // phone means by "more actions", so it reads
- // as a menu rather than as a truncation.
- icon: LucideIcons.ellipsisVertical300,
- size: 21,
- tooltip: 'Harness actions',
- // Last in the row, so its padding stops at
- // the header's own right inset.
- last: true,
- onPressed: () => _showActions(
- machineName:
- machine?.machine.displayName ?? '',
- agent: agent,
- status: headerStatus,
- session: session,
- ),
- ),
- ],
- ),
- // The hairline, carrying a sweep while the header
- // reads as a wait — Attaching, Resyncing,
- // Reconnecting. See [TerminalHeaderRule].
- TerminalHeaderRule(
- busy: headerStatus.tone == PhoneTone.busy,
- ),
- // ⚠️ Inside the header's own slide, not under it: the two are one bar as far
- // as a scroll is concerned, and a band left behind while the header left
- // would sit on the output with nothing above it.
- //
- // Up for a take in flight, not for a reconnect: that one is the header's
- // own wait, and a band over it said "Taking control…" of a stream nobody
- // else held. See [_reclaiming].
- if (blocked || _reclaiming == _Reclaim.control)
- _ControlBanner(
- watching: session?.watching ?? false,
- busy: !blocked,
- takeoverNotice: takeoverNotice,
- holderName: holderName,
- onTakeControl: _takeControl,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ TerminalTitle(
+ sample: SampleMode.maybeOf(context) != null,
+ name:
+ agent?.displayName ?? _cachedAgentName ?? '',
+ place: _placeOf(agent, machine),
+ branch:
+ agent?.gitContext?.branchLabel ??
+ agent?.displayProject?.branch,
+ // In the sample the guide line says it, once is enough.
+ asking: SampleMode.maybeOf(context) != null
+ ? null
+ : _askingElsewhere(),
+ onHold: _openLastHarness,
+ onFind: _openSearch,
+ onTap: () {
+ if (agent == null) return;
+ _showActions(
+ machineName:
+ machine?.machine.displayName ?? '',
+ agent: agent,
++ session: session,
+ );
+ },
+ ),
+ // ⚠️ No "take control" band: a tap or a scroll on a terminal held
+ // elsewhere takes it — see `onInputTap` and [_onScrollTakeControl].
+ ],
+ ),
+ ),
+ ),
+ // ⚠️ No `[42/1380]` at the top right while reading back, by the owner's
+ // call (2026-09-27): "we don't need the scrolling indicator". The history
+ // scrolls like any list; scrolling down is the way back to the stream.
+ // The line above the mic: what is going on, in a few words — see [_statusLine].
+ if (!_ownsInput)
+ Positioned(
+ left: 0,
+ right: 0,
+ bottom: _statusBottom - _StatusLine.below,
+ child: IgnorePointer(
+ child: ListenableBuilder(
+ listenable: Listenable.merge([
+ widget.voice,
+ _barMessage,
+ _scrollback,
+ ]),
+ builder: (context, _) =>
+ _statusLine() ?? const SizedBox.shrink(),
+ ),
+ ),
+ ),
+ // How loud the take is: a glow behind the mic that swells with the voice.
+ if (!_ownsInput)
+ ListenableBuilder(
+ listenable: widget.voice,
+ builder: (context, _) =>
+ widget.voice.status == VoiceInputStatus.listening
+ ? Positioned(
+ left: 0,
+ right: 0,
+ bottom: _micCenter - VoiceLevelHalo.extent / 2,
+ child: IgnorePointer(
+ child: Center(
+ child: VoiceLevelHalo(voice: widget.voice),
+ ),
),
- ],
+ )
+ : const Positioned(
+ left: 0,
+ bottom: 0,
+ child: SizedBox.shrink(),
+ ),
+ ),
+ // The mic: Siri's orb, low at the foot and centred, floating
+ // over the terminal — which stays full screen under it, the
+ // way the home screen stays whole under Siri. Laid over the
+ // whole page so its capsule, rising as it talks, still takes
+ // taps.
+ if (!_ownsInput)
+ Positioned(
+ left: 0,
+ right: 0,
+ bottom: _micCenter - VoiceMicButton.extent / 2,
+ // Centred at its own size — the mic's slot must not
+ // stretch to the page's width.
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ heightFactor: 1,
+ // Always there, reading or not: what is read is what gets answered.
+ child: TerminalActionColumn(
+ voice: widget.voice,
+ session: session,
+ working: _agentWorking,
),
),
),
@@@ -1835,15 -2279,7 +2281,11 @@@
});
}
- void _showActions({required String machineName, required Agent agent}) {
+ void _showActions({
+ required String machineName,
+ required Agent agent,
- required PhoneSummary status,
+ TerminalSession? session,
+ }) {
- // Set here, where no build is running, so the sheet opens on the dot the header shows now
- // rather than on whatever the last frame handed over. See [_actionsStatus].
- _actionsStatus.value = status;
final agentName = agent.displayName;
showPhoneSheet(
context,
@@@ -1879,41 -2299,18 +2305,27 @@@
// them, where they have room for every row and do not push the rest of this sheet down. The
// chevron is what tells a door from an action.
sections: [
- PhoneSheetSection(actions: _agentActions(agent)),
+ PhoneSheetSection(
+ actions: [
+ // First, because it is the one used mid-conversation: iOS has no paste gesture on a
+ // terminal (long-press is selection there), and the soft keyboard has no paste key.
+ // Hidden rather than dimmed while the stream is read-only: reclaiming is the header's
+ // job, and a paste that silently goes nowhere is worse than no row.
+ if (session != null && session.acceptsInput) _pasteAction(session),
+ ..._agentActions(agent),
+ ],
+ ),
+ // Harnesses and Machines went: Find (a swipe right) is every agent on every computer, and
+ // the computers are a row in Settings.
PhoneSheetSection(
- caption: 'App',
actions: [
- // Every agent on the account, not just this machine's: the sheet is opened from inside
- // one agent, and the thing somebody wants from here is another agent — which is as
- // often on the other laptop as on this one.
- //
- // [AgentsListPage] draws them, with the magnifier in its header for when the list is
- // longer than a screenful.
- PhoneSheetAction(
- icon: LucideIcons.squareTerminal300,
- label: 'Harnesses',
- chevron: true,
- onTap: () => unawaited(_openAgentList()),
- ),
- PhoneSheetAction(
- icon: LucideIcons.laptopMinimal300,
- label: 'Machines',
- chevron: true,
- onTap: () => Navigator.of(context).push(
- phoneRoute(
- (_) => MachinesTab(notifier: widget.notifier, large: false),
- ),
+ // In the sample: the way back out, where a person looks for "what else can I do".
+ if (SampleMode.maybeOf(context) case final sample?)
+ PhoneSheetAction(
+ icon: LucideIcons.logOut300,
+ label: 'Leave the sample',
+ onTap: () => sample.leave(),
),
- ),
PhoneSheetAction(
icon: LucideIcons.settings300,
label: 'Settings',
@@@ -1931,38 -2328,70 +2343,100 @@@
);
}
+ /// Paste: the clipboard into [session]. What it reads and sends lives in [pasteClipboard]; the
+ /// page hands it only what the page alone knows, whether this is still the terminal on screen.
+ PhoneSheetAction _pasteAction(TerminalSession session) => PhoneSheetAction(
+ icon: LucideIcons.clipboardPaste300,
+ label: 'Paste',
+ onTap: () {
+ final messenger = ScaffoldMessenger.maybeOf(context);
+ unawaited(
+ pasteClipboard(
+ session: session,
+ machine: widget.notifier.stateOf(widget.machineId),
+ stillShowing: () =>
+ mounted &&
+ widget.isActive &&
+ identical(
+ widget.notifier
+ .paneOfAgent(widget.machineId, widget.agentId)
+ ?.session,
+ session,
+ ),
+ report: (message) {
+ if (mounted) {
+ messenger?.showSnackBar(SnackBar(content: Text(message)));
+ }
+ },
+ ),
+ );
+ },
+ );
+
/// What acts on this agent and can be taken back — the first card of its sheet.
+ /// Pastes the phone's clipboard into the terminal, the way a desktop's ⌘V does — the pane's raw
+ /// paste where the computer takes one, bracketed paste where it does not.
+ Future<void> _pasteClipboard() async {
+ final session = widget.notifier
+ .paneOfAgent(widget.machineId, widget.agentId)
+ ?.session;
+ if (session == null || !session.acceptsInput) return;
+ final text = (await Clipboard.getData(Clipboard.kTextPlain))?.text;
+ if (!mounted) return;
+ if (text == null || text.isEmpty) {
+ _flash('the clipboard has no text', error: true);
+ return;
+ }
+ final machine = widget.notifier.stateOf(widget.machineId);
+ if (machine != null && machine.terminalPasteRawAvailable) {
+ await session.pasteText(text);
+ } else {
+ session.terminal.paste(text);
+ }
+ }
+
List<PhoneSheetAction> _agentActions(Agent agent) => [
+ PhoneSheetAction(
+ icon: LucideIcons.gitBranch300,
+ label: 'Branches and pull requests',
+ chevron: true,
+ onTap: () => Navigator.of(context).push(
+ phoneRoute(
+ (_) => SessionWorkPage(
+ agent: agent,
+ online:
+ widget.notifier.stateOf(widget.machineId)?.nodeOnline !=
+ false &&
+ widget.notifier.stateOf(widget.machineId)?.connectionStatus ==
+ ConnectionStatus.connected,
+ read: (offset) => widget.notifier.readAgentGitHistory(
+ widget.machineId,
+ agent.id,
+ offset: offset,
+ ),
+ ),
+ ),
+ ),
+ ),
+ PhoneSheetAction(
+ icon: LucideIcons.clipboardPaste300,
+ label: 'Paste from clipboard',
+ onTap: () => unawaited(_pasteClipboard()),
+ ),
+ // Stop what it is doing — Esc, as in the terminal — only while it is doing something. First,
+ // because when it is wanted it is wanted now.
+ if (_agentWorking)
+ PhoneSheetAction(
+ icon: LucideIcons.octagonPause300,
+ label: 'Interrupt',
+ value: 'esc',
+ onTap: () {
+ final session = widget.notifier
+ .paneOfAgent(widget.machineId, widget.agentId)
+ ?.session;
+ session?.terminal.keyInput(TerminalKey.escape);
+ },
+ ),
// Where this agent runs, above the actions that act ON it: the desktop
// keeps it in the pane header, and this sheet is the phone's pane header.
//
diff --cc mobile/lib/widgets/terminal_panel.dart
index 418cdd8f7,040ceefd7..352facc22
--- a/mobile/lib/widgets/terminal_panel.dart
+++ b/mobile/lib/widgets/terminal_panel.dart
@@@ -1071,13 -757,13 +757,13 @@@ class _TerminalPanelState extends State
/// app share the exact same OS clipboard. The wire-based `pasteImage` (chunked
/// upload, daemon writes the far side's OS clipboard, daemon replays Ctrl+V) is
/// reserved for a genuinely REMOTE pane, whose engine reads a DIFFERENT
- /// clipboard than this one — see `MachineState.isLocalMachine`.
+ /// clipboard than this one — which, on a phone, is every pane.
/// An image handed over by the software keyboard's own clipboard.
///
- /// This is the phone's ONLY way to get an image into a pane: Flutter's
- /// [Clipboard] reads `text/plain` and nothing else, and the native reader
- /// [_paste] falls back on is macOS/Linux. Gboard hands the bytes over directly,
- /// so there is no clipboard to read at all.
+ /// Flutter's [Clipboard] reads `text/plain` and nothing else, and Gboard hands
+ /// the bytes over directly, so there is no clipboard to read at all. (The
+ /// actions sheet's Paste reads the system clipboard's image instead, through
+ /// [NativeClipboard]: see `phone/terminal_paste.dart`.)
///
/// ⚠️ A pane on a phone is ALWAYS remote — the agent runs on another machine,
/// whose engine reads a different OS clipboard — so unlike the desktop there is