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.

fix(desktop): polish search and preserve its input focus

dee5613a273de64
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index c2afba98f..6719dc380 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -254,8 +254,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (choice != null) await _chooseSearch(choice);
case 'close':
_closeSearch();
- case 'dismiss':
- _closeSearch();
}
return;
}
@@ -553,11 +551,11 @@ class _SwarmScreenState extends State<SwarmScreen> {
height: height.toDouble(),
child: Material(
key: const ValueKey('swarm-search-results'),
- elevation: 12,
- color: grid.AppPalette.panelBg,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10),
- side: const BorderSide(color: Colors.white12),
+ elevation: 8,
+ shadowColor: Colors.black54,
+ color: grid.AppPalette.swarmSearchSurface,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(bottom: Radius.circular(10)),
),
clipBehavior: Clip.antiAlias,
child: Padding(
@@ -583,7 +581,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
),
if (_native)
- Positioned(top: 6, right: 8, child: results)
+ Positioned(top: 0, right: 8, child: results)
else
Positioned(
left: 0,
@@ -593,7 +591,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
showWhenUnlinked: false,
targetAnchor: Alignment.bottomRight,
followerAnchor: Alignment.topRight,
- offset: const Offset(0, 6),
+ offset: Offset.zero,
child: results,
),
),
@@ -947,7 +945,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
swarm.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 12),
+ style: const TextStyle(fontSize: 13),
),
),
),
@@ -977,60 +975,102 @@ class _SwarmScreenState extends State<SwarmScreen> {
icon: const Icon(Icons.add, size: 18),
),
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8),
+ padding: const EdgeInsets.only(left: 8, right: 8, top: 6),
child: CompositedTransformTarget(
link: _searchAnchor,
child: SizedBox(
width: _searchWidth(MediaQuery.sizeOf(context).width),
- height: 28,
- child: ListenableBuilder(
- listenable: _search ?? _searchText,
- builder: (context, _) => SwarmSearchKeys(
- search: _search,
- editing: _searchText,
- onChoose: _chooseSearch,
- onClose: _closeSearch,
- child: Listener(
- onPointerDown: (_) => _openSearch(),
- child: TextField(
- key: const ValueKey('swarm-search-input'),
- controller: _searchText,
- focusNode: _searchFocus,
- onChanged: (query) => _search?.setQuery(query),
- style: const TextStyle(fontSize: 12),
- textAlignVertical: TextAlignVertical.center,
- decoration: InputDecoration(
- hintText: _search?.hint ?? 'Search…',
- isDense: true,
- contentPadding: const EdgeInsets.symmetric(
- horizontal: 10,
- ),
- prefixIcon: const Icon(Icons.search, size: 14),
- prefixIconConstraints: const BoxConstraints.tightFor(
- width: 30,
- height: 28,
- ),
- suffixIcon: _search == null
- ? const Padding(
- padding: EdgeInsets.only(right: 10),
- child: Text(
- '⌘P',
- style: TextStyle(fontSize: 11),
+ height: 38,
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: _search == null
+ ? null
+ : grid.AppPalette.swarmSearchSurface,
+ borderRadius: const BorderRadius.vertical(
+ top: Radius.circular(10),
+ ),
+ ),
+ child: Align(
+ alignment: Alignment.topCenter,
+ child: SizedBox(
+ height: 32,
+ child: ListenableBuilder(
+ listenable: _search ?? _searchText,
+ builder: (context, _) => SwarmSearchKeys(
+ search: _search,
+ editing: _searchText,
+ onChoose: _chooseSearch,
+ onClose: _closeSearch,
+ child: Listener(
+ onPointerDown: (_) => _openSearch(),
+ child: TextField(
+ key: const ValueKey('swarm-search-input'),
+ controller: _searchText,
+ focusNode: _searchFocus,
+ onChanged: (query) => _search?.setQuery(query),
+ style: const TextStyle(
+ fontSize: 13,
+ color: Color(0xffebebeb),
+ ),
+ textAlignVertical: TextAlignVertical.center,
+ decoration: InputDecoration(
+ hintText: _search?.hint ?? 'Search…',
+ isDense: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ ),
+ prefixIcon: const Icon(
+ Icons.search,
+ size: 16,
+ color: Colors.white60,
+ ),
+ prefixIconConstraints:
+ const BoxConstraints.tightFor(
+ width: 36,
+ height: 32,
+ ),
+ suffixIcon: _search == null
+ ? const Padding(
+ padding: EdgeInsets.only(right: 12),
+ child: Text(
+ '⌘P',
+ style: TextStyle(fontSize: 11),
+ ),
+ )
+ : null,
+ suffixIconConstraints: const BoxConstraints(
+ minWidth: 24,
+ ),
+ filled: true,
+ fillColor: grid.AppPalette.swarmSearchSurface,
+ hintStyle: const TextStyle(color: Colors.white60),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(16),
+ borderSide: const BorderSide(
+ color: Color(0x29ffffff),
),
- )
- : null,
- suffixIconConstraints: const BoxConstraints(
- minWidth: 24,
- ),
- filled: true,
- fillColor: grid.AppPalette.swarmField,
- border: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: Colors.white12),
- ),
- enabledBorder: OutlineInputBorder(
- borderRadius: BorderRadius.circular(8),
- borderSide: const BorderSide(color: Colors.white12),
+ ),
+ enabledBorder: _search != null
+ ? const OutlineInputBorder(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(10),
+ ),
+ borderSide: BorderSide.none,
+ )
+ : OutlineInputBorder(
+ borderRadius: BorderRadius.circular(16),
+ borderSide: const BorderSide(
+ color: Color(0x29ffffff),
+ ),
+ ),
+ focusedBorder: const OutlineInputBorder(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(10),
+ ),
+ borderSide: BorderSide.none,
+ ),
+ ),
+ ),
),
),
),
diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dart
index 46264a038..ebbcc5f9d 100644
--- a/desktop/lib/shared/theme/app_theme.dart
+++ b/desktop/lib/shared/theme/app_theme.dart
@@ -180,6 +180,8 @@ abstract final class AppPalette {
static Color get swarmField => const Color(0xff463746);
static Color get swarmTabBar => const Color(0xff332936);
static Color get swarmAccent => const Color(0xffd8cce1);
+ // Shared with the native search field for a continuous input/results surface.
+ static Color get swarmSearchSurface => const Color(0xff3d333f);
// the conversation / content area — pure white in light, like Codex.
//
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index 223f2e78f..a9c42668c 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -573,7 +573,7 @@ const kSwarmShortcuts = [
meta: true,
shift: true,
),
- label: 'Close the focused agent view',
+ label: 'Remove the focused agent from this swarm',
group: ShortcutGroup.panes,
),
AppShortcut(
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index 334e3acbd..f5cac8555 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -347,6 +347,11 @@ Future<bool> activateSwarmSearchSelection(
return true;
}
+String _agentCountLabel(Iterable<String?> ids) {
+ final count = ids.whereType<String>().length;
+ return '$count ${count == 1 ? 'agent' : 'agents'}';
+}
+
List<SwarmDestination> closedSwarmDestinations(AppNotifier app) => [
for (final entry in app.closedSwarms)
SwarmDestination(
@@ -354,7 +359,7 @@ List<SwarmDestination> closedSwarmDestinations(AppNotifier app) => [
closedId: entry.historyId,
title: entry.name,
detail:
- '${entry.panes.length} ${entry.panes.length == 1 ? 'view' : 'views'} · Recently closed',
+ '${_agentCountLabel(entry.panes.map((pane) => pane.agentId))} · Recently closed',
swarmId: null,
current: false,
),
@@ -396,8 +401,7 @@ List<SwarmDestination> swarmDestinations(
SwarmDestination(
id: swarmDestinationId(swarm.id),
title: swarm.name,
- detail:
- '${swarm.panes.length} ${swarm.panes.length == 1 ? 'view' : 'views'}',
+ detail: _agentCountLabel(swarm.panes.map((pane) => pane.agentId)),
swarmId: swarm.id,
current: swarm.id == app.activeSwarmId,
searchFields: context,
diff --git a/desktop/lib/widgets/swarm_attention.dart b/desktop/lib/widgets/swarm_attention.dart
index f1291938b..8a0186220 100644
--- a/desktop/lib/widgets/swarm_attention.dart
+++ b/desktop/lib/widgets/swarm_attention.dart
@@ -237,7 +237,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
? 'Unavailable'
: destination.hasView
? 'Jump'
- : 'Open view',
+ : 'Open agent',
style: const TextStyle(
fontSize: 11,
color: Colors.white54,
@@ -257,7 +257,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
selected != null && !selected.available
? 'This agent’s terminal is unavailable · Esc to close'
: selected != null && !selected.destination.hasView
- ? '↵ Open view in $_targetName · Esc to close'
+ ? '↵ Open agent in $_targetName · Esc to close'
: '↑↓ or ⌃N ⌃P to choose · Return to jump · Esc to close',
maxLines: 1,
overflow: TextOverflow.ellipsis,
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 0005cfe22..fcaf23bd8 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -318,7 +318,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? Center(
child: Text(
search.scoped && search.query.isEmpty
- ? 'No available agent views in this group'
+ ? 'No available agents in this group'
: 'No matching results',
style: const TextStyle(
fontSize: 13,
@@ -391,7 +391,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
selected?.agentId != null && !selected!.hasView
- ? 'Open view in ${search.targetName}'
+ ? 'Open agent in ${search.targetName}'
: '↑↓ choose · Esc close',
maxLines: 1,
overflow: TextOverflow.ellipsis,
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index efa8c0102..abb1280ff 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -62,9 +62,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {
[weak self] _ in self?.resize()
})
}
- observers.append(NotificationCenter.default.addObserver(forName: NSWindow.didResignKeyNotification, object: window, queue: .main) {
- [weak self] _ in self?.strip.dismissSearch()
- })
+ // Keep an in-progress search and its native input owner across app switches.
+ // Cancelling on window blur would return the next typed key to an agent.
}
deinit { observers.forEach(NotificationCenter.default.removeObserver) }
@@ -93,6 +92,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {
window.addTitlebarAccessoryViewController(accessory)
resize()
installSwarmMenu()
+ // An editable accessory must not become the window's initial input owner.
+ window.makeFirstResponder(window.contentViewController)
}
private func resize() {
@@ -136,7 +137,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation {
add(file, "Link Machine…", "", "linkMachine")
add(file, "Add Project…", "", "addProject")
file.addItem(.separator())
- add(file, "Close Agent View", "w", "closePane", [.command, .shift])
+ add(file, "Remove Agent from Swarm", "w", "closePane", [.command, .shift])
add(file, "Close Swarm", "w", "closeActive")
install(file, at: 1)
@@ -279,9 +280,34 @@ private struct SwarmHistoryEntry: Equatable {
private let swarmPasteboardType = NSPasteboard.PasteboardType("ai.autonomous.harness.v2.swarm")
// Matches AppPalette.swarmField exactly, joining the tab to the terminal canvas.
private let swarmSelectedTabColor = NSColor(srgbRed: 70.0 / 255, green: 55.0 / 255, blue: 70.0 / 255, alpha: 1)
+// Matches AppPalette.swarmSearchSurface so the input joins its results below.
+private let swarmSearchSurface = NSColor(srgbRed: 61.0 / 255, green: 51.0 / 255, blue: 63.0 / 255, alpha: 1)
+
+private final class SwarmSearchCell: NSSearchFieldCell {
+ override func select(withFrame rect: NSRect, in controlView: NSView, editor: NSText,
+ delegate: Any?, start: Int, length: Int) {
+ super.select(withFrame: searchTextRect(forBounds: rect), in: controlView,
+ editor: editor, delegate: delegate, start: start, length: length)
+ }
+ override func edit(withFrame rect: NSRect, in controlView: NSView, editor: NSText,
+ delegate: Any?, event: NSEvent?) {
+ super.edit(withFrame: searchTextRect(forBounds: rect), in: controlView,
+ editor: editor, delegate: delegate, event: event)
+ }
+ override func searchButtonRect(forBounds rect: NSRect) -> NSRect {
+ NSRect(x: rect.minX + 12, y: rect.midY - 8, width: 16, height: 16)
+ }
+ override func cancelButtonRect(forBounds rect: NSRect) -> NSRect {
+ NSRect(x: rect.maxX - 28, y: rect.midY - 8, width: 16, height: 16)
+ }
+ override func searchTextRect(forBounds rect: NSRect) -> NSRect {
+ let font = font ?? NSFont.systemFont(ofSize: 13)
+ let height = ceil(font.ascender - font.descender + font.leading)
+ return NSRect(x: rect.minX + 36, y: rect.midY - height / 2,
+ width: max(0, rect.width - 68), height: height)
+ }
+}
-/// A compact launcher for the shared picker; no second editable field or search
-/// state lives in AppKit. Native keyboard focus and button activation still work.
/// AppKit owns editing, selection, paste and IME. Only result-navigation keys
/// leave the field editor; ordinary terminal input never passes through here.
private final class SwarmSearchField: NSSearchField {
@@ -291,15 +317,27 @@ private final class SwarmSearchField: NSSearchField {
var searching = false { didSet { needsDisplay = true } }
override init(frame: NSRect) {
super.init(frame: frame)
- font = NSFont.systemFont(ofSize: 12)
- controlSize = .small
+ cell = SwarmSearchCell(textCell: "")
+ font = NSFont.systemFont(ofSize: 13)
+ controlSize = .regular
appearance = NSAppearance(named: .darkAqua)
+ isEditable = true
+ isSelectable = true
+ isBordered = false
+ drawsBackground = false
+ textColor = NSColor(white: 0.92, alpha: 1)
placeholderString = "Search…"
sendsSearchStringImmediately = true
sendsWholeSearchString = false
maximumRecents = 0
searchMenuTemplate = nil
- focusRingType = .exterior
+ focusRingType = .none
+ if let search = cell as? NSSearchFieldCell {
+ search.focusRingType = .none
+ search.isScrollable = true
+ search.searchButtonCell?.image = NSImage(systemSymbolName: "magnifyingglass", accessibilityDescription: nil)?
+ .withSymbolConfiguration(NSImage.SymbolConfiguration(pointSize: 14, weight: .regular))
+ }
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
override var mouseDownCanMoveWindow: Bool { false }
@@ -347,13 +385,26 @@ private final class SwarmSearchField: NSSearchField {
}
}
override func draw(_ dirtyRect: NSRect) {
+ let shape = NSBezierPath(roundedRect: bounds, xRadius: searching ? 10 : 16, yRadius: searching ? 10 : 16)
+ swarmSearchSurface.setFill()
+ shape.fill()
+ if searching {
+ // The strip continues the square bottom edge down to the result list.
+ NSRect(x: 0, y: isFlipped ? bounds.midY : 0,
+ width: bounds.width, height: bounds.height / 2).fill()
+ } else {
+ NSColor(white: 1, alpha: 0.16).setStroke()
+ let rim = NSBezierPath(roundedRect: bounds.insetBy(dx: 0.5, dy: 0.5), xRadius: 16, yRadius: 16)
+ rim.lineWidth = 1
+ rim.stroke()
+ }
super.draw(dirtyRect)
if !searching && stringValue.isEmpty && bounds.width >= 140 {
let shortcut = "⌘P" as NSString
let attrs: [NSAttributedString.Key: Any] = [.font: NSFont.systemFont(ofSize: 11),
.foregroundColor: NSColor.secondaryLabelColor]
let size = shortcut.size(withAttributes: attrs)
- shortcut.draw(at: NSPoint(x: bounds.width - size.width - 10,
+ shortcut.draw(at: NSPoint(x: bounds.width - size.width - 12,
y: (bounds.height - size.height) / 2), withAttributes: attrs)
}
}
@@ -392,6 +443,7 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
}
button(newButton, "plus", "New swarm (⌘T)", #selector(newSwarm))
searchField.delegate = self
+ searchField.isEnabled = false
searchField.begin = { [weak self] in self?.beginSearch() }
searchField.command = { [weak self] action in self?.emit?("searchCommand", ["command": action]) }
searchField.toolTip = "Search agents, swarms, machines and projects (⌘P)"
@@ -459,7 +511,7 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
}
let buttonY = (bounds.height - 28) / 2
newButton.frame = NSRect(x: occupied + 4, y: buttonY, width: 28, height: 28)
- searchField.frame = NSRect(x: bounds.width - searchWidth - 8, y: buttonY, width: searchWidth, height: 28)
+ searchField.frame = NSRect(x: bounds.width - searchWidth - 8, y: (bounds.height - 32) / 2, width: searchWidth, height: 32)
if searchField.searching && searchWidth != lastSearchWidth {
lastSearchWidth = searchWidth
emit?("searchGeometry", ["width": searchWidth])
@@ -473,6 +525,11 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
// rather than the rounded bottom of a separate pill.
swarmSelectedTabColor.setFill()
NSRect(x: 0, y: 0, width: bounds.width, height: 1).fill()
+ if searchField.searching {
+ swarmSearchSurface.setFill()
+ NSRect(x: searchField.frame.minX, y: 0, width: searchField.frame.width,
+ height: searchField.frame.minY + 1).fill()
+ }
}
override func mouseDown(with event: NSEvent) {
if event.clickCount == 2 { window?.performZoom(nil) }
@@ -482,6 +539,7 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
private func beginSearch() {
guard actionsEnabled, !searchField.searching else { return }
searchField.searching = true
+ needsDisplay = true
needsLayout = true
layoutSubtreeIfNeeded()
emit?("searchBegin", ["width": searchField.frame.width])
@@ -506,6 +564,7 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
func closeSearch() {
guard searchField.searching else { return }
searchField.searching = false
+ needsDisplay = true
if searchField.currentEditor() != nil {
// Flutter's wrapper NSView does not accept first responder. Its public
// view controller does, and routes the next event to Flutter's keyboard.
@@ -517,9 +576,6 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {
lastSearchWidth = 0
needsLayout = true
}
- func dismissSearch() {
- if searchField.searching { emit?("searchCommand", ["command": "dismiss"]) }
- }
func controlTextDidChange(_ notification: Notification) {
guard searchField.searching else { return }
emit?("searchChanged", ["query": searchField.stringValue])
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 29963a243..4fc364ca1 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -270,7 +270,7 @@ void main() {
await tester.pump();
await tester.pump();
expect(tester.widget<ListTile>(selectedRow).key, ValueKey(selectedId));
- expect(find.textContaining('Open view in'), findsOneWidget);
+ expect(find.textContaining('Open agent in'), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
expect(app.panes, hasLength(2));
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index c8baeeb38..012815520 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -159,6 +159,20 @@ private extension SwarmTabStrip {
focusSearch(selectAll: true)
try checkTitlebar((searchField.currentEditor() as? NSTextView)?.selectedRange().length == ("feature/木" as NSString).length,
"Command-P selects the current query for replacement")
+ var cancelled = false
+ let originalEmit = emit
+ emit = { method, args in
+ if method == "searchCommand", let command = (args as? [String: Any])?["command"] as? String,
+ command == "dismiss" || command == "close" { cancelled = true }
+ originalEmit?(method, args)
+ }
+ defer { emit = originalEmit }
+ let editor = window.firstResponder
+ NotificationCenter.default.post(name: NSWindow.didResignKeyNotification, object: window)
+ NotificationCenter.default.post(name: NSWindow.didBecomeKeyNotification, object: window)
+ try checkTitlebar(!cancelled, "Switching applications does not cancel search or restore terminal input")
+ try checkTitlebar(searchField.stringValue == "feature/木" && window.firstResponder === editor,
+ "Returning to the window retains the native search query and its input owner")
closeSearch()
try checkTitlebar(window.firstResponder === window.contentViewController,
"Closing native search returns keyboard events to the content controller")
@@ -195,6 +209,8 @@ private extension SwarmTitlebar {
}
NSApp.mainMenu = main
configure()
+ try checkTitlebar(window.firstResponder === window.contentViewController,
+ "Adding the search field does not take initial keyboard focus from the workspace")
try checkTitlebar(main.items.map(\.title) == ["Harness V2", "File", "Edit", "View", "History", "Swarm", "Window", "Help"], "Menus follow the familiar macOS order")
let settings = appItem.submenu!.items[0]
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
@@ -211,9 +227,9 @@ private extension SwarmTitlebar {
try checkTitlebar(validateMenuItem(reopen), "Closed-Swarm recovery becomes available")
let closePane = file.items.first(where: { $0.representedObject as? String == "closePane" })!
canClosePane = false
- try checkTitlebar(!validateMenuItem(closePane), "Close Agent View is disabled in New swarm")
+ try checkTitlebar(!validateMenuItem(closePane), "Remove Agent is disabled in New swarm")
canClosePane = true
- try checkTitlebar(validateMenuItem(closePane), "Close Agent View is enabled for a focused pane")
+ try checkTitlebar(validateMenuItem(closePane), "Remove Agent is enabled for a focused pane")
let create = file.items.first(where: { $0.representedObject as? String == "new" })!
canCreateSwarm = false
try checkTitlebar(!validateMenuItem(create), "Native New Swarm respects the tab capacity")
@@ -223,7 +239,7 @@ private extension SwarmTitlebar {
["id": "agent:\($0)", "title": "Agent \($0) — Machine", "detail": "Project \($0)", "current": $0 == 0]
} + [["id": "swarm:recent", "title": "Recent Swarm", "swarm": true]]
let closedRows: [[String: Any]] = (0..<14).map {
- ["id": "closed-\($0)", "title": "Closed Swarm \($0)", "detail": "3 views", "swarm": true]
+ ["id": "closed-\($0)", "title": "Closed Swarm \($0)", "detail": "3 agents", "swarm": true]
}
updateHistory(recentRows, closed: closedRows)
let recentItems = historyMenu.items.filter { $0.action == #selector(historyAction(_:)) }
diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.md
index 1733e076b..ccfa77bcf 100644
--- a/docs/harness-v2-progress.md
+++ b/docs/harness-v2-progress.md
@@ -1,8 +1,20 @@
# Harness App V2 — development handoff
-Updated 2026-09-13 after replacing the search launcher with an editable title-bar input and attached results. This is a working preview, not a release.
+Updated 2026-09-13 after polishing the editable search bar and making Swarm terminology consistent. This is a working preview, not a release.
-## Current continuation: editable title-bar search and keyboard configuration
+## Current continuation: search polish and agent terminology
+
+- **Menu organization is discussion only.** The user asked to study Terminal/iTerm2 and explicitly requested no menu-bar changes yet. Discussed replacing File with Swarm, putting focused-session actions under Agent, retaining Edit/View/Window/Help and keeping Models/Machines/Projects out of separate menus for now. No proposed reorganization is approved or implemented. The agent-removal wording below was already in the preview before this instruction.
+- The native search bar now uses the same 13-point text size as the tabs, a 32-point field, balanced icon/text insets, and a quiet one-point inactive rim. The blue focus ring is removed. While searching, the field has rounded top corners and extends into the attached results on one matching `#3d333f` surface; the gap, separate top border and rounded top corners of the result panel are removed. The Flutter fallback follows the same sizing and connected layout. No animation, blur or additional search work was introduced.
+- The actual AppKit editor keeps the same text inset as the inactive field. Isolated renders covered inactive, focused, typed and resized long-query states. The first render caught a borderless native editor placing text at the upper-left corner; the cell's editing and selection rectangles now preserve the intended padding.
+- User-facing Swarm counts now say **0 agents / 1 agent / N agents**, including recently closed History entries. Setup panes without an agent are excluded. Search and Needs Input say **Open agent**, and File/shortcut help say **Remove Agent from Swarm**. Internal view/session names remain implementation details.
+- **69 focused Flutter tests and 255 AppKit checks passed**. The native regression reproduced search cancellation on window blur before the fix and now confirms query/input ownership survives app switching. Initial native window focus stays in the workspace. Search and History tests were rerun after the focus fix. Analyzer has no errors or warnings and the same 12 existing vendored infos. Release build succeeded with `lib/main.dart`. Logs: `/private/tmp/harness-v2-search-polish-tests.log`, `harness-v2-search-polish-titlebar.log`, `harness-v2-search-polish-analyze.log`, `harness-v2-search-focus-tests.log`, `harness-v2-search-focus-build.log`.
+- The first live typing check exposed the window-blur path: it cancelled search, restored terminal focus and put the unsent word `workshop` in the left strategies prompt. No Return was sent. The user explicitly approved removing that word; eight Backspace events removed it, and CUA verified the prompt was clear. Search now retains its query and native input owner across app switches; Escape, explicit navigation and outside clicks still close it. **Use an existing empty New swarm or isolated fixtures for any future test typing.**
+- Normally relaunched one final Release preview after the correction, **PID 55560** at the last process check. Live CUA verification used the existing empty New swarm: clicking the native bar, typing `workshop`, Cmd-P select-all, replacement typing `New swarm`, and Escape all stayed in the same input and showed the correct `0 agents` result. The joined field/results surface was inspected. Returned to the previously active Focus swarm; the five Swarms and their membership are intact. Revalidate the preview PID before any later restart.
+- Keyboard customization remains the next track. Dispatcher, command catalog, platform validation, inherited configuration and focus-aware host work is preserved; **31 isolated foundation tests pass**. Its incomplete screen/search wiring is parked in `/private/tmp/harness-v2-keyboard-wiring-20260913-search-polish.patch` (SHA-256 `ef2841a963c4392abc612dba186c12ee2c3c05b3cfe87ad06c4ea21d580a6466`) so the preview includes only completed changes. It passes `git apply --check` against this visual update. Native menu/remap integration, command search and dynamic shortcut help still need completion before that wiring is built or shipped. Keep menu edits paused during the user's menu discussion.
+- The native latency benchmark remains paused calibration work with no accepted figures. `docs/prototypes/` and `docs/harness-collaboration-design.md` are unrelated user work; leave them alone.
+
+## Previous continuation: editable title-bar search and keyboard configuration
- The top-right search control is now a **real editable input**, using AppKit’s native field editor on macOS and a Flutter TextField in the fallback title bar. Clicking places the caret there; Cmd-P focuses/selects that same input. It expands left while active, and a modeless result list is anchored directly below it. There is no duplicate global-search input, centered dialog, dimming or blur. New swarm’s search launcher focuses the same bar; full History retains its separate session view.
- `SwarmSearchController` shares catalog/ranking/actions between input and results. The catalog includes agents, Swarms, machines and projects, fuzzy matching across names/branches/folders/machines, and saved cross-machine project associations. Output notifications reuse normalized results; typing makes no file/network requests. Native edits are never echoed back over newer text/IME input, and keyboard result scrolling happens before paint.