Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Separate New and Open Agent actions on pane edges

dee9fcaf2754437
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 78ec03a74..a3defcc9a 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -753,11 +753,19 @@ class _SwarmScreenState extends State<SwarmScreen> {
await _ensureEmptyEntry();
}
- Future<void> _splitAgent(PaneResizeAxis axis, {int? paneId}) async {
+ Future<void> _splitAgent(
+ PaneResizeAxis axis, {
+ int? paneId,
+ bool create = false,
+ }) async {
final split = app.preparePaneSplit(axis, paneId: paneId);
if (split == null) return;
if (paneId != null) app.focusPane(split.paneId);
- _openSearch(adding: true, split: split);
+ if (create) {
+ await _newAgent(split: split);
+ } else {
+ _openSearch(adding: true, split: split);
+ }
}
Future<void> _showHistory() async {
@@ -1423,6 +1431,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
onSplit: (paneId, axis) => unawaited(
_splitAgent(axis, paneId: paneId),
),
+ onNewSplit: (paneId, axis) => unawaited(
+ _splitAgent(
+ axis,
+ paneId: paneId,
+ create: true,
+ ),
+ ),
empty: app.panes.isEmpty
? HarnessStartPage(
key: ValueKey(
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 936028161..b569b5a4c 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -38,12 +38,14 @@ 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;
@override
Widget build(BuildContext context) {
@@ -56,6 +58,7 @@ class PaneGrid extends StatelessWidget {
dragging: dragging,
empty: empty,
onSplit: onSplit,
+ onNewSplit: onNewSplit,
);
}
final panes = notifier.panes;
@@ -222,11 +225,13 @@ 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;
@override
State<_SwarmCanvas> createState() => _SwarmCanvasState();
}
@@ -423,10 +428,10 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
zoomed: app.zoomedPaneId == pane.id,
canSplit: app.canAddPane,
splitRight:
- widget.onSplit != null &&
+ (widget.onSplit != null || widget.onNewSplit != null) &&
app.preparePaneSplit(PaneResizeAxis.x, paneId: pane.id) != null,
splitDown:
- widget.onSplit != null &&
+ (widget.onSplit != null || widget.onNewSplit != null) &&
app.preparePaneSplit(PaneResizeAxis.y, paneId: pane.id) != null,
composer: pane.composerVisible,
blocked:
@@ -516,6 +521,7 @@ class _SwarmCanvasState extends State<_SwarmCanvas> {
visible: rectangles.containsKey(pane.id),
swarmMode: true,
onSplit: widget.onSplit,
+ onNewSplit: widget.onNewSplit,
),
),
),
@@ -1084,6 +1090,7 @@ class _PaneCell extends StatelessWidget {
this.visible = true,
this.swarmMode = false,
this.onSplit,
+ this.onNewSplit,
});
final AppNotifier notifier;
@@ -1092,6 +1099,7 @@ 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;
@@ -1124,7 +1132,7 @@ class _PaneCell extends StatelessWidget {
swarmMode &&
visible &&
agentId != null &&
- onSplit != null &&
+ (onSplit != null || onNewSplit != null) &&
notifier.zoomedPaneId == null &&
notifier.canAddPane &&
dragging == null &&
@@ -1136,6 +1144,9 @@ class _PaneCell extends StatelessWidget {
notifier.preparePaneSplit(PaneResizeAxis.y, paneId: pane.id) !=
null,
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.dart
index 7ea4c2a22..d6b59762b 100644
--- a/desktop/lib/widgets/pane_split_edges.dart
+++ b/desktop/lib/widgets/pane_split_edges.dart
@@ -1,10 +1,10 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/pane_arrangement.dart';
import '../theme/app_theme.dart';
+import 'agent_action_icons.dart';
/// Reveals split controls inside the pane, leaving the resize gap untouched.
/// Hover state stays here so pointer movement never rebuilds the terminal.
@@ -16,11 +16,13 @@ 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;
@override
State<PaneSplitEdges> createState() => _PaneSplitEdgesState();
@@ -28,6 +30,7 @@ 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;
@@ -66,34 +69,33 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {
);
}
- Rect _buttonRect(PaneResizeAxis axis) => axis == PaneResizeAxis.x
+ Rect _actionsRect(PaneResizeAxis axis) => axis == PaneResizeAxis.x
? Rect.fromLTWH(
_size.width - _inset - _buttonSize,
- (_size.height - _buttonSize) / 2,
- _buttonSize,
+ (_size.height - _actionsSize) / 2,
_buttonSize,
+ _actionsSize,
)
: Rect.fromLTWH(
- (_size.width - _buttonSize) / 2,
+ (_size.width - _actionsSize) / 2,
_size.height - _inset - _buttonSize,
- _buttonSize,
+ _actionsSize,
_buttonSize,
);
void _pressed(PointerDownEvent event) {
final edge = _edge;
- if (edge != null && !_buttonRect(edge).contains(event.localPosition)) {
+ if (edge != null && !_actionsRect(edge).contains(event.localPosition)) {
_reveal(null);
}
}
- Widget _button(PaneResizeAxis axis) {
+ Widget _actions(PaneResizeAxis axis) {
final visible = widget.enabled && _edge == axis;
final right = axis == PaneResizeAxis.x;
final available = right ? widget.canSplitRight : widget.canSplitDown;
- final label = right ? 'Split right' : 'Split down';
return Positioned.fromRect(
- rect: _buttonRect(axis),
+ rect: _actionsRect(axis),
child: IgnorePointer(
ignoring: !visible,
child: ExcludeFocus(
@@ -105,34 +107,19 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {
duration: MediaQuery.disableAnimationsOf(context)
? Duration.zero
: const Duration(milliseconds: 100),
- child: IconButton(
- key: ValueKey(right ? 'pane-split-right' : 'pane-split-down'),
- tooltip: available
- ? label
- : right
- ? 'Make this pane wider to split right'
- : 'Make this pane taller to split down',
- onPressed: available && widget.onSplit != null
- ? () {
- _reveal(null);
- widget.onSplit!(axis);
- }
- : null,
- icon: const Icon(LucideIcons.plus, size: 18),
- style: IconButton.styleFrom(
- fixedSize: const Size.square(_buttonSize),
- minimumSize: const Size.square(_buttonSize),
- padding: EdgeInsets.zero,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- visualDensity: VisualDensity.standard,
- foregroundColor: grid.AppPalette.swarmAccent,
- disabledForegroundColor: AppColors.mutedStrong,
- backgroundColor: AppColors.surface,
- disabledBackgroundColor: AppColors.surface,
- hoverColor: grid.AppSurface.hoverFill,
- shape: CircleBorder(
- side: BorderSide(color: AppColors.borderStrong),
- ),
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: AppColors.surface,
+ 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),
+ ],
),
),
),
@@ -142,6 +129,44 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {
);
}
+ Widget _button(
+ PaneResizeAxis axis, {
+ required bool create,
+ required bool available,
+ }) {
+ final right = axis == PaneResizeAxis.x;
+ final action = create ? 'New Agent' : 'Open Agent';
+ final direction = right ? 'right' : 'down';
+ final callback = create ? widget.onNewSplit : widget.onSplit;
+ return IconButton(
+ key: ValueKey('pane-${create ? 'new' : 'open'}-$direction'),
+ tooltip: available
+ ? '$action · Split $direction'
+ : '$action: make this pane ${right ? 'wider' : 'taller'} to split $direction',
+ onPressed: available && callback != null
+ ? () {
+ _reveal(null);
+ callback(axis);
+ }
+ : null,
+ icon: Icon(
+ create ? AgentActionIcons.create : AgentActionIcons.open,
+ size: 18,
+ ),
+ style: IconButton.styleFrom(
+ fixedSize: const Size.square(_buttonSize),
+ minimumSize: const Size.square(_buttonSize),
+ padding: EdgeInsets.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ visualDensity: VisualDensity.standard,
+ foregroundColor: grid.AppPalette.swarmAccent,
+ disabledForegroundColor: AppColors.mutedStrong,
+ hoverColor: grid.AppSurface.hoverFill,
+ shape: const CircleBorder(),
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
@@ -157,8 +182,8 @@ class _PaneSplitEdgesState extends State<PaneSplitEdges> {
fit: StackFit.expand,
children: [
widget.child,
- _button(PaneResizeAxis.x),
- _button(PaneResizeAxis.y),
+ _actions(PaneResizeAxis.x),
+ _actions(PaneResizeAxis.y),
],
),
),
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index 644ed2330..e4bb65d08 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -98,7 +98,7 @@ void main() {
);
testWidgets(
- 'hover split $direction targets that pane without disturbing its neighbor',
+ 'edge Open $direction targets that pane without disturbing its neighbor',
(tester) async {
final app = createApp();
final machine = app.machineStates['m']!;
@@ -132,9 +132,14 @@ void main() {
final previousFocus = FocusManager.instance.primaryFocus;
final button = find.descendant(
of: target,
- matching: find.byKey(ValueKey('pane-split-$direction')),
+ matching: find.byKey(ValueKey('pane-open-$direction')),
+ );
+ final newButton = find.descendant(
+ of: target,
+ matching: find.byKey(ValueKey('pane-new-$direction')),
);
expect(button.hitTestable(), findsNothing);
+ expect(newButton.hitTestable(), findsNothing);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: rect.center);
await mouse.moveTo(
@@ -144,6 +149,11 @@ void main() {
);
await tester.pump(const Duration(milliseconds: 120));
expect(button.hitTestable(), findsOneWidget);
+ expect(newButton.hitTestable(), findsOneWidget);
+ expect(
+ tester.getRect(button).overlaps(tester.getRect(newButton)),
+ isFalse,
+ );
expect(app.focusedPaneId, neighbor.id);
expect(FocusManager.instance.primaryFocus, same(previousFocus));
expect(tester.element(view), same(retained));
@@ -151,6 +161,9 @@ void main() {
expect(frames, isEmpty);
// Moving from the border onto the inset button must keep it visible.
+ await mouse.moveTo(tester.getCenter(newButton));
+ await tester.pump();
+ expect(newButton.hitTestable(), findsOneWidget);
await mouse.moveTo(tester.getCenter(button));
await tester.pump();
expect(button.hitTestable(), findsOneWidget);
@@ -193,6 +206,80 @@ void main() {
app.dispose();
},
);
+ testWidgets('edge New $direction opens creation with the hovered project', (
+ tester,
+ ) async {
+ final connection = _Creation();
+ final app = createApp(connectionForTest: (_) => connection);
+ final machine = app.machineStates['m']!;
+ machine.nodeOnline = true;
+ machine.agents[0] = const Agent(
+ id: 'a0',
+ name: 'First project',
+ engine: 'claude',
+ project: AgentProject(name: 'first', cwd: '/work/first'),
+ );
+ machine.agents[1] = const Agent(
+ id: 'a1',
+ name: 'Neighbor',
+ engine: 'claude',
+ project: AgentProject(name: 'neighbor', cwd: '/work/neighbor'),
+ );
+ final frames = <TerminalBinaryFrame>[];
+ final first = app.adoptSessionForTest(terminal('a0', frames));
+ final neighbor = app.adoptSessionForTest(terminal('a1', frames));
+ 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 before = tester.getRect(target);
+ final neighborBefore = tester.getRect(find.byKey(neighbor.cellKey));
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: before.center);
+ await mouse.moveTo(
+ axis == PaneResizeAxis.x
+ ? Offset(before.right - 2, before.center.dy)
+ : Offset(before.center.dx, before.bottom - 2),
+ );
+ await tester.pump(const Duration(milliseconds: 120));
+ final create = find.descendant(
+ of: target,
+ matching: find.byKey(ValueKey('pane-new-$direction')),
+ );
+ await mouse.moveTo(tester.getCenter(create));
+ await mouse.down(tester.getCenter(create));
+ await mouse.up();
+ await tester.pump();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(
+ find.text(
+ axis == PaneResizeAxis.x
+ ? 'New Agent to the right'
+ : 'New Agent below',
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('/work/first'), findsOneWidget);
+ expect(find.text('/work/neighbor'), findsNothing);
+ expect(find.byKey(const ValueKey('swarm-search-input')), findsNothing);
+ expect(app.focusedPaneId, first.id);
+ expect(tester.getRect(target), before);
+ expect(tester.getRect(find.byKey(neighbor.cellKey)), neighborBefore);
+ expect(connection.calls, isNot(contains('agent_create')));
+ expect(frames, isEmpty);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ await tester.pump();
+ expect(find.byType(AlertDialog), findsNothing);
+ expect(app.panes, [first, neighbor]);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);
+ await tester.pump(const Duration(milliseconds: 10));
+ expect(frames.single.streamId, first.session!.streamId);
+ await mouse.removePointer();
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
}
testWidgets(
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index bd7f1c268..db210ae10 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -220,8 +220,18 @@ disabled for unavailable or unlinked machines. Keyboard toggles the remote messa
Resize grips are invisible while idle and appear on divider hover, keyboard
focus or active drag. Their hit targets and resize behavior stay the same. The
-right/bottom edge plus controls continue to open search at that split position, and
-keyboard split commands remain available.
+right/bottom edges reveal two actions in a small capsule: **+ New Agent** and
+**↗ Open Agent**. On the right they stack; along the bottom they sit side by side.
+Both name the split direction in their tooltip. New opens creation directly with
+the hovered pane's machine/project; Open shows existing-agent search for that
+position. Hovering and crossing between the buttons preserves keyboard focus,
+terminal views and neighbor geometry. Keyboard split commands remain available.
+
+The edge change passes 47 split, resize and creation-recovery checks, including
+both directions for New and Open and dismissal back to the intended terminal.
+Analysis of the four changed Dart/test files is clean. Logs:
+`/private/tmp/harness-agent-edge-tests.log` and
+`/private/tmp/harness-agent-edge-analyze.log`.
## Latest terminal output
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index e4c91e072..2e9f8bc7b 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -34,7 +34,17 @@ user for a benchmark window.
## Current product contract
-### Latest: Customize Harness
+### Latest: distinct New/Open edge actions
+
+The right and bottom pane edges now reveal **+ New Agent** and **↗ Open Agent**
+together. New opens creation directly with the hovered pane's machine/project;
+Open retains the existing-agent split picker. Hovering does not move focus or
+rebuild the terminal; both actions preserve the split and adjacent pane geometry.
+Forty-seven split, resize and recovery tests and analysis of all four changed
+Dart/test files pass. Logs: `/private/tmp/harness-agent-edge-tests.log` and
+`/private/tmp/harness-agent-edge-analyze.log`.
+
+### Customize Harness — pushed 60a95d5
New Harness defaults to the selected tab's solid color. The bottom-right
**Customize Harness** button opens Background, Appearance and Terminal in a
@@ -45,8 +55,8 @@ Choices apply immediately and persist; only empty Harness pages get wallpaper.
Forty-six affected checks and analysis of all 17 changed Dart/test units pass.
Logs: `/private/tmp/harness-customize-final-tests.log`,
`/private/tmp/harness-customize-analyze.log`. Captures:
-`/private/tmp/harness-customize-captures`. The incoming edge New/Open actions
-remain a separate feature and push.
+`/private/tmp/harness-customize-captures`. The macOS Release build and deep/strict
+signature verification pass. Pushed separately after the New/Open rollback.
### Separate New Agent and Open Agent — pushed aa327c0