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
feat(mobile): slimmer terminal chrome — one-row key bar, status dot on the engine mark
bubu-dudu349711198a55
diff --git a/mobile/lib/phone/phone_sheet.dart b/mobile/lib/phone/phone_sheet.dartindex 957947bb3..ef0f4f5dd 100644--- a/mobile/lib/phone/phone_sheet.dart+++ b/mobile/lib/phone/phone_sheet.dart@@ -29,6 +29,7 @@ Future<void> showPhoneSheet(BuildContext context, {required String title,required List<PhoneSheetAction> actions,+ PhoneSheetAction? titleAction,}) => showModalBottomSheet<void>(context: context,useRootNavigator: true,@@ -40,12 +41,38 @@ Future<void> showPhoneSheet(crossAxisAlignment: CrossAxisAlignment.stretch,children: [Padding(- padding: const EdgeInsets.fromLTRB(20, 0, 20, 10),- child: Text(- title,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: TextStyle(color: AppPalette.textSecondary, fontSize: 13),+ padding: EdgeInsets.fromLTRB(20, 0, titleAction == null ? 20 : 8, 10),+ child: Row(+ children: [+ Expanded(+ child: Text(+ title,+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ color: AppPalette.textSecondary,+ fontSize: 13,+ ),+ ),+ ),+ // [titleAction]: an icon on the title line — for something that is not about the+ // subject of the sheet (Settings, on an agent's sheet), so it does not take a row+ // among the actions that are. Its label is the tooltip.+ if (titleAction != null)+ IconButton(+ tooltip: titleAction.label,+ icon: Icon(+ titleAction.icon,+ size: 20,+ color: AppPalette.textSecondary,+ ),+ visualDensity: VisualDensity.compact,+ onPressed: () {+ Navigator.of(sheetContext).pop();+ titleAction.onTap();+ },+ ),+ ],),),// Scrolls once the rows outgrow the sheet — voice input's six languages do on a short phone —diff --git a/mobile/lib/phone/status_pill.dart b/mobile/lib/phone/status_pill.dartindex 54e128de2..4aae1f155 100644--- a/mobile/lib/phone/status_pill.dart+++ b/mobile/lib/phone/status_pill.dart@@ -1,6 +1,7 @@import 'package:flutter/material.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';+import 'phone_status.dart';/// The palette colour a [PhoneTone] draws in.@@ -27,20 +28,7 @@ class StatusPill extends StatelessWidget {return Row(mainAxisSize: MainAxisSize.min,children: [- SizedBox.square(- dimension: 10,- child: summary.tone == PhoneTone.busy- ? CircularProgressIndicator(strokeWidth: 1.6, color: color)- : Center(- child: DecoratedBox(- decoration: BoxDecoration(- color: color,- shape: BoxShape.circle,- ),- child: const SizedBox.square(dimension: 8),- ),- ),- ),+ StatusDot(summary: summary),const SizedBox(width: 7),Flexible(child: Text(@@ -58,3 +46,47 @@ class StatusPill extends StatelessWidget {);}}++/// The status without its words: a dot in the tone's colour, or a small spinner while something is+/// under way. For a place with no room for a label — the terminal header, beside the agent's name.+///+/// The label is still there for a screen reader, and as a long-press tooltip, so a colour is never+/// the only way to learn what it means.+class StatusDot extends StatelessWidget {+ const StatusDot({super.key, required this.summary, this.ring});++ final PhoneSummary summary;++ /// A cut-out ring in this colour around the dot, for a dot laid OVER something — a badge on a+ /// mark, the way presence sits on an avatar. It should be the colour behind the mark, so the dot+ /// reads as notched into it rather than stuck on top.+ final Color? ring;++ @override+ Widget build(BuildContext context) {+ AppTheme.watch(context);+ final color = phoneToneColor(summary.tone);+ final ring = this.ring;+ Widget dot = SizedBox.square(+ dimension: 10,+ child: summary.tone == PhoneTone.busy+ ? CircularProgressIndicator(strokeWidth: 1.6, color: color)+ : Center(+ child: DecoratedBox(+ decoration: BoxDecoration(color: color, shape: BoxShape.circle),+ child: const SizedBox.square(dimension: 8),+ ),+ ),+ );+ if (ring != null) {+ dot = DecoratedBox(+ decoration: BoxDecoration(color: ring, shape: BoxShape.circle),+ child: Padding(padding: const EdgeInsets.all(2), child: dot),+ );+ }+ return Tooltip(+ message: summary.label,+ child: Semantics(label: summary.label, child: dot),+ );+ }+}diff --git a/mobile/lib/phone/terminal_input_dock.dart b/mobile/lib/phone/terminal_input_dock.dartindex 39fcca661..7a65731f5 100644--- a/mobile/lib/phone/terminal_input_dock.dart+++ b/mobile/lib/phone/terminal_input_dock.dart@@ -35,8 +35,6 @@ class TerminalInputDock extends StatelessWidget {builder: (context, _) => TerminalKeyBar(terminal: session.terminal,enabled: session.acceptsInput,- controlArmed: session.controlArmed,- onControlToggle: session.armControl,onDismissKeyboard: onDismiss,onPickImage: onPickImage,onTakePhoto: onTakePhoto,diff --git a/mobile/lib/phone/terminal_key_bar.dart b/mobile/lib/phone/terminal_key_bar.dartindex 2216374f0..fc4cc7fcc 100644--- a/mobile/lib/phone/terminal_key_bar.dart+++ b/mobile/lib/phone/terminal_key_bar.dart@@ -4,36 +4,32 @@ import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:xterm/xterm.dart';import 'package:harness_mobile/shared/theme/app_theme.dart';+import 'phone_sheet.dart';/// The keys a phone keyboard does not have, in a strip above the one it does.///-/// A pane is driven by `esc`, `tab`, the arrows and `ctrl` far more than by-/// anything the alphabet offers — interrupting Claude Code, cycling its modes,-/// walking shell history, `^C`. None of them exist on a software keyboard, so+/// A pane is driven by `esc` and the arrows far more than by anything the+/// alphabet offers — interrupting Claude Code, walking shell history, moving+/// through a menu. None of them exist on a software keyboard, so/// until this strip a phone could type at an agent but could not DRIVE one.////// It appears with the keyboard and goes away with it: the terminal is short-/// enough on a phone that two rows of chrome are worth their height only while-/// someone is actually typing.-///-/// ⚠️ **Two FIXED rows, and nothing scrolls.** A horizontal scroller was tried-/// and reverted: at a comfortable key width only four keys fit a 393pt phone, so-/// the arrows and `ctrl` — the two most-pressed things here — ended up behind a-/// swipe, and a `»` key had to exist to reach the digits. Every key being in the-/// same place every time is worth more than any of them being bigger: this strip-/// is used while looking at the TERMINAL, not at the strip.+/// enough on a phone that chrome is worth its height only while someone is+/// actually typing.///-/// `~ | / -` are deliberately gone from this row. The system keyboard one row-/// below types all four, which is exactly what the row above it should not spend-/// space on — unlike `↵` and `⇧tab`, which it cannot produce at all.+/// ⚠️ **ONE row, fixed, and nothing scrolls.** It used to be two — `tab`, `↵`,+/// `⇧tab`, `ctrl` and a row of digits beside what is here now — and the second+/// row cost the terminal a line of output for keys the system keyboard below+/// already types (the digits) or that were rarely reached for. What is left is+/// what a phone keyboard genuinely cannot produce and a pane is driven by: `esc`+/// and the arrows. Every key stays in the same place every time; this strip is+/// used while looking at the TERMINAL, not at the strip.class TerminalKeyBar extends StatelessWidget {const TerminalKeyBar({super.key,required this.terminal,required this.enabled,- required this.controlArmed,- required this.onControlToggle,required this.onDismissKeyboard,this.onPickImage,this.onTakePhoto,@@ -46,10 +42,6 @@ class TerminalKeyBar extends StatelessWidget {/// keyboard's place with it) but dims and stops answering.final bool enabled;- /// Whether the next character typed leaves as a control chord. Owned by the- /// session, which is also what spends it — see `TerminalSession.armControl`.- final bool controlArmed;- final ValueChanged<bool> onControlToggle;final VoidCallback onDismissKeyboard;/// Sending a picture. Null on a pane that cannot take one — an older CLI that@@ -61,13 +53,6 @@ class TerminalKeyBar extends StatelessWidget {bool get _canSendImage => onPickImage != null || onTakePhoto != null;- /// The width of a key that sits OUTSIDE the grid — see `apart` in [build].- ///- /// Square, and stated rather than shared with the grid on purpose: the grid- /// keys stretch to fill whatever the row leaves them, and these must not move- /// when a digit is added or the image key is absent.- static const double _apartKeyWidth = 34;-void _send(void Function() action) {if (!enabled) return;HapticFeedback.selectionClick();@@ -111,25 +96,10 @@ class TerminalKeyBar extends StatelessWidget {@overrideWidget build(BuildContext context) {AppTheme.watch(context);- // Row one is what drives an engine: leave a mode, complete a path, send,- // cycle Claude Code's modes, walk history. The image key ends it because- // sending a picture is a deliberate act, not something done mid-sentence —- // but it is still HERE, on screen, not behind anything.- final top = <Widget>[+ // What drives an engine and a phone keyboard lacks: leave a mode, walk+ // history, move through a menu.+ final keys = <Widget>[_key(label: 'esc', onTap: () => terminal.keyInput(TerminalKey.escape)),- _key(label: 'tab', onTap: () => terminal.keyInput(TerminalKey.tab)),- _key(- icon: LucideIcons.cornerDownLeft300,- semanticLabel: 'Enter',- onTap: () => terminal.keyInput(TerminalKey.enter),- ),- // Shift+Tab is CSI Z, and xterm builds it from the modifier rather than- // from a key of its own — which is why this passes `shift` instead of- // looking for a `TerminalKey.shiftTab` that does not exist.- _key(- label: '⇧tab',- onTap: () => terminal.keyInput(TerminalKey.tab, shift: true),- ),_key(icon: LucideIcons.arrowLeft300,semanticLabel: 'Left',@@ -151,15 +121,6 @@ class TerminalKeyBar extends StatelessWidget {onTap: () => terminal.keyInput(TerminalKey.arrowRight),),];- final bottom = <Widget>[- _key(- label: 'ctrl',- held: controlArmed,- onTap: () => onControlToggle(!controlArmed),- ),- for (final digit in const ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'])- _key(label: digit, onTap: () => terminal.textInput(digit)),- ];// ⚠️ **Neither of these sends a byte anywhere**, and that is why they sit// apart from the grid rather than in it. Every key to the left of the rule// is a keystroke the pty receives; these two act on the PHONE — one opens an@@ -196,38 +157,24 @@ class TerminalKeyBar extends StatelessWidget {child: Padding(padding: const EdgeInsets.all(6),// Held out of the app-wide text scale like the composer's own type:- // at a large scale twelve keys across a phone stop fitting the row.+ // at a large scale the keys stop fitting the row.child: MediaQuery.withNoTextScaling(- child: Column(- mainAxisSize: MainAxisSize.min,+ // Every key the same width, the two apart ones included — they are+ // separated by the rule, not by being a different size.+ child: Row(children: [- // The pair sits beside the SHORTER row, and the arithmetic is- // the whole reason: row one carries eight keys and row two- // eleven, so taking ~85pt out of row two would squeeze the- // digits to 23pt — narrower than the system keyboard's own keys- // right below them. Beside row one they cost it 44pt → 33pt,- // which is where the old bar's keys already were.- Row(- children: [- Expanded(child: _row(top)),- const SizedBox(width: 8),- // The rule earns its place only when there are two kinds of- // thing to separate. Against an older CLI the image key is- // absent and `⌄` is all that is left — it lived inside the- // grid before this, so a rule drawn for it alone would be- // marking a distinction that is no longer being made.- if (_canSendImage) ...[- Container(width: 1, height: 22, color: AppGlass.hair),- const SizedBox(width: 8),- ],- for (var index = 0; index < apart.length; index++) ...[- if (index > 0) const SizedBox(width: 4),- SizedBox(width: _apartKeyWidth, child: apart[index]),- ],- ],- ),- const SizedBox(height: 6),- _row(bottom),+ ..._row(keys),+ // The rule earns its place only when there are two kinds of+ // thing to separate. Against an older CLI the image key is+ // absent and `⌄` is all that is left, so a rule drawn for it+ // alone would be marking a distinction that is no longer made.+ if (_canSendImage) ...[+ const SizedBox(width: 8),+ Container(width: 1, height: 22, color: AppGlass.hair),+ const SizedBox(width: 8),+ ] else+ const SizedBox(width: 4),+ ..._row(apart),],),),@@ -236,36 +183,26 @@ class TerminalKeyBar extends StatelessWidget {);}- /// One row, every key sharing the width equally.- ///- /// `Expanded` rather than a fixed width: the keys then land on the same grid- /// the system keyboard below uses, which is what lets a thumb find one without- /// looking. It also means a row of nine and a row of twelve both fill the- /// phone rather than ending in a ragged gap.- Widget _row(List<Widget> keys) => Row(- children: [- for (var index = 0; index < keys.length; index++) ...[- if (index > 0) const SizedBox(width: 4),- Expanded(child: keys[index]),- ],+ /// A run of keys for the strip's one [Row], each `Expanded` with the same+ /// flex — so every key on the strip, on either side of the rule, gets the+ /// same width, and the row fills the phone rather than ending in a gap.+ List<Widget> _row(List<Widget> keys) => [+ for (var index = 0; index < keys.length; index++) ...[+ if (index > 0) const SizedBox(width: 4),+ Expanded(child: keys[index]),],- );+ ];Widget _key({String? label,IconData? icon,String? semanticLabel,- bool held = false,bool alwaysEnabled = false,required VoidCallback onTap,}) {assert((label == null) != (icon == null), 'a key carries one of the two');final live = enabled || alwaysEnabled;- final foreground = held- ? AppPalette.accentOnSurface- : live- ? AppPalette.textPrimary- : AppPalette.textFaint;+ final foreground = live ? AppPalette.textPrimary : AppPalette.textFaint;return Semantics(button: true,label: semanticLabel ?? label,@@ -280,11 +217,9 @@ class TerminalKeyBar extends StatelessWidget {height: 34,alignment: Alignment.center,decoration: BoxDecoration(- color: held ? AppSurface.accentWash : AppGlass.surfaceFill,+ color: AppGlass.surfaceFill,borderRadius: BorderRadius.circular(7),- border: Border.all(- color: held ? AppPalette.accentOnSurface : AppGlass.lift,- ),+ border: Border.all(color: AppGlass.lift),),child: icon != null? Icon(icon, size: 16, color: foreground)diff --git a/mobile/lib/phone/terminal_page.dart b/mobile/lib/phone/terminal_page.dartindex 6ef64869f..d152daf75 100644--- a/mobile/lib/phone/terminal_page.dart+++ b/mobile/lib/phone/terminal_page.dart@@ -390,7 +390,6 @@ class _TerminalPageState extends State<TerminalPage>final agent = machine?.agents.where((a) => a.id == widget.agentId).firstOrNull;- final status = phoneSessionSummary(session);final reclaim = phoneReclaimAction(session);return Scaffold(backgroundColor: AppPalette.windowBg,@@ -407,10 +406,29 @@ class _TerminalPageState extends State<TerminalPage>children: [PhoneHeader(title: _clipTitle(agent?.name ?? 'Agent'),- leading: EngineMark(- engine: agent?.engine,- displayName: agent?.engineDisplayName,- size: 22,+ // The connection state rides the engine mark as a badge in+ // its bottom-right corner, the way a messenger shows presence+ // on an avatar: green while live, a spinner while attaching or+ // resyncing, the warning or error colour when the stream is+ // taken over or drops. No words — the long-press tooltip and+ // screen readers still get them.+ leading: Stack(+ clipBehavior: Clip.none,+ children: [+ EngineMark(+ engine: agent?.engine,+ displayName: agent?.engineDisplayName,+ size: 22,+ ),+ Positioned(+ right: -4,+ bottom: -4,+ child: StatusDot(+ summary: phoneSessionSummary(session),+ ring: AppPalette.windowBg,+ ),+ ),+ ],),// ⚠️ No subtitle. The machine and its state moved to// [TerminalFootBar] at the foot of the page — see there for@@ -479,7 +497,7 @@ class _TerminalPageState extends State<TerminalPage>// and machines.//// ⚠️ Shown while the keyboard is up, and so is `+`. Both- // were once hidden on `!_ownsInput`, to spare a one-row+ // were once hidden while typing, to spare a one-row// header while typing — but the row is not what was short.// The title ellipses at the same width either way, so// hiding them bought the title nothing and only left a gap,@@ -489,9 +507,9 @@ class _TerminalPageState extends State<TerminalPage>//// ⚠️ Not [PhoneSearchButton], which pushes and forgets. A// page that pops back onto the top gets no rebuild of its- // own, so anything read from [_ownsInput] — the machine- // bar below still does — would keep answering with what was- // true while the search was covering it. Awaiting the push+ // own, so anything read from the route's state would keep+ // answering with what was true while the search was+ // covering it. Awaiting the push// is what turns "the search closed" into a frame._HeaderAction(icon: LucideIcons.search300,@@ -593,10 +611,13 @@ class _TerminalPageState extends State<TerminalPage>): null,),- // Which computer this is running on, whether it is still- // answering, and the mic — the pair that used to sit- // under the filename in the header, and the one voice- // control the page has.+ // The mic — the one voice control the page has.+ //+ // ⚠️ No machine name and no status in it any more: the+ // state is the dot on the engine mark in the header, and+ // the machine is on the `⋯` sheet's title line. The row+ // stays for the mic, and for what the mic is doing while+ // it is doing it.//// ⚠️ Below the key bar, not above it. The bar is what the// thumb works, and a line that moves every time it@@ -611,19 +632,10 @@ class _TerminalPageState extends State<TerminalPage>// what is being read mid-typing.if (!_ownsInput)TerminalFootBar(- name: machine?.machine.displayName ?? '',+ name: '',voice: widget.voice,session: session,- // ⚠️ The machine ALONE once the reclaim button is up.- // The two say the same fact in different words —- // "Taken over" here against "Take control" there,- // "Disconnected" against "Reconnect" — and a page- // stating its problem twice reads as two problems.- // The button wins because it is the way out of the- // state, not just a report of it. Same rule the- // header's subtitle followed before this row took- // the pair over.- status: reclaim == null ? status : null,+ status: null,),],),@@ -672,6 +684,17 @@ class _TerminalPageState extends State<TerminalPage>showPhoneSheet(context,title: '$agentName · $machineName',+ // Settings is an icon on the title line rather than a row: it is about the app, not about+ // this agent, and it is here only because the tab bar that used to lead to it is hidden.+ titleAction: PhoneSheetAction(+ icon: LucideIcons.settings300,+ label: 'Settings',+ onTap: () => Navigator.of(context).push(+ phoneRoute(+ (_) => SettingsPage(notifier: widget.notifier, large: false),+ ),+ ),+ ),actions: [PhoneSheetAction(icon: LucideIcons.pencil300,@@ -689,17 +712,6 @@ class _TerminalPageState extends State<TerminalPage>label: 'Restart agent',onTap: () => unawaited(_restart()),),- // Settings lives here now that the tab bar is hidden and the phone opens into a terminal:- // this sheet is the one menu every screen the person actually sits on reaches.- PhoneSheetAction(- icon: LucideIcons.settings300,- label: 'Settings',- onTap: () => Navigator.of(context).push(- phoneRoute(- (_) => SettingsPage(notifier: widget.notifier, large: false),- ),- ),- ),// Last, and alone in red: the two above are recoverable and this one is// not, so it does not sit where a thumb lands on the way to them.//diff --git a/mobile/test/terminal_key_bar_test.dart b/mobile/test/terminal_key_bar_test.dartindex 13a853782..1bc181f07 100644--- a/mobile/test/terminal_key_bar_test.dart+++ b/mobile/test/terminal_key_bar_test.dart@@ -6,22 +6,16 @@ import 'package:xterm/xterm.dart';void main() {late Terminal terminal;late List<String> outbound;- late List<bool> armings;late int dismissals;setUp(() {terminal = Terminal(maxLines: 200, reflowEnabled: false)..resize(80, 12);outbound = [];- armings = [];dismissals = 0;terminal.onOutput = outbound.add;});- Future<void> pumpBar(- WidgetTester tester, {- bool enabled = true,- bool controlArmed = false,- }) async {+ Future<void> pumpBar(WidgetTester tester, {bool enabled = true}) async {await tester.pumpWidget(MaterialApp(home: Scaffold(@@ -30,8 +24,6 @@ void main() {child: TerminalKeyBar(terminal: terminal,enabled: enabled,- controlArmed: controlArmed,- onControlToggle: armings.add,onDismissKeyboard: () => dismissals++,),),@@ -51,30 +43,26 @@ void main() {await pumpBar(tester);await tapKey(tester, 'esc');- await tapKey(tester, 'tab');- // CSI Z, built from the modifier — there is no `TerminalKey.shiftTab`.- await tapKey(tester, '\u21e7tab');+ await tapKey(tester, 'Left');await tapKey(tester, 'Up');- await tapKey(tester, '7');+ await tapKey(tester, 'Down');+ await tapKey(tester, 'Right');- expect(outbound, ['\x1b', '\t', '\x1b[Z', '\x1b[A', '7']);+ expect(outbound, ['\x1b', '\x1b[D', '\x1b[A', '\x1b[B', '\x1b[C']);});- testWidgets('ctrl is handed to the session, which owns the modifier', (+ testWidgets('the row holds esc, the arrows and hide — nothing else', (tester,) async {await pumpBar(tester);- await tapKey(tester, 'ctrl');-- // Nothing goes down the wire: the chord is made from the NEXT character,- // and only the session sees that one arrive.- expect(outbound, isEmpty);- expect(armings, [true]);-- await pumpBar(tester, controlArmed: true);- await tapKey(tester, 'ctrl');- expect(armings, [true, false]);+ for (final gone in ['tab', 'Enter', 'ctrl', '1', '0']) {+ expect(+ find.byKey(ValueKey('terminal-key-$gone')),+ findsNothing,+ reason: gone,+ );+ }});testWidgets('a stream that takes no input answers nothing — except the key '@@ -82,9 +70,8 @@ void main() {await pumpBar(tester, enabled: false);await tapKey(tester, 'esc');- await tapKey(tester, 'ctrl');+ await tapKey(tester, 'Up');expect(outbound, isEmpty);- expect(armings, isEmpty);// Hiding the keyboard is this page's own business, not the pane's, and it// is the way back to a full screen of output — it works either way.