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(web): implement compact footer and dropdown controls for mobile layout
Dev jacob0e56910b2817
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.mdindex 40a996083..7d8135028 100644--- a/desktop/CLAUDE.md+++ b/desktop/CLAUDE.md@@ -113,7 +113,8 @@ behavior (e.g. `SwarmScreen.chrome` / `WorkspaceChrome` in `state/workspace_chrowhich runs the same `_commands` table keys use, adds a bar over the picker, and turns off`KeyHints` — `widgets/key_hints.dart`, absent means hints shown). Below`WorkspaceChrome.compactBelow` (web: 720px, a phone) the workspace goes compact: a tab-switcher replaces the tab row and `PaneGrid.soloFocused` draws only the focused harness —+switcher replaces the tab row, `WorkspaceChrome.compactFooter` replaces the status bar with one+dropdown plus Share (hidden while the on-screen keyboard is up), and `PaneGrid.soloFocused` draws only the focused harness —without touching zoom or the synced layout, so the same desk keeps its grid on a computer. Do not change desktop behavior for theweb, and do not copy shared screens into `lib/web/` — add a seam instead.diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 763abc9fd..e4a170e71 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -6869,7 +6869,70 @@ class _SwarmScreenState extends State<SwarmScreen> {? workspaceBarControlHeight(context) + kWorkspaceInset: 0;- Widget _statusBar() => LayoutBuilder(+ Widget _statusBar() {+ final compactFooter = widget.chrome?.compactFooter;+ if (compactFooter != null && _compact(context)) {+ return compactFooter(context, _workspaceFooter());+ }+ return _fullStatusBar();+ }++ /// The status bar's content for a host that draws its own compact footer.+ WorkspaceFooter _workspaceFooter() {+ final focused = WorkspacePaneContext.focused(app);+ final links = focused == null ? null : _contextLinks(focused);+ final pr = _pullRequest.value;+ WorkspaceFooterItem? link(+ StatusLineField field,+ String title,+ String? detail,+ ) => detail == null || detail.isEmpty || links?[field] == null+ ? null+ : WorkspaceFooterItem(+ title: title,+ detail: detail,+ onPressed: links![field]!.onPressed,+ );+ return WorkspaceFooter(+ summary: focused == null+ ? _subscriptionUsage.text+ : [+ focused.machineName,+ focused.branch ?? focused.projectName,+ ].where((part) => part.isNotEmpty).join(' · '),+ items: [+ WorkspaceFooterItem(+ title: 'Subscriptions',+ detail: _subscriptionUsage.text,+ onPressed: _shortcutsEnabled+ ? () => _toggleModels(initialTab: ModelsTab.subscriptions)+ : null,+ ),+ ?link(StatusLineField.machine, 'Machine', focused?.machineName),+ ?link(StatusLineField.project, 'Project', focused?.projectName),+ ?link(StatusLineField.branch, 'Branch', focused?.branch),+ if (pr != null)+ WorkspaceFooterItem(+ title: pr.label,+ detail: 'Open on GitHub',+ onPressed: _shortcutsEnabled+ ? () => _openFocusedPullRequest(pr.url.toString())+ : null,+ ),+ ],+ share: !_showShareButton+ ? null+ : WorkspaceFooterItem(+ title: _shareLabel(focused),+ detail: _shareTooltip(focused),+ onPressed: _canExecuteCommand('agent.share')+ ? () => _runShortcut('agent.share')+ : null,+ ),+ );+ }++ Widget _fullStatusBar() => LayoutBuilder(builder: (context, constraints) {final cell = workspaceBarCellSizeOf(context);final focused = WorkspacePaneContext.focused(app);diff --git a/desktop/lib/state/workspace_chrome.dart b/desktop/lib/state/workspace_chrome.dartindex 7c3529ef0..85ed6eae3 100644--- a/desktop/lib/state/workspace_chrome.dart+++ b/desktop/lib/state/workspace_chrome.dart@@ -33,6 +33,38 @@ class WorkspacePicker {final VoidCallback close;}+/// One entry of the workspace footer as a host composition sees it: what it+/// names, what it currently reads, and the same action its footer link runs.+class WorkspaceFooterItem {+ const WorkspaceFooterItem({+ required this.title,+ this.detail = '',+ this.onPressed,+ });++ final String title;+ final String detail;+ final VoidCallback? onPressed;+}++/// The workspace footer's content, for a host that lays it out its own way.+class WorkspaceFooter {+ const WorkspaceFooter({+ required this.summary,+ required this.items,+ this.share,+ });++ /// One line standing for the whole footer, e.g. `MacBook · feat/web`.+ final String summary;++ /// Subscriptions, then the focused harness's machine, project, branch, PR.+ final List<WorkspaceFooterItem> items;++ /// The Share action, when the Share button is enabled.+ final WorkspaceFooterItem? share;+}+/// What a host composition adds to the shared workspace. Desktop passes none;/// the web build (`lib/web/`) puts its mouse-first menu before the tabs, a bar/// over the picker, and names a machine for New Harness. [leadingWidth] is reserved before the tabs@@ -49,6 +81,7 @@ class WorkspaceChrome {this.scrollsTabsByArrows = false,this.attachesFiles = false,this.compactTabs,+ this.compactFooter,this.compactBelow = 0,});@@ -85,5 +118,10 @@ class WorkspaceChrome {/// harness is drawn — a phone has room for neither a tab row nor a grid.final Widget Function(BuildContext context, WorkspaceCommands commands)?compactTabs;++ /// Replaces the status bar while compact. It is handed the footer's content+ /// and owns its own height — zero hides it.+ final Widget Function(BuildContext context, WorkspaceFooter footer)?+ compactFooter;final double compactBelow;}diff --git a/desktop/lib/web/footer/web_footer_bar.dart b/desktop/lib/web/footer/web_footer_bar.dartnew file mode 100644index 000000000..958f1954f--- /dev/null+++ b/desktop/lib/web/footer/web_footer_bar.dart@@ -0,0 +1,125 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_icons.dart';+import '../../shared/theme/app_theme.dart' as grid;+import '../../shared/theme/workspace_bar_style.dart';+import '../../state/workspace_chrome.dart';+import '../../terminal/terminal_theme.dart';+import '../../terminal/terminal_theme_store.dart';+import '../../widgets/box_chrome.dart' show kWorkspaceInset;+import '../../widgets/pane_menu.dart';+import '../../widgets/workspace_bar_control.dart';+import '../../widgets/workspace_share_button.dart';+import '../shell/web_dropdown_control.dart';+import '../shell/web_hidden_under_keyboard.dart';++/// The footer on a phone, shaped like its header: the whole status line as one+/// dropdown whose menu holds each entry, and Share beside it. Gone while the+/// on-screen keyboard is up — the terminal needs that height more.+class WebFooterBar extends StatelessWidget {+ const WebFooterBar({super.key, required this.footer});++ final WorkspaceFooter footer;++ @override+ Widget build(BuildContext context) {+ final foreground = terminalThemeFor(+ grid.AppTheme.palette.value,+ terminalThemeStore.value,+ ).foreground;+ final share = footer.share;+ return WebHiddenUnderKeyboard(+ child: Material(+ key: const ValueKey('workspace-status-bar'),+ type: MaterialType.transparency,+ child: SizedBox(+ height: workspaceBarControlHeight(context) + kWorkspaceInset,+ child: Padding(+ padding: EdgeInsets.symmetric(+ horizontal: workspaceBarCellSizeOf(context).width,+ ),+ child: Row(+ children: [+ Expanded(+ child: Align(+ alignment: Alignment.centerLeft,+ child: Builder(+ builder: (context) => WebDropdownControl(+ key: const ValueKey('web-footer-menu-button'),+ label: footer.summary,+ tooltip: 'Status',+ color: foreground,+ onPressed: () => _open(context),+ ),+ ),+ ),+ ),+ if (share != null) _WebShareIconButton(share: share),+ ],+ ),+ ),+ ),+ ),+ );+ }++ Future<void> _open(BuildContext context) async {+ final position = webMenuAnchor(context);+ if (position == null) return;+ final choice = await showPaneMenu<WorkspaceFooterItem>(+ context: context,+ position: position,+ minWidth: 260,+ maxWidth: 360,+ children: (close) => [+ for (final item in footer.items)+ paneMenuItem(+ onTap: () => close(item),+ child: KeyedSubtree(+ key: ValueKey('web-footer:${item.title}'),+ child: PaneMenuRow(+ selected: false,+ title: item.title,+ status: item.detail.isEmpty ? null : item.detail,+ ),+ ),+ ),+ ],+ );+ // Run once the menu has closed and handed focus back.+ choice?.onPressed?.call();+ }+}++/// Share as an icon on the accent fill: still the bar's primary action, in+/// the width of one tab-bar button.+class _WebShareIconButton extends StatelessWidget {+ const _WebShareIconButton({required this.share});++ final WorkspaceFooterItem share;++ @override+ Widget build(BuildContext context) {+ grid.AppTheme.watch(context);+ final enabled = share.onPressed != null;+ final height = workspaceBarControlHeight(context);+ return WorkspaceBarControl(+ key: const ValueKey('workspace-share-button'),+ label: share.title,+ tooltip: share.detail,+ onPressed: share.onPressed,+ builder: (context, emphasized) => ColoredBox(+ color: WorkspaceShareButton.backgroundFor(enabled),+ child: SizedBox(+ width: workspaceBarCellSizeOf(context).width * 4,+ height: height,+ child: Icon(+ AppIcons.share,+ size: 16,+ color: WorkspaceShareButton.foregroundFor(enabled),+ ),+ ),+ ),+ );+ }+}diff --git a/desktop/lib/web/shell/web_chrome.dart b/desktop/lib/web/shell/web_chrome.dartindex bfdcd8598..c2d5f08dc 100644--- a/desktop/lib/web/shell/web_chrome.dart+++ b/desktop/lib/web/shell/web_chrome.dart@@ -1,5 +1,6 @@import '../../state/app_state.dart';import '../../state/workspace_chrome.dart';+import '../footer/web_footer_bar.dart';import '../picker/web_picker_bar.dart';import '../tabs/web_tab_switcher.dart';import 'web_app_menu.dart';@@ -7,7 +8,7 @@ import 'web_layout.dart';import 'web_machine_choice.dart';/// Everything the browser adds to the shared workspace: a menu before the-/// tabs, a tab switcher on narrow screens, a clickable bar over the picker+/// tabs, a tab switcher and a one-dropdown footer on narrow screens, a clickable bar over the picker/// with its key hints hidden, and a connected machine for New Harness, since/// a browser is not a machine.WorkspaceChrome webWorkspaceChrome(AppNotifier app) => WorkspaceChrome(@@ -23,5 +24,6 @@ WorkspaceChrome webWorkspaceChrome(AppNotifier app) => WorkspaceChrome(attachesFiles: true,compactTabs: (context, commands) =>WebTabSwitcher(app: app, commands: commands),+ compactFooter: (context, footer) => WebFooterBar(footer: footer),compactBelow: kWebCompactBelow,);diff --git a/desktop/lib/web/shell/web_dropdown_control.dart b/desktop/lib/web/shell/web_dropdown_control.dartnew file mode 100644index 000000000..dad234de5--- /dev/null+++ b/desktop/lib/web/shell/web_dropdown_control.dart@@ -0,0 +1,75 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_icons.dart';+import '../../shared/theme/workspace_bar_style.dart';+import '../../widgets/workspace_bar_control.dart';++/// A bar control that reads as a dropdown: one line of text, then a chevron.+/// The phone's tab switcher and its footer are both one of these.+class WebDropdownControl extends StatelessWidget {+ const WebDropdownControl({+ super.key,+ required this.label,+ required this.tooltip,+ required this.color,+ this.onPressed,+ });++ final String label;+ final String tooltip;+ final Color color;+ final VoidCallback? onPressed;++ @override+ Widget build(BuildContext context) => WorkspaceBarControl(+ label: '$tooltip: $label',+ tooltip: tooltip,+ onPressed: onPressed,+ builder: (context, emphasized) => SizedBox(+ height: workspaceBarControlHeight(context),+ child: Padding(+ padding: EdgeInsets.symmetric(+ horizontal: workspaceBarCellSizeOf(context).width,+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Flexible(+ child: Text(+ label,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: workspaceBarTextStyle(+ color: color,+ emphasized: emphasized,+ ),+ ),+ ),+ // An icon, not "▾": the terminal face may have no such glyph.+ Icon(+ AppIcons.chevronDown,+ size: 14,+ color: color.withValues(alpha: .75),+ ),+ ],+ ),+ ),+ ),+ );+}++/// Where a menu opened from the widget at [context] goes: under it, flush+/// with its right edge. Near the bottom of the window the menu is lifted to+/// fit. Null while that widget is not laid out.+RelativeRect? webMenuAnchor(BuildContext context) {+ final box = context.findRenderObject() as RenderBox?;+ final overlay = Overlay.of(context).context.findRenderObject() as RenderBox?;+ if (box == null || overlay == null) return null;+ final origin = box.localToGlobal(Offset.zero, ancestor: overlay);+ return RelativeRect.fromLTRB(+ origin.dx,+ origin.dy + box.size.height + 6,+ overlay.size.width - origin.dx - box.size.width,+ 0,+ );+}diff --git a/desktop/lib/web/shell/web_hidden_under_keyboard.dart b/desktop/lib/web/shell/web_hidden_under_keyboard.dartnew file mode 100644index 000000000..00b0bc130--- /dev/null+++ b/desktop/lib/web/shell/web_hidden_under_keyboard.dart@@ -0,0 +1,36 @@+import 'package:flutter/widgets.dart';++/// Draws [child] only while no on-screen keyboard is up. Reads the view+/// itself: a Scaffold hands its body a MediaQuery with the keyboard's inset+/// already taken out, so the body never sees it there.+class WebHiddenUnderKeyboard extends StatefulWidget {+ const WebHiddenUnderKeyboard({super.key, required this.child});++ final Widget child;++ @override+ State<WebHiddenUnderKeyboard> createState() => _WebHiddenUnderKeyboardState();+}++class _WebHiddenUnderKeyboardState extends State<WebHiddenUnderKeyboard>+ with WidgetsBindingObserver {+ @override+ void initState() {+ super.initState();+ WidgetsBinding.instance.addObserver(this);+ }++ @override+ void dispose() {+ WidgetsBinding.instance.removeObserver(this);+ super.dispose();+ }++ @override+ void didChangeMetrics() => setState(() {});++ @override+ Widget build(BuildContext context) => View.of(context).viewInsets.bottom > 0+ ? const SizedBox.shrink()+ : widget.child;+}diff --git a/desktop/lib/web/tabs/web_tab_switcher.dart b/desktop/lib/web/tabs/web_tab_switcher.dartindex a59971bfa..dcafc2d27 100644--- a/desktop/lib/web/tabs/web_tab_switcher.dart+++ b/desktop/lib/web/tabs/web_tab_switcher.dart@@ -1,5 +1,3 @@-import 'package:harness/shared/theme/app_icons.dart';-import 'dart:async';import 'package:flutter/material.dart';@@ -15,6 +13,7 @@ import '../../terminal/terminal_theme.dart';import '../../terminal/terminal_theme_store.dart';import '../../widgets/pane_menu.dart';import '../../widgets/pane_grid.dart' show soloPaneId;+import '../shell/web_dropdown_control.dart';import 'web_tab_menu.dart';import '../../widgets/workspace_bar_control.dart';@@ -58,41 +57,12 @@ class WebTabSwitcher extends StatelessWidget {String label,bool enabled,TerminalTheme theme,- ) => WorkspaceBarControl(+ ) => WebDropdownControl(key: const ValueKey('web-tab-switcher'),- label: 'Tabs: $label',+ label: label,tooltip: 'Tabs',+ color: theme.foreground,onPressed: enabled ? () => _open(context) : null,- builder: (context, emphasized) => SizedBox(- height: workspaceBarControlHeight(context),- child: Padding(- padding: EdgeInsets.symmetric(- horizontal: workspaceBarCellSizeOf(context).width,- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Flexible(- child: Text(- label,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: workspaceBarTextStyle(- color: theme.foreground,- emphasized: emphasized,- ),- ),- ),- // An icon, not "▾": the terminal face may have no such glyph.- Icon(- AppIcons.chevronDown,- size: 14,- color: theme.foreground.withValues(alpha: .75),- ),- ],- ),- ),- ),);/// Desktop's `+` beside the tabs: a new tab, which opens on "Start an agent".@@ -118,19 +88,11 @@ class WebTabSwitcher extends StatelessWidget {);Future<void> _open(BuildContext context) async {- final box = context.findRenderObject() as RenderBox?;- final overlay =- Overlay.of(context).context.findRenderObject() as RenderBox?;- if (box == null || overlay == null) return;- final origin = box.localToGlobal(Offset.zero, ancestor: overlay);+ final position = webMenuAnchor(context);+ if (position == null) return;final choice = await showPaneMenu<WebTabChoice>(context: context,- position: RelativeRect.fromLTRB(- origin.dx,- origin.dy + box.size.height + 6,- overlay.size.width - origin.dx - box.size.width,- 0,- ),+ position: position,minWidth: 260,maxWidth: 360,children: (close) => webTabMenuRows(app, commands, close),diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex d04e9a8a1..69b86542a 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -107,6 +107,9 @@ bool get isTouchBrowser =>(defaultTargetPlatform == TargetPlatform.android ||defaultTargetPlatform == TargetPlatform.iOS);+/// Safari (or any browser) on an iPhone or iPad.+bool get isIOSBrowser => kIsWeb && defaultTargetPlatform == TargetPlatform.iOS;+class TerminalPanel extends StatefulWidget {final AppNotifier notifier;final TerminalSession session;@@ -2283,6 +2286,13 @@ class _TerminalPanelState extends State<TerminalPanel>: SystemMouseCursors.text,onSecondaryTapDown: (_, _) => _copyOrPaste(),deleteDetection: isTouchBrowser,+ // A <textarea>, not an <input>: iOS Safari hangs+ // its AutoFill bar (passwords, cards, places)+ // over the keyboard for every <input>. Return+ // still submits: see CustomTextEdit's action echo.+ keyboardType: isIOSBrowser+ ? TextInputType.multiline+ : TextInputType.text,onAltBufferScroll: session.scrollViaTmuxCopyMode? (up) => session.sendScrollCommand(up, 1)diff --git a/desktop/test/terminal_delete_detection_test.dart b/desktop/test/terminal_delete_detection_test.dartindex 39082b549..f7b1d4591 100644--- a/desktop/test/terminal_delete_detection_test.dart+++ b/desktop/test/terminal_delete_detection_test.dart@@ -42,6 +42,24 @@ void main() {}expect(output.join(), 'ab${'\x7f' * 4}');});++ // iOS Safari types into a <textarea>: Return reports the action, then the+ // textarea types its own newline onto the pad or the line just sent.+ for (final (race, newline) in [+ ('after the reset', (String line) => ' \n'),+ ('before the reset', (String line) => ' $line\n'),+ ]) {+ testWidgets('Return submits once when its newline lands $race', (+ tester,+ ) async {+ final (output, keyboard) = await mount(tester);+ await keyboard.type('ls');+ await tester.testTextInput.receiveAction(TextInputAction.newline);+ await keyboard._send(newline('ls'));+ await keyboard.type('a');+ expect(output.join(), 'ls\ra');+ });+ }}/// The on-screen keyboard's own copy of the buffer. `testTextInput` recordsdiff --git a/desktop/test/web_tab_switcher_test.dart b/desktop/test/web_tab_switcher_test.dartindex be94f7e35..7f5cdea7d 100644--- a/desktop/test/web_tab_switcher_test.dart+++ b/desktop/test/web_tab_switcher_test.dart@@ -171,6 +171,45 @@ void main() {app.dispose();});+ testWidgets(+ 'a phone folds the footer into one menu, hidden by the keyboard',+ (tester) async {+ final app = await mount(tester, const Size(390, 844), harnesses: 1);+ app.focusPane(100);+ await tester.pump(const Duration(milliseconds: 100));+ const footer = ValueKey('web-footer-menu-button');+ expect(+ find.descendant(of: find.byKey(footer), matching: find.text('box')),+ findsOneWidget,+ );+ expect(+ find.byKey(const ValueKey('workspace-subscription-usage')),+ findsNothing,+ );++ await tester.tap(find.byKey(footer));+ await tester.pump(const Duration(milliseconds: 100));+ expect(+ find.byKey(const ValueKey('web-footer:Subscriptions')),+ findsOneWidget,+ );+ expect(find.byKey(const ValueKey('web-footer:Machine')), findsOneWidget);+ await capture(tester, 'web-phone-footer-menu');+ await tester.tapAt(const Offset(195, 300));+ await tester.pump(const Duration(milliseconds: 100));++ tester.view.viewInsets = const FakeViewPadding(bottom: 300);+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.byKey(footer), findsNothing);+ tester.view.resetViewInsets();+ await tester.pump(const Duration(milliseconds: 100));+ expect(find.byKey(footer), findsOneWidget);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox.shrink());+ app.dispose();+ },+ );+testWidgets('a wide window keeps the grid of harnesses', (tester) async {final app = await mount(tester, const Size(1280, 800), harnesses: 3);expect(find.text('Agent 0').hitTestable(), findsOneWidget);@@ -184,6 +223,11 @@ void main() {final app = await mount(tester, const Size(1280, 800));expect(find.byKey(const ValueKey('web-tab-switcher')), findsNothing);expect(find.byKey(const ValueKey('swarm-store-button')), findsOneWidget);+ expect(+ find.byKey(const ValueKey('workspace-subscription-usage')),+ findsOneWidget,+ );+ expect(find.byKey(const ValueKey('web-footer-menu-button')), findsNothing);expect(tester.takeException(), isNull);await tester.pumpWidget(const SizedBox.shrink());app.dispose();diff --git a/desktop/third_party/xterm/lib/src/ui/custom_text_edit.dart b/desktop/third_party/xterm/lib/src/ui/custom_text_edit.dartindex 65ec760a5..4e92c8687 100644--- a/desktop/third_party/xterm/lib/src/ui/custom_text_edit.dart+++ b/desktop/third_party/xterm/lib/src/ui/custom_text_edit.dart@@ -341,8 +341,13 @@ class CustomTextEditState extends State<CustomTextEdit> with TextInputClient {_pendingActionEcho = null;if (submitted == null) return false;// The newline either lands on the buffer the action was performed on, or- // after this side's reset has already emptied it — whichever wins the race.- if (value.text != '$submitted\n' && value.text != '\n') return false;+ // after this side's reset has already emptied it (back to the delete pad,+ // when there is one) — whichever wins the race. A browser's <textarea>+ // does the same as iOS: Return reports the action, then types its newline.+ if (value.text != '$submitted\n' &&+ value.text != '${_initEditingState.text}\n') {+ return false;+ }_connection?.setEditingState(_currentEditingState);return true;}