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.

Unify Add Harness behind a compact Command-N chooser

dee9af924f63a67
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 5faf9daf7..0e9b8665e 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -32,6 +32,7 @@ import '../state/swarm.dart';
import '../widgets/layout_palette.dart';
import '../widgets/engine_identity.dart';
import '../widgets/harness_start_page.dart';
+import '../widgets/harness_entry_actions.dart';
import '../widgets/link_machine_screen.dart';
import '../widgets/machines_manager.dart';
import '../widgets/new_agent_dialog.dart';
@@ -82,7 +83,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
final _searchFocus = FocusNode(debugLabel: 'Find a harness');
SwarmSearchController? _search;
OverlayEntry? _searchOverlay;
- (String, bool, bool)? _searchHeaderState;
+ (String, bool, bool, bool)? _searchHeaderState;
+ bool _searchResultsVisible = false;
FocusNode? _searchReturnFocus;
(String, bool)? _lastWorkspace;
bool _spokenPaletteOpen = false;
@@ -784,6 +786,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
catalog: _searchCatalog,
)..setQuery(query);
_search!.addListener(_syncSearch);
+ _searchResultsVisible = !adding || query.isNotEmpty;
_searchOverlay = OverlayEntry(builder: _buildSearchOverlay);
Overlay.of(context).insert(_searchOverlay!);
_syncSearch();
@@ -820,13 +823,27 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
// Results listen to their controller directly. Rebuilding the entire
// overlay on every arrow also rebuilt the unchanged text editor/button.
- final header = (search.hint, search.canCreate, _canDismissSearch);
+ if (search.query.isNotEmpty) _searchResultsVisible = true;
+ final header = (
+ search.hint,
+ search.canCreate,
+ _canDismissSearch,
+ _searchResultsVisible,
+ );
if (_searchHeaderState != header) {
_searchHeaderState = header;
_searchOverlay?.markNeedsBuild();
}
}
+ void _revealSearch() {
+ if (_search == null) return;
+ _searchResultsVisible = true;
+ _search!.setQuery(_searchText.text);
+ _syncSearch();
+ _focusSearch();
+ }
+
void _closeSearch({bool restoreFocus = true}) {
if (_search == null) return;
// Enable the chosen terminal synchronously, before activation requests its
@@ -881,13 +898,15 @@ class _SwarmScreenState extends State<SwarmScreen> {
// Keep the command editor mounted as its query changes so every keystroke
// retains focus and text editing ownership.
final commandsOnly = search.commandsOnly;
+ final showResults = _searchResultsVisible || commandsOnly;
return KeymapProvider(
keymap: _keymap,
child: SwarmSearchKeys(
- search: search,
+ search: showResults ? search : null,
editing: _searchText,
onChoose: _chooseSearch,
onClose: _dismissSearch,
+ onOpen: _revealSearch,
onNewAgent: () => _runShortcut('agent.new'),
onRefocus: _focusSearch,
child: LayoutBuilder(
@@ -910,18 +929,25 @@ class _SwarmScreenState extends State<SwarmScreen> {
height: (constraints.maxHeight - 96).clamp(220.0, 600.0),
child: Column(
children: [
- Expanded(
+ Flexible(
child: Material(
key: const ValueKey('swarm-search-results'),
- elevation: 16,
+ elevation: showResults ? 16 : 0,
shadowColor: Colors.black54,
- color: grid.AppPalette.swarmSearchSurface,
+ color: showResults
+ ? grid.AppPalette.swarmSearchSurface
+ : Colors.transparent,
shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
- side: const BorderSide(color: Colors.white24),
+ borderRadius: BorderRadius.circular(
+ showResults ? 12 : 999,
+ ),
+ side: showResults
+ ? const BorderSide(color: Colors.white24)
+ : BorderSide.none,
),
clipBehavior: Clip.antiAlias,
child: Column(
+ mainAxisSize: MainAxisSize.min,
children: [
if (commandsOnly)
const Padding(
@@ -941,23 +967,52 @@ class _SwarmScreenState extends State<SwarmScreen> {
inputKey: const ValueKey('swarm-search-input'),
controller: _searchText,
focusNode: _searchFocus,
- search: search,
+ search: showResults ? search : null,
onClose: _dismissSearch,
onChanged: search.setQuery,
- showClose: _canDismissSearch || commandsOnly,
+ onOpen: _revealSearch,
+ showClose: showResults,
+ rounded: true,
+ prominent: !commandsOnly,
),
- const Divider(height: 1, color: Colors.white12),
- Expanded(
- child: SwarmSearchResults(
- search: search,
- onChoose: _chooseSearch,
- onRefocus: _focusSearch,
+ if (showResults) ...[
+ const Divider(height: 1, color: Colors.white12),
+ Flexible(
+ child: SizedBox(
+ height: 480,
+ child: SwarmSearchResults(
+ search: search,
+ onChoose: _chooseSearch,
+ onRefocus: _focusSearch,
+ ),
+ ),
),
- ),
+ ],
],
),
),
),
+ if (!commandsOnly) ...[
+ const SizedBox(height: 20),
+ Align(
+ alignment: Alignment.centerLeft,
+ child: ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => HarnessEntryActions(
+ openKey: const ValueKey('harness-picker-open'),
+ newKey: const ValueKey('harness-picker-new'),
+ onOpen: !showResults
+ ? _revealSearch
+ : search.canAccept
+ ? () => _chooseSearch(search.submit()!)
+ : null,
+ onNew: search.canCreate
+ ? () => _runShortcut('agent.new')
+ : null,
+ ),
+ ),
+ ),
+ ],
],
),
),
@@ -1492,40 +1547,28 @@ class _SwarmScreenState extends State<SwarmScreen> {
onPressed: app.canOpenNewTab ? _newTab : null,
icon: const Icon(Icons.add, size: 18, semanticLabel: 'New Tab'),
),
- _harnessButton(create: true),
- const SizedBox(width: 12),
- _harnessButton(create: false),
+ _harnessButton(),
const SizedBox(width: 12),
],
),
);
- Widget _harnessButton({required bool create}) {
- final label = create ? 'New Harness' : 'Open Harness';
+ Widget _harnessButton() {
return TextButton(
- key: ValueKey(
- create ? 'swarm-new-harness-button' : 'swarm-open-harness-button',
- ),
- onPressed: create ? _newAgent : _addAgent,
+ key: const ValueKey('swarm-add-harness-button'),
+ onPressed: _addAgent,
style: TextButton.styleFrom(
enabledMouseCursor: SystemMouseCursors.click,
- minimumSize: Size(create ? 122 : 128, 34),
+ minimumSize: const Size(122, 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
- : Colors.transparent,
- foregroundColor: create
- ? grid.AppPalette.swarmTabBar
- : grid.AppPalette.swarmAccent,
+ backgroundColor: grid.AppPalette.swarmAccent,
+ foregroundColor: grid.AppPalette.swarmTabBar,
shape: const StadiumBorder(),
- side: create
- ? BorderSide.none
- : const BorderSide(color: Colors.white24),
),
- child: Text(label),
+ child: const Text('Add Harness'),
);
}
}
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index 1440e12c4..5637ed50e 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';
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,
+/// T opens a tab, N adds an existing or new harness, S changes layout,
/// 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.
///
@@ -279,7 +279,11 @@ const List<AppShortcut> kAppShortcuts = [
// --- actions --------------------------------------------------------------
AppShortcut(
action: ShortcutAction.newAgent,
- activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),
+ activator: SingleActivator(
+ LogicalKeyboardKey.keyN,
+ meta: true,
+ shift: true,
+ ),
label: 'New Harness',
group: ShortcutGroup.actions,
),
@@ -341,8 +345,8 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) => [
const kSwarmShortcuts = [
AppShortcut(
action: ShortcutAction.addAgent,
- activator: SingleActivator(LogicalKeyboardKey.keyO, meta: true),
- label: 'Find Harness',
+ activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),
+ label: 'Add Harness',
group: ShortcutGroup.actions,
),
AppShortcut(
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index e1440f55f..9d689b0d6 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -272,7 +272,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'agent.add',
- 'Open Harness',
+ 'Add Harness',
ShortcutGroup.actions,
action: ShortcutAction.addAgent,
nativeAction: 'addAgent',
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 98df3660a..f2b8ed9ba 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -481,7 +481,7 @@ class AppNotifier extends ChangeNotifier {
// An unused starter has no work to recover. This also covers empty pages
// restored from builds that did not mark them as drafts.
if (entry is ClosedSwarm &&
- entry.name == 'New Harness' &&
+ Swarm.normalizeName(entry.name) == Swarm.defaultName &&
entry.panes.isEmpty &&
entry.presets.isEmpty) {
return;
@@ -509,14 +509,15 @@ class AppNotifier extends ChangeNotifier {
final swarm = swarms.where((swarm) => swarm.id == id).firstOrNull;
return swarm != null &&
swarm.panes.isEmpty &&
- swarm.name == 'New Harness' &&
+ swarm.name == Swarm.defaultName &&
swarm.presets.isEmpty;
}
- void newSwarm({String name = 'New Harness', bool draft = false}) {
+ void newSwarm({String name = Swarm.defaultName, bool draft = false}) {
+ name = Swarm.normalizeName(name);
// Every New Tab entry point reuses the existing start page, including
// when another tab is selected or the tab limit has been reached.
- if (name == 'New Harness') {
+ if (name == Swarm.defaultName) {
final starter = activeSwarm.isEmptyStarter
? activeSwarm
: swarms.where((swarm) => swarm.isEmptyStarter).firstOrNull;
@@ -567,7 +568,7 @@ class AppNotifier extends ChangeNotifier {
if (returnId == null ||
target == null ||
target.panes.isNotEmpty ||
- target.name != 'New Harness' ||
+ target.name != Swarm.defaultName ||
target.presets.isNotEmpty ||
swarms.length == 1) {
return false;
@@ -666,7 +667,7 @@ class AppNotifier extends ChangeNotifier {
// welcome tabs, evicting the real work from recently closed history.
if (swarms.length == 1 &&
swarms.single.panes.isEmpty &&
- swarms.single.name == 'New Harness' &&
+ swarms.single.name == Swarm.defaultName &&
swarms.single.presets.isEmpty) {
return;
}
@@ -4498,7 +4499,7 @@ class AppNotifier extends ChangeNotifier {
target.arranged = split.after;
target.arrangedKey = key;
}
- if (firstAgent && target.name == 'New Harness') {
+ if (firstAgent && target.name == Swarm.defaultName) {
final name = agent.name.trim();
if (name.isNotEmpty) {
target.name = name.length > 80 ? name.substring(0, 80) : name;
@@ -4991,7 +4992,7 @@ class AppNotifier extends ChangeNotifier {
final swarm = swarms.where((swarm) => swarm.id == id).firstOrNull;
return swarm == null ||
swarm.panes.isNotEmpty ||
- swarm.name != 'New Harness' ||
+ swarm.name != Swarm.defaultName ||
swarm.presets.isNotEmpty;
});
_layoutRevision++;
@@ -5045,7 +5046,7 @@ class AppNotifier extends ChangeNotifier {
0,
(raw['name'] as String).length.clamp(0, 80),
)
- : 'New Harness',
+ : Swarm.defaultName,
);
for (final item in (raw['panes'] as List).take(maxPanes)) {
final entry = PaneLayoutEntry.fromJson(item);
diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dart
index 13d536162..f5f75fe69 100644
--- a/desktop/lib/state/swarm.dart
+++ b/desktop/lib/state/swarm.dart
@@ -8,10 +8,14 @@ import 'terminal_pane.dart';
/// Shared agents reuse the same pane/session across swarms, so the daemon has
/// exactly one controller and switching tabs cannot take over our own stream.
class Swarm {
- Swarm({required this.id, String name = 'New Harness'})
- : name = const {'New swarm', 'New tab', 'New Agent'}.contains(name)
- ? 'New Harness'
- : name;
+ Swarm({required this.id, String name = defaultName})
+ : name = normalizeName(name);
+
+ static const defaultName = 'New Tab';
+ static String normalizeName(String name) =>
+ const {'New swarm', 'New tab', 'New Agent', 'New Harness'}.contains(name)
+ ? defaultName
+ : name;
final String id;
String name;
@@ -28,7 +32,7 @@ class Swarm {
final Map<int, int> pinnedSlots = {};
bool get isEmptyStarter =>
- name == 'New Harness' && panes.isEmpty && presets.isEmpty;
+ name == defaultName && panes.isEmpty && presets.isEmpty;
PaneArrangement? get manualLayout => paneSizes['${panes.length}:manual'];
@@ -180,7 +184,7 @@ class ClosedSwarm extends ClosedWork {
bool replacesUntouchedWelcome(Swarm swarm) =>
swarm.id == replacementId &&
- swarm.name == 'New Harness' &&
+ swarm.name == Swarm.defaultName &&
swarm.panes.isEmpty &&
swarm.presets.isEmpty;
}
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index b0447970e..571cbe774 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -565,7 +565,7 @@ Future<bool> activateSwarmSearchSelection(
)) {
return false;
}
- if (target.panes.isEmpty && target.name == 'New Harness') {
+ if (target.panes.isEmpty && target.name == Swarm.defaultName) {
app.renameSwarm(target.id, destination.title);
}
// Every membership is recorded before awaiting any attachment. A slow
diff --git a/desktop/lib/widgets/harness_entry_actions.dart b/desktop/lib/widgets/harness_entry_actions.dart
new file mode 100644
index 000000000..2198825d5
--- /dev/null
+++ b/desktop/lib/widgets/harness_entry_actions.dart
@@ -0,0 +1,97 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:lucide_icons_flutter/lucide_icons.dart';
+
+import '../shared/theme/app_theme.dart' as grid;
+import '../shortcuts/app_keymap.dart';
+import '../shortcuts/keymap.dart';
+
+/// The same search-or-create choice on New Tab and in the Add Harness picker.
+class HarnessEntryActions extends StatelessWidget {
+ const HarnessEntryActions({
+ super.key,
+ required this.onOpen,
+ required this.onNew,
+ required this.openKey,
+ required this.newKey,
+ });
+ final VoidCallback? onOpen, onNew;
+ final Key openKey, newKey;
+
+ Widget _keyboardAction(
+ BuildContext context,
+ VoidCallback? onPressed,
+ Widget child,
+ ) {
+ final region = KeymapRegion.of(context);
+ if (region?.contextKind == KeymapContext.picker) {
+ child = KeymapRegion(
+ contextKind: KeymapContext.picker,
+ actions: {
+ ...?region?.actions,
+ 'picker.accept': () => onPressed?.call(),
+ 'picker.add_here': () => onPressed?.call(),
+ },
+ child: child,
+ );
+ }
+ return CallbackShortcuts(
+ bindings: {
+ const SingleActivator(LogicalKeyboardKey.enter): () =>
+ onPressed?.call(),
+ const SingleActivator(LogicalKeyboardKey.numpadEnter): () =>
+ onPressed?.call(),
+ },
+ child: child,
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ const size = Size(140, 48);
+ const padding = EdgeInsets.symmetric(horizontal: 20);
+ return Wrap(
+ spacing: 12,
+ runSpacing: 12,
+ children: [
+ _keyboardAction(
+ context,
+ onOpen,
+ OutlinedButton(
+ key: openKey,
+ onPressed: onOpen,
+ style: OutlinedButton.styleFrom(
+ enabledMouseCursor: SystemMouseCursors.click,
+ minimumSize: size,
+ padding: padding,
+ backgroundColor: Colors.transparent,
+ foregroundColor: Colors.white,
+ side: const BorderSide(color: Colors.white24),
+ shape: const StadiumBorder(),
+ ),
+ child: const Text('Open Harness'),
+ ),
+ ),
+ _keyboardAction(
+ context,
+ onNew,
+ FilledButton.icon(
+ key: newKey,
+ onPressed: onNew,
+ icon: const Icon(LucideIcons.plus300, size: 18),
+ label: const Text('New Harness'),
+ style: FilledButton.styleFrom(
+ enabledMouseCursor: SystemMouseCursors.click,
+ minimumSize: size,
+ padding: padding,
+ backgroundColor: grid.AppPalette.swarmAccent,
+ foregroundColor: grid.AppPalette.swarmTabBar,
+ shape: const StadiumBorder(),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
index 86b5b054b..9d4b3ffa3 100644
--- a/desktop/lib/widgets/harness_start_page.dart
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:url_launcher/url_launcher.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/swarm_navigation.dart';
import '../state/swarm_search.dart';
+import 'harness_entry_actions.dart';
import 'swarm_search_input.dart';
import 'swarm_switcher.dart';
@@ -72,50 +72,6 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
widget.onNew();
}
- Widget _action({required bool create}) {
- final label = create ? 'New Harness' : 'Open Harness';
- final content = Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- if (create) ...[
- const Icon(LucideIcons.plus300, size: 18),
- const SizedBox(width: 8),
- ],
- Text(label),
- ],
- );
- const size = Size(140, 48);
- const padding = EdgeInsets.symmetric(horizontal: 20);
- return create
- ? FilledButton(
- key: const ValueKey('harness-start-new'),
- onPressed: _new,
- style: FilledButton.styleFrom(
- enabledMouseCursor: SystemMouseCursors.click,
- minimumSize: size,
- padding: padding,
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmTabBar,
- shape: const StadiumBorder(),
- ),
- child: content,
- )
- : OutlinedButton(
- key: const ValueKey('harness-start-open'),
- onPressed: _open,
- style: OutlinedButton.styleFrom(
- enabledMouseCursor: SystemMouseCursors.click,
- minimumSize: size,
- padding: padding,
- backgroundColor: Colors.transparent,
- foregroundColor: Colors.white,
- side: const BorderSide(color: Colors.white24),
- shape: const StadiumBorder(),
- ),
- child: content,
- );
- }
-
Widget _searchPanel() => TextFieldTapRegion(
groupId: _searchGroup,
child: Focus(
@@ -287,13 +243,11 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
Flexible(child: _searchPanel()),
if (!_showResults) ...[
const SizedBox(height: 20),
- Wrap(
- spacing: 12,
- runSpacing: 12,
- children: [
- _action(create: false),
- _action(create: true),
- ],
+ HarnessEntryActions(
+ onOpen: _open,
+ onNew: _new,
+ openKey: const ValueKey('harness-start-open'),
+ newKey: const ValueKey('harness-start-new'),
),
],
],
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 187d6fe58..2f815291f 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -195,7 +195,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
item.representedObject = action
item.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + action)
let symbols = [
- "new": "plus.square", "newAgent": "plus", "addAgent": "magnifyingglass",
+ "new": "plus.square", "newAgent": "plus", "addAgent": "plus",
"renameActive": "pencil", "closeActive": "xmark",
"splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",
"zoomPane": "viewfinder", "closePane": "xmark",
@@ -214,8 +214,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
if let file = main.item(withTitle: "File") { main.removeItem(file) }
let file = NSMenu(title: "File")
add(file, "New Tab", "t", "new")
- add(file, "New Harness…", "n", "newAgent")
- add(file, "Open Harness…", "o", "addAgent")
+ add(file, "Add Harness…", "n", "addAgent")
add(file, "Rename Tab…", "r", "renameActive", [.command, .shift])
add(file, "Close Tab", "w", "closeActive")
file.addItem(.separator())
@@ -786,7 +785,6 @@ private final class SwarmTabStrip: NSView {
private let document = NSView()
fileprivate let newButton = NSButton()
fileprivate let notificationButton = SwarmNotificationButton()
- fileprivate let createButton = SwarmActionButton()
fileprivate let openButton = SwarmActionButton()
private var tabs: [SwarmTabButton] = []
private let icons = SwarmHistoryIcons()
@@ -833,10 +831,9 @@ private final class SwarmTabStrip: NSView {
button.isEnabled = false
addSubview(button)
}
- textButton(createButton, "New Harness", #selector(createHarness))
- textButton(openButton, "Open Harness", #selector(openHarness))
+ textButton(openButton, "Add Harness", #selector(openHarness))
updateActionColors()
- setAccessibilityChildren([notificationButton, scroll, newButton, createButton, openButton])
+ setAccessibilityChildren([notificationButton, scroll, newButton, openButton])
registerForDraggedTypes([swarmPasteboardType])
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@@ -853,11 +850,8 @@ private final class SwarmTabStrip: NSView {
}
private func updateActionColors() {
- createButton.fillColor = palette.accent
- createButton.labelColor = palette.tabBar
- openButton.fillColor = .clear
- openButton.borderColor = NSColor.white.withAlphaComponent(0.24)
- openButton.labelColor = palette.accent
+ openButton.fillColor = palette.accent
+ openButton.labelColor = palette.tabBar
}
func update(_ state: [String: Any]) {
@@ -877,13 +871,13 @@ private final class SwarmTabStrip: NSView {
guard let id = row["id"] as? String else { return nil }
let tab = previous[id] ?? SwarmTabButton(id: id)
tab.palette = palette
- tab.name = row["name"] as? String ?? "New Harness"
+ tab.name = row["name"] as? String ?? "New Tab"
let count = row["agentCount"] as? Int ?? 0
tab.icon = count == 1
? icons.image(engine: row["engine"] as? String, asset: row["iconAsset"] as? String)
: count > 1
? SwarmIdentity.menuIcon
- : NSImage(systemSymbolName: "plus", accessibilityDescription: "New Harness")
+ : NSImage(systemSymbolName: "plus", accessibilityDescription: "New Tab")
tab.selected = id == activeId
tab.actionsEnabled = actionsEnabled
tab.attention = (row["attention"] as? Int ?? 0) > 0
@@ -902,7 +896,6 @@ private final class SwarmTabStrip: NSView {
document.setAccessibilityChildren(tabs)
newButton.isEnabled = actionsEnabled && (state["canOpenNewTab"] as? Bool ?? (tabs.count < 24))
notificationButton.isEnabled = actionsEnabled
- createButton.isEnabled = actionsEnabled
openButton.isEnabled = actionsEnabled
let attention = state["attention"] as? Int ?? 0
notificationButton.hasAttention = attention > 0
@@ -930,11 +923,9 @@ private final class SwarmTabStrip: NSView {
let previousDocumentSize = document.frame.size
let leading: CGFloat = 36
let spacious = bounds.width >= 480
- let createWidth: CGFloat = spacious ? 122 : 106
- let openWidth: CGFloat = spacious ? 128 : 108
- let actionGap: CGFloat = spacious ? 12 : 8
+ let openWidth: CGFloat = spacious ? 122 : 108
let trailing: CGFloat = spacious ? 12 : 8
- let actionsWidth = createWidth + actionGap + openWidth + trailing
+ let actionsWidth = openWidth + trailing
newButton.isHidden = bounds.width < 420
let 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))))
@@ -949,7 +940,6 @@ private final class SwarmTabStrip: NSView {
notificationButton.frame = NSRect(x: 0, y: buttonY, width: 28, height: 28)
newButton.frame = NSRect(x: leading + occupied + 4, y: buttonY, width: 28, 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 != previousDocumentSize
if let active, revealActiveAfterLayout || (activeWasVisible && (geometryChanged || tabOrderChanged)) {
@@ -989,9 +979,6 @@ private final class SwarmTabStrip: NSView {
@objc private func openNotifications() {
if actionsEnabled { emit?("notifications", nil) }
}
- @objc private func createHarness() {
- if actionsEnabled { emit?("newAgent", nil) }
- }
@objc private func openHarness() {
if actionsEnabled { emit?("addAgent", nil) }
}
@@ -1021,7 +1008,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
didSet { if palette != oldValue { needsDisplay = true } }
}
let swarmId: String
- var name = "New Harness" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
+ var name = "New Tab" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }
var attention = false { didSet { if attention != oldValue { needsDisplay = true; updateAccessibility() } } }
var showsDivider = false { didSet { if showsDivider != oldValue { needsDisplay = true } } }
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 7b38e562f..6124adc6b 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -103,20 +103,22 @@ void main() {
switch (entry) {
case 'header':
await tester.tap(
- find.byKey(const ValueKey('swarm-new-harness-button')),
+ find.byKey(const ValueKey('swarm-add-harness-button')),
);
+ await tester.pump();
+ await tester.tap(find.byKey(const ValueKey('harness-picker-new')));
case 'start page':
await chord(tester, LogicalKeyboardKey.keyT);
await tester.tap(find.byKey(const ValueKey('harness-start-new')));
case 'search shortcut':
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Agent 12',
);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
default:
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
}
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
@@ -162,7 +164,7 @@ void main() {
final connection = _Connection();
final app = createApp(connectionForTest: (_) => connection);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
await tester.tapAt(const Offset(12, 72));
@@ -198,7 +200,7 @@ void main() {
await mount(tester, app);
final field = find.byKey(const ValueKey('swarm-search-input'));
if (entry == 'Open') {
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
} else {
await chord(tester, LogicalKeyboardKey.keyP, shift: true);
await tester.enterText(field, '> $entry');
@@ -206,8 +208,8 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
}
- await tester.enterText(field, 'Agent 12');
- await chord(tester, LogicalKeyboardKey.keyN);
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ await tester.tap(find.byKey(const ValueKey('harness-picker-new')));
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.byType(SwarmSearchResults), findsNothing);
@@ -267,7 +269,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
}
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('new-agent-folder')));
await tester.pumpAndSettle();
@@ -342,8 +344,8 @@ void main() {
final input = <TerminalBinaryFrame>[];
final pane = app.adoptSessionForTest(terminal('a0', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('new-agent-folder')));
await tester.pumpAndSettle();
@@ -368,8 +370,9 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
expect(input.single.bytes, [27, 91, 66]);
- await chord(tester, LogicalKeyboardKey.keyO);
- expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await chord(tester, LogicalKeyboardKey.keyN);
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
expect(connection.calls, hasLength(1));
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/entry_surfaces_render_test.dart b/desktop/test/entry_surfaces_render_test.dart
index ee06d0d8d..a6bc28cf5 100644
--- a/desktop/test/entry_surfaces_render_test.dart
+++ b/desktop/test/entry_surfaces_render_test.dart
@@ -187,11 +187,11 @@ void main() {
}
}
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
await capture('open');
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
await capture('new');
expect(tester.takeException(), isNull);
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index a2ef79019..9c0aeac42 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -136,7 +136,7 @@ void main() {
EngineAvailability(engine: 'hermes', installed: true),
]);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
FocusNode fieldFocus(String key) => tester
.widget<InkWell>(
@@ -381,7 +381,7 @@ void main() {
FileSelectorPlatform.instance = _FolderPicker();
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pump();
await tester.tap(find.text('Browse…'));
await tester.pump();
@@ -490,29 +490,28 @@ void main() {
);
await runtime.mount(tester, app, map, native: native);
if (native) {
- final opening = runtime.native(tester, 'newAgent');
+ final opening = runtime.native(tester, 'addAgent');
await tester.pump();
await opening;
} else {
- final newButton = find.byKey(
- const ValueKey('swarm-new-harness-button'),
- );
- final openButton = find.byKey(
- const ValueKey('swarm-open-harness-button'),
+ final addButton = find.byKey(
+ const ValueKey('swarm-add-harness-button'),
);
final bell = find.byKey(const ValueKey('swarm-notifications-button'));
expect(
tester.getRect(bell).right,
- lessThan(tester.getRect(newButton).left),
+ lessThan(tester.getRect(addButton).left),
);
expect(
- tester.getRect(newButton).right,
- lessThanOrEqualTo(tester.getRect(openButton).left),
+ find.byKey(const ValueKey('swarm-new-harness-button')),
+ findsNothing,
);
expect(find.byType(FloatingActionButton), findsNothing);
- await tester.tap(newButton);
+ await tester.tap(addButton);
await tester.pump();
}
+ await tester.tap(find.byKey(const ValueKey('harness-picker-new')));
+ await tester.pump();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('/work/existing'), findsNothing);
expect(find.text('Choose a folder…'), findsOneWidget);
@@ -572,7 +571,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pump();
final folder = tester.widget<InkWell>(
@@ -626,7 +625,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
final field = find.byKey(const Key('new-agent-folder'));
await tester.tap(field);
await tester.pump();
@@ -785,7 +784,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
expect(picker.opened, 1);
expect(app.probes, 1);
expect(find.byType(AlertDialog), findsOneWidget);
@@ -851,7 +850,7 @@ void main() {
for (final chooseExplicitly in [false, true]) {
final app = _FirstUseApp()..probe = Completer<void>();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pump();
if (chooseExplicitly) {
await tester.tap(
diff --git a/desktop/test/harness_picker_entry_test.dart b/desktop/test/harness_picker_entry_test.dart
new file mode 100644
index 000000000..a0b7d96d9
--- /dev/null
+++ b/desktop/test/harness_picker_entry_test.dart
@@ -0,0 +1,132 @@
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shortcuts/app_keymap.dart';
+import 'package:harness/terminal/terminal_binary.dart';
+import 'package:harness/widgets/swarm_switcher.dart';
+
+import 'swarm_interactions_test.dart' show chord;
+import 'swarm_screen_test.dart' show terminal;
+import 'swarm_search_preview_test.dart' show seedPreviews;
+import 'swarm_state_test.dart' show createApp;
+import 'support/real_fonts.dart';
+
+void main() {
+ setUpAll(() async {
+ await loadRealFonts();
+ for (final (name, asset) in [
+ ('MaterialIcons', 'fonts/MaterialIcons-Regular.otf'),
+ (
+ 'packages/lucide_icons_flutter/Lucide300',
+ 'packages/lucide_icons_flutter/assets/build_font/LucideVariable-w300.ttf',
+ ),
+ ]) {
+ await (FontLoader(name)..addFont(rootBundle.load(asset))).load();
+ }
+ });
+ for (final (size, scale) in [
+ (const Size(1280, 900), 1.0),
+ (const Size(760, 760), 1.0),
+ (const Size(600, 680), 2.0),
+ ]) {
+ testWidgets('compact Add Harness keeps its editor stable at $size, $scale', (
+ tester,
+ ) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ final app = createApp();
+ await seedPreviews(app);
+ final frames = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a69', frames));
+ final pane = app.focusedPane;
+ final keymap = AppKeymap();
+ final boundaryKey = GlobalKey();
+ await tester.pumpWidget(
+ RepaintBoundary(
+ key: boundaryKey,
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context)
+ .copyWith(textScaler: TextScaler.linear(scale)),
+ child: KeymapProvider(keymap: keymap, child: child!),
+ ),
+ home: SwarmScreen(notifier: app, nativeTabs: false),
+ ),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 100));
+ final field = find.byKey(const ValueKey('swarm-search-input'));
+ await chord(tester, LogicalKeyboardKey.keyO);
+ expect(field, findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyN);
+ expect(field, findsOneWidget);
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byKey(const ValueKey('harness-picker-open')), findsOneWidget);
+ expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
+ final before = tester.getRect(field);
+ final controller = tester.widget<TextField>(field).controller;
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+
+ Future<void> capture(String state) async {
+ final output = Platform.environment['HARNESS_PICKER_CAPTURE_DIR'];
+ if (output == null) return;
+ await tester.pumpAndSettle();
+ final boundary =
+ boundaryKey.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/${size.width.toInt()}-$scale-$state.png')
+ .writeAsBytes(bytes!.buffer.asUint8List());
+ image.dispose();
+ });
+ }
+
+ await capture('compact');
+ // Return reveals choices, never opens a result the user has not seen.
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(app.focusedPane, same(pane));
+ expect(tester.getRect(field), before);
+ expect(tester.widget<TextField>(field).controller, same(controller));
+ await tester.enterText(field, 'idempotency');
+ await tester.pump();
+ expect(find.textContaining('Payment retries now reuse'), findsOneWidget);
+ await capture('results');
+ // Creation remains reachable after a query, including with the keyboard.
+ Focus.of(
+ tester.element(
+ find.descendant(
+ of: find.byKey(const ValueKey('harness-picker-new')),
+ matching: find.text('New Harness'),
+ ),
+ ),
+ ).requestFocus();
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(field, findsNothing);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(app.focusedPane, same(pane));
+ expect(frames, isEmpty);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ keymap.dispose();
+ });
+ }
+}
diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dart
index 4f563a5d8..bca2d5c0d 100644
--- a/desktop/test/keymap_host_test.dart
+++ b/desktop/test/keymap_host_test.dart
@@ -58,8 +58,8 @@ void main() {
('cmd+1', 'swarm.select_1'),
('cmd+9', 'swarm.select_9'),
('cmd+t', 'swarm.new'),
- ('cmd+n', 'agent.new'),
- ('cmd+o', 'agent.add'),
+ ('cmd+shift+n', 'agent.new'),
+ ('cmd+n', 'agent.add'),
('cmd+h', 'pane.focus_left'),
('cmd+j', 'pane.focus_below'),
('cmd+k', 'pane.focus_above'),
@@ -94,7 +94,7 @@ void main() {
expect(harnessCommandById[id]?.action, shortcut.action);
}
for (final retired in [
- 'cmd+shift+n',
+ 'cmd+o',
'cmd+shift+h',
'cmd+shift+j',
'cmd+shift+k',
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index 89208fa09..5110d5864 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -380,7 +380,7 @@ void main() {
if (inline) {
await tester.tap(input);
} else {
- await key(tester, LogicalKeyboardKey.keyO, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
}
await tester.enterText(input, 'Agent');
await tester.pump();
@@ -456,7 +456,7 @@ void main() {
expect(find.byType(SwarmSearchResults), findsNothing);
expect(tester.widget<TextField>(field).controller!.text, '> ');
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isFalse);
- await key(tester, LogicalKeyboardKey.keyO, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
final modal = find.byKey(const ValueKey('swarm-search-input'));
expect(tester.widget<TextField>(modal).focusNode!.hasFocus, isTrue);
expect(tester.widget<TextField>(modal).controller!.text, isEmpty);
@@ -609,7 +609,7 @@ void main() {
await tester.pump();
await opening;
} else {
- await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true, shift: true);
}
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
@@ -662,7 +662,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await key(tester, LogicalKeyboardKey.keyO, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
}
await tester.enterText(field, 'Agent');
await tester.pump();
diff --git a/desktop/test/search_workspace_test.dart b/desktop/test/search_workspace_test.dart
index 2cdb874ec..b72b3add6 100644
--- a/desktop/test/search_workspace_test.dart
+++ b/desktop/test/search_workspace_test.dart
@@ -68,7 +68,7 @@ void main() {
);
await key(tester, LogicalKeyboardKey.escape);
expect(field, findsNothing);
- await key(tester, LogicalKeyboardKey.keyO, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
await tester.enterText(field, 'Agent 0');
await tester.pump();
expect(
diff --git a/desktop/test/shortcuts_test.dart b/desktop/test/shortcuts_test.dart
index 0c6b28a7e..21d3c7910 100644
--- a/desktop/test/shortcuts_test.dart
+++ b/desktop/test/shortcuts_test.dart
@@ -267,8 +267,8 @@ void main() {
appShortcuts().where((s) => describeShortcut(s.activator) == '⌘P'),
isEmpty,
);
- expect(chordsFor(ShortcutAction.addAgent), ['⌘O']);
- expect(chordsFor(ShortcutAction.newAgent), ['⌘N']);
+ expect(chordsFor(ShortcutAction.addAgent), ['⌘N']);
+ expect(chordsFor(ShortcutAction.newAgent), ['⇧⌘N']);
expect(chordsFor(ShortcutAction.showAttention), ['⇧⌘I']);
expect(chordsFor(ShortcutAction.findTerminal), ['⌘F']);
expect(chordsFor(ShortcutAction.findNext), ['⌘G']);
diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dart
index 6e9dab88d..0d0e4c01e 100644
--- a/desktop/test/swarm_add_agent_test.dart
+++ b/desktop/test/swarm_add_agent_test.dart
@@ -25,7 +25,7 @@ void main() {
await mount(tester, app);
tester.view.physicalSize = const Size(880, 560);
await tester.pump();
- final add = find.byKey(const ValueKey('swarm-open-harness-button'));
+ final add = find.byKey(const ValueKey('swarm-add-harness-button'));
expect(tester.getRect(add).top, lessThan(44));
expect(find.byType(FloatingActionButton), findsNothing);
expect(
diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dart
index a41b5878d..149c1090b 100644
--- a/desktop/test/swarm_commands_test.dart
+++ b/desktop/test/swarm_commands_test.dart
@@ -117,7 +117,7 @@ void main() {
final app = createApp();
await mount(tester, app);
final input = find.byKey(const ValueKey('swarm-search-input'));
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(input, '> rename');
await tester.pump();
expect(
diff --git a/desktop/test/swarm_content_search_test.dart b/desktop/test/swarm_content_search_test.dart
index 182fb75dd..b4de91981 100644
--- a/desktop/test/swarm_content_search_test.dart
+++ b/desktop/test/swarm_content_search_test.dart
@@ -160,7 +160,7 @@ void main() {
app.adoptSessionForTest(terminal('a69', []));
app.newSwarm();
await mount(tester, app);
- if (!inline) await chord(tester, LogicalKeyboardKey.keyO);
+ if (!inline) await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(
ValueKey(inline ? 'harness-start-search' : 'swarm-search-input'),
);
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index 8ac36aeb7..e561cca31 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -187,7 +187,7 @@ void main() {
expect(page, isNot(original));
expect(_results, findsNothing);
expect(_startInput, findsOneWidget);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
expect(_results, findsOneWidget);
if (dismissal == 'outside') {
await tester.tapAt(const Offset(20, 200));
@@ -218,7 +218,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(_input, 'Agent 12');
await tester.pump();
final text = tester.widget<TextField>(_input).controller!;
@@ -261,7 +261,7 @@ void main() {
app.newSwarm();
final destination = app.activeSwarmId;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(_input, 'Agent 0');
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index 8f0ccd05f..bfa866c8f 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -170,7 +170,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
expect(app.panes, isEmpty);
await tester.enterText(
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
index 03c5ec6f7..7f891bbb2 100644
--- a/desktop/test/swarm_picker_activation_test.dart
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -16,14 +16,14 @@ void main() {
final input = <TerminalBinaryFrame>[];
final pane = app.adoptSessionForTest(terminal('a0', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
final results = find.byKey(const ValueKey('swarm-search-results'));
expect(field, findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
expect(find.byKey(const ValueKey('swarm-search-new-agent')), findsNothing);
expect(tester.getRect(field).width, tester.getRect(results).width);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.widgetWithText(FilledButton, 'New Harness'), findsOneWidget);
expect(results, findsNothing);
@@ -53,7 +53,7 @@ void main() {
app.newSwarm();
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent 0');
await tester.pump();
diff --git a/desktop/test/swarm_project_members_test.dart b/desktop/test/swarm_project_members_test.dart
index 4395a5783..2ccb66960 100644
--- a/desktop/test/swarm_project_members_test.dart
+++ b/desktop/test/swarm_project_members_test.dart
@@ -92,7 +92,7 @@ void main() {
reason:
'Editing project membership does not attach or take over terminals',
);
- await tester.tap(find.byKey(const ValueKey('swarm-open-harness-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-add-harness-button')));
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 45322d550..9af5bfcc7 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -120,7 +120,7 @@ void main() {
final app = createApp();
final tab = app.activeSwarm;
await mount(tester, app, nativeTabs: native);
- expect(tab.name, 'New Harness');
+ expect(tab.name, 'New Tab');
expect(
find.byKey(const ValueKey('harness-start-search')),
findsOneWidget,
@@ -180,7 +180,7 @@ void main() {
);
await mount(tester, app);
expect(find.text('Existing project'), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -216,7 +216,7 @@ void main() {
);
expect(find.text('Models'), findsNothing);
expect(find.text('Machines'), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -232,7 +232,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 200));
final zoom = app.zoomedPaneId;
final before = tester.getSize(find.byType(PaneGrid));
- await tester.tap(find.byKey(const ValueKey('swarm-open-harness-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-add-harness-button')));
await tester.pump(const Duration(milliseconds: 300));
expect(
find.byKey(const ValueKey('swarm-search-results')),
diff --git a/desktop/test/swarm_search_preview_test.dart b/desktop/test/swarm_search_preview_test.dart
index 0ee7509b2..498d84fdf 100644
--- a/desktop/test/swarm_search_preview_test.dart
+++ b/desktop/test/swarm_search_preview_test.dart
@@ -99,7 +99,7 @@ void main() {
await seedPreviews(app);
app.adoptSessionForTest(terminal('a69', []));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Workspace sync');
await tester.pump();
@@ -163,7 +163,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
}
await tester.enterText(field, 'Checkout retries');
await tester.pump();
@@ -276,7 +276,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
}
await tester.enterText(field, 'Checkout retries');
await tester.pump();
@@ -371,7 +371,7 @@ void main() {
);
app.adoptSessionForTest(terminal('a69', []));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Checkout',
@@ -405,7 +405,7 @@ void main() {
await mount(tester, app);
tester.view.physicalSize = size;
await tester.pump();
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Checkout',
diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dart
index 430dc8ff8..fa0b1d0d7 100644
--- a/desktop/test/swarm_search_render_test.dart
+++ b/desktop/test/swarm_search_render_test.dart
@@ -60,7 +60,7 @@ void main() {
final field = find.byKey(const ValueKey('swarm-search-input'));
Future<void> open() => chord(
tester,
- add ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
+ add ? LogicalKeyboardKey.keyN : LogicalKeyboardKey.keyP,
);
SwarmSearchKeys keys() => tester.widget<SwarmSearchKeys>(
find.ancestor(of: field, matching: find.byType(SwarmSearchKeys)),
@@ -144,7 +144,7 @@ void main() {
SwarmSearchInput inputWidget() => tester.widget<SwarmSearchInput>(
find.ancestor(of: field, matching: find.byType(SwarmSearchInput)),
);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(field, 'Agent 0');
await tester.pump();
final first = inputWidget().search!;
@@ -159,7 +159,7 @@ void main() {
await tester.pump();
session.terminal.write('Newest useful output.\r\n');
machine.projectReads = 0;
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
expect(tester.widget<TextField>(field).controller!.text, isEmpty);
await tester.enterText(field, 'Agent 0');
await tester.pump();
@@ -200,7 +200,7 @@ void main() {
try {
await chord(
tester,
- add ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
+ add ? LogicalKeyboardKey.keyN : LogicalKeyboardKey.keyP,
shift: !add,
);
expect(
@@ -242,7 +242,7 @@ void main() {
final input = <TerminalBinaryFrame>[];
app.adoptSessionForTest(terminal('a69', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump(const Duration(milliseconds: 200));
@@ -303,7 +303,7 @@ void main() {
),
),
);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
@@ -338,7 +338,7 @@ void main() {
final input = <TerminalBinaryFrame>[];
app.adoptSessionForTest(terminal('a69', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
@@ -375,7 +375,7 @@ void main() {
app.adoptSessionForTest(terminal('a69', input));
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dart
index 1987115f4..d02b07e0c 100644
--- a/desktop/test/swarm_search_test.dart
+++ b/desktop/test/swarm_search_test.dart
@@ -27,7 +27,7 @@ void main() {
await mount(tester, app);
final input = find.byKey(const ValueKey('swarm-search-input'));
expect(input, findsNothing);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
final originalController = tester.widget<TextField>(input).controller;
await tester.enterText(input, 'a query only');
@@ -275,7 +275,7 @@ void main() {
.take(3)
.toList();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.enterText(jumpField, 'Test host');
await tester.pump();
@@ -304,7 +304,7 @@ void main() {
app.adoptSessionForTest(terminal('a1', secondInputs));
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.enterText(jumpField, 'Agent 0');
await tester.pump();
@@ -350,7 +350,7 @@ void main() {
ValueKey(adding ? 'swarm-search-input' : 'harness-start-search'),
);
if (adding) {
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
} else {
await tester.tap(field);
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index c16b37fb5..ade671d17 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -376,10 +376,10 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
- expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
- expect(find.text('Split right'), findsOneWidget);
+ expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
+ expect(find.byKey(const ValueKey('swarm-row-action')), findsNothing);
expect(find.byType(AlertDialog), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pump();
expect(find.text('New Harness to the right'), findsOneWidget);
expect(find.text('/work/checkout'), findsOneWidget);
diff --git a/desktop/test/swarm_state_test.dart b/desktop/test/swarm_state_test.dart
index d1f0a9c42..48d15decd 100644
--- a/desktop/test/swarm_state_test.dart
+++ b/desktop/test/swarm_state_test.dart
@@ -130,9 +130,9 @@ void main() {
);
}
- for (final legacy in ['New swarm', 'New tab', 'New Agent']) {
+ for (final legacy in ['New swarm', 'New tab', 'New Agent', 'New Harness']) {
test(
- '$legacy empty tabs restore as New Harness and still name the first agent',
+ '$legacy empty tabs restore as New Tab and still name the first agent',
() async {
final store = MemoryStore();
final original = createApp(store: store);
@@ -147,7 +147,7 @@ void main() {
final restored = createApp(store: store);
addTearDown(restored.dispose);
await restored.restorePaneLayoutForTest();
- expect(restored.activeSwarm.name, 'New Harness');
+ expect(restored.activeSwarm.name, 'New Tab');
await restored.addAgentToSwarm('m', 'a0');
expect(restored.activeSwarm.name, 'Agent 0');
},
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 1950569d5..8f31cc2ce 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -51,17 +51,15 @@ void main() {
await tester.pump();
await opening;
} else {
- await tester.tap(
- find.byKey(const ValueKey('swarm-new-tab-button')),
- );
+ await tester.tap(find.byKey(const ValueKey('swarm-new-tab-button')));
await tester.pump();
}
final opened = app.activeSwarm;
expect(opened, isNot(same(original)));
- expect(opened.name, 'New Harness');
+ expect(opened.name, 'New Tab');
expect(opened.panes, isEmpty);
expect(find.byType(AlertDialog), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
await tester.enterText(field, 'Agent 0');
@@ -109,7 +107,7 @@ void main() {
expect(harnessCommandById['agent.new']!.label, 'New Harness');
await tester.tap(find.byKey(const ValueKey('command:swarm.new')));
await tester.pump();
- expect(app.activeSwarm.name, 'New Harness');
+ expect(app.activeSwarm.name, 'New Tab');
expect(app.panes, isEmpty);
expect(app.allPanes, contains(pane));
expect(find.byKey(const ValueKey('harness-start-search')), findsOneWidget);
diff --git a/desktop/test/terminal_tail_lifecycle_test.dart b/desktop/test/terminal_tail_lifecycle_test.dart
index d085fb69a..cc8c05f03 100644
--- a/desktop/test/terminal_tail_lifecycle_test.dart
+++ b/desktop/test/terminal_tail_lifecycle_test.dart
@@ -257,7 +257,7 @@ void main() {
view.widget.scrollController!.jumpTo(100);
await tester.pump();
await chord(tester, LogicalKeyboardKey.keyT);
- await chord(tester, LogicalKeyboardKey.keyO);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Agent 0',
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 9e2318364..7f9fae26b 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -127,7 +127,7 @@ private extension SwarmTabStrip {
let zoomFrame = zoom.convert(zoom.bounds, to: nil)
let newFrame = newButton.convert(newButton.bounds, to: nil)
try checkTitlebar(bounds.height >= 48, "Native title bar leaves room around the pill actions")
- for button in [createButton, openButton] {
+ for button in [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")
@@ -229,22 +229,21 @@ private extension SwarmTabStrip {
try checkTitlebar(!newButton.isEnabled,
"New Tab respects the workspace's availability")
update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0"))
- try checkTitlebar(newButton.toolTip == nil && createButton.toolTip == nil && openButton.toolTip == nil,
+ try checkTitlebar(newButton.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,
- "New and Open Harness have separate targets on the right")
- try checkTitlebar(createButton.title == "New Harness" && openButton.title == "Open Harness",
- "Creation and opening are explicit in the titlebar")
+ try checkTitlebar((newButton.isHidden || newButton.frame.maxX <= openButton.frame.minX) && scroll.frame.maxX <= openButton.frame.minX,
+ "Add Harness has its own target on the right")
+ try checkTitlebar(openButton.title == "Add Harness",
+ "The titlebar has one Add Harness entry point")
try checkTitlebar(!subviews.contains(where: { $0 is NSTextField }), "The titlebar has no competing text editor")
events.removeAll()
newButton.performClick(nil)
notificationButton.performClick(nil)
- createButton.performClick(nil)
openButton.performClick(nil)
- try checkTitlebar(events == ["new", "notifications", "newAgent", "addAgent"],
- "The new tab, notification, create and open buttons dispatch separate actions once")
+ try checkTitlebar(events == ["new", "notifications", "addAgent"],
+ "The new tab, notification and Add Harness buttons dispatch once")
try checkTitlebar(notificationButton.hasAttention, "The bell represents pending agent attention")
let oldButton = newButton
var themedState = state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0")
@@ -259,17 +258,16 @@ private extension SwarmTabStrip {
original.clickBothActions()
try checkTitlebar(events == ["select", "close"], "Native selection and close dispatch once each")
- let actionPixels = [createButton.renderedPixels(), openButton.renderedPixels()]
+ let actionPixels = [openButton.renderedPixels()]
events.removeAll()
update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0", enabled: false))
try original.checkEnabled(false)
- try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled && !createButton.isEnabled && !openButton.isEnabled, "Titlebar actions disable with a modal")
- try checkTitlebar(actionPixels == [createButton.renderedPixels(), openButton.renderedPixels()],
- "New and Open Harness keep their rendered colors when a workspace modal opens")
+ try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled && !openButton.isEnabled, "Titlebar actions disable with a modal")
+ try checkTitlebar(actionPixels == [openButton.renderedPixels()],
+ "Add Harness keeps its rendered colors when a workspace modal opens")
original.clickBothActions()
newButton.performClick(nil)
notificationButton.performClick(nil)
- createButton.performClick(nil)
openButton.performClick(nil)
try checkTitlebar(events.isEmpty, "Disabled controls emit no actions")
try checkDragOperations()
@@ -567,8 +565,11 @@ private extension SwarmTitlebar {
let settings = appItem.submenu!.items[0]
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
let agent = main.item(withTitle: "File")!.submenu!
+ let addHarness = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!
+ try checkTitlebar(addHarness.title == "Add Harness…" && addHarness.keyEquivalent == "n" && addHarness.keyEquivalentModifierMask == [.command],
+ "The single Add Harness menu entry advertises Command-N")
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.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "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 Tab…" && $0.representedObject as? String == "renameActive" }, "Rename Tab preserves its command")