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
Refine Harness chrome and offer distinct pane layouts
dee518977c66d33
diff --git a/desktop/assets/harness_device.webp b/desktop/assets/harness_device.webpindex 1d21dfbbe..ca142a0c0 100644Binary files a/desktop/assets/harness_device.webp and b/desktop/assets/harness_device.webp differdiff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex c19a50219..36556d24c 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -1365,21 +1365,22 @@ class _SwarmScreenState extends State<SwarmScreen> {);Widget _tabStrip() => Container(- height: 44,+ height: 52,color: grid.AppPalette.swarmTabBar,child: Row(children: [IconButton(key: const ValueKey('swarm-notifications-button'),- tooltip: withEffectiveShortcutHint(- context,- 'Harnesses needing input',- ShortcutAction.showAttention,- ),onPressed: _notifications,icon: Badge(isLabelVisible: _attention > 0,- child: const Icon(Icons.notifications_none, size: 20),+ child: Icon(+ Icons.notifications_none,+ size: 20,+ semanticLabel: _attention > 0+ ? '$_attention harnesses need input'+ : 'Notifications',+ ),),),const SizedBox(width: 10),@@ -1398,68 +1399,78 @@ class _SwarmScreenState extends State<SwarmScreen> {index: index,child: GestureDetector(onDoubleTap: () => _rename(swarm.id),- child: Container(- width: 186,- margin: const EdgeInsets.only(top: 6, right: 2),- decoration: BoxDecoration(- color: app.activeSwarmId == swarm.id- ? grid.AppPalette.swarmField- : Colors.transparent,- borderRadius: const BorderRadius.vertical(- top: Radius.circular(9),+ child: _TabActionsReveal(+ builder: (showClose) => Container(+ width: 186,+ margin: const EdgeInsets.only(top: 6, right: 2),+ decoration: BoxDecoration(+ color: app.activeSwarmId == swarm.id+ ? grid.AppPalette.swarmField+ : Colors.transparent,+ borderRadius: const BorderRadius.vertical(+ top: Radius.circular(9),+ ),),- ),- child: Row(- children: [- Expanded(- child: TextButton(- onPressed: () => app.selectSwarm(swarm.id),- style: TextButton.styleFrom(- animationDuration: Duration.zero,- foregroundColor: app.activeSwarmId == swarm.id- ? Colors.white- : Colors.white70,- ),- child: Row(- children: [- if (swarm.panes.length == 1)- EngineMark(- key: ValueKey('tab-engine:${swarm.id}'),- engine: _tabEngine(swarm),- size: 16,- )- else if (swarm.panes.length > 1)- SwarmIcon(- key: ValueKey('tab-group:${swarm.id}'),- size: 16,- color: Colors.white70,- )- else- const Icon(Icons.add_box_outlined, size: 16),- const SizedBox(width: 8),- Expanded(- child: Text(- swarm.name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(fontSize: 13),+ child: Row(+ children: [+ Expanded(+ child: TextButton(+ onPressed: () => app.selectSwarm(swarm.id),+ style: TextButton.styleFrom(+ animationDuration: Duration.zero,+ foregroundColor: app.activeSwarmId == swarm.id+ ? Colors.white+ : Colors.white70,+ ),+ child: Row(+ children: [+ if (swarm.panes.length == 1)+ EngineMark(+ key: ValueKey('tab-engine:${swarm.id}'),+ engine: _tabEngine(swarm),+ size: 16,+ )+ else if (swarm.panes.length > 1)+ SwarmIcon(+ key: ValueKey('tab-group:${swarm.id}'),+ size: 16,+ color: Colors.white70,+ )+ else+ const Icon(Icons.add, size: 16),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ swarm.name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: const TextStyle(fontSize: 13),+ ),),- ),- ],+ ],+ ),),),- ),- IconButton(- tooltip: 'Close ${swarm.name}',- onPressed: () => app.closeSwarm(swarm.id),- icon: const Icon(Icons.close, size: 13),- constraints: const BoxConstraints.tightFor(- width: 30,- height: 30,+ Opacity(+ key: ValueKey('tab-close:${swarm.id}'),+ opacity: showClose ? 1 : 0,+ alwaysIncludeSemantics: true,+ child: IconButton(+ onPressed: () => app.closeSwarm(swarm.id),+ icon: Icon(+ Icons.close,+ size: 13,+ semanticLabel: 'Close ${swarm.name}',+ ),+ constraints: const BoxConstraints.tightFor(+ width: 30,+ height: 30,+ ),+ padding: EdgeInsets.zero,+ ),),- padding: EdgeInsets.zero,- ),- ],+ ],+ ),),),),@@ -1469,51 +1480,64 @@ class _SwarmScreenState extends State<SwarmScreen> {),IconButton(key: const ValueKey('swarm-new-tab-button'),- tooltip: withEffectiveShortcutHint(- context,- 'New Tab',- ShortcutAction.newSwarm,- ),onPressed: app.swarms.length < AppNotifier.maxSwarms ? _newTab : null,- icon: const Icon(Icons.add, size: 18),+ icon: const Icon(Icons.add, size: 18, semanticLabel: 'New Tab'),),_harnessButton(create: true),- const SizedBox(width: 8),+ const SizedBox(width: 12),_harnessButton(create: false),- const SizedBox(width: 6),+ const SizedBox(width: 12),],),);Widget _harnessButton({required bool create}) {final label = create ? 'New Harness' : 'Open Harness';- return Tooltip(- message: withEffectiveShortcutHint(- context,- label,- create ? ShortcutAction.newAgent : ShortcutAction.addAgent,+ return TextButton(+ key: ValueKey(+ create ? 'swarm-new-harness-button' : 'swarm-open-harness-button',),- child: TextButton(- key: ValueKey(- create ? 'swarm-new-harness-button' : 'swarm-open-harness-button',- ),- onPressed: create ? _newAgent : _addAgent,- style: TextButton.styleFrom(- minimumSize: Size(create ? 106 : 108, 28),- padding: const EdgeInsets.symmetric(horizontal: 12),- tapTargetSize: MaterialTapTargetSize.shrinkWrap,- textStyle: Theme.of(context).textTheme.labelLarge- ?.copyWith(fontSize: 12, fontWeight: FontWeight.w500),- backgroundColor: create- ? grid.AppPalette.swarmAccent- : grid.AppPalette.swarmSearchSurface,- foregroundColor: create- ? grid.AppPalette.swarmTabBar- : grid.AppPalette.swarmAccent,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),- ),- child: Text(label),+ onPressed: create ? _newAgent : _addAgent,+ style: TextButton.styleFrom(+ minimumSize: Size(create ? 122 : 128, 34),+ padding: const EdgeInsets.symmetric(horizontal: 20),+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,+ textStyle: Theme.of(context).textTheme.labelLarge+ ?.copyWith(fontSize: 12, fontWeight: FontWeight.w500),+ backgroundColor: create+ ? grid.AppPalette.swarmAccent+ : grid.AppPalette.swarmSearchSurface,+ foregroundColor: create+ ? grid.AppPalette.swarmTabBar+ : grid.AppPalette.swarmAccent,+ shape: const StadiumBorder(),),+ child: Text(label),);}}++/// Hovering or focusing one tab only rebuilds its own controls.+class _TabActionsReveal extends StatefulWidget {+ const _TabActionsReveal({required this.builder});+ final Widget Function(bool visible) builder;++ @override+ State<_TabActionsReveal> createState() => _TabActionsRevealState();+}++class _TabActionsRevealState extends State<_TabActionsReveal> {+ bool _hovered = false, _focused = false;++ @override+ Widget build(BuildContext context) => MouseRegion(+ onEnter: (_) => setState(() => _hovered = true),+ onExit: (_) => setState(() => _hovered = false),+ child: Focus(+ canRequestFocus: false,+ includeSemantics: false,+ onFocusChange: (value) => setState(() => _focused = value),+ child: widget.builder(_hovered || _focused),+ ),+ );+}diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dartindex ae654f6ae..c67228c67 100644--- a/desktop/lib/shortcuts/app_shortcuts.dart+++ b/desktop/lib/shortcuts/app_shortcuts.dart@@ -5,8 +5,8 @@ import '../logging/debug_surface.dart';/// Harness uses Command as a direct prefix for frequent workspace actions./// T opens a tab, N creates a harness, O finds one, S changes layout,-/// H/J/K/L and arrows focus panes, B routes a task-/// and R refreshes discovery. The same definitions feed live keys, help and search.+/// H/J/K/L and arrows focus panes, B routes a task, D splits down and R splits+/// right. The same definitions feed live keys, help and search.////// Unclaimed input stays with the focused agent or text field. Composition,/// copy/paste and the coding agent's own prompt editing must keep working.@@ -307,12 +307,11 @@ const List<AppShortcut> kAppShortcuts = [////// Kept out of [kAppShortcuts] because it is not always there: a release build/// has no Debug screen (see [kDebugSurfaceEnabled]), and a key that opens-/// nothing is worse than a key that was never taken. `⌘D` is free on this list-/// and on this OS's own menus, and — like every other shortcut here — never-/// reaches the pty.+/// nothing is worse than a key that was never taken. Shift keeps it separate+/// from the everyday Command-D split action.const AppShortcut kDebugShortcut = AppShortcut(action: ShortcutAction.showDebug,- activator: SingleActivator(LogicalKeyboardKey.keyD, meta: true),+ activator: SingleActivator(LogicalKeyboardKey.keyD, meta: true, shift: true),label: 'Open the debug log',group: ShortcutGroup.actions,);@@ -329,6 +328,7 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) => [(!const {ShortcutAction.toggleRail,ShortcutAction.closePane,+ ShortcutAction.reload,}.contains(shortcut.action) &&!shortcut.activator.control))shortcut,diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex 43d54ee5e..d12504ce7 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -232,12 +232,14 @@ final harnessCommands = <HarnessCommand>['pane.split_right','Split right…',ShortcutGroup.panes,+ extraKeys: ['cmd+r'],nativeAction: 'splitRight',),const HarnessCommand('pane.split_down','Split down…',ShortcutGroup.panes,+ extraKeys: ['cmd+d'],nativeAction: 'splitDown',),const HarnessCommand(diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex b585e6694..d3a033569 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -873,7 +873,7 @@ class AppNotifier extends ChangeNotifier {/// Choosing a preset also resets custom sizes for that pane count. Selecting/// the current preset in Command-S is the quick way back to its proportions.void setPreset(int paneCount, PanePreset preset) {- if (!PanePreset.forCount(paneCount).contains(preset)) return;+ if (!preset.supportsCount(paneCount)) return;final resized = activeSwarm.paneSizes.keys.any((key) => key.startsWith('$paneCount:'),);@@ -2260,8 +2260,9 @@ class AppNotifier extends ChangeNotifier {_resetLoginBrowser();notifyListeners();await _finishBootstrapSignedIn();- if (!_authWorkCurrent(revision) || status != AppStatus.authenticated)+ if (!_authWorkCurrent(revision) || status != AppStatus.authenticated) {return;+ }analytics.signedIn();// Restarts the clock even if `_trackAppOpened` already started one: this// person met the login screen, so their wait begins where the launch's@@ -2928,8 +2929,9 @@ class AppNotifier extends ChangeNotifier {notifyListeners();return;}- if (!_authWorkCurrent(revision) || status == AppStatus.unauthenticated)+ if (!_authWorkCurrent(revision) || status == AppStatus.unauthenticated) {return;+ }if (currentUser == null) unawaited(_loadProfile());try {await refreshMachines();@@ -5012,7 +5014,7 @@ class AppNotifier extends ChangeNotifier {count >= 2 &&count <= maxPanes &&preset != null &&- PanePreset.forCount(count).contains(preset)) {+ preset.supportsCount(count)) {swarm.presets[count] = preset;}}diff --git a/desktop/lib/state/pane_layout_store.dart b/desktop/lib/state/pane_layout_store.dartindex d54f749cb..d4ae5bcc7 100644--- a/desktop/lib/state/pane_layout_store.dart+++ b/desktop/lib/state/pane_layout_store.dart@@ -100,7 +100,7 @@ class PaneLayoutStore {if (count == null || count < 2 || count > maxPanes) continue;final preset = PanePreset.byId(entry.value?.toString());if (preset == null) continue;- if (!PanePreset.forCount(count).contains(preset)) continue;+ if (!preset.supportsCount(count)) continue;out[count] = preset;}return out;diff --git a/desktop/lib/state/pane_preset.dart b/desktop/lib/state/pane_preset.dartindex 11a5e99df..668a4c0cf 100644--- a/desktop/lib/state/pane_preset.dart+++ b/desktop/lib/state/pane_preset.dart@@ -2,16 +2,9 @@ import 'dart:ui' show Rect;/// The named shapes a grid of tiles can take.///-/// A shape is not a free-form tree. Up to four tiles the shapes are few enough-/// to name, and naming them is what the whole feature is for: people do not-/// want to draw a layout, they want to pick the one they meant.-///-/// Above four, naming every arrangement would be silly — but there IS still a-/// choice, and it is the only one that matters at that size: HOW MANY COLUMNS.-/// The first cut of this feature said the window decides and offered nothing,-/// which was wrong: the window decides how many columns FIT, not how many the-/// person wants. [auto] is that measured answer kept as one option among the-/// column counts, not as the only one.+/// The picker offers concrete, distinct arrangements. Automatic and older+/// lattice presets still restore saved work, but are not duplicate cards in+/// the picker. New balanced grids fill every row and use all the canvas.enum PanePreset {/// Two tiles: split whichever side is longer. A terminal's usable size is its/// column count first, so halving the short axis is what protects it.@@ -59,24 +52,51 @@ enum PanePreset {quad,/// Four tiles: one tall on the left, three stacked on the right.- mainAndStack;+ mainAndStack,++ /// Three tiles: two on the left and one full-height on the right.+ mainRight,++ /// Five tiles: two above three, with both rows filling the width.+ twoOverThree,++ /// Row counts follow the requested maximum columns; panes are distributed+ /// evenly between rows so there are no unused cells or sparse trailing rows.+ balanced2,+ balanced3,+ balanced4,+ balanced5,++ /// A full-height main pane beside a balanced grid of supporting panes.+ mainAndGrid,++ /// A full-width main pane above a balanced grid of supporting panes.+ mainOverGrid;/// What the picker prints.String get label => switch (this) {PanePreset.splitLong => 'Split',PanePreset.columns => 'Columns',PanePreset.rows => 'Rows',- PanePreset.twoOverOne => 'Two over one',- PanePreset.oneOverTwo => 'One over two',- PanePreset.mainLeft => 'Main + stack',+ PanePreset.twoOverOne => 'Main bottom',+ PanePreset.oneOverTwo => 'Main top',+ PanePreset.mainLeft => 'Main left',PanePreset.quad => 'Grid',- PanePreset.mainAndStack => 'Main + stack',+ PanePreset.mainAndStack => 'Main left',PanePreset.auto => 'Auto',PanePreset.cols2 => '2 columns',PanePreset.cols3 => '3 columns',PanePreset.cols4 => '4 columns',PanePreset.cols5 => '5 columns',PanePreset.middleMain => 'Middle + sides',+ PanePreset.mainRight => 'Main right',+ PanePreset.twoOverThree => 'Two over three',+ PanePreset.balanced2 => '2 columns',+ PanePreset.balanced3 => '3 columns',+ PanePreset.balanced4 => '4 columns',+ PanePreset.balanced5 => '5 columns',+ PanePreset.mainAndGrid => 'Main left',+ PanePreset.mainOverGrid => 'Main top',};/// The column count this shape states, or null for [auto] and for the shapes@@ -89,6 +109,19 @@ enum PanePreset {_ => null,};+ /// These shapes use their unit rectangles directly in both renderers.+ bool get usesTileGeometry => switch (this) {+ PanePreset.mainRight ||+ PanePreset.twoOverThree ||+ PanePreset.balanced2 ||+ PanePreset.balanced3 ||+ PanePreset.balanced4 ||+ PanePreset.balanced5 ||+ PanePreset.mainAndGrid ||+ PanePreset.mainOverGrid => true,+ _ => false,+ };+/// The tiles this shape makes, as fractions of the grid.////// This is the shape's DESCRIPTION, and it lives here rather than in the@@ -96,23 +129,14 @@ enum PanePreset {/// rectangles and a test measures the real layout against them, so a diagram/// cannot drift into advertising a shape the grid does not build.///- /// Two shapes are approximate on purpose. [splitLong] is written as columns- /// because that is what a wide window gets; on a tall one it splits the other- /// way. [auto] is drawn at the column count a typical wide window carries,- /// since its real answer is not knowable without the window — which is- /// exactly what "auto" means.- /// [columns] answers the one shape that cannot know its own: `auto` measures- /// the window at build time, so the grid tells this what it actually laid out.- /// Every other shape states its columns and ignores the argument.+ /// Legacy automatic layouts accept their measured column count. They are+ /// not offered in the picker because they resolve to another shape there.List<Rect> tilesFor(int count, {int? columns}) => switch (this) {PanePreset.columns || PanePreset.splitLong => const [Rect.fromLTRB(0, 0, .5, 1),Rect.fromLTRB(.5, 0, 1, 1),],- PanePreset.rows => const [- Rect.fromLTRB(0, 0, 1, .5),- Rect.fromLTRB(0, .5, 1, 1),- ],+ PanePreset.rows => _lattice(count, 1),PanePreset.twoOverOne => const [Rect.fromLTRB(0, 0, .5, .5),Rect.fromLTRB(.5, 0, 1, .5),@@ -128,6 +152,11 @@ enum PanePreset {Rect.fromLTRB(.5, 0, 1, .5),Rect.fromLTRB(.5, .5, 1, 1),],+ PanePreset.mainRight => const [+ Rect.fromLTRB(0, 0, .5, .5),+ Rect.fromLTRB(.5, 0, 1, 1),+ Rect.fromLTRB(0, .5, .5, 1),+ ],PanePreset.quad => const [Rect.fromLTRB(0, 0, .5, .5),Rect.fromLTRB(.5, 0, 1, .5),@@ -150,6 +179,34 @@ enum PanePreset {Rect.fromLTRB(0, 1 / 2, 1 / 3, 1),Rect.fromLTRB(2 / 3, 1 / 2, 1, 1),],+ PanePreset.twoOverThree => _balanced(count, 3, largerRowsLast: true),+ PanePreset.balanced2 => _balanced(count, 2),+ PanePreset.balanced3 => _balanced(count, 3),+ PanePreset.balanced4 => _balanced(count, 4),+ PanePreset.balanced5 => _balanced(count, 5),+ PanePreset.mainAndGrid => [+ const Rect.fromLTRB(0, 0, .5, 1),+ for (final tile in _balanced(count - 1, 2))+ Rect.fromLTRB(+ .5 + tile.left / 2,+ tile.top,+ .5 + tile.right / 2,+ tile.bottom,+ ),+ ],+ PanePreset.mainOverGrid => [+ const Rect.fromLTRB(0, 0, 1, .5),+ for (final tile in _balanced(+ count - 1,+ count == 4 ? 3 : ((count - 1) / 2).ceil().clamp(2, 5),+ ))+ Rect.fromLTRB(+ tile.left,+ .5 + tile.top / 2,+ tile.right,+ .5 + tile.bottom / 2,+ ),+ ],PanePreset.auto => _lattice(count,columns ?? _autoColumnsForDrawing(count),@@ -157,6 +214,28 @@ enum PanePreset {_ => _lattice(count, statedColumns!.clamp(1, count)),};+ static List<Rect> _balanced(+ int count,+ int columns, {+ bool largerRowsLast = false,+ }) {+ final rows = (count / columns.clamp(1, count)).ceil();+ final perRow = count ~/ rows;+ final extra = count % rows;+ int columnsIn(int row) =>+ perRow + ((largerRowsLast ? row >= rows - extra : row < extra) ? 1 : 0);+ return [+ for (var row = 0; row < rows; row++)+ for (var col = 0; col < columnsIn(row); col++)+ Rect.fromLTRB(+ col / columnsIn(row),+ row / rows,+ (col + 1) / columnsIn(row),+ (row + 1) / rows,+ ),+ ];+ }+/// The lattice, laid out the way `_Lattice` lays it: row-major, the last row/// short when the count does not divide.///@@ -195,53 +274,111 @@ enum PanePreset {return _legacyIds[id];}- /// The shapes on offer for this many tiles, the shipped one first.- ///- /// One tile has nothing to choose. Everything else does — including the big- /// grids, where the choice is the column count and [auto] is the measured- /// answer sitting among them rather than replacing them.- static List<PanePreset> forCount(int count) => switch (count) {+ /// At most six useful shapes. Balanced grids that resolve to the same+ /// rectangles at a particular count are offered only once.+ static List<PanePreset> forCount(int count) {+ if (count < 2) return const [];+ return _choices.putIfAbsent(count, () {+ final seen = <String>{};+ return List.unmodifiable([+ for (final preset in _candidates(count))+ if (seen.add(_shapeKey(preset.tilesFor(count)))) preset,+ ]);+ });+ }++ static final _choices = <int, List<PanePreset>>{};++ static List<PanePreset> _candidates(int count) => switch (count) {< 2 => const [],- 2 => const [PanePreset.splitLong, PanePreset.columns, PanePreset.rows],+ 2 => const [PanePreset.columns, PanePreset.rows],3 => const [PanePreset.twoOverOne,PanePreset.oneOverTwo,PanePreset.mainLeft,+ PanePreset.mainRight,PanePreset.cols3,+ PanePreset.rows,+ ],+ 4 => const [+ PanePreset.quad,+ PanePreset.mainAndStack,+ PanePreset.mainOverGrid,+ PanePreset.cols4,+ PanePreset.rows,],- 4 => const [PanePreset.quad, PanePreset.mainAndStack, PanePreset.cols4],- // A column count equal to the tile count is one row, which is worth having;- // more columns than tiles is the same grid with empty air in it, so the- // list stops there. Five is the practical end: six 40-column terminals need- // a window almost nobody has, and the floor would clamp it back anyway.- // Five has a shape of its own to offer, beside the column counts.- 5 => [- PanePreset.auto,+ 5 => const [+ PanePreset.balanced3,+ PanePreset.twoOverThree,PanePreset.middleMain,- for (final preset in const [- PanePreset.cols2,- PanePreset.cols3,- PanePreset.cols4,- PanePreset.cols5,- ])- preset,+ PanePreset.mainAndGrid,+ PanePreset.mainOverGrid,+ PanePreset.cols5,],_ => [- PanePreset.auto,- for (final preset in const [- PanePreset.cols2,- PanePreset.cols3,- PanePreset.cols4,- PanePreset.cols5,- ])- if (preset.statedColumns! <= count) preset,+ PanePreset.balanced2,+ PanePreset.balanced3,+ PanePreset.balanced4,+ PanePreset.balanced5,+ if (count <= 9) ...[PanePreset.mainAndGrid, PanePreset.mainOverGrid],],};+ /// Saved automatic/regular grids remain valid even though the picker now+ /// offers explicit, filled arrangements. Do not silently discard their IDs.+ bool supportsCount(int count) => switch (this) {+ PanePreset.splitLong || PanePreset.columns => count == 2,+ PanePreset.rows => count >= 2 && count <= 4,+ PanePreset.twoOverOne ||+ PanePreset.oneOverTwo ||+ PanePreset.mainLeft ||+ PanePreset.mainRight => count == 3,+ PanePreset.quad || PanePreset.mainAndStack => count == 4,+ PanePreset.middleMain || PanePreset.twoOverThree => count == 5,+ PanePreset.cols2 || PanePreset.auto => count >= 5,+ PanePreset.cols3 => count >= 3,+ PanePreset.cols4 => count >= 4,+ PanePreset.cols5 ||+ PanePreset.balanced2 ||+ PanePreset.balanced3 ||+ PanePreset.balanced4 ||+ PanePreset.balanced5 ||+ PanePreset.mainAndGrid => count >= 5,+ PanePreset.mainOverGrid => count >= 4,+ };++ /// Match the visible geometry rather than the old preset's name or tile+ /// order. This highlights Columns/Rows for saved automatic two-pane splits.+ static PanePreset? matchingChoice(int count, List<Rect> tiles) {+ final key = _shapeKey(tiles);+ for (final choice in forCount(count)) {+ if (_shapeKey(choice.tilesFor(count)) == key) return choice;+ }+ return null;+ }++ static String _shapeKey(List<Rect> tiles) {+ final parts = [+ for (final tile in tiles)+ [+ tile.left,+ tile.top,+ tile.right,+ tile.bottom,+ ].map((edge) => (edge * 1e8).round()).join(','),+ ]..sort();+ return parts.join(';');+ }+/// What a grid of this size looks like when nobody has chosen.static PanePreset? defaultFor(int count) {- final choices = forCount(count);- return choices.isEmpty ? null : choices.first;+ return switch (count) {+ < 2 => null,+ 2 => PanePreset.splitLong,+ 3 => PanePreset.twoOverOne,+ 4 => PanePreset.quad,+ _ => PanePreset.auto,+ };}/// Ids written by the build that named these two by hand, before the columndiff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dartindex 77d0e03bc..17faf4f72 100644--- a/desktop/lib/state/swarm_navigation.dart+++ b/desktop/lib/state/swarm_navigation.dart@@ -152,6 +152,7 @@ class SwarmDestination {required this.id,required this.title,required this.detail,+ this.detailBranchOffset,required this.swarmId,required this.current,this.machineId,@@ -172,6 +173,9 @@ class SwarmDestination {];final String id, title, detail, machineLabel;++ /// The branch's start in the readable metadata, for its decorative glyph.+ final int? detailBranchOffset;final String? swarmId, machineId, agentId, engine;final String? closedId;final String? commandId, shortcut;@@ -193,6 +197,26 @@ class SwarmDestination {enum SwarmSearchAction { open, addHere }+({String text, int? branchOffset}) _harnessDetail(+ AgentProject? project,+ String machine,+ bool offline,+) {+ final name = project?.name;+ final branch = project?.branch;+ return (+ text: [+ name,+ branch,+ machine,+ if (offline) 'Offline',+ ].whereType<String>().where((part) => part.isNotEmpty).join(' · '),+ branchOffset: branch?.isNotEmpty == true+ ? (name?.isNotEmpty == true ? name!.length + 3 : 0)+ : null,+ );+}+class SwarmSearchSelection {const SwarmSearchSelection(this.destination, [@@ -390,16 +414,16 @@ class SwarmLocationCatalog {final project = agent == null ? null : machine?.projectOf(agent);final machineLabel = machine?.machine.displayName ?? pane.machineId;final engine = agent?.engine ?? pane.session?.engineId;- final detail = [- project?.name,- project?.branch,+ final detail = _harnessDetail(+ project,machineLabel,- if (machine?.nodeOnline == false) 'Offline',- ].whereType<String>().where((s) => s.isNotEmpty).toSet().join(' · ');+ machine?.nodeOnline == false,+ );return SwarmDestination(id: agentLocationId(swarm.id, pane.id),title: agent?.name ?? pane.session?.agentName ?? pane.agentId!,- detail: detail,+ detail: detail.text,+ detailBranchOffset: detail.branchOffset,swarmId: swarm.id,swarmName: swarm.name,paneId: pane.id,@@ -408,7 +432,7 @@ class SwarmLocationCatalog {agentId: pane.agentId,engine: engine,current: swarm.id == app.activeSwarmId && pane.id == app.focusedPaneId,- searchFields: [detail, project?.cwd, engine, swarm.name],+ searchFields: [detail.text, project?.cwd, engine, swarm.name],);}}@@ -801,16 +825,17 @@ List<SwarmDestination> swarmDestinations(final project = row?.$1.projectOf(row.$2);final machineName = machine?.machine.displayName ?? machineId;final engine = row?.$2.engine ?? pane?.session?.engineId;+ final detail = _harnessDetail(+ project,+ machineName,+ machine?.nodeOnline == false,+ );result.add(SwarmDestination(id: id,title: row?.$2.name ?? pane?.session?.agentName ?? agentId,- detail: [- project?.name,- project?.branch,- machineName,- if (machine?.nodeOnline == false) 'Offline',- ].whereType<String>().where((s) => s.isNotEmpty).toSet().join(' · '),+ detail: detail.text,+ detailBranchOffset: detail.branchOffset,swarmId: owner?.id,machineId: machineId,machineLabel: machineName,diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dartindex 9cdd9b03d..023679be9 100644--- a/desktop/lib/widgets/harness_start_page.dart+++ b/desktop/lib/widgets/harness_start_page.dart@@ -205,13 +205,14 @@ class _HarnessStartPageState extends State<HarnessStartPage> {spacing: 12,runSpacing: 12,children: [- FilledButton(+ OutlinedButton(key: const ValueKey('harness-start-open'),onPressed: _open,- style: FilledButton.styleFrom(+ style: OutlinedButton.styleFrom(minimumSize: const Size(160, 44),- backgroundColor: grid.AppPalette.swarmSearchSurface,+ backgroundColor: Colors.transparent,foregroundColor: Colors.white,+ side: const BorderSide(color: Colors.white24),shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8),),@@ -252,9 +253,9 @@ class _HarnessStartPageState extends State<HarnessStartPage> {borderRadius: BorderRadius.circular(10),child: Image.asset('assets/harness_device.webp',- width: 192,- height: 120,- fit: BoxFit.cover,+ width: 256,+ height: 144,+ fit: BoxFit.contain,semanticLabel: 'Harness Device',),),@@ -263,7 +264,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {mainAxisSize: MainAxisSize.min,children: [Text(- 'Meet Harness Device',+ 'The ultimate Harness setup',style: TextStyle(fontSize: 13,color: Colors.white70,@@ -279,7 +280,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {),const SizedBox(height: 6),const Text(- 'Voice control for your agents, right on your desk.',+ 'Scroll, switch panes, and give voice commands.',textAlign: TextAlign.center,style: TextStyle(fontSize: 12,diff --git a/desktop/lib/widgets/layout_palette.dart b/desktop/lib/widgets/layout_palette.dartindex 2d559fb12..8dfff1d58 100644--- a/desktop/lib/widgets/layout_palette.dart+++ b/desktop/lib/widgets/layout_palette.dart@@ -15,10 +15,8 @@ import '../theme/app_theme.dart';/// four words in a different order, and nobody reads a layout name twice; the/// little diagram is the whole interface and the label only confirms it.///-/// Every size has a choice except one tile. Up to four they are named shapes;-/// above that the choice is the column count, with "Auto" — as many columns as-/// the width carries at the forty-column floor — sitting among them as the-/// measured answer rather than as the only one.+/// Every card describes a distinct concrete arrangement. Automatic defaults+/// resolve to the matching card, instead of adding a duplicate picture./// Set while the palette is up, so a second ⌘S can be answered rather than/// stacking a route.///@@ -81,7 +79,10 @@ class _Strip {static const sidePadding = 14.0;/// The dialog's own width, which changes with how many shapes there are.- static double width(int choices) => choices > 3 ? 500 : 420;+ static double width(int choices) {+ final columns = choices > 4 ? 3 : choices.clamp(1, 4);+ return sidePadding * 2 + shape * columns + gap * (columns - 1);+ }/// How many shapes sit on one line. The same arithmetic Wrap does.static int perRow(int choices, double width, double shape) {@@ -142,7 +143,7 @@ class _LayoutPaletteState extends State<_LayoutPalette> {if (choices.isEmpty) return true;// presetFor is keyed on the PANE COUNT, not on how many shapes that count// offers — the two are different numbers and only one of them is a key.- final at = _cursorIn(choices, widget.notifier.presetFor(count));+ final at = _cursorIn(choices, _currentChoice(count));_select((at + 1) % choices.length);return true;}@@ -185,18 +186,39 @@ class _LayoutPaletteState extends State<_LayoutPalette> {return start.clamp(0, choices.length - 1);}+ PanePreset? _currentChoice(int count) {+ final notifier = widget.notifier;+ final preset = notifier.presetFor(count);+ if (preset == null || PanePreset.forCount(count).contains(preset)) {+ return preset;+ }+ final actual = notifier.activeSwarm.arranged?.tiles;+ if (actual != null && actual.length == count) {+ return PanePreset.matchingChoice(count, actual);+ }+ final viewport = MediaQuery.sizeOf(context);+ final resolved =+ preset == PanePreset.splitLong && viewport.height > viewport.width+ ? PanePreset.rows+ : preset;+ return PanePreset.matchingChoice(+ count,+ resolved.tilesFor(count, columns: notifier.gridColumns),+ );+ }+@overrideWidget build(BuildContext context) {final notifier = widget.notifier;grid.AppTheme.watch(context);final count = notifier.panes.length;final choices = PanePreset.forCount(count);- final current = notifier.presetFor(count);+ final current = _currentChoice(count);final cursor = _cursorIn(choices, current);final textScale = MediaQuery.textScalerOf(context).scale(11.5) / 11.5;final shapeWidth = (_Strip.shape * textScale).clamp(_Strip.shape, 216.0);final paletteWidth =- _Strip.width(choices.length) * textScale.clamp(1.0, 1.5);+ _Strip.width(choices.length) * textScale.clamp(1.0, 2.0);return KeymapRegion(contextKind: KeymapContext.workspace,@@ -282,7 +304,7 @@ class _LayoutPaletteState extends State<_LayoutPalette> {Padding(padding: const EdgeInsets.fromLTRB(18, 16, 18, 12),child: Text(- choices.isEmpty ? 'Layout' : 'Layout · $count tiles',+ choices.isEmpty ? 'Layout' : 'Layout · $count panes',style: TextStyle(color: grid.AppPalette.textSecondary,fontSize: 11.5,@@ -498,14 +520,17 @@ class _ShapePainter extends CustomPainter {@overridevoid paint(Canvas canvas, Size size) {- const gap = 1.5;final fill = Paint()..color = AppColors.accent.withValues(alpha: 0.55);for (final unit in preset.tilesFor(count)) {+ // Dense layouts must still draw every pane. A fixed 3px inset erased+ // short rows entirely once the diagram contained more than 21 rows.+ final gapX = (unit.width * size.width * .12).clamp(0.0, 1.5);+ final gapY = (unit.height * size.height * .12).clamp(0.0, 1.5);final rect = Rect.fromLTRB(- unit.left * size.width + gap,- unit.top * size.height + gap,- unit.right * size.width - gap,- unit.bottom * size.height - gap,+ unit.left * size.width + gapX,+ unit.top * size.height + gapY,+ unit.right * size.width - gapX,+ unit.bottom * size.height - gapY,);canvas.drawRRect(RRect.fromRectAndRadius(rect, const Radius.circular(2)),diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex 1c2f83937..9af38c0a7 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -95,6 +95,12 @@ class PaneGrid extends StatelessWidget {Widget _arrange(List<Widget> cells) {final preset = notifier.presetFor(cells.length);+ if (preset != null &&+ (preset.usesTileGeometry ||+ (preset == PanePreset.rows && cells.length > 2))) {+ return _PresetCells(cells: cells, preset: preset);+ }+// Above four, one family of shapes: a grid whose COLUMN COUNT is either// stated by the preset or measured from the width. The hand-tuned shapes// below stay as they are — three tiles are two over one with the bottom one@@ -684,6 +690,44 @@ class _SwarmGeometry {List<Rect> rectangles = const [];}+/// Non-retained grids use the same geometry for the new spanning presets.+/// The active Swarm canvas continues to keep all terminal subtrees in place.+class _PresetCells extends StatelessWidget {+ const _PresetCells({required this.cells, required this.preset});++ final List<Widget> cells;+ final PanePreset preset;++ @override+ Widget build(BuildContext context) => LayoutBuilder(+ builder: (context, constraints) {+ final minimum = _MinTile.of();+ final geometry = _SwarmGeometry(+ count: cells.length,+ viewport: constraints.biggest,+ preset: preset,+ minimum: Size(minimum.width, minimum.height),+ );+ final canvas = SizedBox(+ width: constraints.maxWidth,+ height: geometry.height,+ child: Stack(+ children: [+ for (var i = 0; i < cells.length; i++)+ Positioned.fromRect(+ rect: geometry.rectangles[i],+ child: ClipRect(child: cells[i]),+ ),+ ],+ ),+ );+ return geometry.height > constraints.maxHeight+ ? SingleChildScrollView(child: canvas)+ : canvas;+ },+ );+}+/// A hidden view retains its last configuration and geometry. Status changes/// update a replaced session; showing it applies fresh machine/agent metadata.class _PaneLayer extends StatefulWidget {diff --git a/desktop/lib/widgets/search_result_text.dart b/desktop/lib/widgets/search_result_text.dartindex 5716954ca..09f370da0 100644--- a/desktop/lib/widgets/search_result_text.dart+++ b/desktop/lib/widgets/search_result_text.dart@@ -120,15 +120,23 @@ class SearchResultText extends StatelessWidget {super.key,required this.matches,required this.style,+ this.inlineIcon,+ this.iconOffset = 0,});final String text;final Iterable<SearchFieldMatch> matches;final TextStyle style;+ /// Insert a decorative mark without changing searchable text or match offsets.+ final Widget? inlineIcon;+ final int iconOffset;+@overrideWidget build(BuildContext context) {final runs = searchTextRuns(text, matches);- if (!runs.any((run) => run.matched)) {+ final insertIcon =+ inlineIcon != null && iconOffset >= 0 && iconOffset < text.length;+ if (!insertIcon && !runs.any((run) => run.matched)) {return Text(text,maxLines: 1,@@ -136,18 +144,41 @@ class SearchResultText extends StatelessWidget {style: style,);}- return Text.rich(- TextSpan(- children: [- for (final run in runs)- TextSpan(- text: run.text,- style: run.matched- ? const TextStyle(fontWeight: FontWeight.w700)- : null,+ final spans = <InlineSpan>[];+ var offset = 0;+ for (final run in runs) {+ final emphasis = run.matched+ ? const TextStyle(fontWeight: FontWeight.w700)+ : null;+ if (insertIcon &&+ iconOffset >= offset &&+ iconOffset < offset + run.text.length) {+ final split = iconOffset - offset;+ if (split > 0) {+ spans.add(+ TextSpan(text: run.text.substring(0, split), style: emphasis),+ );+ }+ spans.add(+ WidgetSpan(+ alignment: PlaceholderAlignment.middle,+ child: ExcludeSemantics(+ child: Padding(+ padding: const EdgeInsets.only(right: 4),+ child: inlineIcon!,+ ),),- ],- ),+ ),+ );+ spans.add(TextSpan(text: run.text.substring(split), style: emphasis));+ } else {+ spans.add(TextSpan(text: run.text, style: emphasis));+ }+ offset += run.text.length;+ }+ return Text.rich(+ TextSpan(children: spans),+ semanticsLabel: insertIcon ? text : null,maxLines: 1,overflow: TextOverflow.ellipsis,style: style,diff --git a/desktop/lib/widgets/swarm_icon.dart b/desktop/lib/widgets/swarm_icon.dartindex 32f68bc76..9028036ec 100644--- a/desktop/lib/widgets/swarm_icon.dart+++ b/desktop/lib/widgets/swarm_icon.dart@@ -1,7 +1,7 @@import 'package:flutter/cupertino.dart';/// Four agents sharing one workspace. Native menus use the corresponding-/// `square.split.2x2` symbol in SwarmTitlebar.swift.+/// `square.grid.2x2` symbol in SwarmTitlebar.swift.class SwarmIcon extends StatelessWidget {const SwarmIcon({super.key, this.size = 19, this.color});@@ -10,5 +10,5 @@ class SwarmIcon extends StatelessWidget {@overrideWidget build(BuildContext context) =>- Icon(CupertinoIcons.square_split_2x2, size: size, color: color);+ Icon(CupertinoIcons.square_grid_2x2, size: size, color: color);}diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex 335fe32a2..1a6da05e9 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -1,6 +1,7 @@import 'swarm_search_field.dart';import 'package:flutter/material.dart';+import 'package:lucide_icons_flutter/lucide_icons.dart';import 'package:flutter/services.dart';import '../shortcuts/app_keymap.dart';@@ -481,6 +482,14 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {? null: SearchResultText(row.detail,+ iconOffset: row.detailBranchOffset ?? 0,+ inlineIcon: row.detailBranchOffset == null+ ? null+ : const Icon(+ LucideIcons.gitBranch300,+ size: 12,+ color: Colors.white60,+ ),matches: matches.where((match) => !match.title,),diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex c284f8812..8b451ab92 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -1494,6 +1494,9 @@ class _TerminalHeader extends StatelessWidget {if (project?.branch?.trim().isNotEmpty == true) project!.branch!,machineName,];+ final branchIndex = project?.branch?.trim().isNotEmpty == true+ ? (folder?.isNotEmpty == true ? 1 : 0)+ : null;final strip = PaneHeaderHover(child: SizedBox(height: compact ? 38 : 46,@@ -1637,15 +1640,30 @@ class _TerminalHeader extends StatelessWidget {),),Flexible(- child: Text(- details[i],- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontFamily: AppFonts.sans,- fontSize: 12,- color: AppColors.mutedStrong,- ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (i == branchIndex) ...[+ Icon(+ LucideIcons.gitBranch300,+ size: 12,+ color: AppColors.mutedStrong,+ ),+ const SizedBox(width: 4),+ ],+ Flexible(+ child: Text(+ details[i],+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ fontFamily: AppFonts.sans,+ fontSize: 12,+ color: AppColors.mutedStrong,+ ),+ ),+ ),+ ],),),],diff --git a/desktop/macos/Runner/HarnessKeymap.swift b/desktop/macos/Runner/HarnessKeymap.swiftindex 4770fc593..ff92eb18e 100644--- a/desktop/macos/Runner/HarnessKeymap.swift+++ b/desktop/macos/Runner/HarnessKeymap.swift@@ -185,9 +185,9 @@ final class HarnessNativeKeymap {let key = binding?.keys.count == 1 ? binding?.keys.first : nilitem.keyEquivalent = key?.menuEquivalent ?? ""item.keyEquivalentModifierMask = key?.modifiers ?? []- // AppKit has no multi-stroke key-equivalent column. Show its complete- // binding in the tooltip; never advertise just a sequence's first key.- item.toolTip = binding.map { "\(item.title) — \($0.hint)" }+ // Menu equivalents show single chords. Longer sequences remain in+ // Keyboard Shortcuts; hovering a menu row adds no duplicate hint.+ item.toolTip = nil}if let submenu = item.submenu { applyMenuKeys(to: submenu, context: context) }}diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex c2ac800dd..258451e3e 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -8,7 +8,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {private weak var window: NSWindow?private let channel: FlutterMethodChannelprivate let accessory = NSTitlebarAccessoryViewController()- private let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 40))+ private let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 52))private var observers: [NSObjectProtocol] = []private var configured = falseprivate var actionsEnabled = false@@ -113,12 +113,6 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {private func setKeymap(_ map: HarnessNativeKeymap) {keymap = map- let hint = map.hint(for: "swarm.new", context: "workspace")- strip.newButton.toolTip = hint.map { "New Tab (\($0))" } ?? "New Tab"- strip.createButton.toolTip = map.hint(for: "agent.new", context: "workspace")- .map { "New Harness (\($0))" } ?? "New Harness"- strip.openButton.toolTip = map.hint(for: "agent.add", context: "workspace")- .map { "Open Harness (\($0))" } ?? "Open Harness"if let main = NSApp.mainMenu, let window {let menu = main as? HarnessKeymapMenu ?? HarnessKeymapMenu.replacing(main)if NSApp.mainMenu !== menu { NSApp.mainMenu = menu }@@ -149,13 +143,13 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {window.styleMask.remove(.fullSizeContentView)window.backgroundColor = strip.palette.tabBar// AppKit fixes a right accessory's height to the title bar. A taller view- // alone is clipped. A compact unified toolbar gives the native traffic- // lights and the tab strip one 40-point row, without a second toolbar row.+ // alone is clipped. A unified toolbar gives the native traffic lights and+ // the tab strip one spacious row, without a second toolbar row.let toolbar = NSToolbar(identifier: "harness.swarm.titlebar")toolbar.displayMode = .iconOnlytoolbar.allowsUserCustomization = falsewindow.toolbar = toolbar- window.toolbarStyle = .unifiedCompact+ window.toolbarStyle = .unifiedwindow.titlebarSeparatorStyle = .noneaccessory.layoutAttribute = .rightaccessory.view = strip@@ -170,7 +164,11 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {private func resize() {guard let window else { return }// AppKit owns height; only width is configurable for a right accessory.- strip.setFrameSize(NSSize(width: max(200, window.frame.width - 88), height: strip.frame.height))+ let trafficLightEdge = window.standardWindowButton(.zoomButton).map {+ $0.convert($0.bounds, to: nil).maxX+ } ?? 76+ let leading = max(88, trafficLightEdge + 16)+ strip.setFrameSize(NSSize(width: max(200, window.frame.width - leading), height: strip.frame.height))strip.needsLayout = true}@@ -195,6 +193,16 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {item.target = selfitem.representedObject = actionitem.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + action)+ let symbols = [+ "new": "plus.square", "newAgent": "plus", "addAgent": "magnifyingglass",+ "renameActive": "pencil", "closeActive": "xmark",+ "splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",+ "zoomPane": "arrow.up.left.and.arrow.down.right", "closePane": "xmark.square",+ "commands": "command", "notifications": "bell",+ ]+ if let symbol = symbols[action] {+ item.image = NSImage(systemSymbolName: symbol, accessibilityDescription: title)+ }menu.addItem(item)}func install(_ menu: NSMenu, at index: Int) {@@ -210,8 +218,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {add(file, "Rename Harness…", "r", "renameActive", [.command, .shift])add(file, "Close Harness", "w", "closeActive")file.addItem(.separator())- add(file, "Split Right…", "", "splitRight")- add(file, "Split Down…", "", "splitDown")+ add(file, "Split Right…", "r", "splitRight")+ add(file, "Split Down…", "d", "splitDown")add(file, "Zoom Pane", "", "zoomPane")add(file, "Close Pane", "w", "closePane", [.command, .shift])install(file, at: 1)@@ -267,7 +275,6 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {let label = NSMutableAttributedString(string: machine.name)label.append(NSAttributedString(string: " " + machine.status, attributes: [.foregroundColor: NSColor.secondaryLabelColor]))item.attributedTitle = label- item.toolTip = "Find harnesses on " + machine.nameitem.image = NSImage(systemSymbolName: machine.local ? "laptopcomputer" : "desktopcomputer", accessibilityDescription: nil)machinesMenu.addItem(item)}@@ -313,7 +320,6 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {let item = NSMenuItem(title: entry.accessibilityLabel, action: nil, keyEquivalent: "")let icon = historyIcons.image(engine: entry.engine, asset: entry.iconAsset)item.view = SwarmSubscriptionView(entry: entry, icon: icon, width: rowWidth)- item.toolTip = entry.details.joined(separator: "\n")item.isEnabled = falsemodelsMenu.addItem(item)}@@ -383,7 +389,6 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {item.attributedTitle = entry.menuTitleitem.target = selfitem.representedObject = entry.id- item.toolTip = [entry.title, entry.machineName, entry.detail].filter { !$0.isEmpty }.joined(separator: "\n")item.state = entry.current ? .on : .offitem.image = entry.swarm && entry.agentCount != 1? SwarmIdentity.menuIcon@@ -457,8 +462,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {}private enum SwarmIdentity {- // Same four-pane symbol as widgets/swarm_icon.dart.- static let menuIcon = NSImage(systemSymbolName: "square.split.2x2", accessibilityDescription: nil)+ // Same four separate tiles as widgets/swarm_icon.dart.+ static let menuIcon = NSImage(systemSymbolName: "square.grid.2x2", accessibilityDescription: nil)}private struct SwarmMachineEntry: Equatable {@@ -547,7 +552,6 @@ private final class SwarmSubscriptionView: NSView {setAccessibilityElement(true)setAccessibilityRole(.staticText)setAccessibilityLabel(entry.accessibilityLabel)- toolTip = entry.details.joined(separator: "\n")layout()}@@ -743,7 +747,7 @@ private final class SwarmActionButton: NSButton {? fillColor.blended(withFraction: isHighlighted ? 0.16 : 0.08, of: labelColor) ?? fillColor: fillColorfill.withAlphaComponent(opacity).setFill()- NSBezierPath(roundedRect: bounds, xRadius: 6, yRadius: 6).fill()+ NSBezierPath(roundedRect: bounds, xRadius: bounds.height / 2, yRadius: bounds.height / 2).fill()let label = NSAttributedString(string: title, attributes: [.font: font ?? NSFont.systemFont(ofSize: 12, weight: .medium),.foregroundColor: labelColor.withAlphaComponent(opacity),@@ -788,11 +792,10 @@ private final class SwarmTabStrip: NSView {button.contentTintColor = palette.accentbutton.target = selfbutton.action = action- button.toolTip = labelbutton.setAccessibilityLabel(label)addSubview(button)}- button(newButton, "plus", "New Tab (⌘T)", #selector(newSwarm))+ button(newButton, "plus", "New Tab", #selector(newSwarm))newButton.setAccessibilityLabel("New Tab")newButton.isEnabled = falsebutton(notificationButton, "bell", "Notifications", #selector(openNotifications))@@ -804,7 +807,6 @@ private final class SwarmTabStrip: NSView {button.setButtonType(.momentaryChange)button.target = selfbutton.action = action- button.toolTip = labelbutton.setAccessibilityLabel(label)button.isEnabled = falseaddSubview(button)@@ -858,7 +860,7 @@ private final class SwarmTabStrip: NSView {? icons.image(engine: row["engine"] as? String, asset: row["iconAsset"] as? String): count > 1? SwarmIdentity.menuIcon- : NSImage(systemSymbolName: "plus.square", accessibilityDescription: "New Harness")+ : NSImage(systemSymbolName: "plus", accessibilityDescription: "New Harness")tab.selected = id == activeIdtab.actionsEnabled = actionsEnabledtab.attention = (row["attention"] as? Int ?? 0) > 0@@ -881,8 +883,7 @@ private final class SwarmTabStrip: NSView {openButton.isEnabled = actionsEnabledlet attention = state["attention"] as? Int ?? 0notificationButton.hasAttention = attention > 0- notificationButton.toolTip = attention > 0 ? "\(attention) harnesses need input" : "Notifications"- notificationButton.setAccessibilityLabel(notificationButton.toolTip)+ notificationButton.setAccessibilityLabel(attention > 0 ? "\(attention) harnesses need input" : "Notifications")needsLayout = truelayoutSubtreeIfNeeded()if ids != previousOrder {@@ -905,7 +906,12 @@ private final class SwarmTabStrip: NSView {let previousScrollSize = scroll.frame.sizelet previousDocumentSize = document.frame.sizelet leading: CGFloat = 36- let actionsWidth: CGFloat = 232+ let spacious = bounds.width >= 480+ let createWidth: CGFloat = spacious ? 122 : 106+ let openWidth: CGFloat = spacious ? 128 : 108+ let actionGap: CGFloat = spacious ? 12 : 8+ let trailing: CGFloat = spacious ? 12 : 8+ let actionsWidth = createWidth + actionGap + openWidth + trailingnewButton.isHidden = bounds.width < 420let available = max(32, bounds.width - leading - actionsWidth - (newButton.isHidden ? 0 : 36))let width = min(220, max(min(132, available), available / CGFloat(max(1, tabs.count))))@@ -919,8 +925,9 @@ private final class SwarmTabStrip: NSView {let buttonY = (bounds.height - 28) / 2notificationButton.frame = NSRect(x: 0, y: buttonY, width: 28, height: 28)newButton.frame = NSRect(x: leading + occupied + 4, y: buttonY, width: 28, height: 28)- createButton.frame = NSRect(x: bounds.width - actionsWidth, y: buttonY, width: 106, height: 28)- openButton.frame = NSRect(x: bounds.width - 116, y: buttonY, width: 108, height: 28)+ let actionY = (bounds.height - 34) / 2+ createButton.frame = NSRect(x: bounds.width - actionsWidth, y: actionY, width: createWidth, height: 34)+ openButton.frame = NSRect(x: bounds.width - trailing - openWidth, y: actionY, width: openWidth, height: 34)let geometryChanged = scroll.frame.size != previousScrollSize || document.frame.size != previousDocumentSizeif let active, revealActiveAfterLayout || (activeWasVisible && (geometryChanged || tabOrderChanged)) {document.scrollToVisible(active.frame)@@ -999,7 +1006,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidativar emit: ((String, Any?) -> Void)?var hoverChanged: (() -> Void)?var isHovered: Bool { hovered && actionsEnabled }- private let closeButton = SwarmTabActionButton()+ private let closeButton = SwarmCloseButton()private let selectButton = SwarmSelectButton()private let iconView = NSImageView()var icon: NSImage? {@@ -1041,7 +1048,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidaticloseButton.isBordered = falsecloseButton.target = selfcloseButton.action = #selector(closeSwarm)- closeButton.toolTip = "Close Harness"addSubview(closeButton)let menu = NSMenu()for (title, action) in [("Rename Harness…", #selector(renameSwarm)), ("Close Harness", #selector(closeSwarm))] {@@ -1072,9 +1078,13 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiprivate func setHovered(_ value: Bool) {guard hovered != value else { return }hovered = value+ updateCloseVisibility()needsDisplay = truehoverChanged?()}+ fileprivate func updateCloseVisibility() {+ closeButton.showsGlyph = hovered || selectButton.hasKeyboardFocus || closeButton.hasKeyboardFocus+ }private func invalidateLabel() {cachedLabel = nilneedsDisplay = true@@ -1130,7 +1140,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiselectButton.setAccessibilityLabel("Select \(name)")selectButton.setAccessibilityValue(selected ? "Selected" : "")selectButton.setAccessibilityHelp(attention ? "Contains harnesses needing input" : nil)- toolTip = "\(name) — double-click to rename"closeButton.setAccessibilityLabel("Close \(name)")}func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { actionsEnabled }@@ -1164,11 +1173,29 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati/// UI automation can reach the close action without treating the tab as a leaf.private class SwarmTabActionButton: NSButton {weak var owner: SwarmTabButton?+ private(set) var hasKeyboardFocus = falseoverride func becomeFirstResponder() -> Bool {guard super.becomeFirstResponder() else { return false }+ hasKeyboardFocus = true+ owner?.updateCloseVisibility()if let owner { owner.scrollToVisible(owner.bounds) }return true}+ override func resignFirstResponder() -> Bool {+ guard super.resignFirstResponder() else { return false }+ hasKeyboardFocus = false+ owner?.updateCloseVisibility()+ return true+ }+}++/// Keep the close action reachable by keyboard and VoiceOver while its glyph+/// rests quietly. Reserving its space avoids shifting labels on hover.+private final class SwarmCloseButton: SwarmTabActionButton {+ var showsGlyph = false { didSet { if showsGlyph != oldValue { needsDisplay = true } } }+ override func draw(_ dirtyRect: NSRect) {+ if showsGlyph { super.draw(dirtyRect) }+ }}private final class SwarmSelectButton: SwarmTabActionButton {diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dartindex ebeb1a628..4f563a5d8 100644--- a/desktop/test/keymap_host_test.dart+++ b/desktop/test/keymap_host_test.dart@@ -72,7 +72,8 @@ void main() {('cmd+shift+p', 'navigation.commands'),('cmd+s', 'pane.layout'),('cmd+b', 'task.route'),- ('cmd+r', 'machines.refresh'),+ ('cmd+r', 'pane.split_right'),+ ('cmd+d', 'pane.split_down'),('cmd+shift+w', 'pane.close'),('cmd+w', 'swarm.close'),('ctrl+tab', 'swarm.next'),diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dartindex 5b962cabe..30dc2a8c7 100644--- a/desktop/test/keymap_runtime_test.dart+++ b/desktop/test/keymap_runtime_test.dart@@ -118,6 +118,7 @@ void main() {await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);await tester.sendKeyEvent(shortcut);await tester.sendKeyEvent(shortcut);+ await tester.sendKeyEvent(shortcut);await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);await tester.pump();expect(find.byType(Dialog), findsOneWidget);@@ -188,7 +189,7 @@ void main() {await mount(tester, app, map);await key(tester, LogicalKeyboardKey.keyS, cmd: true);await tester.pumpAndSettle();- expect(find.text('Layout · 2 tiles'), findsOneWidget);+ expect(find.text('Layout · 2 panes'), findsOneWidget);expect(app.focusedPane, same(focused));await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pumpAndSettle();diff --git a/desktop/test/layout_palette_render_test.dart b/desktop/test/layout_palette_render_test.dartindex d31b1c9ee..c6125977c 100644--- a/desktop/test/layout_palette_render_test.dart+++ b/desktop/test/layout_palette_render_test.dart@@ -17,95 +17,108 @@ import 'support/real_fonts.dart';void main() {setUpAll(loadRealFonts);- for (final scale in [1.0, 2.0]) {- testWidgets('Layout choices fit the minimum window at text scale $scale', (- tester,- ) async {- tester.view.devicePixelRatio = 1;- tester.view.physicalSize = const Size(880, 560);- addTearDown(tester.view.reset);- final app = AppNotifier(- config: AppConfig.dev,- authSession: AuthSession(),- configStore: null,- );- for (var i = 0; i < 5; i++) {- app.panes.add(TerminalPane(id: i, machineId: 'm', agentId: 'a$i'));- }- final capture = GlobalKey();- await tester.pumpWidget(- RepaintBoundary(- key: capture,- child: MaterialApp(- debugShowCheckedModeBanner: false,- theme: grid.buildAppTheme(brightness: Brightness.dark),- builder: (context, child) => MediaQuery(- data: MediaQuery.of(context)- .copyWith(textScaler: TextScaler.linear(scale)),- child: child!,- ),- home: Scaffold(- backgroundColor: grid.AppPalette.swarmField,- body: Builder(- builder: (context) => TextButton(- onPressed: () => showLayoutPalette(context, app),- child: const Text('Layout'),+ for (final (count, scale) in [+ for (final count in [2, 3, 4, 5, 6, 7, 8, 9, 12, 16, 32, 64]) (count, 1.0),+ (5, 2.0),+ ]) {+ testWidgets(+ '$count-pane Layout choices fit the minimum window at text scale $scale',+ (tester) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(880, 560);+ addTearDown(tester.view.reset);+ final app = AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ );+ for (var i = 0; i < count; i++) {+ app.panes.add(TerminalPane(id: i, machineId: 'm', agentId: 'a$i'));+ }+ final capture = GlobalKey();+ await tester.pumpWidget(+ RepaintBoundary(+ key: capture,+ child: MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ builder: (context, child) => MediaQuery(+ data: MediaQuery.of(context)+ .copyWith(textScaler: TextScaler.linear(scale)),+ child: child!,+ ),+ home: Scaffold(+ backgroundColor: grid.AppPalette.swarmField,+ body: Builder(+ builder: (context) => TextButton(+ onPressed: () => showLayoutPalette(context, app),+ child: const Text('Layout'),+ ),),),),),- ),- );- await tester.tap(find.text('Layout'));- await tester.pumpAndSettle();- final output = Platform.environment['HARNESS_LAYOUT_CAPTURE_DIR'];- if (output != null) {- final boundary =- capture.currentContext!.findRenderObject()!- as RenderRepaintBoundary;- await tester.runAsync(() async {- final image = await boundary.toImage(pixelRatio: 1);- final bytes = await image.toByteData(format: ui.ImageByteFormat.png);- await Directory(output).create(recursive: true);- await File('$output/layout-880-$scale.png')- .writeAsBytes(bytes!.buffer.asUint8List());- image.dispose();- });- }- expect(tester.takeException(), isNull);- final choices = PanePreset.forCount(5);- Rect card(PanePreset preset) => tester.getRect(- find.ancestor(- of: find.text(preset.label),- matching: find.byType(Container),- ),- );- for (final preset in choices) {- expect(find.text(preset.label).hitTestable(), findsOneWidget);+ );+ await tester.tap(find.text('Layout'));+ await tester.pumpAndSettle();+ final output = Platform.environment['HARNESS_LAYOUT_CAPTURE_DIR'];+ if (output != null) {+ final boundary =+ capture.currentContext!.findRenderObject()!+ as RenderRepaintBoundary;+ await tester.runAsync(() async {+ final image = await boundary.toImage(pixelRatio: 1);+ final bytes = await image.toByteData(+ format: ui.ImageByteFormat.png,+ );+ await Directory(output).create(recursive: true);+ await File('$output/layout-$count-880-$scale.png')+ .writeAsBytes(bytes!.buffer.asUint8List());+ image.dispose();+ });+ }+ expect(tester.takeException(), isNull);+ final choices = PanePreset.forCount(count);+ Rect card(PanePreset preset) => tester.getRect(+ find.ancestor(+ of: find.text(preset.label),+ matching: find.byType(Container),+ ),+ );+ for (final preset in choices) {+ expect(find.text(preset.label).hitTestable(), findsOneWidget);+ expect(+ tester+ .renderObject<RenderParagraph>(find.text(preset.label))+ .didExceedMaxLines,+ isFalse,+ );+ }+ final first = card(choices.first);+ final below = choices.where((preset) {+ final rect = card(preset);+ return rect.top > first.top && (rect.left - first.left).abs() < 1;+ }).firstOrNull;+ // Start explicitly at the first option so legacy automatic geometry+ // does not choose a different initial card for this keyboard check.+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ app.setPreset(count, choices.first);+ await tester.tap(find.text('Layout'));+ await tester.pumpAndSettle();+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();expect(- tester- .renderObject<RenderParagraph>(find.text(preset.label))- .didExceedMaxLines,- isFalse,+ app.presetFor(count),+ below ?? choices.first,+ reason: 'Down follows the row actually drawn below',);- }- final first = card(choices.first);- final below = choices.firstWhere((preset) {- final rect = card(preset);- return rect.top > first.top && (rect.left - first.left).abs() < 1;- });- await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pumpAndSettle();- expect(- app.presetFor(5),- below,- reason: 'Down follows the row actually drawn below',- );- expect(find.byType(Dialog), findsNothing);- expect(tester.takeException(), isNull);- await tester.pumpWidget(const SizedBox());- app.dispose();- });+ expect(find.byType(Dialog), findsNothing);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );}}diff --git a/desktop/test/layout_palette_test.dart b/desktop/test/layout_palette_test.dartindex 59c0c8e3f..c4735454e 100644--- a/desktop/test/layout_palette_test.dart+++ b/desktop/test/layout_palette_test.dart@@ -92,7 +92,7 @@ void main() {await tester.tap(find.text('3 columns'));await tester.pump(const Duration(milliseconds: 300));- expect(notifier.presetFor(6), PanePreset.cols3);+ expect(notifier.presetFor(6), PanePreset.balanced3);expect(columnsOnScreen(), 3, reason: 'the grid followed the pick');});@@ -155,7 +155,7 @@ void main() {expect(notifier.presetFor(3), choices[1]);});- testWidgets('the cursor stops at the ends rather than wrapping round', (+ testWidgets('repeated arrows wrap through the available choices', (tester,) async {final notifier = await _open(tester);@@ -167,7 +167,7 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pumpAndSettle();- expect(notifier.presetFor(3), choices.last);+ expect(notifier.presetFor(3), choices[3 % choices.length]);});testWidgets('a digit picks straight away, without the arrows', (@@ -184,12 +184,12 @@ void main() {});testWidgets('a digit with no shape behind it does nothing', (tester) async {- // Three tiles offer four shapes, so 5 names none of them. Closing on it+ // There are at most six choices, so 9 names none of them. Closing on it// would throw away the choice someone was in the middle of making.final notifier = await _open(tester);final before = notifier.presetFor(3);- await tester.sendKeyEvent(LogicalKeyboardKey.digit5);+ await tester.sendKeyEvent(LogicalKeyboardKey.digit9);await tester.pumpAndSettle();expect(notifier.presetFor(3), before);@@ -199,9 +199,13 @@ void main() {testWidgets('a big grid offers the column counts, and they are pickable', (tester,) async {- final notifier = await _open(tester, panes: 6);+ final notifier = await _open(+ tester,+ panes: 6,+ preset: PanePreset.balanced2,+ );final choices = PanePreset.forCount(6);- expect(choices.first, PanePreset.auto);+ expect(choices.first, PanePreset.balanced2);// RIGHT, not down. Down used to be a second spelling of "one along"; it// moves a ROW now, which is what the arrow on the cap says.@@ -210,23 +214,62 @@ void main() {await tester.pumpAndSettle();expect(notifier.presetFor(6), choices[1]);- expect(notifier.presetFor(6)!.statedColumns, isNotNull);+ expect(notifier.presetFor(6), PanePreset.balanced3);+ });++ for (final (size, selected) in [+ (const Size(1200, 800), PanePreset.columns),+ (const Size(800, 1200), PanePreset.rows),+ ]) {+ testWidgets('saved automatic split selects ${selected.label} at $size', (+ tester,+ ) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = size;+ addTearDown(tester.view.reset);+ final notifier = await _open(+ tester,+ panes: 2,+ preset: PanePreset.splitLong,+ );+ expect(find.text('Split'), findsNothing);+ expect(find.text('Columns'), findsOneWidget);+ expect(find.text('Rows'), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(notifier.presetFor(2), selected);+ await tester.pumpWidget(const SizedBox());+ notifier.dispose();+ });+ }++ testWidgets('saved regular grid highlights the matching balanced choice', (+ tester,+ ) async {+ final notifier = await _open(tester, panes: 6, preset: PanePreset.cols3);+ expect(find.text('Auto'), findsNothing);+ expect(find.text('3 columns'), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(notifier.presetFor(6), PanePreset.balanced3);+ await tester.pumpWidget(const SizedBox());+ notifier.dispose();});testWidgets('down moves a ROW of the strip, not one along it', (tester,) async {- // Six shapes wrap to four over two, so down from the first lands on the- // fifth — the one drawn underneath it. Reported from the desk: it used to+ // Six shapes form two rows of three, so down from the first lands on the+ // fourth — the one drawn underneath it. Reported from the desk: it used to// walk sideways, which is worse than a key that waits.- final notifier = await _open(tester, panes: 6);- final choices = PanePreset.forCount(6);+ final notifier = await _open(tester, panes: 3);+ final choices = PanePreset.forCount(3);await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pumpAndSettle();- expect(notifier.presetFor(6), choices[4]);+ expect(notifier.presetFor(3), choices[3]);});testWidgets('the strip comes round at both ends', (tester) async {diff --git a/desktop/test/pane_layout_choices_test.dart b/desktop/test/pane_layout_choices_test.dartnew file mode 100644index 000000000..79ecb518e--- /dev/null+++ b/desktop/test/pane_layout_choices_test.dart@@ -0,0 +1,110 @@+import 'dart:convert';+import 'dart:ui';++import 'package:flutter_test/flutter_test.dart';+import 'package:harness/state/app_state.dart';+import 'package:harness/state/pane_layout_store.dart';+import 'package:harness/state/pane_preset.dart';++import 'swarm_state_test.dart' show createApp, MemoryStore;++String _shape(List<Rect> tiles) {+ final coordinates = [+ for (final tile in tiles)+ [+ tile.left,+ tile.top,+ tile.right,+ tile.bottom,+ ].map((value) => value.toStringAsFixed(8)).join(','),+ ]..sort();+ return coordinates.join(';');+}++void main() {+ test('saved automatic and regular grids remain restorable', () async {+ final storage = MemoryStore();+ final presets = {+ 2: PanePreset.splitLong,+ 5: PanePreset.cols2,+ 6: PanePreset.auto,+ 7: PanePreset.cols3,+ 8: PanePreset.cols4,+ 9: PanePreset.cols5,+ };+ storage.values['terminal_pane_presets'] = jsonEncode({+ for (final entry in presets.entries) '${entry.key}': entry.value.id,+ });+ expect(await PaneLayoutStore(storage: storage).loadPresets(), presets);++ final app = createApp(store: storage);+ await app.addAgentToSwarm('m', 'a0');+ app.activeSwarm.presets.addAll(presets);+ app.renameSwarm(app.activeSwarmId, 'Saved layouts');+ await Future<void>.delayed(Duration.zero);+ final restored = createApp(store: storage);+ await restored.restorePaneLayoutForTest();+ expect(restored.activeSwarm.presets, presets);+ app.dispose();+ restored.dispose();+ });++ test('two panes offer just side-by-side and stacked', () {+ expect(PanePreset.forCount(2), [PanePreset.columns, PanePreset.rows]);+ });++ test(+ 'every pane count offers distinct arrangements, not automatic aliases',+ () {+ for (var count = 2; count <= AppNotifier.maxPanes; count++) {+ final seen = <String, PanePreset>{};+ final labels = <String>{};+ for (final preset in PanePreset.forCount(count)) {+ final key = _shape(preset.tilesFor(count));+ expect(+ seen[key],+ isNull,+ reason: '$count panes: ${preset.id} duplicates ${seen[key]?.id}',+ );+ expect(+ labels.add(preset.label),+ isTrue,+ reason: '$count ${preset.label}',+ );+ expect(preset, isNot(PanePreset.auto));+ expect(preset, isNot(PanePreset.splitLong));+ seen[key] = preset;+ }+ expect(seen.length, inInclusiveRange(2, 6), reason: '$count panes');+ }+ },+ );++ test(+ 'every offered arrangement fills the canvas with nonoverlapping panes',+ () {+ for (var count = 2; count <= AppNotifier.maxPanes; count++) {+ for (final preset in PanePreset.forCount(count)) {+ final tiles = preset.tilesFor(count);+ final reason = '$count panes: ${preset.id}';+ expect(tiles, hasLength(count), reason: reason);+ var area = 0.0;+ for (var i = 0; i < tiles.length; i++) {+ final tile = tiles[i];+ expect(tile.width, greaterThan(0), reason: reason);+ expect(tile.height, greaterThan(0), reason: reason);+ expect(tile.left, greaterThanOrEqualTo(0), reason: reason);+ expect(tile.top, greaterThanOrEqualTo(0), reason: reason);+ expect(tile.right, lessThanOrEqualTo(1), reason: reason);+ expect(tile.bottom, lessThanOrEqualTo(1), reason: reason);+ area += tile.width * tile.height;+ for (final other in tiles.skip(i + 1)) {+ expect(tile.overlaps(other), isFalse, reason: reason);+ }+ }+ expect(area, closeTo(1, 1e-9), reason: reason);+ }+ }+ },+ );+}diff --git a/desktop/test/pane_preset_test.dart b/desktop/test/pane_preset_test.dartindex 6ff5f3a6e..df9b04617 100644--- a/desktop/test/pane_preset_test.dart+++ b/desktop/test/pane_preset_test.dart@@ -34,11 +34,7 @@ Future<List<Rect>> _layout(bool swarmMode = false,Size size = const Size(1600, 1500),}) async {- // Tall enough that no shape here hits the scroll fallback. Two columns of- // nine tiles is five rows, and a window without the height for five rows at- // the terminal floor SCROLLS rather than squeezing — correct behaviour, and- // covered in pane_lattice_test, but it puts tiles outside the grid box and- // there are no fractions of a visible grid left to measure.+ // Measure the entire canvas, including panes below the visible scroll area.await tester.binding.setSurfaceSize(size);await tester.pumpWidget(MaterialApp(@@ -47,15 +43,21 @@ Future<List<Rect>> _layout();await tester.pump();final grid = tester.getRect(find.byType(PaneGrid));+ final rectangles = [+ for (final pane in notifier.panes) tester.getRect(find.byKey(pane.cellKey)),+ ];+ final height = rectangles.fold<double>(+ grid.height,+ (height, rect) => (rect.bottom - grid.top).clamp(height, double.infinity),+ );return [- for (final pane in notifier.panes)+ for (final r in rectangles)() {- final r = tester.getRect(find.byKey(pane.cellKey));return Rect.fromLTRB((r.left - grid.left) / grid.width,- (r.top - grid.top) / grid.height,+ (r.top - grid.top) / height,(r.right - grid.left) / grid.width,- (r.bottom - grid.top) / grid.height,+ (r.bottom - grid.top) / height,);}(),];@@ -114,12 +116,8 @@ void main() {},);- for (final count in [2, 3, 4, 5, 6, 7, 9]) {+ for (final count in [2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 32, 64]) {for (final preset in PanePreset.forCount(count)) {- // `auto` measures the window, so its diagram is openly approximate and- // there is nothing to hold it to — every other shape states its answer- // and must lay out exactly that way.- if (preset == PanePreset.auto) continue;testWidgets('$count tiles · ${preset.id} is laid out as it is drawn', (tester,) async {@@ -188,10 +186,10 @@ void main() {expect(shape[4].bottom, closeTo(1, 0.02));});- test('a big grid offers auto first, then column counts that fit', () {- expect(PanePreset.forCount(5).first, PanePreset.auto);+ test('a big grid offers concrete balanced arrangements', () {+ expect(PanePreset.forCount(5).first, PanePreset.balanced3);for (var count = 5; count <= 9; count++) {- for (final preset in PanePreset.forCount(count).skip(1)) {+ for (final preset in PanePreset.forCount(count)) {final columns = preset.statedColumns;// A shape that is not a lattice carries its own rectangles instead —// `middleMain` is a full-height column with two stacked either side, anddiff --git a/desktop/test/rail_header_test.dart b/desktop/test/rail_header_test.dartindex bf63e9fd3..08d22a866 100644--- a/desktop/test/rail_header_test.dart+++ b/desktop/test/rail_header_test.dart@@ -88,7 +88,7 @@ void main() {final notifier = railNotifier();await pumpRail(tester, notifier);- final reload = find.byTooltip('Reload machines ⌘R');+ final reload = find.byTooltip('Reload machines');RotationTransition glyph() => tester.widget<RotationTransition>(find.descendant(of: reload, matching: find.byType(RotationTransition)),);@@ -112,7 +112,7 @@ void main() {// 2px between glyphs was the old spacing and it read as one smudge. The// gap is measured between the buttons' boxes, so it survives a change of// glyph size.- final reload = tester.getRect(find.byTooltip('Reload machines ⌘R'));+ final reload = tester.getRect(find.byTooltip('Reload machines'));final collapse = tester.getRect(find.byTooltip('Collapse sidebar ⌘\\'));expect(collapse.left - reload.right, greaterThanOrEqualTo(6));diff --git a/desktop/test/shortcuts_test.dart b/desktop/test/shortcuts_test.dartindex 1b7cc4979..0c6b28a7e 100644--- a/desktop/test/shortcuts_test.dart+++ b/desktop/test/shortcuts_test.dart@@ -357,7 +357,7 @@ void main() {});group('the developer shortcut', () {- // ⌘D opens Settings ▸ Debug. It is the one shortcut that is not always+ // ⇧⌘D opens Settings ▸ Debug. It is the one shortcut that is not always// there — a release build has no Debug screen — so what is guarded is that// the list and the build agree, in both directions.test(@@ -366,7 +366,7 @@ void main() {expect(kDebugSurfaceEnabled, isTrue, reason: 'tests run in debug mode');expect(appShortcuts(), contains(kDebugShortcut));expect(kAppShortcuts, isNot(contains(kDebugShortcut)));- expect(describeShortcut(kDebugShortcut.activator), '⌘D');+ expect(describeShortcut(kDebugShortcut.activator), '⇧⌘D');},);@@ -375,7 +375,7 @@ void main() {handlers: {ShortcutAction.showDebug: () {}},);expect(bindings.containsKey(kDebugShortcut.activator), isTrue);- expect(shortcutHintFor(ShortcutAction.showDebug), '⌘D');+ expect(shortcutHintFor(ShortcutAction.showDebug), '⇧⌘D');expect(shortcutRows().map((row) => row.label),contains(kDebugShortcut.label),diff --git a/desktop/test/swarm_canvas_test.dart b/desktop/test/swarm_canvas_test.dartindex 835d52176..402138417 100644--- a/desktop/test/swarm_canvas_test.dart+++ b/desktop/test/swarm_canvas_test.dart@@ -10,6 +10,61 @@ import 'swarm_state_test.dart' show createApp;import 'swarm_screen_test.dart' show terminal;void main() {+ for (final count in [3, 4, 5, 6, 9, 16]) {+ testWidgets(+ 'all $count-pane choices retain views and reveal latest output',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ for (var i = 0; i < count; i++) {+ final session = terminal('a$i', []);+ session.terminal.write(+ List.generate(200, (line) => 'pane $i line $line\r\n').join(),+ );+ app.adoptSessionForTest(session);+ }+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1600, 1000);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(home: PaneGrid(notifier: app, swarmMode: true)),+ );+ await tester.pump();+ final views = [+ for (final pane in app.panes)+ find.byWidgetPredicate(+ (w) => w is TerminalView && w.terminal == pane.session!.terminal,+ ),+ ];+ final states = [for (final view in views) tester.state(view)];+ final focus = app.focusedPaneId;+ for (final preset in PanePreset.forCount(count)) {+ for (final view in views) {+ tester.widget<TerminalView>(view).scrollController!.jumpTo(0);+ }+ await tester.pump();+ app.setPreset(count, preset);+ await tester.pump();+ for (var i = 0; i < count; i++) {+ expect(tester.state(views[i]), same(states[i]), reason: preset.id);+ final scroll = tester+ .widget<TerminalView>(views[i])+ .scrollController!;+ expect(+ scroll.offset,+ scroll.position.maxScrollExtent,+ reason: '$count ${preset.id} pane $i',+ );+ }+ expect(app.focusedPaneId, focus);+ expect(tester.takeException(), isNull);+ }+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );+ }+testWidgets('changed terminal metrics update the grid without a font-size change',(tester) async {diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dartindex 20f0166bd..872e4d6fb 100644--- a/desktop/test/swarm_screen_test.dart+++ b/desktop/test/swarm_screen_test.dart@@ -1,6 +1,7 @@import 'dart:convert';import 'package:flutter/material.dart';+import 'package:flutter/gestures.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';@@ -58,6 +59,46 @@ TerminalSession terminal(String id, List<TerminalBinaryFrame> input) =>..streamId = 'stream-$id';void main() {+ testWidgets('tab close marks follow hover and keyboard focus', (+ tester,+ ) async {+ final app = createApp();+ final first = app.activeSwarm;+ app.renameSwarm(first.id, 'First tab');+ app.newSwarm();+ final second = app.activeSwarm;+ app.renameSwarm(second.id, 'Second tab');+ await mount(tester, app);+ Finder close(String id) => find.byKey(ValueKey('tab-close:$id'));+ double opacity(String id) => tester.widget<Opacity>(close(id)).opacity;+ expect(opacity(first.id), 0);+ expect(opacity(second.id), 0);+ final pointer = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await pointer.addPointer(location: const Offset(900, 500));+ await pointer.moveTo(tester.getCenter(find.text('First tab')));+ await tester.pump();+ expect(opacity(first.id), 1);+ expect(opacity(second.id), 0);+ await pointer.moveTo(const Offset(900, 500));+ await tester.pump();+ expect(opacity(first.id), 0);+ Focus.of(tester.element(find.text('First tab'))).requestFocus();+ await tester.pumpAndSettle();+ expect(opacity(first.id), 1);+ final closeIcon = find.descendant(+ of: close(first.id),+ matching: find.byType(Icon),+ );+ Focus.of(tester.element(closeIcon)).requestFocus();+ await tester.pumpAndSettle();+ await tester.sendKeyEvent(LogicalKeyboardKey.space);+ await tester.pump();+ expect(app.swarms.map((swarm) => swarm.id), [second.id]);+ await pointer.removePointer();+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+for (final native in [false, true]) {testWidgets('tab identity follows its agent count (native=$native)', (tester,diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dartindex 9dd1400f0..c16b37fb5 100644--- a/desktop/test/swarm_split_test.dart+++ b/desktop/test/swarm_split_test.dart@@ -47,6 +47,56 @@ class _Creation extends WsConn {void main() {for (final axis in PaneResizeAxis.values) {final direction = axis == PaneResizeAxis.x ? 'right' : 'down';+ testWidgets(+ 'Command-${direction == 'right' ? 'R' : 'D'} splits the focused pane $direction',+ (tester) async {+ final app = createApp();+ final machine = app.machineStates['m']!;+ machine.nodeOnline = true;+ machine.localOnly = true;+ machine.agents[2] = const Agent(+ id: 'a2',+ name: 'New split helper',+ engine: 'codex',+ terminalAvailable: true,+ );+ final frames = <TerminalBinaryFrame>[];+ final first = app.adoptSessionForTest(terminal('a0', frames));+ final original = app.activeSwarmId;+ app.newSwarm();+ final helper = app.adoptSessionForTest(terminal('a2', frames));+ app.selectSwarm(original);+ app.focusPane(first.id);+ await mountWide(tester, app);+ await chord(+ tester,+ axis == PaneResizeAxis.x+ ? LogicalKeyboardKey.keyR+ : LogicalKeyboardKey.keyD,+ );+ await tester.pump();+ final search = find.byKey(const ValueKey('swarm-search-input'));+ expect(search, findsOneWidget);+ await tester.enterText(search, 'New split helper');+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(app.panes, [first, helper]);+ final before = tester.getRect(find.byKey(first.cellKey));+ final after = tester.getRect(find.byKey(helper.cellKey));+ if (axis == PaneResizeAxis.x) {+ expect(after.left, greaterThan(before.right));+ expect(after.top, before.top);+ } else {+ expect(after.top, greaterThan(before.bottom));+ expect(after.left, before.left);+ }+ expect(frames, isEmpty);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );+testWidgets('hover split $direction targets that pane without disturbing its neighbor',(tester) async {diff --git a/desktop/tool/keymap_native_checks.swift b/desktop/tool/keymap_native_checks.swiftindex 01fafaf7b..f0dc79946 100644--- a/desktop/tool/keymap_native_checks.swift+++ b/desktop/tool/keymap_native_checks.swift@@ -14,7 +14,8 @@ let changed = HarnessNativeKeymap(fixture["changed"]!)!for (key, command) in [("cmd+left", "pane.focus_left"), ("cmd+down", "pane.focus_below"),("cmd+up", "pane.focus_above"), ("cmd+right", "pane.focus_right"),- ("cmd+s", "pane.layout"), ("cmd+r", "machines.refresh"),+ ("cmd+s", "pane.layout"), ("cmd+r", "pane.split_right"),+ ("cmd+d", "pane.split_down"),("cmd+b", "task.route"), ("cmd+t", "swarm.new"),("cmd+n", "agent.new"), ("cmd+o", "agent.add"),("cmd+h", "pane.focus_left"), ("cmd+j", "pane.focus_below"),diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swiftindex d87c9e2d4..53a0ee46c 100644--- a/desktop/tool/swarm_titlebar_checks.swift+++ b/desktop/tool/swarm_titlebar_checks.swift@@ -29,6 +29,13 @@ private extension SwarmTabButton {}}+ func checkCloseVisibility(_ visible: Bool) throws {+ try checkTitlebar(closeButton.showsGlyph == visible,+ "A tab reveals its close mark only for hover or keyboard focus")+ try checkTitlebar(!closeButton.isHidden && closeButton.accessibilityLabel() == "Close \(name)",+ "A quiet close mark remains an accessible action")+ }+func clickBothActions() {selectButton.performClick(nil)closeButton.performClick(nil)@@ -67,7 +74,12 @@ private extension SwarmTabStrip {let closeFrame = close.convert(close.bounds, to: nil)let zoomFrame = zoom.convert(zoom.bounds, to: nil)let newFrame = newButton.convert(newButton.bounds, to: nil)- try checkTitlebar(bounds.height >= 40, "Native title bar does not clip the requested tab row")+ try checkTitlebar(bounds.height >= 48, "Native title bar leaves room around the pill actions")+ for button in [createButton, openButton] {+ let labelWidth = (button.title as NSString).size(withAttributes: [.font: button.font!]).width+ try checkTitlebar(button.frame.minY >= 6 && bounds.height - button.frame.maxY >= 6 && button.frame.width - labelWidth >= 32,+ "\(button.title) has vertical breathing room and readable horizontal padding")+ }try checkTitlebar(stripFrame.minX >= zoomFrame.maxX + 12, "Tab row leaves room beside native traffic lights")try checkTitlebar(abs(newFrame.midY - closeFrame.midY) <= 1, "Tab controls align vertically with native traffic lights")try checkTitlebar(abs(stripFrame.minY - window.contentLayoutRect.maxY) <= 1, "Tab row meets content without a second toolbar row")@@ -105,9 +117,13 @@ private extension SwarmTabStrip {try checkTitlebar(ownsBackgroundDoubleClick(click(2, at: NSPoint(x: 40, y: 20), time: 2.1)),"A double-click wholly on titlebar background still zooms the window")try checkTitlebar(tabs[0].showsDivider && tabs[1].showsDivider, "Idle neighboring tabs have separators")+ try tabs[1].checkCloseVisibility(false)tabs[1].mouseEntered(with: hover)+ try tabs[1].checkCloseVisibility(true)+ try tabs[0].checkCloseVisibility(false)try checkTitlebar(!tabs[0].showsDivider && !tabs[1].showsDivider, "Hover clears separators on both sides of the tab")tabs[1].mouseExited(with: hover)+ try tabs[1].checkCloseVisibility(false)try checkTitlebar(tabs[0].showsDivider && tabs[1].showsDivider, "Separators return when the pointer leaves")try checkTitlebar(!tabs[10].showsDivider && !tabs[11].showsDivider, "Selected tab remains joined without neighboring separators")try checkTitlebar(tabs.count == 24, "All overflow tabs exist")@@ -132,7 +148,7 @@ private extension SwarmTabStrip {"A palette update does not undo manual tab scrolling")update(state(rows, active: "swarm-23"))try checkActiveVisible()- setFrameSize(NSSize(width: 320, height: 40))+ setFrameSize(NSSize(width: 320, height: 52))needsLayout = truelayoutSubtreeIfNeeded()try checkActiveVisible()@@ -150,7 +166,8 @@ private extension SwarmTabStrip {try checkTitlebar(tabs.count == 1 && tabs[0] === original, "Closing tabs retains the surviving control")try original.checkAccessibility(expectedName: "Renamed tab", active: true)try checkTitlebar(newButton.isEnabled, "New Harness returns below capacity")- try checkTitlebar(newButton.toolTip?.contains("⌘T") == true, "New Harness advertises its keyboard shortcut")+ try checkTitlebar(newButton.toolTip == nil && createButton.toolTip == nil && openButton.toolTip == nil,+ "Titlebar actions add no hover hints")try checkTitlebar(notificationButton.frame.maxX <= scroll.frame.minX,"The bell is before the tabs beside the traffic lights")try checkTitlebar((newButton.isHidden || newButton.frame.maxX <= createButton.frame.minX) && scroll.frame.maxX <= createButton.frame.minX && createButton.frame.maxX < openButton.frame.minX,@@ -201,6 +218,7 @@ private extension SwarmTabStrip {let buttons = tab.accessibilityChildren()!.compactMap { $0 as? NSButton }for button in buttons {try checkTitlebar(window.makeFirstResponder(button), "An enabled tab action accepts keyboard focus")+ try tab.checkCloseVisibility(true)try checkTitlebar(scroll.documentVisibleRect.contains(tab.frame),"Keyboard focus reveals the entire overflowed tab and close control")try checkTitlebar(activeId == "keyboard-23", "Focusing a tab control does not activate its swarm")@@ -212,6 +230,7 @@ private extension SwarmTabStrip {messenger.finishNextReply()try checkTitlebar(window.firstResponder === window.contentViewController,"Activating a tab action returns the next key to Flutter content")+ try tab.checkCloseVisibility(false)try checkTitlebar(messenger.calls.count == before + 1, "Each native tab activation sends one action")}tab.attention = true@@ -293,7 +312,7 @@ private final class TitlebarCheckDrag: NSObject, NSDraggingInfo {private extension SwarmTabStrip {func checkDragOperations() throws {- setFrameSize(NSSize(width: 900, height: 40))+ setFrameSize(NSSize(width: 900, height: 52))let rows = (0..<4).map { ["id": "drag-\($0)", "name": "Drag \($0)"] }update(["tabs": rows, "activeId": "drag-0", "enabled": true])var moves: [[String: Any]] = []@@ -389,8 +408,8 @@ private extension SwarmTitlebar {let main = NSApp.mainMenu as! HarnessKeymapMenutry checkTitlebar(main !== original && main.item(withTitle: "Edit")?.submenu === edit,"The main-menu dispatcher retains the actual Edit submenu and its targets")- try checkTitlebar(newSwarm.keyEquivalent == "t" && newSwarm.toolTip?.contains("⌘T") == true,- "Native shortcut display comes from the effective Dart binding")+ try checkTitlebar(newSwarm.keyEquivalent == "t" && newSwarm.toolTip == nil,+ "Native shortcuts display in the menu without duplicate hover hints")setKeymap(changed)try checkTitlebar(NSApp.mainMenu === main && newSwarm.keyEquivalent == "o","Hot reload updates the existing menu to the remapped key")@@ -402,8 +421,8 @@ private extension SwarmTitlebar {["workspace", "terminal", "picker"].map { ($0, [["keys": ["cmd+k", "n"], "command": "swarm.new","hint": "⌘K N", "repeatable": false, "menuAction": "new"]]) })])!setKeymap(onlySequence)- try checkTitlebar(newSwarm.keyEquivalent.isEmpty && newSwarm.toolTip?.contains("⌘K N") == true,- "A sequence has a complete tooltip without a misleading first-key menu shortcut")+ try checkTitlebar(newSwarm.keyEquivalent.isEmpty && newSwarm.toolTip == nil,+ "Sequences add no hover hints or misleading first-key menu shortcut")setKeymap(HarnessNativeKeymap(["version": 1, "contexts": ["workspace": [], "terminal": [], "picker": []]])!)try checkTitlebar(newSwarm.keyEquivalent.isEmpty && newSwarm.toolTip == nil,"Unbinding clears the old native shortcut and hint")@@ -423,7 +442,7 @@ private extension SwarmTitlebar {"The menu yields the remapped search shortcut to Flutter")try checkTitlebar(!main.performKeyEquivalent(with: open), "Menu equivalents defer before input dispatch")setKeymap(defaults)- try checkTitlebar(strip.newButton.toolTip == "New Tab (⌘T)", "Reload refreshes the New Harness button hint")+ try checkTitlebar(strip.newButton.toolTip == nil, "Keymap reload does not restore hover hints")try checkTitlebar(strip.newButton.accessibilityLabel() == "New Tab", "The plus announces New Harness")try checkTitlebar(!main.defersToInput(event("p", 35, .command)), "Command-P no longer opens Navigate")try checkTitlebar(main.defersToInput(event("p", 35, [.command, .shift])), "Command-Shift-P reaches command search")@@ -484,6 +503,8 @@ private extension SwarmTitlebar {let agent = main.item(withTitle: "File")!.submenu!let historyMenu = main.item(withTitle: "History")!.submenu!try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "newAgent", "addAgent", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups Harness and Pane actions, without Pin or Add Project clutter")+ try checkTitlebar(agent.items.filter { !$0.isSeparatorItem }.allSatisfy { $0.image != nil && $0.toolTip == nil },+ "Every File action has a native icon and no hover hint")try checkTitlebar(agent.items.contains { $0.title == "Rename Harness…" && $0.representedObject as? String == "renameActive" }, "Rename Harness preserves its command")try checkTitlebar(agent.items.contains { $0.title == "Close Harness" && $0.representedObject as? String == "closeActive" }, "Close Harness preserves its command")let commands = edit.submenu!.items.first(where: { $0.representedObject as? String == "commands" })!@@ -563,7 +584,7 @@ private extension SwarmTitlebar {let closed = closedItems[0]try checkTitlebar(recent.image?.size == NSSize(width: 16, height: 16) && recent.image?.isTemplate == false,"History uses the colored Claude mark at native menu size")- try checkTitlebar(recent.state == .on && recent.toolTip == "Agent 0 — Machine\nProject 0", "Recent work includes its complete title and project context")+ try checkTitlebar(recent.state == .on && recent.toolTip == nil, "History adds no hover hints")updateHistory(recentRows, closed: closedRows)try checkTitlebar(historyMenu.items.contains(where: { $0 === recent }), "Unchanged history retains native menu items")try checkTitlebar(validateMenuItem(closed), "A specific closed Swarm can be restored")@@ -745,7 +766,7 @@ do {try checkTitlebar(assetReads == 4, "Native history loads each bundled mark only once")let unknown = icons.image(engine: "custom", asset: nil)try checkTitlebar(unknown.isTemplate && unknown.size == NSSize(width: 16, height: 16), "Unknown engines have a native-size adaptive initial")- let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 40))+ let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 52))try strip.runChecks()try strip.checkAgentIdentity()try checkTitlebar(titlebarCheckApp.windows.isEmpty, "Checks never open an application window")diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.mdindex aa75701fa..e64ee2de8 100644--- a/docs/harness-agent-first-tabs.md+++ b/docs/harness-agent-first-tabs.md@@ -24,7 +24,11 @@ Opening the dropdown keeps its whole list viewport inside the window. Resizingor changing text size reveals the highlighted row without changing the selection.A small product image and introduction sit well below the controls and link tohttps://www.autonomous.ai/harness-device. The bundled image is the official-product photo from https://cdn.autonomous.ai/production/ecm/260731/2.webp.+device image from https://cdn.autonomous.ai/production/ecm/260731/1-2.webp,+as shown on https://www.autonomous.ai/harness. The short introduction is+“The ultimate Harness setup” / “Scroll, switch panes, and give voice commands.”+The start-page Open Harness button is transparent with a subtle border; New+Harness retains its accent fill.Unused default-name empty pages are excluded from Recently Closed.The titlebar places the bell beside the traffic lights, then the tabs and tab@@ -32,8 +36,11 @@ plus. Explicit **New Harness** and **Open Harness** buttons sit on the right.There is no floating +. Cmd-N opens creation directly; Cmd-O opens existing-worksearch. Each has its own popup, with no creation CTA or “or” divider in search,no Back to Search button in creation, and no stacked dialog on dismissal.-The Flutter titlebar uses the same compact accent/secondary button treatment as-AppKit, inherits the app's font, and exposes current shortcut hints on hover.+The titlebar actions are 34-point-high pills with generous horizontal padding,+12 points between them and at the right edge. AppKit uses one unified toolbar+row; the Flutter titlebar is 52 points high and uses the same accent/secondary+treatment and app font. Titlebar and native menu hover hints are+removed. Accessible names remain, and menus and Keyboard Shortcuts show bindings.The creation dialog title and CTA are **New Harness**. Cancel is removed; Escapeand clicking outside dismiss it. Launch-in-progress and uncertain-outcome statesretain their existing safeguards and recovery actions.@@ -52,7 +59,8 @@ also work immediately after opening the menu, before its first frame.The Open popup keeps its full-width **Find a harness** field, single-choiceresults and 90% black backdrop. Only the highlighted row shows **Open Harness**,**Open N Harnesses**, or **Split right/down**, depending on context.-Secondary text is **project · branch · machine**. Missing metadata is omitted+Secondary text is **project · branch · machine**, with one small muted Git branch+mark immediately before the branch in search and pane headers. Missing metadata is omittedand the containing workspace name is not repeated.The Commands footer stays removed; Shift-Cmd-P and typing `>` expose commands.An explicit Cmd-N while choosing a split replaces search with creation in that@@ -69,7 +77,10 @@ handing keyboard ownership back to Flutter and preserve in-progress search compo## Tabs and menus-One harness shows its engine mark; multiple harnesses use the group mark. Returning+One harness shows its engine mark; multiple harnesses use four separate outlined+tiles, matching the native square.grid.2x2 symbol. An empty tab uses a plain plus.+Tab close marks appear only on hover or keyboard focus, retaining their space+and accessible actions while idle. Returningto one restores the engine mark. The same rule applies in search and History,including Recently Closed; a closure retains its engine identity even if theagent disappears from discovery. Tab names remain editable. Former default names@@ -79,7 +90,7 @@ the first agent's name when opened.The macOS menus are **Harness, File, Edit, View, History, Models, Machines,Window, Help**. File groups **New Tab, New Harness, Open Harness, Rename Harness, Close Harness**;then **Split Right, Split Down, Zoom Pane, Close Pane**. Pin/Unpin and Add Project-are removed from this menu. Machines starts with **Open Machines Manager**, then+are removed from this menu. File actions have native system icons. Machines starts with **Open Machines Manager**, thenlinked computers with their status, followed by Link Machine and Refresh Machines.The manager has a visible **Rename** action on each computer and uses the existingmachine rename API. It reports failures inline and refreshes names in the menu@@ -88,12 +99,22 @@ name filled in; no agent is opened until the user chooses a result.**Cmd-T** opens the start page, **Cmd-N** opens New Harnessdirectly, and **Cmd-O** finds an existing harness. **Cmd-S** opens Layout.+**Cmd-R** splits right and **Cmd-D** splits down, opening the shared picker for+that position. Refresh Machines stays in the Machines menu and command search,+without a default chord. The developer-only Debug shortcut is Shift-Cmd-D.Pressing the configured Layout key again cycles choices without applying them;Enter applies the highlighted choice and Escape cancels. Plain digits choosedirectly, while modified digits and arrows cannot accidentally apply a shape.Layout cards keep fixed diagram bounds as the highlight moves. Larger text getswider cards and readable labels, with arrow navigation following the renderedrows and scrolling the selected choice into view when necessary.+Two panes offer only Columns and Rows. Three and four panes add spanning main+panes and explicit rows/columns; five adds balanced 3+2 and 2+3 rows, a central+main pane, and main-plus-grid choices. Larger counts offer balanced grids, with+main-plus-grid choices through nine panes. Every offered shape fills the canvas;+equivalent rectangles are deduplicated at each count through the 64-pane limit.+Automatic and older grid IDs still restore saved geometry, but do not appear as+duplicate cards. Their matching explicit card is highlighted when available.**Cmd-H/J/K/L** and **Cmd-arrows** focus panes; **Shift-Cmd-arrows** move them.**Cmd-1…Cmd-9** select tabs in their visible order; missing numbers do nothing.Cmd-W closes the tab, Shift-Cmd-W closes the focused pane, and Shift-Cmd-T