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
Restore directional pane splitting (#170)
Dee0a4e33bf9400
diff --git a/desktop/design/review/pane-split-hover.png b/desktop/design/review/pane-split-hover.pngnew file mode 100644index 000000000..8d68f6c0cBinary files /dev/null and b/desktop/design/review/pane-split-hover.png differdiff --git a/desktop/design/review/pane-split-picker.png b/desktop/design/review/pane-split-picker.pngnew file mode 100644index 000000000..baf7894cdBinary files /dev/null and b/desktop/design/review/pane-split-picker.png differdiff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 1af45f89a..92724dc71 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -64,7 +64,6 @@ import '../widgets/swarm_search_input.dart';import '../widgets/swarm_attention.dart';import '../widgets/swarm_switcher.dart';import '../widgets/swarm_wallpaper.dart';-import '../widgets/agent_action_icons.dart';import '../widgets/swarm_icon.dart';import '../widgets/task_palette.dart';import '../state/command_bar.dart';@@ -1821,19 +1820,11 @@ class _SwarmScreenState extends State<SwarmScreen> {}}- Future<void> _splitAgent(- PaneResizeAxis axis, {- int? paneId,- bool create = false,- }) async {+ Future<void> _splitAgent(PaneResizeAxis axis, {int? paneId}) async {final split = app.preparePaneSplit(axis, paneId: paneId);if (split == null) return;if (paneId != null) app.focusPane(split.paneId);- if (create) {- await _newAgent(split: split);- } else {- _openSearch(adding: true, split: split);- }+ _openSearch(adding: true, split: split);}Future<void> _showHistory() async {@@ -2073,7 +2064,6 @@ class _SwarmScreenState extends State<SwarmScreen> {Widget _buildSearchOverlay(BuildContext context) {final search = _search!;- final commandsOnly = search.isCommandMode;// Results sit above a stable input line in the workspace command dock.// The input is visually below results, but Tab still starts at the first// result rather than a cached, offscreen ListView row below the input.@@ -2095,7 +2085,8 @@ class _SwarmScreenState extends State<SwarmScreen> {search.title,style: boxMonoStyle(size: 12, color: kBoxFaint),),- if (search.placement == HarnessPlacement.currentTab)+ if (search.placement == HarnessPlacement.currentTab ||+ search.split != null)Expanded(child: Padding(padding: const EdgeInsets.symmetric(horizontal: 8),@@ -2145,22 +2136,6 @@ class _SwarmScreenState extends State<SwarmScreen> {fontSize: 13,terminal: true,hintText: search.hint,- trailing: !commandsOnly && search.split != null- ? KeymapRegion(- contextKind: KeymapContext.workspace,- child: IconButton(- key: const ValueKey('harness-picker-new'),- tooltip: 'New Harness',- onPressed: search.canCreate- ? () => _runShortcut('agent.new')- : null,- icon: const Icon(- AgentActionIcons.create,- size: 18,- ),- ),- )- : null,),),),@@ -2902,6 +2877,8 @@ class _SwarmScreenState extends State<SwarmScreen> {child: PaneGrid(notifier: app,swarmMode: true,+ onSplit: (paneId, axis) =>+ _splitAgent(axis, paneId: paneId),empty:app.panes.isEmpty &&!app.activeSwarm.isStore &&diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex bd68d6ca7..d5639d61b 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -247,12 +247,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/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex 1fc1a8169..abaf7c370 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -123,7 +123,11 @@ class SwarmSearchController extends ChangeNotifier {? 'Machines': _groupScope != null? 'Agents · ${_groupScope!.name}'- : placement?.title ?? 'Search';+ : switch (split?.axis) {+ PaneResizeAxis.x => 'New Pane to the Right',+ PaneResizeAxis.y => 'New Pane Below',+ null => placement?.title ?? 'Search',+ };bool _previewVisible;bool get previewVisible => _previewVisible;@@ -517,12 +521,12 @@ class SwarmSearchController extends ChangeNotifier {? 0: index >= 0? index- // The box opens on the most recent harness, not on the create row above- // it: Return on a fresh box goes back to work, it does not make more.+ // New Tab, New Pane and directional splits start on creation with an+ // empty query. Other searches and typed queries prefer a match.: preferred == null &&rows.length > 1 &&rows.first.isCreate &&- (placement == null || query.trim().isNotEmpty)+ ((placement == null && split == null) || query.trim().isNotEmpty)? 1: cursor.clamp(0, rows.length - 1);// Nor on a row Return cannot take: "Already added", dimmed, with itsdiff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex 5a33d23b4..8bc120ee3 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -45,14 +45,12 @@ class PaneGrid extends StatelessWidget {this.swarmMode = false,this.empty,this.onSplit,- this.onNewSplit,});final AppNotifier notifier;final bool swarmMode;final Widget? empty;final void Function(int paneId, PaneResizeAxis axis)? onSplit;- final void Function(int paneId, PaneResizeAxis axis)? onNewSplit;@overrideWidget build(BuildContext context) {@@ -65,7 +63,6 @@ class PaneGrid extends StatelessWidget {dragging: dragging,empty: empty,onSplit: onSplit,- onNewSplit: onNewSplit,);}final panes = notifier.panes;@@ -232,13 +229,11 @@ class _SwarmCanvas extends StatefulWidget {required this.dragging,this.empty,this.onSplit,- this.onNewSplit,});final AppNotifier notifier;final AgentDragRef? dragging;final Widget? empty;final void Function(int paneId, PaneResizeAxis axis)? onSplit;- final void Function(int paneId, PaneResizeAxis axis)? onNewSplit;@overrideState<_SwarmCanvas> createState() => _SwarmCanvasState();}@@ -435,10 +430,10 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {zoomed: app.zoomedPaneId == pane.id,canSplit: app.canAddPane,splitRight:- (widget.onSplit != null || widget.onNewSplit != null) &&+ widget.onSplit != null &&app.preparePaneSplit(PaneResizeAxis.x, paneId: pane.id) != null,splitDown:- (widget.onSplit != null || widget.onNewSplit != null) &&+ widget.onSplit != null &&app.preparePaneSplit(PaneResizeAxis.y, paneId: pane.id) != null,composer: pane.composerVisible,blocked:@@ -528,7 +523,6 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {visible: rectangles.containsKey(pane.id),swarmMode: true,onSplit: widget.onSplit,- onNewSplit: widget.onNewSplit,),),),@@ -1123,7 +1117,6 @@ class _PaneCell extends StatelessWidget {this.visible = true,this.swarmMode = false,this.onSplit,- this.onNewSplit,});final AppNotifier notifier;@@ -1132,7 +1125,6 @@ class _PaneCell extends StatelessWidget {final bool visible;final bool swarmMode;final void Function(int paneId, PaneResizeAxis axis)? onSplit;- final void Function(int paneId, PaneResizeAxis axis)? onNewSplit;bool get _single => notifier.panes.length == 1;@@ -1160,15 +1152,13 @@ class _PaneCell extends StatelessWidget {onPointerDown: (_) => notifier.focusPane(pane.id),child: ValueListenableBuilder<PaneDragRef?>(valueListenable: paneDragging,- builder: (context, inFlight, child) =>- onSplit == null && onNewSplit == null+ builder: (context, inFlight, child) => onSplit == null? child!: PaneSplitEdges(enabled:swarmMode &&visible &&agentId != null &&- (onSplit != null || onNewSplit != null) &¬ifier.zoomedPaneId == null &¬ifier.canAddPane &&dragging == null &&@@ -1188,9 +1178,6 @@ class _PaneCell extends StatelessWidget {onSplit: onSplit == null? null: (axis) => onSplit!(pane.id, axis),- onNewSplit: onNewSplit == null- ? null- : (axis) => onNewSplit!(pane.id, axis),child: child!,),child: Container(diff --git a/desktop/lib/widgets/pane_split_edges.dart b/desktop/lib/widgets/pane_split_edges.dartindex 4d31b73fd..c6d5e241f 100644--- a/desktop/lib/widgets/pane_split_edges.dart+++ b/desktop/lib/widgets/pane_split_edges.dart@@ -16,13 +16,11 @@ class PaneSplitEdges extends StatefulWidget {required this.canSplitRight,required this.canSplitDown,required this.onSplit,- this.onNewSplit,});final Widget child;final bool enabled, canSplitRight, canSplitDown;final ValueChanged<PaneResizeAxis>? onSplit;- final ValueChanged<PaneResizeAxis>? onNewSplit;@overrideState<PaneSplitEdges> createState() => _PaneSplitEdgesState();@@ -30,7 +28,6 @@ class PaneSplitEdges extends StatefulWidget {class _PaneSplitEdgesState extends State<PaneSplitEdges> {static const _buttonSize = 32.0;- static const _actionsSize = _buttonSize * 2 + 4;static const _inset = 8.0;static const _edgeWidth = 44.0;PaneResizeAxis? _edge;@@ -72,14 +69,14 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {Rect _actionsRect(PaneResizeAxis axis) => axis == PaneResizeAxis.x? Rect.fromLTWH(_size.width - _inset - _buttonSize,- (_size.height - _actionsSize) / 2,+ (_size.height - _buttonSize) / 2,+ _buttonSize,_buttonSize,- _actionsSize,): Rect.fromLTWH(- (_size.width - _actionsSize) / 2,+ (_size.width - _buttonSize) / 2,_size.height - _inset - _buttonSize,- _actionsSize,+ _buttonSize,_buttonSize,);@@ -113,14 +110,7 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {border: Border.all(color: AppColors.borderStrong),borderRadius: BorderRadius.circular(_buttonSize / 2),),- child: Flex(- direction: right ? Axis.vertical : Axis.horizontal,- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- _button(axis, create: true, available: available),- _button(axis, create: false, available: available),- ],- ),+ child: _button(axis, available: available),),),),@@ -129,19 +119,15 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {);}- Widget _button(- PaneResizeAxis axis, {- required bool create,- required bool available,- }) {+ Widget _button(PaneResizeAxis axis, {required bool available}) {final right = axis == PaneResizeAxis.x;- final action = create ? 'New Harness' : 'Open Harness';+ final action = right ? 'New Pane to the Right' : 'New Pane Below';final direction = right ? 'right' : 'down';- final callback = create ? widget.onNewSplit : widget.onSplit;+ final callback = widget.onSplit;return IconButton(- key: ValueKey('pane-${create ? 'new' : 'open'}-$direction'),+ key: ValueKey('pane-split-$direction'),tooltip: available- ? '$action · Split $direction'+ ? action: '$action: make this pane ${right ? 'wider' : 'taller'} to split $direction',onPressed: available && callback != null? () {@@ -149,10 +135,7 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {callback(axis);}: null,- icon: Icon(- create ? AgentActionIcons.create : AgentActionIcons.open,- size: 18,- ),+ icon: const Icon(AgentActionIcons.create, size: 18),style: IconButton.styleFrom(fixedSize: const Size.square(_buttonSize),minimumSize: const Size.square(_buttonSize),diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex eace5ca77..59f7f95c5 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -257,6 +257,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {add(file, "Rename Tab…", "r", "renameActive", [.command, .shift])add(file, "Close Tab", "w", "closeActive")file.addItem(.separator())+ 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)diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dartindex f3f69568e..a187da724 100644--- a/desktop/test/keymap_host_test.dart+++ b/desktop/test/keymap_host_test.dart@@ -60,6 +60,8 @@ void main() {('cmd+t', 'swarm.new'),('cmd+n', 'agent.new'),('cmd+p', 'agent.add'),+ ('cmd+r', 'pane.split_right'),+ ('cmd+d', 'pane.split_down'),('cmd+h', 'pane.focus_left'),('cmd+j', 'pane.focus_below'),('cmd+k', 'pane.focus_above'),diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dartindex 87a0df47b..b40960669 100644--- a/desktop/test/swarm_split_test.dart+++ b/desktop/test/swarm_split_test.dart@@ -5,15 +5,17 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';+import 'package:harness/state/new_harness.dart';import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/pane_preset.dart';import 'package:harness/terminal/terminal_binary.dart';+import 'package:harness/widgets/new_harness_box.dart';import 'package:harness/ws/ws_conn.dart';import 'package:xterm/xterm.dart';import 'swarm_interactions_test.dart' show chord;import 'swarm_resize_test.dart' show mountWide;-import 'swarm_screen_test.dart' show terminal;+import 'swarm_screen_test.dart' show mount, terminal;import 'swarm_state_test.dart' show createApp, MemoryStore;class _Creation extends WsConn {@@ -36,6 +38,13 @@ class _Creation extends WsConn {Duration timeout = const Duration(seconds: 20),}) {calls.add(type);+ if (type == 'engines_probe') {+ return Future.value({+ 'engines': [+ {'engine': 'claude', 'installed': true},+ ],+ });+ }return type == 'agent_create' ? reply.future : Future.value({});}@@ -47,9 +56,13 @@ class _Creation extends WsConn {void main() {for (final axis in PaneResizeAxis.values) {final direction = axis == PaneResizeAxis.x ? 'right' : 'down';- testWidgets(- 'the secondary palette command splits the focused pane $direction',- (tester) async {+ final title = axis == PaneResizeAxis.x+ ? 'New Pane to the Right'+ : 'New Pane Below';+ for (final trigger in ['shortcut', 'palette', 'native menu']) {+ testWidgets('$trigger splits the focused pane $direction', (+ tester,+ ) async {final app = createApp();final machine = app.machineStates['m']!;machine.nodeOnline = true;@@ -67,17 +80,45 @@ void main() {final helper = app.adoptSessionForTest(terminal('a2', frames));app.selectSwarm(original);app.focusPane(first.id);- await mountWide(tester, app);- await chord(tester, LogicalKeyboardKey.keyP, shift: true);- await tester.enterText(- find.byKey(const ValueKey('swarm-search-input')),- '> split $direction',- );+ const channel = MethodChannel('harness/swarm_tabs');+ final messenger = tester.binding.defaultBinaryMessenger;+ messenger.setMockMethodCallHandler(channel, (_) async => true);+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));+ await mount(tester, app, nativeTabs: trigger == 'native menu');+ tester.view.physicalSize = const Size(2000, 1200);await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ switch (trigger) {+ case 'shortcut':+ await chord(+ tester,+ axis == PaneResizeAxis.x+ ? LogicalKeyboardKey.keyR+ : LogicalKeyboardKey.keyD,+ );+ case 'palette':+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);+ await tester.enterText(+ find.byKey(const ValueKey('swarm-search-input')),+ '> split $direction',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ case 'native menu':+ messenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall(+ axis == PaneResizeAxis.x ? 'splitRight' : 'splitDown',+ ),+ ),+ (_) {},+ );+ }await tester.pump();final search = find.byKey(const ValueKey('swarm-search-input'));expect(search, findsOneWidget);+ expect(find.text(title), findsOneWidget);+ expect(app.panes, [first]);await tester.enterText(search, 'New split helper');await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -95,27 +136,176 @@ void main() {expect(frames, isEmpty);await tester.pumpWidget(const SizedBox());app.dispose();+ });+ }++ testWidgets(+ 'edge + $direction targets that pane without disturbing its neighbor',+ (tester) async {+ final app = createApp();+ final machine = app.machineStates['m']!;+ machine.nodeOnline = true;+ machine.localOnly = true;+ machine.agents[2] = const Agent(+ id: 'a2',+ name: 'Existing helper',+ engine: 'codex',+ terminalAvailable: true,+ );+ final frames = <TerminalBinaryFrame>[];+ final first = app.adoptSessionForTest(terminal('a0', frames));+ final neighbor = app.adoptSessionForTest(terminal('a1', frames));+ final original = app.activeSwarmId;+ app.newSwarm();+ final helper = app.adoptSessionForTest(terminal('a2', frames));+ app.selectSwarm(original);+ app.focusPane(neighbor.id);+ await mountWide(tester, app);+ tester.view.physicalSize = const Size(3000, 1800);+ await tester.pump();+ final target = find.byKey(first.cellKey);+ final rect = tester.getRect(target);+ final neighborRect = tester.getRect(find.byKey(neighbor.cellKey));+ final view = find.descendant(+ of: target,+ matching: find.byType(TerminalView),+ );+ final retained = tester.element(view);+ final previousFocus = FocusManager.instance.primaryFocus;+ final button = find.descendant(+ of: target,+ matching: find.byKey(ValueKey('pane-split-$direction')),+ );+ expect(button.hitTestable(), findsNothing);+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await mouse.addPointer(location: rect.center);+ await mouse.moveTo(+ axis == PaneResizeAxis.x+ ? Offset(rect.right - 2, rect.center.dy)+ : Offset(rect.center.dx, rect.bottom - 2),+ );+ await tester.pump(const Duration(milliseconds: 120));+ expect(button.hitTestable(), findsOneWidget);+ expect(app.focusedPaneId, neighbor.id);+ expect(FocusManager.instance.primaryFocus, same(previousFocus));+ expect(tester.element(view), same(retained));+ expect(tester.getRect(target), rect);+ expect(frames, isEmpty);++ // Moving from the border onto the inset button must keep it visible.+ await mouse.moveTo(tester.getCenter(button));+ await tester.pump();+ expect(button.hitTestable(), findsOneWidget);+ await mouse.down(tester.getCenter(button));+ await mouse.up();+ await tester.pump();+ final search = find.byKey(const ValueKey('swarm-search-input'));+ expect(search, findsOneWidget);+ expect(find.text(title), findsOneWidget);+ expect(app.focusedPaneId, first.id);+ await tester.enterText(search, 'Existing helper');+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(search, findsNothing);+ expect(app.panes, [first, helper, neighbor]);+ expect(tester.element(view), same(retained));+ expect(tester.getRect(find.byKey(neighbor.cellKey)), neighborRect);+ final splitRect = tester.getRect(target);+ final addedRect = tester.getRect(find.byKey(helper.cellKey));+ if (axis == PaneResizeAxis.x) {+ expect(addedRect.left, greaterThan(splitRect.right));+ expect(addedRect.top, splitRect.top);+ expect(addedRect.height, splitRect.height);+ } else {+ expect(addedRect.top, greaterThan(splitRect.bottom));+ expect(addedRect.left, splitRect.left);+ expect(addedRect.width, splitRect.width);+ }+ expect(frames, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);+ await tester.pump(const Duration(milliseconds: 10));+ expect(frames.single.streamId, helper.session!.streamId);+ expect(frames.single.bytes, [27, 91, 67]);+ await mouse.removePointer();+ await tester.pumpWidget(const SizedBox());+ app.dispose();},);- testWidgets('pane edges no longer offer New/Open $direction', (+ testWidgets('split $direction creates through the same picker as Cmd-P', (tester,) async {- final app = createApp();- app.adoptSessionForTest(terminal('a0', []));+ newHarnessOpensInBox = true;+ addTearDown(() => newHarnessOpensInBox = false);+ final connection = _Creation();+ final app = createApp(connectionForTest: (_) => connection);+ final machine = app.machineStates['m']!;+ machine.nodeOnline = true;+ machine.localOnly = true;+ machine.agents[0] = const Agent(+ id: 'a0',+ name: 'Checkout',+ engine: 'claude',+ project: AgentProject(name: 'work', cwd: '/work/checkout'),+ );+ final frames = <TerminalBinaryFrame>[];+ final pane = app.adoptSessionForTest(terminal('a0', frames));+ final original = app.activeSwarmId;await mountWide(tester, app);- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);- final rect = tester.getRect(find.byKey(app.panes.single.cellKey));- await mouse.addPointer(location: rect.center);- await mouse.moveTo(- axis == PaneResizeAxis.x- ? Offset(rect.right - 2, rect.center.dy)- : Offset(rect.center.dx, rect.bottom - 2),+ final rect = tester.getRect(find.byKey(pane.cellKey));+ final shortcut = axis == PaneResizeAxis.x+ ? LogicalKeyboardKey.keyR+ : LogicalKeyboardKey.keyD;+ await chord(tester, shortcut);+ expect(find.text(title), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();+ expect(app.panes, [pane]);+ expect(tester.getRect(find.byKey(pane.cellKey)), rect);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);+ await tester.pump(const Duration(milliseconds: 10));+ expect(frames.single.bytes, [27, 91, 67]);+ frames.clear();++ // Empty search selects creation, just as New Pane does.+ await chord(tester, shortcut);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ final box = tester+ .widget<NewHarnessBox>(find.byType(NewHarnessBox))+ .controller;+ expect(box.split?.axis, axis);+ expect(box.split?.paneId, pane.id);+ expect(box.engine, 'claude');+ expect(box.machineId, 'm');+ expect(box.project.folder, '/work/checkout');+ expect(app.panes, [pane]);+ expect(connection.calls, isNot(contains('agent_create')));+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(+ connection.calls.where((call) => call == 'agent_create'),+ hasLength(1),);- await tester.pump(const Duration(milliseconds: 120));- expect(find.byKey(ValueKey('pane-open-$direction')), findsNothing);- expect(find.byKey(ValueKey('pane-new-$direction')), findsNothing);- await mouse.removePointer();+ expect(app.panes, [pane]);+ connection.complete();+ await tester.pump();+ // The fake connection never attaches the new terminal, whose loading+ // indicator keeps animating after creation has already completed.+ await tester.pump(const Duration(milliseconds: 200));+ expect(app.activeSwarmId, original);+ expect(app.panes.map((pane) => pane.agentId), ['a0', 'created']);+ final before = tester.getRect(find.byKey(pane.cellKey));+ final after = tester.getRect(find.byKey(app.panes.last.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();});@@ -302,7 +492,7 @@ void main() {await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();- expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);+ expect(find.text('New Pane to the Right'), findsOneWidget);expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);expect(find.byType(AlertDialog), findsNothing);await chord(tester, LogicalKeyboardKey.keyN);diff --git a/desktop/tool/keymap_native_checks.swift b/desktop/tool/keymap_native_checks.swiftindex a63adab15..95b0e2f7e 100644--- a/desktop/tool/keymap_native_checks.swift+++ b/desktop/tool/keymap_native_checks.swift@@ -28,6 +28,7 @@ for (key, command) in [("cmd+s", "app.store"), ("cmd+shift+l", "pane.layout"),("cmd+b", "task.route"), ("cmd+t", "swarm.new"),("cmd+p", "agent.add"),+ ("cmd+r", "pane.split_right"), ("cmd+d", "pane.split_down"),("cmd+n", "agent.new"),("cmd+h", "pane.focus_left"), ("cmd+j", "pane.focus_below"),("cmd+k", "pane.focus_above"), ("cmd+l", "pane.focus_right"),diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swiftindex 362b8eba1..58f546d72 100644--- a/desktop/tool/swarm_titlebar_checks.swift+++ b/desktop/tool/swarm_titlebar_checks.swift@@ -489,6 +489,11 @@ private extension SwarmTitlebar {"Native shortcuts display in the menu without duplicate hover hints")try checkTitlebar(addHarness.keyEquivalent == "p" && addHarness.keyEquivalentModifierMask == [.command],"The exported keymap keeps New Pane on Command-P")+ for (action, key) in [("splitRight", "r"), ("splitDown", "d")] {+ let split = agent.items.first(where: { $0.representedObject as? String == action })!+ try checkTitlebar(split.keyEquivalent == key && split.keyEquivalentModifierMask == [.command],+ "The exported keymap preserves the native \(action) shortcut")+ }setKeymap(changed)try checkTitlebar(NSApp.mainMenu === main && newSwarm.keyEquivalent == "o","Hot reload updates the existing menu to the remapped key")@@ -658,7 +663,19 @@ private extension SwarmTitlebar {try checkTitlebar(agent.items.contains { $0.title == "New Terminal" && $0.keyEquivalent == "t" && $0.keyEquivalentModifierMask == [.command, .shift] && $0.representedObject as? String == "newTerminal" },"New Terminal has its Command-Shift-T menu action")let historyMenu = main.item(withTitle: "History")!.submenu!- try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "newTerminal", "renameActive", "closeActive", "separator", "zoomPane", "closePane"], "File groups tab, terminal and pane actions")+ try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "newTerminal", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups tab, terminal and pane actions")+ for (action, title, key) in [("splitRight", "Split Right…", "r"), ("splitDown", "Split Down…", "d")] {+ let split = agent.items.first(where: { $0.representedObject as? String == action })!+ try checkTitlebar(split.title == title && split.keyEquivalent == key && split.keyEquivalentModifierMask == [.command],+ "\(title) advertises its directional split shortcut")+ actionsEnabled = true+ canFind = false+ try checkTitlebar(!validateMenuItem(split), "\(title) needs a focused pane")+ canFind = true+ try checkTitlebar(validateMenuItem(split), "\(title) is available with a focused pane")+ menuAction(split)+ try checkTitlebar(messenger.calls.last?.method == action, "\(title) reaches the Flutter split picker")+ }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 Tab…" && $0.representedObject as? String == "renameActive" }, "Rename Tab preserves its command")diff --git a/docs/keyboard.md b/docs/keyboard.mdindex 5d4d79a27..4947401b9 100644--- a/docs/keyboard.md+++ b/docs/keyboard.md@@ -8,6 +8,7 @@ The defaults, in the workspace:|---|---|| ⌘T | New Tab — choose an existing harness or select the pinned New agent row. The tab is allocated only after selection or successful creation; Escape leaves the layout unchanged || ⌘P | New Pane — the same picker, adding to the current tab and automatically tiling its panes. Search by harness name, project, machine, or session content. Selecting a harness already here focuses its pane |+| ⌘R / ⌘D | Split right / down — open the New Pane picker with the requested direction, then choose an existing harness or create one || ⌘N | New Harness directly — the box opens on the task: type what it should do and press Return, and it starts as another of the pane you were in (labeled agent, machine, project, and mode defaults stay visible above `task >`). Tab and ⇧Tab step out to those answers; each is a list you filter by typing, with a ✓ on the current one. One verb per field: in a list Return **chooses** and comes back to the task, on the task Return **makes it**, and ⌘↵ makes it from anywhere with the highlighted row. In the project field a word names a new project, `owner/repo` clones it, a path completes the way zsh's does (Tab: common prefix, then walk the candidates, ⇧Tab back; `/` goes in) and Browse… opens the folder chooser. ⌥↵ breaks the line in the task; ⌥1–⌥9 pick a row; ⌘. opens the full form. Escape keeps what you typed for the next ⌘N || ⇧⌘P | Command palette — a `:` prompt with an empty input; includes the orchestrator, directional splits, and settings. Recent commands appear first; typing `usage` opens Settings ▸ Usage || ⌘B | Boss mode: describe a task, it picks the agent |@@ -26,6 +27,8 @@ The defaults, in the workspace:In the New Tab and New Pane pickers, New agent is selected when the query is empty. Typing selects the best matching existing harness; the creation row stays pinned above it and carries the query into the first task. Projects and machines filter individual harnesses rather than opening whole groups. The destination is shown in the picker and carried into creation. A harness can have views in several tabs, with one view per tab; closing a pane only removes that view.+Hover near a pane’s right or bottom edge to reveal its **+** button, or use **File → Split Right… / Split Down…**. The picker shows **New Pane to the Right** or **New Pane Below**. The split is applied after choosing or creating a harness; Escape leaves the layout unchanged.+In a picker: ↓ ⌃N ⌃J and ↑ ⌃P ⌃K move, ⏎ accepts, and Esc, ⌃C, or ⌃G closes. In the New Tab and New Pane pickers, ⌘⏎ accepts into the same requested destination. Preview starts hidden; ⌃/ toggles it and Page Up/Down scroll it without leaving the search input.The terminal keeps ⌘C, ⌘V, ⌘A, Esc, ⌥⏎ and ⌃C for itself. `pane.pin`, `pane.focus_1…9`,`pane.resize`, `pane.reset_sizes`, `machine.link` and a few others ship unbound and are in the palette.