The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Keep search in place and unify swarm and account presentation
dee110af40b462a
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 1c9b9bceb..2253a915d 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -26,6 +26,7 @@ import '../widgets/new_agent_dialog.dart';import '../widgets/pane_grid.dart';import '../widgets/shortcuts_sheet.dart';import '../widgets/swarm_dialogs.dart';+import '../widgets/swarm_inline_search.dart';import '../widgets/swarm_project_agents.dart';import '../widgets/swarm_attention.dart';import '../widgets/swarm_switcher.dart';@@ -186,6 +187,7 @@ class _SwarmScreenState extends State<SwarmScreen> {{'id': entry.id,'title': entry.title,+ 'machineName': entry.machineLabel,'detail': entry.detail,'swarm': entry.isSwarm,'engine': entry.engine,@@ -198,9 +200,8 @@ class _SwarmScreenState extends State<SwarmScreen> {for (final entry in _navigation.menuDestinations(app)){'id': entry.id,- 'title': entry.isSwarm- ? entry.title- : '${entry.title} — ${app.stateOf(entry.machineId!)?.machine.displayName ?? entry.machineId}',+ 'title': entry.title,+ 'machineName': entry.machineLabel,'detail': entry.detail,'swarm': entry.isSwarm,'engine': entry.engine,@@ -277,8 +278,6 @@ class _SwarmScreenState extends State<SwarmScreen> {search.move(1);case 'previous':search.move(-1);- case 'back':- search.back();case 'submit':final choice = search.submit();if (choice != null) await _chooseSearch(choice);@@ -500,11 +499,7 @@ class _SwarmScreenState extends State<SwarmScreen> {selection: TextSelection.collapsed(offset: search.query.length),);}- final state = {- 'query': search.query,- 'hint': search.hint,- 'scoped': search.scoped,- };+ final state = {'query': search.query, 'hint': search.hint};final encoded = jsonEncode(state);if (_searchFieldState != encoded) {_searchFieldState = encoded;@@ -513,7 +508,6 @@ class _SwarmScreenState extends State<SwarmScreen> {_channel.invokeMethod<void>('searchState', {if (!_nativeQueryChange) 'query': search.query,'hint': search.hint,- 'scoped': search.scoped,}),);}@@ -574,11 +568,10 @@ class _SwarmScreenState extends State<SwarmScreen> {56,double.infinity,);- final height =- (search.rows.length.clamp(1, 7) * rowHeight +- 64 +- (search.scoped ? 48 : 0))- .clamp(140.0, constraints.maxHeight - (_native ? 12 : 56));+ final height = (search.rows.length.clamp(1, 7) * rowHeight + 64).clamp(+ 140.0,+ constraints.maxHeight - (_native ? 12 : 56),+ );final results = SizedBox(width: width,height: height.toDouble(),@@ -912,7 +905,15 @@ class _SwarmScreenState extends State<SwarmScreen> {notifier: app,projects: _projects.projects,onNewAgent: _newAgent,- onSearch: _jump,+ searchField: SwarmInlineSearch(+ key: ValueKey(+ 'welcome-search:${app.activeSwarmId}',+ ),+ app: app,+ projects: _projects,+ recent: _navigation.recent,+ onChoose: _activateSearch,+ ),onAddProject: _addProject,onLinkMachine: () => _dialog(() => showSwarmLinkDialog(context, app),diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dartindex 740464d79..f7136d8e3 100644--- a/desktop/lib/state/swarm_navigation.dart+++ b/desktop/lib/state/swarm_navigation.dart@@ -132,6 +132,7 @@ class SwarmDestination {required this.swarmId,required this.current,this.machineId,+ this.machineLabel = '',this.agentId,this.engine,this.closedId,@@ -143,7 +144,7 @@ class SwarmDestination {...searchFields.whereType<String>().map((s) => s.toLowerCase()),];- final String id, title, detail;+ final String id, title, detail, machineLabel;final String? swarmId, machineId, agentId, engine;final String? closedId;final String? projectId;@@ -157,7 +158,7 @@ class SwarmDestination {bool get hasView => swarmId != null;}-enum SwarmSearchAction { open, addHere, openGroup }+enum SwarmSearchAction { open, addHere }class SwarmSearchSelection {const SwarmSearchSelection(@@ -281,10 +282,7 @@ Future<bool> activateSwarmSearchSelection(List<SavedSwarmProject> projects = const [],}) async {final destination = selection.destination;- if (selection.action == SwarmSearchAction.open) {- if (destination.isGroup) {- return false; // Groups are browsed inside the picker.- }+ if (selection.action == SwarmSearchAction.open && !destination.isGroup) {return activateSwarmDestination(app,destination,@@ -322,17 +320,19 @@ Future<bool> activateSwarmSearchSelection(),);}- if (!destination.isGroup ||- destination.members.isEmpty ||- destination.members.length > AppNotifier.maxPanes ||- app.swarms.length >= AppNotifier.maxSwarms) {+ if (!canOpenSwarmGroup(+ app,+ destination,+ destinationSwarmId: destinationSwarmId,+ )) {return false;}final entries = SwarmSearchCatalog().read(app, projects);final group = entries.where((entry) => entry.id == destination.id).firstOrNull;- // Open exactly the reviewed set, never silently include newly discovered work.+ // Keep the membership represented by the selected result. Discovery may+ // change while this action is waiting to run.if (group == null || !group.members.containsAll(destination.members)) {return false;}@@ -342,16 +342,70 @@ Future<bool> activateSwarmSearchSelection((machineId: entry.machineId!, agentId: entry.agentId!),];if (agents.length != destination.members.length) return false;- app.newSwarm(name: group.title);+ final existing = _matchingGroupSwarm(app, destination);+ if (existing != null) {+ app.selectSwarm(existing.id);+ final focus = existing.focusedPaneId;+ if (focus != null) app.focusPane(focus);+ return true;+ }+ final target = app.swarms+ .where((swarm) => swarm.id == destinationSwarmId)+ .firstOrNull;+ if (target != null && target.panes.isEmpty) {+ app.selectSwarm(target.id);+ } else {+ app.newSwarm(name: group.title);+ }await app.seedSwarm(group.title, agents);return true;}+bool canOpenSwarmGroup(+ AppNotifier app,+ SwarmDestination destination, {+ required String destinationSwarmId,+}) =>+ destination.isGroup &&+ destination.members.length <= AppNotifier.maxPanes &&+ (_matchingGroupSwarm(app, destination) != null ||+ app.swarms.any(+ (swarm) => swarm.id == destinationSwarmId && swarm.panes.isEmpty,+ ) ||+ app.swarms.length < AppNotifier.maxSwarms);++Swarm? _matchingGroupSwarm(AppNotifier app, SwarmDestination destination) {+ bool matches(Swarm swarm) =>+ // Empty tabs only match their name; two empty projects are distinct.+ (destination.members.isNotEmpty || swarm.name == destination.title) &&+ swarm.panes.length == destination.members.length &&+ swarm.panes.every(+ (pane) =>+ pane.agentId != null &&+ destination.members.contains(+ agentDestinationId(pane.machineId, pane.agentId!),+ ),+ );+ return app.swarms+ .where((swarm) => swarm.name == destination.title && matches(swarm))+ .firstOrNull ??+ (matches(app.activeSwarm) ? app.activeSwarm : null) ??+ app.swarms.where(matches).firstOrNull;+}+String _agentCountLabel(Iterable<String?> ids) {final count = ids.whereType<String>().length;return '$count ${count == 1 ? 'agent' : 'agents'}';}+String _swarmMachineLabel(AppNotifier app, Iterable<String> machineIds) {+ final ids = machineIds.toSet();+ if (ids.isEmpty) return '';+ if (ids.length > 1) return '${ids.length} machines';+ final id = ids.single;+ return app.stateOf(id)?.machine.displayName ?? id;+}+List<SwarmDestination> closedWorkDestinations(AppNotifier app) => [for (final entry in app.closedHistory)if (entry is ClosedSwarm)@@ -359,6 +413,10 @@ List<SwarmDestination> closedWorkDestinations(AppNotifier app) => [id: entry.historyId,closedId: entry.historyId,title: entry.name,+ machineLabel: _swarmMachineLabel(app, [+ for (final pane in entry.panes)+ if (pane.agentId != null) pane.machineId,+ ]),detail:'${_agentCountLabel(entry.panes.map((pane) => pane.agentId))} · Recently closed',swarmId: null,@@ -372,6 +430,9 @@ List<SwarmDestination> closedWorkDestinations(AppNotifier app) => [detail: '${entry.machineName} · ${entry.swarmName} · Recently closed',swarmId: null,machineId: entry.machineId,+ machineLabel:+ app.stateOf(entry.machineId)?.machine.displayName ??+ entry.machineName,agentId: entry.agentId,engine: entry.engine,current: false,@@ -415,6 +476,10 @@ List<SwarmDestination> swarmDestinations(SwarmDestination(id: swarmDestinationId(swarm.id),title: swarm.name,+ machineLabel: _swarmMachineLabel(app, [+ for (final pane in swarm.panes)+ if (pane.agentId != null) pane.machineId,+ ]),detail: _agentCountLabel(swarm.panes.map((pane) => pane.agentId)),swarmId: swarm.id,current: swarm.id == app.activeSwarmId,@@ -463,6 +528,7 @@ List<SwarmDestination> swarmDestinations(].whereType<String>().where((s) => s.isNotEmpty).toSet().join(' · '),swarmId: owner?.id,machineId: machineId,+ machineLabel: machineName,agentId: agentId,engine: engine,current:diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex e84cad680..f4402a73f 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -23,18 +23,13 @@ class SwarmSearchController extends ChangeNotifier {final _cache = SwarmSearchCatalog();List<SwarmDestination> _catalog = const [];List<SwarmDestination> rows = const [];- String query = '', _rootQuery = '';- String? _scopeId, _selectedId;+ String query = '';+ String? _selectedId;int cursor = 0;SwarmDestination? get selected => rows.isEmpty ? null : rows[cursor];- bool get scoped => _scopeId != null;- SwarmDestination? get scope =>- _catalog.where((row) => row.id == _scopeId).firstOrNull;String get hint => history != null? 'Search history…'- : scoped- ? 'Search agents in ${scope?.title ?? 'this group'}…': 'Search agents, swarms, machines, projects…';void _refresh() {@@ -48,17 +43,7 @@ class SwarmSearchController extends ChangeNotifier {}void _filter() {- final group = scope;- rows = rankSwarmDestinations(- !scoped- ? _catalog- : [- for (final row in _catalog)- if (group?.members.contains(row.id) == true) row,- ],- query,- recent: recent,- );+ rows = rankSwarmDestinations(_catalog, query, recent: recent);final index = rows.indexWhere((row) => row.id == _selectedId);cursor = rows.isEmpty? 0@@ -87,30 +72,15 @@ class SwarmSearchController extends ChangeNotifier {SwarmSearchSelection? submit([SwarmDestination? row]) {final destination = row ?? selected;if (destination == null || !canSubmit(destination)) return null;- if (!destination.isGroup) return SwarmSearchSelection(destination);- _rootQuery = query;- _scopeId = destination.id;- query = '';- cursor = 0;- _selectedId = null;- _filter();- notifyListeners();- return null;+ return SwarmSearchSelection(destination);}bool canSubmit(SwarmDestination? row) =>row != null &&+ (!row.isGroup ||+ canOpenSwarmGroup(app, row, destinationSwarmId: targetId)) &&(row.closedId == null || app.canReopenClosed(row.closedId!));- void back() {- if (!scoped) return;- _selectedId = _scopeId;- _scopeId = null;- query = _rootQuery;- _filter();- notifyListeners();- }-bool canAdd(SwarmDestination? row) =>history == null &&row?.agentId != null &&@@ -130,21 +100,11 @@ class SwarmSearchController extends ChangeNotifier {? SwarmSearchSelection(selected!, SwarmSearchAction.addHere): null;- bool get canOpenGroup =>- scope != null &&- scope!.members.isNotEmpty &&- scope!.members.length <= AppNotifier.maxPanes &&- app.swarms.length < AppNotifier.maxSwarms;-static String action(SwarmDestination row) => row.closedId != null? 'Reopen'- : row.isGroup- ? 'Browse agents'- : row.isSwarm- ? 'Switch swarm'- : row.hasView- ? 'Focus pane'- : 'Open here';+ : row.isGroup || row.isSwarm+ ? 'Go to swarm'+ : 'Go to agent';@overridevoid dispose() {diff --git a/desktop/lib/usage/models_menu_controller.dart b/desktop/lib/usage/models_menu_controller.dartindex a49ca6e62..f7c7365bd 100644--- a/desktop/lib/usage/models_menu_controller.dart+++ b/desktop/lib/usage/models_menu_controller.dart@@ -83,8 +83,6 @@ class ModelsMenuController extends ChangeNotifier {UsageProvider.claude => 'Anthropic',UsageProvider.codex => 'OpenAI',};- final scope = account.isLocal ? '' : account.machines.join(', ');- final title = scope.isEmpty ? provider : '$provider · $scope';final windows = reading.windows;final expired =(reading.fetchedAt != null &&@@ -124,15 +122,9 @@ class ModelsMenuController extends ChangeNotifier {: reading.message ?? status,);}- if (account.machines.isNotEmpty) {- details.add(- account.isLocal- ? 'Shared with ${account.machines.join(', ')}'- : 'On ${account.machines.join(', ')}',- );- }return {- 'title': title,+ 'title': provider,+ 'account': _accountLabel(reading),'status': status,'details': details,'engine': reading.provider.engineId,@@ -140,6 +132,16 @@ class ModelsMenuController extends ChangeNotifier {};}+ static String _accountLabel(ProviderUsage reading) {+ // The same opaque identity is available locally and across machines.+ // Use it consistently instead of mixing emails with fallback IDs.+ final key = reading.account;+ if (key != null && RegExp(r'^[0-9a-f]{16}$').hasMatch(key)) {+ return 'Account ${key.substring(0, 6)}';+ }+ return '';+ }+static String _remaining(UsageWindow window) {final left = (100 - window.usedPercent).clamp(0, 100);// Never round a positive remainder to zero (or a partial balance to 100).diff --git a/desktop/lib/widgets/swarm_icon.dart b/desktop/lib/widgets/swarm_icon.dartnew file mode 100644index 000000000..32f68bc76--- /dev/null+++ b/desktop/lib/widgets/swarm_icon.dart@@ -0,0 +1,14 @@+import 'package:flutter/cupertino.dart';++/// Four agents sharing one workspace. Native menus use the corresponding+/// `square.split.2x2` symbol in SwarmTitlebar.swift.+class SwarmIcon extends StatelessWidget {+ const SwarmIcon({super.key, this.size = 19, this.color});++ final double size;+ final Color? color;++ @override+ Widget build(BuildContext context) =>+ Icon(CupertinoIcons.square_split_2x2, size: size, color: color);+}diff --git a/desktop/lib/widgets/swarm_inline_search.dart b/desktop/lib/widgets/swarm_inline_search.dartnew file mode 100644index 000000000..9e4ee412b--- /dev/null+++ b/desktop/lib/widgets/swarm_inline_search.dart@@ -0,0 +1,195 @@+import 'dart:math' as math;++import 'package:flutter/material.dart';++import '../shared/theme/app_theme.dart' as grid;+import '../state/app_state.dart';+import '../state/swarm_catalog.dart';+import '../state/swarm_navigation.dart';+import '../state/swarm_search.dart';+import 'swarm_switcher.dart';++/// New swarm owns its input and caret. Only the catalog and result actions are+/// shared with the title bar; typing here never activates the native field.+class SwarmInlineSearch extends StatefulWidget {+ const SwarmInlineSearch({+ super.key,+ required this.app,+ required this.projects,+ required this.recent,+ required this.onChoose,+ });++ final AppNotifier app;+ final SwarmProjectStore projects;+ final List<String> recent;+ final void Function(SwarmSearchSelection choice, String target) onChoose;++ @override+ State<SwarmInlineSearch> createState() => _SwarmInlineSearchState();+}++class _SwarmInlineSearchState extends State<SwarmInlineSearch> {+ final _text = TextEditingController();+ final _focus = FocusNode(debugLabel: 'New swarm search');+ final _overlay = OverlayPortalController();+ final _tapGroup = Object();+ SwarmSearchController? _search;++ @override+ void initState() {+ super.initState();+ _focus.addListener(_focusChanged);+ }++ void _focusChanged() {+ if (!_focus.hasFocus) _close();+ }++ void _begin() {+ if (_search != null) return;+ _search = SwarmSearchController(+ widget.app,+ widget.recent,+ projects: widget.projects,+ )..setQuery(_text.text);+ _search!.addListener(_changed);+ _overlay.show();+ setState(() {});+ }++ void _changed() => setState(() {});++ void _close() {+ if (_search == null) return;+ _overlay.hide();+ _search!.removeListener(_changed);+ _search!.dispose();+ _search = null;+ _focus.unfocus();+ setState(() {});+ }++ void _choose(SwarmSearchSelection choice) {+ final target = _search?.targetId;+ if (target == null) return;+ _close();+ widget.onChoose(choice, target);+ }++ @override+ void dispose() {+ _search?.removeListener(_changed);+ _search?.dispose();+ _focus.removeListener(_focusChanged);+ _focus.dispose();+ _text.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final open = _search != null;+ final border = OutlineInputBorder(+ borderRadius: BorderRadius.vertical(+ top: const Radius.circular(8),+ bottom: Radius.circular(open ? 0 : 8),+ ),+ borderSide: BorderSide(color: open ? Colors.transparent : Colors.white24),+ );+ return OverlayPortal.overlayChildLayoutBuilder(+ controller: _overlay,+ overlayChildBuilder: (context, info) {+ final search = _search!;+ final anchor = MatrixUtils.transformRect(+ info.childPaintTransform,+ Offset.zero & info.childSize,+ );+ final scale = MediaQuery.textScalerOf(context);+ final rowHeight = math.max(+ 56.0,+ scale.scale(13) + scale.scale(11) + 32,+ );+ final available = math.max(+ 0.0,+ info.overlaySize.height - anchor.bottom - 16,+ );+ final height = math.min(+ available,+ search.rows.length.clamp(1, 7) * rowHeight + 64,+ );+ return Positioned(+ top: anchor.bottom,+ left: anchor.left,+ width: anchor.width,+ height: height,+ child: TextFieldTapRegion(+ groupId: _tapGroup,+ child: ExcludeFocus(+ child: Material(+ key: const ValueKey('swarm-welcome-search-results'),+ color: grid.AppPalette.swarmSearchSurface,+ elevation: 8,+ shadowColor: Colors.black54,+ borderRadius: const BorderRadius.vertical(+ bottom: Radius.circular(8),+ ),+ clipBehavior: Clip.antiAlias,+ child: Padding(+ padding: const EdgeInsets.all(8),+ child: SwarmSearchResults(+ search: search,+ onChoose: _choose,+ onRefocus: _focus.requestFocus,+ ),+ ),+ ),+ ),+ ),+ );+ },+ child: SwarmSearchKeys(+ search: _search,+ editing: _text,+ onChoose: _choose,+ onClose: _close,+ child: TextField(+ key: const ValueKey('swarm-welcome-search-input'),+ groupId: _tapGroup,+ controller: _text,+ focusNode: _focus,+ autofocus: true,+ onTap: _begin,+ onTapAlwaysCalled: true,+ onTapOutside: (_) => _close(),+ onChanged: (value) {+ _begin();+ _search!.setQuery(value);+ },+ style: const TextStyle(fontSize: 13, color: Colors.white),+ decoration: InputDecoration(+ hintText: 'Search agents, swarms, machines, projects…',+ hintStyle: const TextStyle(fontSize: 13, color: Color(0xffc5bece)),+ prefixIcon: const Icon(+ Icons.search,+ size: 18,+ color: Color(0xffc5bece),+ ),+ filled: true,+ fillColor: open+ ? grid.AppPalette.swarmSearchSurface+ : const Color(0xa6111521),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 14,+ vertical: 14,+ ),+ isDense: true,+ border: border,+ enabledBorder: border,+ focusedBorder: border,+ ),+ ),+ ),+ );+ }+}diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex a0fd68fb5..8c22cfa2f 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -6,6 +6,7 @@ import '../state/app_state.dart';import '../state/swarm_navigation.dart';import '../state/swarm_search.dart';import 'engine_identity.dart';+import 'swarm_icon.dart';import 'swarm_welcome.dart';Future<SwarmSearchSelection?> showSwarmHistory(@@ -185,19 +186,13 @@ class SwarmSearchKeys extends StatelessWidget {control: true,): () =>run(onClose),- if (search.scoped)- const SingleActivator(- LogicalKeyboardKey.arrowLeft,- alt: true,- ): () =>- run(search.back),},child: child,);}}-/// Results only: global search keeps its one editable input in the title bar.+/// Shared results for the title bar, New swarm field and History.class SwarmSearchResults extends StatefulWidget {const SwarmSearchResults({super.key,@@ -271,55 +266,17 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {56,double.infinity,);- final scope = search.scope;final selected = search.selected;return Semantics(container: true,label: 'Search results',child: Column(children: [- if (search.scoped)- Row(- children: [- IconButton(- tooltip: 'All results',- onPressed: () {- search.back();- widget.onRefocus();- },- icon: const Icon(Icons.arrow_back, size: 16),- ),- Expanded(- child: Text(- scope?.title ?? 'Group no longer available',- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(fontSize: 12),- ),- ),- TextButton(- onPressed: !search.canOpenGroup- ? null- : () => widget.onChoose(- SwarmSearchSelection(- scope!,- SwarmSearchAction.openGroup,- ),- ),- child: Text(- 'Open ${scope?.members.length ?? 0} agents as swarm',- style: const TextStyle(fontSize: 11),- ),- ),- ],- ),Expanded(child: search.rows.isEmpty? Center(child: Text(- search.scoped && search.query.isEmpty- ? 'No available agents in this group'- : 'No matching results',+ 'No matching results',style: const TextStyle(fontSize: 13,color: Colors.white60,@@ -350,12 +307,12 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {size: 20,enabled: search.canSubmit(row),)+ : row.isSwarm+ ? const SwarmIcon(color: Colors.white60): Icon(row.isMachine? Icons.computer_outlined- : row.isProject- ? Icons.folder_outlined- : Icons.tab,+ : Icons.folder_outlined,size: 19,color: Colors.white60,),@@ -374,15 +331,6 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {color: Colors.white54,),),- trailing: Text(- row.current- ? 'Current'- : SwarmSearchController.action(row),- style: const TextStyle(- fontSize: 11,- color: Colors.white54,- ),- ),onTap: search.canSubmit(row)? () => _submit(row): null,@@ -397,12 +345,17 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {child: Padding(padding: const EdgeInsets.symmetric(horizontal: 10),child: Text(- selected?.closedId != null+ selected != null && !search.canSubmit(selected)+ ? selected.isGroup &&+ selected.members.length > AppNotifier.maxPanes+ ? 'A swarm supports up to ${AppNotifier.maxPanes} agents'+ : 'No room to open this ${selected.isSwarm || selected.isGroup ? 'swarm' : 'agent'}'+ : selected?.closedId != null? search.canSubmit(selected)? 'Reopen ${selected!.isSwarm ? 'swarm' : 'agent'}': 'No room to reopen': selected?.agentId != null && !selected!.hasView- ? 'Open agent in ${search.targetName}'+ ? 'Opens in ${search.targetName}': '↑↓ choose · Esc close',maxLines: 1,overflow: TextOverflow.ellipsis,@@ -413,15 +366,17 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {if (search.canAdd(selected))TextButton(onPressed: () => widget.onChoose(search.addHere()!),+ style: TextButton.styleFrom(foregroundColor: Colors.white70),child: const Text('Add to this swarm ⌘↵',style: TextStyle(fontSize: 11),),),TextButton(- onPressed: selected == null ? null : _submit,+ onPressed: search.canSubmit(selected) ? _submit : null,+ style: TextButton.styleFrom(foregroundColor: Colors.white),child: Text(- '${selected == null ? 'Open' : SwarmSearchController.action(selected)} ↵',+ '${selected == null ? 'Go to' : SwarmSearchController.action(selected)} ↵',style: const TextStyle(fontSize: 11),),),diff --git a/desktop/lib/widgets/swarm_welcome.dart b/desktop/lib/widgets/swarm_welcome.dartindex acd2b45fc..b6c58551a 100644--- a/desktop/lib/widgets/swarm_welcome.dart+++ b/desktop/lib/widgets/swarm_welcome.dart@@ -14,7 +14,7 @@ class SwarmWelcome extends StatelessWidget {required this.notifier,required this.projects,required this.onNewAgent,- required this.onSearch,+ required this.searchField,required this.onAddProject,required this.onLinkMachine,required this.onMachine,@@ -24,7 +24,7 @@ class SwarmWelcome extends StatelessWidget {final AppNotifier notifier;final List<SavedSwarmProject> projects;final VoidCallback onNewAgent;- final VoidCallback onSearch;+ final Widget searchField;final VoidCallback onAddProject;final VoidCallback onLinkMachine;final ValueChanged<MachineState> onMachine;@@ -73,39 +73,7 @@ class SwarmWelcome extends StatelessWidget {const SizedBox(height: 28),Row(children: [- Expanded(- child: OutlinedButton.icon(- autofocus: true,- onPressed: onSearch,- icon: const Icon(Icons.search, size: 18),- label: const Row(- children: [- Expanded(- child: Text(- 'Search agents, swarms, machines, projects…',- maxLines: 1,- overflow: TextOverflow.ellipsis,- ),- ),- SizedBox(width: 12),- Text('⌘P'),- ],- ),- style: OutlinedButton.styleFrom(- alignment: Alignment.centerLeft,- minimumSize: const Size(0, 44),- foregroundColor: const Color(0xffc5bece),- backgroundColor: const Color(0xa6111521),- side: const BorderSide(color: Colors.white24),- padding: const EdgeInsets.symmetric(- horizontal: 14,- ),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(8),- ),- ),- ),- ),+ Expanded(child: searchField),const SizedBox(width: 12),FilledButton.icon(onPressed: onNewAgent,diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex c9c35fe5b..2ff32cf26 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -38,9 +38,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {result(true)case "update":let state = call.arguments as? [String: Any] ?? [:]- let wasEnabled = self.actionsEnabledself.actionsEnabled = state["enabled"] as? Bool == true- if wasEnabled != self.actionsEnabled { self.updateModelsAvailability() }self.canReopen = state["canReopen"] as? Bool == trueself.canFind = state["canFind"] as? Bool == trueself.canClosePane = state["canClosePane"] as? Bool == true@@ -202,15 +200,13 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {}}section("Subscription")+ let rowWidth = subscriptions.map(SwarmSubscriptionView.preferredWidth).max() ?? 440for entry in subscriptions {- let item = NSMenuItem(title: entry.title + " — " + entry.status, action: nil, keyEquivalent: "")- item.image = historyIcons.image(engine: entry.engine, asset: entry.iconAsset)+ let item = NSMenuItem(title: entry.accessibilityLabel, action: nil, keyEquivalent: "")+ let icon = historyIcons.image(engine: entry.engine, asset: entry.iconAsset)+ item.view = SwarmSubscriptionView(entry: entry, icon: icon, width: rowWidth)item.toolTip = entry.details.joined(separator: "\n")- let detail = NSMenu(title: entry.title)- detail.autoenablesItems = false- for line in entry.details { label(line, in: detail) }- item.submenu = detail- item.isEnabled = actionsEnabled+ item.isEnabled = falsemodelsMenu.addItem(item)}if subscriptions.isEmpty {@@ -219,21 +215,16 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {}modelsMenu.addItem(.separator())section("API")- label("OpenRouter API", in: modelsMenu)- label("fal.ai API", in: modelsMenu)+ label("OpenRouter", in: modelsMenu)+ label("fal.ai", in: modelsMenu)modelsMenu.addItem(.separator())section("Local")- label("Local models", in: modelsMenu)+ label("DeepSeek V4 Flash", in: modelsMenu)+ label("Qwen3.8-27B", in: modelsMenu)modelsMenu.addItem(.separator())label("Add Model", in: modelsMenu)}- private func updateModelsAvailability() {- for item in modelsMenu.items where item.submenu != nil {- item.isEnabled = actionsEnabled- }- }-private func updateHistory(_ rows: [[String: Any]], closed: [[String: Any]] = []) {let entries = rows.prefix(64).compactMap(SwarmHistoryEntry.init)let closedEntries = closed.prefix(24).compactMap(SwarmHistoryEntry.init)@@ -273,12 +264,13 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {for entry in entries {let title = entry.title.count > 76 ? String(entry.title.prefix(48)) + "…" + String(entry.title.suffix(24)) : entry.titlelet item = NSMenuItem(title: title, action: closed ? #selector(closedHistoryAction(_:)) : #selector(historyAction(_:)), keyEquivalent: "")+ item.attributedTitle = entry.menuTitleitem.target = selfitem.representedObject = entry.id- item.toolTip = entry.title + "\n" + entry.detail+ item.toolTip = [entry.title, entry.machineName, entry.detail].filter { !$0.isEmpty }.joined(separator: "\n")item.state = entry.current ? .on : .offitem.image = entry.swarm- ? NSImage(systemSymbolName: "rectangle.split.2x2", accessibilityDescription: nil)+ ? SwarmIdentity.menuIcon: historyIcons.image(engine: entry.engine, asset: entry.iconAsset)historyMenu.addItem(item)}@@ -339,8 +331,14 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {}}+private enum SwarmIdentity {+ // Same four-pane symbol as widgets/swarm_icon.dart.+ static let menuIcon = NSImage(systemSymbolName: "square.split.2x2", accessibilityDescription: nil)+}+private struct SwarmSubscriptionEntry: Equatable {let title: String+ let account: Stringlet status: Stringlet details: [String]let engine: String?@@ -350,27 +348,115 @@ private struct SwarmSubscriptionEntry: Equatable {guard let title = row["title"] as? String, !title.isEmpty,let status = row["status"] as? String else { return nil }self.title = title+ account = row["account"] as? String ?? ""self.status = statusdetails = Array((row["details"] as? [String] ?? [status]).prefix(16))engine = row["engine"] as? StringiconAsset = row["iconAsset"] as? String}++ var accessibilityLabel: String {+ [title, account, status].filter { !$0.isEmpty }.joined(separator: ", ")+ }+}++/// Read-only account information, with aligned trailing balances. There is no+/// action or submenu to suggest another step just to read the remaining usage.+private final class SwarmSubscriptionView: NSView {+ private static let rowFont = NSFont.menuFont(ofSize: 0)+ let identity = NSTextField(labelWithString: "")+ let balance = NSTextField(labelWithString: "")+ private let icon = NSImageView()++ private static func textWidth(_ text: String) -> CGFloat {+ // Include the native text cell's horizontal drawing insets. Measuring only+ // glyphs or a label already constrained by its frame can clip the status.+ ceil((text as NSString).size(withAttributes: [.font: rowFont]).width) + 8+ }++ static func preferredWidth(_ entry: SwarmSubscriptionEntry) -> CGFloat {+ let identityWidth = textWidth(entry.title + " " + entry.account)+ let balanceWidth = textWidth(entry.status)+ return min(720, max(440, identityWidth + balanceWidth + 88))+ }++ init(entry: SwarmSubscriptionEntry, icon: NSImage, width: CGFloat) {+ super.init(frame: NSRect(x: 0, y: 0, width: width, height: 26))+ autoresizingMask = [.width]+ self.icon.image = icon+ self.icon.imageScaling = .scaleProportionallyDown+ let title = NSMutableAttributedString(string: entry.title,+ attributes: [.font: Self.rowFont, .foregroundColor: NSColor.labelColor])+ if !entry.account.isEmpty {+ title.append(NSAttributedString(string: " " + entry.account,+ attributes: [.font: Self.rowFont, .foregroundColor: NSColor.secondaryLabelColor]))+ }+ identity.attributedStringValue = title+ identity.usesSingleLineMode = true+ identity.lineBreakMode = .byTruncatingMiddle+ balance.stringValue = entry.status+ balance.font = Self.rowFont+ balance.textColor = .secondaryLabelColor+ balance.alignment = .right+ balance.usesSingleLineMode = true+ balance.lineBreakMode = .byClipping+ for view in [self.icon, identity, balance] {+ addSubview(view)+ view.setAccessibilityElement(false)+ }+ setAccessibilityElement(true)+ setAccessibilityRole(.staticText)+ setAccessibilityLabel(entry.accessibilityLabel)+ toolTip = entry.details.joined(separator: "\n")+ layout()+ }++ required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }++ override func layout() {+ super.layout()+ icon.frame = NSRect(x: 16, y: (bounds.height - 16) / 2, width: 16, height: 16)+ let height = ceil(Self.rowFont.ascender - Self.rowFont.descender + Self.rowFont.leading)+ let balanceWidth = Self.textWidth(balance.stringValue)+ balance.frame = NSRect(x: bounds.width - 18 - balanceWidth,+ y: (bounds.height - height) / 2, width: balanceWidth, height: height)+ identity.frame = NSRect(x: 40, y: balance.frame.minY,+ width: max(0, balance.frame.minX - 24 - 40), height: height)+ }}private struct SwarmHistoryEntry: Equatable {let id: Stringlet title: Stringlet detail: String+ let machineName: Stringlet swarm: Boollet current: Boollet engine: String?let iconAsset: String?let canReopen: Bool+ var menuTitle: NSAttributedString {+ let font = NSFont.menuFont(ofSize: 0)+ func fitted(_ text: String, width: CGFloat) -> String {+ var value = text.replacingOccurrences(of: "\t", with: " ").replacingOccurrences(of: "\n", with: " ")+ if (value as NSString).size(withAttributes: [.font: font]).width <= width { return value }+ while !value.isEmpty && ((value + "…") as NSString).size(withAttributes: [.font: font]).width > width { value.removeLast() }+ return value + "…"+ }+ let paragraph = NSMutableParagraphStyle()+ paragraph.tabStops = [NSTextTab(textAlignment: .right, location: 660)]+ let name = fitted(title, width: machineName.isEmpty ? 660 : 430)+ let machine = fitted(machineName, width: 206)+ return NSAttributedString(string: machine.isEmpty ? name : name + "\t" + machine,+ attributes: [.font: font, .paragraphStyle: paragraph])+ }+init?(_ row: [String: Any]) {guard let id = row["id"] as? String, let title = row["title"] as? String else { return nil }self.id = idself.title = titledetail = row["detail"] as? String ?? ""+ machineName = row["machineName"] as? String ?? ""swarm = row["swarm"] as? Bool == truecurrent = row["current"] as? Bool == trueengine = (row["engine"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()@@ -387,9 +473,12 @@ private final class SwarmHistoryIcons {private let assetURL: (String) -> URL?init(assetURL: @escaping (String) -> URL? = { asset in- let bundle = Bundle(identifier: "io.flutter.flutter.app") ?? Bundle.main- let key = FlutterDartProject.lookupKey(forAsset: asset, from: bundle)- return bundle.url(forResource: key, withExtension: nil)+ // Flutter ships desktop assets inside App.framework, not the runner bundle.+ let framework = Bundle.main.privateFrameworksURL?.appendingPathComponent("App.framework")+ let bundle = framework.flatMap { Bundle(url: $0) }+ ?? Bundle(identifier: "io.flutter.flutter.app")+ ?? Bundle.main+ return bundle.resourceURL?.appendingPathComponent("flutter_assets").appendingPathComponent(asset)}) {self.assetURL = assetURLcache.countLimit = 32@@ -489,7 +578,6 @@ private final class SwarmSearchCell: NSSearchFieldCell {private final class SwarmSearchField: NSSearchField {var begin: (() -> Void)?var command: ((String) -> Void)?- var scoped = falsevar searching = false { didSet { needsDisplay = true } }override init(frame: NSRect) {super.init(frame: frame)@@ -540,7 +628,7 @@ private final class SwarmSearchField: NSSearchField {}return super.performKeyEquivalent(with: event)}- static func resultCommand(_ selector: String, event: NSEvent?, composing: Bool, scoped: Bool = false) -> String? {+ static func resultCommand(_ selector: String, event: NSEvent?, composing: Bool) -> String? {guard !composing else { return nil }let modifiers = event?.modifierFlags.intersection([.command, .option, .control, .shift]) ?? []if modifiers == .control {@@ -551,7 +639,6 @@ private final class SwarmSearchField: NSSearchField {default: break}}- if scoped && modifiers == .option && selector == "moveWordLeft:" { return "back" }switch selector {case "moveDown:": return "next"case "moveUp:": return "previous"@@ -735,7 +822,6 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {}}searchField.placeholderString = state["hint"] as? String ?? "Search…"- searchField.scoped = state["scoped"] as? Bool == true}func closeSearch() {guard searchField.searching else { return }@@ -759,7 +845,7 @@ private final class SwarmTabStrip: NSView, NSSearchFieldDelegate {func control(_ control: NSControl, textView: NSTextView, doCommandBy selector: Selector) -> Bool {let event = NSApp.currentEventguard let action = SwarmSearchField.resultCommand(NSStringFromSelector(selector), event: event,- composing: textView.hasMarkedText(), scoped: searchField.scoped) else { return false }+ composing: textView.hasMarkedText()) else { return false }if event?.isARepeat != true || !["submit", "add", "close"].contains(action) {emit?("searchCommand", ["command": action])}diff --git a/desktop/test/models_menu_test.dart b/desktop/test/models_menu_test.dartindex 1741b2d13..b765314da 100644--- a/desktop/test/models_menu_test.dart+++ b/desktop/test/models_menu_test.dart@@ -33,7 +33,7 @@ void main() {double weekly = 30,DateTime? reset,DateTime? fetched,- String? account = 'same-account',+ String? account = 'aabbccddeeff0011',}) => ProviderUsage(provider: UsageProvider.claude,status: UsageStatus.ok,@@ -56,7 +56,7 @@ void main() {MachineUsage(machineName: 'Shared Mac', readings: [reading()]),MachineUsage(machineName: 'Other Mac',- readings: [reading(account: 'different-account', session: 50)],+ readings: [reading(account: '1122334455667788', session: 50)],),],);@@ -68,10 +68,12 @@ void main() {expect(menu.rows.first['title'], 'Anthropic');expect(menu.rows.first['status'], '15% remaining');expect(menu.rows.first['details'], contains('Weekly — 70% remaining'));- expect(menu.rows.first['details'], contains('Shared with Shared Mac'));- expect(menu.rows.last['title'], 'Anthropic · Other Mac');+ expect(menu.rows.first['account'], 'Account aabbcc');+ expect(menu.rows.toString(), isNot(contains('Shared Mac')));+ expect(menu.rows.last['title'], 'Anthropic');+ expect(menu.rows.last['account'], 'Account 112233');expect(menu.rows.last['status'], '50% remaining');- expect(menu.rows.toString(), isNot(contains('same-account')));+ expect(menu.rows.toString(), isNot(contains('aabbccddeeff0011')));},);@@ -102,6 +104,20 @@ void main() {},);+ test('unidentified accounts do not invent an account label', () async {+ final source = _Source(+ UsageProvider.claude,+ () async => reading(account: null),+ );+ final usage = UsageController(sources: [source], autoStart: false);+ final menu = ModelsMenuController(usage: usage, now: () => instant);+ addTearDown(usage.dispose);+ addTearDown(menu.dispose);+ await menu.refresh();+ expect(menu.rows.single['title'], 'Anthropic');+ expect(menu.rows.single['account'], '');+ });+test('unknown, expired and invalid readings never become made-up percentages',() async {diff --git a/desktop/test/swarm_history_test.dart b/desktop/test/swarm_history_test.dartindex e212a8af6..65e805a6a 100644--- a/desktop/test/swarm_history_test.dart+++ b/desktop/test/swarm_history_test.dart@@ -6,8 +6,10 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/screens/swarm_screen.dart';import 'package:harness/settings/settings_screen.dart';+import 'package:harness/state/app_state.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/state/swarm_navigation.dart';+import 'package:harness/state/terminal_pane.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:xterm/xterm.dart';@@ -16,6 +18,41 @@ import 'swarm_state_test.dart' show createApp;import 'swarm_switcher_test.dart' show jumpField;void main() {+ test(+ 'swarm History counts distinct machines, including offline and closed work',+ () async {+ final app = createApp();+ addTearDown(app.dispose);+ final history = SwarmNavigationHistory();+ history.record(app);+ String machines() => history+ .menuDestinations(app)+ .firstWhere((entry) => entry.isSwarm)+ .machineLabel;+ expect(machines(), '');+ app.adoptSessionForTest(terminal('a0', []));+ app.adoptSessionForTest(terminal('a1', []));+ expect(machines(), 'Test host');+ const remote = Machine(+ machineId: 'remote',+ authMode: MachineAuthMode.remote,+ name: 'Test host',+ );+ app.machineStates['remote'] = MachineState(remote)..nodeOnline = false;+ app.activeSwarm.panes.addAll([+ TerminalPane(id: 900, machineId: 'remote', agentId: 'remote-agent'),+ TerminalPane(id: 901, machineId: 'setup-only'),+ ]);+ expect(+ machines(),+ '2 machines',+ reason: 'Count machine identities, not names, agents or setup panes',+ );+ await app.closeSwarm(app.activeSwarmId);+ expect(closedWorkDestinations(app).single.machineLabel, '2 machines');+ },+ );+testWidgets('native History restores closed agents and sends their engine icons',(tester) async {@@ -51,6 +88,12 @@ void main() {await tester.pump();final recent = (updates.last['history'] as List).cast<Map>().first;expect(recent['engine'], 'claude');+ expect(+ (updates.last['history'] as List).cast<Map>().firstWhere(+ (row) => row['swarm'] == true,+ )['machineName'],+ 'Test host',+ );await app.closePane(pane.id);await tester.pump();final closed = (updates.last['closedHistory'] as List).cast<Map>().single;@@ -77,6 +120,12 @@ void main() {(updates.last['closedHistory'] as List).cast<Map>().single['swarm'],isTrue,);+ expect(+ (updates.last['closedHistory'] as List)+ .cast<Map>()+ .single['machineName'],+ 'Test host',+ );await tester.pumpWidget(const SizedBox());app.dispose();projects.dispose();@@ -225,7 +274,8 @@ void main() {final row = (updates.last['history'] as List).cast<Map>().firstWhere((row) => row['id'] == id,);- expect(row['title'], 'Agent 0 — Test host');+ expect(row['title'], 'Agent 0');+ expect(row['machineName'], 'Test host');expect(row['engine'], 'codex');expect(row['iconAsset'], 'assets/engine-icons/codex.png');final before = updates.length;diff --git a/desktop/test/swarm_inline_search_test.dart b/desktop/test/swarm_inline_search_test.dartnew file mode 100644index 000000000..7da6c6f8f--- /dev/null+++ b/desktop/test/swarm_inline_search_test.dart@@ -0,0 +1,156 @@+import 'package:flutter/material.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/state/swarm_catalog.dart';+import 'package:harness/terminal/terminal_binary.dart';+import 'package:xterm/xterm.dart';++import 'swarm_interactions_test.dart' show chord;+import 'swarm_screen_test.dart' show mount, terminal;+import 'swarm_state_test.dart' show createApp;++final _input = find.byKey(const ValueKey('swarm-welcome-search-input'));+final _results = find.byKey(const ValueKey('swarm-welcome-search-results'));++void main() {+ testWidgets(+ 'New swarm keeps editing and results at the field that was clicked',+ (tester) async {+ final app = createApp();+ await mount(tester, app);+ final top = find.byKey(const ValueKey('swarm-search-input'));+ final before = tester.getRect(_input);+ await tester.tap(_input);+ await tester.enterText(_input, 'Agent 12');+ await tester.pump();+ expect(tester.widget<TextField>(_input).focusNode!.hasFocus, isTrue);+ expect(tester.widget<TextField>(top).controller!.text, isEmpty);+ expect(find.byKey(const ValueKey('swarm-search-results')), findsNothing);+ expect(find.widgetWithText(ListTile, 'Agent 12'), findsOneWidget);+ final results = tester.getRect(_results);+ expect(tester.getRect(_input), before);+ expect(results.top, closeTo(before.bottom, 0.1));+ expect(results.left, closeTo(before.left, 0.1));+ expect(results.width, closeTo(before.width, 0.1));+ expect(results.bottom, lessThanOrEqualTo(784));+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();+ expect(_results, findsNothing);+ expect(tester.widget<TextField>(_input).controller!.text, 'Agent 12');+ await tester.tap(_input);+ await tester.pump();+ expect(_results, findsOneWidget);+ await chord(tester, LogicalKeyboardKey.keyP);+ await tester.pump();+ expect(_results, findsNothing);+ expect(+ find.byKey(const ValueKey('swarm-search-results')),+ findsOneWidget,+ );+ expect(tester.widget<TextField>(top).focusNode!.hasFocus, isTrue);+ expect(tester.widget<TextField>(top).controller!.text, isEmpty);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ testWidgets(+ 'inline selection opens the existing agent and hands it the next key',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final frames = <TerminalBinaryFrame>[];+ final pane = app.adoptSessionForTest(terminal('a0', frames));+ final original = app.activeSwarmId;+ app.newSwarm();+ await mount(tester, app);+ await tester.tap(_input);+ await tester.enterText(_input, 'Agent 0');+ await tester.pump();+ expect(frames, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(app.activeSwarmId, original);+ expect(app.panes.single, same(pane));+ expect(_results, findsNothing);+ expect(+ tester+ .widget<TerminalView>(find.byType(TerminalView))+ .focusNode!+ .hasFocus,+ isTrue,+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ await tester.pump(const Duration(milliseconds: 10));+ expect(frames.single.bytes, [27, 91, 68]);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ testWidgets(+ 'the welcome field never redirects typing through the native title bar',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final messages = <MethodCall>[];+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (+ call,+ ) async {+ messages.add(call);+ return true;+ });+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ tester.view.physicalSize = const Size(1280, 800);+ tester.view.devicePixelRatio = 1;+ addTearDown(tester.view.resetPhysicalSize);+ addTearDown(tester.view.resetDevicePixelRatio);+ final app = createApp();+ final projects = SwarmProjectStore();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: SwarmScreen(+ notifier: app,+ nativeTabs: true,+ projectStore: projects,+ ),+ ),+ );+ await tester.pump();+ messages.clear();+ await tester.tap(_input);+ await tester.enterText(_input, 'Agent 3');+ await tester.pump();+ expect(_results, findsOneWidget);+ expect(+ messages.where(+ (call) =>+ call.method == 'focusSearch' || call.method == 'searchState',+ ),+ isEmpty,+ );+ final controller = tester.widget<TextField>(_input).controller!;+ controller.value = controller.value.copyWith(+ composing: const TextRange(start: 0, end: 3),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(app.panes, isEmpty);+ expect(_results, findsOneWidget);+ controller.clearComposing();+ await tester.tapAt(const Offset(30, 100));+ await tester.pump();+ expect(_results, findsNothing);+ await tester.pumpWidget(const SizedBox());+ projects.dispose();+ app.dispose();+ },+ );+}diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dartindex 79aa22139..3b643adee 100644--- a/desktop/test/swarm_interactions_test.dart+++ b/desktop/test/swarm_interactions_test.dart@@ -68,10 +68,15 @@ void main() {(tester) async {final app = createApp();await mount(tester, app);- await tester.tap(find.text('Search agents, swarms, machines, projects…'));+ await tester.tap(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ );await tester.pump();expect(app.panes, isEmpty);- await tester.enterText(find.byType(TextField), 'Agent 1');+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ 'Agent 1',+ );await tester.pump();await tester.sendKeyDownEvent(LogicalKeyboardKey.control);await tester.sendKeyEvent(LogicalKeyboardKey.keyN);diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dartindex d8bd57fbd..843c82fd1 100644--- a/desktop/test/swarm_screen_test.dart+++ b/desktop/test/swarm_screen_test.dart@@ -68,9 +68,14 @@ void main() {);await mount(tester, app);expect(find.text('Existing project'), findsOneWidget);- await tester.tap(find.text('Search agents, swarms, machines, projects…'));+ await tester.tap(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ );await tester.pump();- await tester.enterText(find.byType(TextField), '/work/existing');+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ '/work/existing',+ );await tester.pump();expect(find.text('Agent 0'), findsOneWidget);expect(find.text('Agent 1'), findsOneWidget);@@ -94,9 +99,14 @@ void main() {expect(find.text('Start a swarm'), findsOneWidget);expect(find.text('Models'), findsNothing);expect(find.text('Machines'), findsOneWidget);- await tester.tap(find.text('Search agents, swarms, machines, projects…'));+ await tester.tap(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ );await tester.pump();- await tester.enterText(find.byType(TextField), 'Agent 1');+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ 'Agent 1',+ );await tester.pump();expect(find.text('Agent 1').last, findsOneWidget);await tester.tap(find.text('Agent 1').last);diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dartindex 06a586612..e55e077e0 100644--- a/desktop/test/swarm_search_test.dart+++ b/desktop/test/swarm_search_test.dart@@ -5,6 +5,7 @@ import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/state/swarm_navigation.dart';+import 'package:harness/state/swarm_search.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:xterm/xterm.dart';@@ -158,42 +159,76 @@ void main() {},);- test('opening a group is explicit, uses a new swarm and opens only reviewed members', () async {- final app = createApp();- addTearDown(app.dispose);- final machine = app.machineStates['m']!;- machine.agents = machine.agents.take(2).toList();- final original = app.activeSwarm;- final group = SwarmSearchCatalog()- .read(app, [])- .singleWhere((e) => e.isMachine);- expect(- await activateSwarmSearchSelection(- app,- SwarmSearchSelection(group),- destinationSwarmId: original.id,- ),- isFalse,- );- expect(app.swarms, [original]);- machine.agents = [- ...machine.agents,- const Agent(id: 'late', name: 'Late arrival', terminalAvailable: true),- ];- expect(- await activateSwarmSearchSelection(- app,- SwarmSearchSelection(group, SwarmSearchAction.openGroup),- destinationSwarmId: original.id,- ),- isTrue,- );- expect(app.swarms.length, 2);- expect(original.panes, isEmpty);- expect(app.activeSwarm.name, 'Test host');- expect(app.panes.map((pane) => pane.agentId), ['a0', 'a1']);- expect(app.allPanes.any((pane) => pane.agentId == 'late'), isFalse);- });+ test(+ 'a machine result opens its agents in the empty swarm and reuses it',+ () async {+ final app = createApp();+ addTearDown(app.dispose);+ final machine = app.machineStates['m']!;+ machine.agents = machine.agents.take(2).toList();+ final original = app.activeSwarm;+ final search = SwarmSearchController(app, []);+ addTearDown(search.dispose);+ search.setQuery('Test host');+ final choice = search.submit();+ expect(choice?.destination.isMachine, isTrue);+ expect(SwarmSearchController.action(choice!.destination), 'Go to swarm');+ expect(+ await activateSwarmSearchSelection(+ app,+ choice,+ destinationSwarmId: original.id,+ ),+ isTrue,+ );+ expect(app.activeSwarm, same(original));+ expect(app.activeSwarm.name, 'Test host');+ expect(app.panes.map((pane) => pane.agentId), ['a0', 'a1']);+ final panes = [...app.panes];+ app.newSwarm();+ final empty = app.activeSwarm;+ expect(+ await activateSwarmSearchSelection(+ app,+ choice,+ destinationSwarmId: empty.id,+ ),+ isTrue,+ );+ expect(app.swarms.length, 2);+ expect(app.activeSwarm, same(original));+ expect(app.panes, panes);+ expect(empty.panes, isEmpty);+ },+ );++ test(+ 'opening a group from an occupied swarm keeps its work intact',+ () async {+ final app = createApp();+ addTearDown(app.dispose);+ final machine = app.machineStates['m']!;+ machine.agents = machine.agents.take(3).toList();+ await app.addAgentToSwarm('m', 'a2');+ final original = app.activeSwarm;+ final retained = app.panes.single;+ final group = SwarmSearchCatalog()+ .read(app, [])+ .singleWhere((e) => e.isMachine);+ expect(+ await activateSwarmSearchSelection(+ app,+ SwarmSearchSelection(group),+ destinationSwarmId: original.id,+ ),+ isTrue,+ );+ expect(app.swarms.length, 2);+ expect(original.panes, [retained]);+ expect(app.panes.map((pane) => pane.agentId).toSet(), {'a0', 'a1', 'a2'});+ expect(app.panes.contains(retained), isTrue);+ },+ );test('removed group members and oversized groups cannot create a partial swarm',@@ -207,7 +242,7 @@ void main() {expect(await activateSwarmSearchSelection(app,- SwarmSearchSelection(oversized, SwarmSearchAction.openGroup),+ SwarmSearchSelection(oversized),destinationSwarmId: app.activeSwarmId,),isFalse,@@ -220,7 +255,7 @@ void main() {expect(await activateSwarmSearchSelection(app,- SwarmSearchSelection(group, SwarmSearchAction.openGroup),+ SwarmSearchSelection(group),destinationSwarmId: app.activeSwarmId,),isFalse,@@ -230,41 +265,28 @@ void main() {},);- testWidgets(- 'browse, filter and return from a machine without opening any views',- (tester) async {- final app = createApp();- await mount(tester, app);- await tester.tap(find.byKey(const ValueKey('swarm-search-input')));- await tester.pump();- await tester.enterText(jumpField, 'Test host');- await tester.pump();- await tester.tap(find.byKey(const ValueKey('machine:m')));- await tester.pump();- expect(app.panes, isEmpty);- expect(app.swarms.length, 1);- final scopedField = find.byType(TextField);- expect(- tester.widget<TextField>(scopedField).focusNode!.hasFocus,- isTrue,- reason: 'Clicking a group must return the next key to its search field',- );- await tester.enterText(scopedField, 'Agent 19');- await tester.pump();- expect(find.widgetWithText(ListTile, 'Agent 19'), findsOneWidget);- expect(find.text('Agent 0'), findsNothing);- await tester.tap(find.byTooltip('All results'));- await tester.pump();- expect(tester.widget<TextField>(jumpField).controller!.text, 'Test host');- expect(tester.widget<TextField>(jumpField).focusNode!.hasFocus, isTrue);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump();- expect(app.panes, isEmpty);- expect(find.byType(Dialog), findsNothing);- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );+ testWidgets('clicking a machine result directly opens all agents', (+ tester,+ ) async {+ final app = createApp();+ app.machineStates['m']!.agents = app.machineStates['m']!.agents+ .take(3)+ .toList();+ await mount(tester, app);+ await tester.tap(find.byKey(const ValueKey('swarm-search-input')));+ await tester.pump();+ await tester.enterText(jumpField, 'Test host');+ await tester.pump();+ await tester.tap(find.byKey(const ValueKey('machine:m')));+ await tester.pump();+ expect(app.activeSwarm.name, 'Test host');+ expect(app.panes.map((pane) => pane.agentId), ['a0', 'a1', 'a2']);+ expect(app.swarms.length, 1);+ expect(find.byKey(const ValueKey('swarm-search-results')), findsNothing);+ expect(find.text('Browse agents'), findsNothing);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });testWidgets('the secondary action adds a shared view here and the first key reaches it',diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dartindex 4fc364ca1..58e3ff232 100644--- a/desktop/test/swarm_switcher_test.dart+++ b/desktop/test/swarm_switcher_test.dart@@ -15,6 +15,7 @@ import 'swarm_state_test.dart' show createApp;Finder get jumpField => find.byWidgetPredicate((w) =>w is TextField &&+ w.key == const ValueKey('swarm-search-input') &&w.decoration?.hintText == 'Search agents, swarms, machines, projects…',);Finder get selectedRow =>@@ -270,7 +271,7 @@ void main() {await tester.pump();await tester.pump();expect(tester.widget<ListTile>(selectedRow).key, ValueKey(selectedId));- expect(find.textContaining('Open agent in'), findsOneWidget);+ expect(find.textContaining('Opens 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.swiftindex 2ea497647..17cde575e 100644--- a/desktop/tool/swarm_titlebar_checks.swift+++ b/desktop/tool/swarm_titlebar_checks.swift@@ -295,7 +295,7 @@ private extension SwarmTitlebar {!["Next Swarm", "Previous Swarm"].contains($0.title)}, "Next and Previous Swarm have no redundant menu rows")let modelRows: [[String: Any]] = [- ["title": "Anthropic", "status": "12% remaining", "engine": "claude",+ ["title": "Anthropic", "account": "Account aabbcc", "status": "12% remaining", "engine": "claude","details": ["Limiting window: Session", "Session — 12% remaining · resets in 2h"]],["title": "OpenAI", "status": "Not signed in", "engine": "codex","details": ["Sign in to Codex to see usage"]],@@ -303,31 +303,41 @@ private extension SwarmTitlebar {updateModels(modelRows)let models = main.item(withTitle: "Models")!.submenu!try checkTitlebar(models.items.filter { !$0.isSeparatorItem }.map(\.title) == [- "Subscription", "Anthropic — 12% remaining", "OpenAI — Not signed in",- "API", "OpenRouter API", "fal.ai API", "Local", "Local models", "Add Model"+ "Subscription", "Anthropic, Account aabbcc, 12% remaining", "OpenAI, Not signed in",+ "API", "OpenRouter", "fal.ai", "Local", "DeepSeek V4 Flash", "Qwen3.8-27B", "Add Model"], "Models has the three requested sections and Add Model last")try checkTitlebar(models.items.filter(\.isSeparatorItem).count == 3,"Native separators distinguish the sections and future Add Model action")- for title in ["OpenRouter API", "fal.ai API", "Local models", "Add Model"] {+ for title in ["OpenRouter", "fal.ai", "DeepSeek V4 Flash", "Qwen3.8-27B", "Add Model"] {let item = models.item(withTitle: title)!try checkTitlebar(!item.isEnabled && item.action == nil && item.target == nil && item.submenu == nil,"\(title) is greyed out and cannot dispatch or open anything")}- let subscription = models.items.first(where: { $0.submenu != nil })!- try checkTitlebar(subscription.isEnabled && subscription.image?.isTemplate == false,- "Subscription rows have colored provider marks and accessible details")- try checkTitlebar(subscription.submenu?.items.last?.title == modelRows[0]["details"].flatMap { ($0 as? [String])?.last },- "The native submenu exposes the measured window and reset time")+ let subscription = models.items.first(where: { $0.view is SwarmSubscriptionView })!+ let row = subscription.view as! SwarmSubscriptionView+ try checkTitlebar(subscription.submenu == nil && subscription.action == nil && !subscription.isEnabled,+ "Subscription balances have no arrow or fake action")+ try checkTitlebar(row.identity.stringValue == "Anthropic Account aabbcc" && row.balance.stringValue == "12% remaining",+ "Provider and account are on the left; usage is a separate right column")+ try checkTitlebar(row.identity.frame.maxX + 24 <= row.balance.frame.minX && row.balance.frame.maxX == row.bounds.width - 18,+ "Account and balance have a clear gap and a consistent trailing inset")+ try checkTitlebar(row.identity.frame.midY == row.balance.frame.midY,+ "Both columns share a vertical center")+ try checkTitlebar(row.accessibilityLabel() == subscription.title,+ "VoiceOver can read the provider, account and remaining usage together")+ let secondRow = models.items.compactMap { $0.view as? SwarmSubscriptionView }.last!+ for view in [row, secondRow] {+ let cell = view.balance.cell!+ let drawing = cell.drawingRect(forBounds: view.balance.bounds)+ let glyphWidth = (view.balance.stringValue as NSString).size(withAttributes: [.font: view.balance.font!]).width+ try checkTitlebar(view.bounds.width >= 440 && drawing.width >= glyphWidth,+ "Remaining usage and sign-in status have enough actual text-cell width to display in full")+ }+ try checkTitlebar(secondRow.balance.frame.maxX == row.balance.frame.maxX,+ "Different balances align on their right edges")updateModels(modelRows)try checkTitlebar(models.items.contains(where: { $0 === subscription }),"Unchanged subscription data reuses native menu items")- actionsEnabled = false- updateModelsAvailability()- try checkTitlebar(!subscription.isEnabled, "Subscription details respect a covered workspace")- actionsEnabled = true- updateModelsAvailability()- try checkTitlebar(subscription.isEnabled && models.item(withTitle: "Add Model")?.isEnabled == false,- "Only implemented subscription details become available again")updateModels([])try checkTitlebar(models.items.allSatisfy { !$0.title.contains("12%") && $0.submenu == nil },"Signing out clears cached native account readings")@@ -370,6 +380,20 @@ let titlebarCheckApp = NSApplication.sharedtitlebarCheckApp.setActivationPolicy(.prohibited)titlebarCheckApp.appearance = NSAppearance(named: .darkAqua)do {+ let historyRow = SwarmHistoryEntry([+ "id": "agent", "title": "Build a toy", "machineName": "MacBook Pro M2", "engine": "codex",+ ])!+ let label = historyRow.menuTitle+ try checkTitlebar(label.string == "Build a toy\tMacBook Pro M2", "Agent and machine occupy separate native menu columns")+ let paragraph = label.attribute(.paragraphStyle, at: 0, effectiveRange: nil) as! NSParagraphStyle+ try checkTitlebar(paragraph.tabStops.count == 1 && paragraph.tabStops[0].alignment == .right && paragraph.tabStops[0].location == 660,+ "Machine labels share a right-aligned column")+ let longRow = SwarmHistoryEntry(["id": "long", "title": String(repeating: "Long title ", count: 100), "machineName": "Mac"])!+ try checkTitlebar(longRow.menuTitle.string.contains("…\tMac"), "Long titles truncate before the machine column")+ let swarmRow = SwarmHistoryEntry(["id": "swarm", "title": "My swarm", "swarm": true])!+ try checkTitlebar(swarmRow.menuTitle.string == "My swarm", "Empty swarm rows have no invented machine label")+ let sharedSwarm = SwarmHistoryEntry(["id": "shared", "title": "Workshop", "swarm": true, "machineName": "2 machines"])!+ try checkTitlebar(sharedSwarm.menuTitle.string == "Workshop\t2 machines", "Swarm machine counts use the same trailing column as agent machines")var assetReads = 0let icons = SwarmHistoryIcons(assetURL: { asset inassetReads += 1diff --git a/docs/harness-v2-developer-tools-research.md b/docs/harness-v2-developer-tools-research.mdindex e36ffb825..872633f0e 100644--- a/docs/harness-v2-developer-tools-research.md+++ b/docs/harness-v2-developer-tools-research.md@@ -2,13 +2,13 @@Research and source audit: 2026-09-12. Recommendation for the existing `app-v2` build.-Harness should make three things excellent: **keep work alive, reach any work instantly, and steer agents without losing concentration.** A developer should be able to spend a whole day here, using their existing agents, shell, editor and commands.+Harness should make three things excellent: **keep work alive, reach any work instantly, and steer agents without losing concentration.** A developer should be able to spend a whole day here directing their existing agents.This is a qualitative sample of firsthand accounts and tool authors' documentation, not a survey of all exceptional developers. “World-class” has no objective tool list. Publication dates matter: several authors have changed their workflows. Product documentation establishes advertised behavior; it does not independently establish performance, reliability or developer affection.## Current implementation queue-Updated 2026-09-13. This is the working list; [the progress log](harness-v2-progress.md) records checks and remaining gaps.+Updated 2026-09-13 after user review. Keep the existing simple Command shortcuts: H/J/K/L and arrows for movement, S for layout, B for Boss mode. The modifier-heavy proposal and general-purpose-terminal assumption are withdrawn. This is the working list; [the progress log](harness-v2-progress.md) records checks and remaining gaps.| Status | Work || --- | --- |@@ -18,13 +18,29 @@ Updated 2026-09-13. This is the working list; [the progress log](harness-v2-prog| Rebuilt; native menu reviewed live | Models replaces Swarm; Subscription shows existing account limits, while API, Local and Add Model are disabled placeholders. History uses provider icons and restores both closed agents and closed Swarms. Recovery is covered with isolated sessions; live agents were not closed to test it. || Rebuilt and reviewed live | Chrome-style Back/Forward, Recently Closed/Visited and full session History; compact branch-aware headers; Workshop includes its requested iMac Home agent. || In the rebuilt preview; regression verified | Preserve the session, terminal view, Find, viewport, selection and draft context through reconnect/keyframe replacement. Stale output/input/upload completions cannot affect the replacement stream. A real remote interruption remains to be validated. |-| Rebuilt; live search/project review passed | One top-right Cmd-P search for agents, Swarms, machines and projects, with Focus/Open and explicit Add here actions; machine/project browsing and explicit group opening. Separate Add picker, floating pane + and titlebar bell removed. New swarm uses only the selected mountain/lake wallpaper; rotation and other assets removed. Native typing, Cmd-P select-all and Escape were verified from an existing empty New swarm after the focus correction. |+| Rebuilt; live search/project review passed | One top-right Cmd-P search for agents, Swarms, machines and projects, with Open and explicit Add here actions. Follow-up in validation: New swarm searches in place, and machine/project results open their swarm directly. Separate Add picker, floating pane + and titlebar bell removed. New swarm uses only the selected mountain/lake wallpaper; rotation and other assets removed. Native typing, Cmd-P select-all and Escape were verified from an existing empty New swarm after the focus correction. || Implemented; measured in isolation | Unified search construction and ranking avoid repeated scans/metadata work. Median catalog construction fell 50% in the 2,059-destination debug fixture; native input-to-display measurement remains separate. |-| In progress | [Audit all shortcuts and implement a coherent terminal-friendly key system with file-first remapping](harness-v2-keyboard-system.md). Config parser/resolver and live reload core pass isolated tests. Apart from the unified search change, new defaults remain proposed until dispatch, native menus and help are integrated and verified. |+| In progress | [Audit all shortcuts and implement a coherent terminal-friendly key system with file-first remapping](harness-v2-keyboard-system.md). Config parser/resolver and live reload core pass isolated tests. Revise the unused draft catalog and integrate runtime dispatch, native menus and help while retaining the user-approved existing defaults. Remapping is not yet enabled. || Calibration in progress; foreground runs paused | Native Release input/navigation fixture with synthetic terminals. No validated latency result yet; resume after the keyboard work stabilizes. Live keyboard/tab/drag and real remote interruption checks remain. |-| Next small addition | Optional cached preview and match highlighting in the existing Cmd+P picker. [The six-prototype review](harness-v2-prototype-review.md) records what to borrow and what stays out. |+| Approved; queued | Manual splits/resizing, optional cached search preview, and `>` commands in search. The user accepted these after reviewing primary-source precedents; no permanent clutter or slowing the fast path. Match highlighting is the smaller search refinement. [The six-prototype review](harness-v2-prototype-review.md) records what to borrow and what stays out. || Keep deferred | Workflow canvases, autonomous manager layers, a full IDE/Git client and a marketplace. |+## Remaining ideas for review++No additional product confirmation blocks the approved milestone. These are the remaining research ideas, with a recommendation to **defer all five**:++| Idea | Why defer |+| --- | --- |+| Open an agent's changes in an external editor/diff tool | Useful later; first establish accurate checkout/change context across machines. |+| Jump between prompts, answers, errors and changes | Requires reliable agent markers; guessing from text would make navigation unpredictable. |+| Swarm CLI/API for scripts | Stabilize the app's operations first, then expose those same operations through the existing CLI. |+| Structured agent-to-agent handoff | Improve the existing Boss mode before adding another coordination workflow. |+| Visual shortcut editor | Deliver the approved file config first; a later editor should edit that same file. |++API/local-model connections and Add Model remain disabled by explicit user instruction. The dashboard, permanent shelf/sidebar, workflow canvas, manager layers and marketplace stay out. Usage ledger and hardware features remain available away from the main work loop; this is not a proposal to delete them.++Newly authorized follow-ups: consistent Models account IDs and complete status labels; swarm machine context in History; one four-pane swarm icon; readable search actions without repeated row labels; research terminal palette selection and add a small coordinated Appearance palette chooser.+## What people actually describe using| Developer / primary evidence | Tools and behavior in the account | What Harness can learn |@@ -71,7 +87,7 @@ The opportunity for Harness is to make movement among real agents across real ma| **Implemented; verify in daily use** | **Needs input** replaces the notifications list; `Cmd+Shift+I` opens it | Search live questions and agent/project/machine context; jump without changing ownership or chosen membership. `Cmd+P`, Return goes back to prior work. Resolved/replaced questions cannot trigger stale navigation. Unavailable terminals remain explicit. Opens on request with no fade, blur or polling. || **Implemented; verify in daily use** | Terminal Find with `Cmd+F`, `Cmd+G` and `Cmd+Shift+G` | Search retained output and move between literal matches without sending input. Escape restores the previous scroll position and prompt focus. The compact field uses the existing header, then disappears. These familiar bindings are documented by [Apple Terminal](https://support.apple.com/en-euro/guide/terminal/trmlshtcts/mac) and [Chrome](https://support.google.com/chrome/answer/157179?co=GENIE.Platform%3DDesktop&hl=en). Retained offline panes now remain searchable; never-attached panes retain setup guidance. || **Removed blocking chrome** | Full-pane frozen and reconnect overlays | Read-only status and explicit Reconnect/Take control actions live in the header. Retained output, selection, search and unsent composer text survive unavailable-machine presentation. Ordinary tab navigation never retries a dead stream. |-| **Preserve compatibility** | Real agent terminals and user shell environments | Verify selection, multiline/image paste, scrollback, nested tmux/Vim and escape/control keys. Before promising a full terminal replacement, verify a straightforward ordinary-shell workflow too; the current New agent UI centers on detected agent engines. |+| **Preserve input correctness** | Real agent CLIs | Verify selection, multiline/image paste, scrollback and composition in Claude Code, Codex and other supported agents. Ordinary-shell creation and nested editor compatibility are outside this milestone. || **Remove from active work — implemented** | Wallpaper behind populated Swarms | Use `#463746`, matching the selected native tab. Wallpaper fills only an empty New swarm canvas and its decoded cache entry is evicted when that view is disposed. || **In the rebuilt preview** | Chrome-style History, Models menu and Settings in the app menu | Settings stays in the macOS app menu with `Cmd+,`. File groups creation, linking, renaming, closing and Reopen Last Closed. History includes closed agents and Swarms, with provider icons for agents. Cmd+P lives in Edit, Needs Input in View. Models has live Subscription usage and explicitly disabled API/Local/Add Model placeholders. Lists are bounded and session-local. The non-macOS toolbar retains Settings access. || **In the rebuilt preview** | Wallpaper rotation and repeated metadata removed | The selected mountain/lake image is the only wallpaper; rotation button, menu actions and other assets are removed. Headers show one agent title, available branch, machine and controls. Repeated project-name text is removed; full folder/branch context remains on demand. Narrow panes use a machine icon with its full-name tooltip. |@@ -90,9 +106,9 @@ Chrome is the user's primary interaction reference. Chromium's [menu definition]## Reductions and prototype follow-up-[The prototype review](harness-v2-prototype-review.md) covers all six variants in `harness-new-ui` at `19ced37`. Keep the terminal canvas and chosen Swarms; borrow optional contextual preview, explicit splits and exact return selectively. Leave out V3's primary/supporting hierarchy, persistent shelf, extra status/footer/context rows, model dashboard, and V4's default replacement of the active pane. Do not copy its Ctrl+B prefix over a real tmux session.+[The prototype review](harness-v2-prototype-review.md) covers all six variants in `harness-new-ui` at `19ced37`. Keep the terminal canvas and chosen Swarms; borrow optional contextual preview, explicit splits and exact return selectively. Leave out V3's primary/supporting hierarchy, persistent shelf, extra status/footer/context rows, model dashboard, and V4's default replacement of the active pane. Use the current easy Command prefix instead of copying Ctrl+B.-The fzf follow-up is one improvement to Cmd+P: match highlights, a bounded preview of already-retained context, and precise filters where names are ambiguous. It must perform no network work or terminal attachment while navigating results. Ordinary-shell creation, remappable keys/passthrough, editor/diff handoff, and structured prompt/output navigation remain important gaps to verify. They are not all new features to build at once; reliability and measured interaction performance come first.+The fzf follow-up is one improvement to Cmd+P: match highlights, a bounded preview of already-retained context, and precise filters where names are ambiguous. It must perform no network work or terminal attachment while navigating results. Remappable keys remain authorized work. Editor/diff handoff and structured prompt/output navigation are parked research ideas; ordinary-shell creation is outside the current product direction. They are not all new features to build at once; reliability and measured interaction performance come first.## The next small product milestonediff --git a/docs/harness-v2-keyboard-system.md b/docs/harness-v2-keyboard-system.mdindex 2a25edc2a..f7fdd9003 100644--- a/docs/harness-v2-keyboard-system.md+++ b/docs/harness-v2-keyboard-system.md@@ -1,77 +1,59 @@# A coherent keyboard system for Harness-Research and complete default-binding audit: 2026-09-13. **Most defaults and file remapping below remain an implementation plan.** The current search change consolidates the old Cmd-P and Cmd-Shift-F experiences under Cmd-P, with an explicit Add action inside the picker. The parser/resolver and file reload core have isolated tests but are not connected to production dispatch yet. The [working queue](harness-v2-developer-tools-research.md) remains the status list.--## Principles from the tools--There is no universal expert keymap. These tools disagree about particular combinations; their useful common ground is stable commands, predictable scope, configurable bindings, and preserving the program inside the terminal.--| Primary source | Relevant behavior | Harness decision |-| --- | --- | --- |-| [Vim window commands](https://github.com/vim/vim/blob/master/runtime/doc/windows.txt) | Ctrl-W introduces window commands; h/j/k/l focus directions, while capitals move windows to edges. | Preserve these bytes inside Vim. Make focus and rearrangement distinct commands. A shifted Harness movement binding is an analogy, not identical Vim layout semantics. |-| [GNU Emacs reference](https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf) | Control and Meta are used extensively; Ctrl-X introduces commands, Ctrl-N/P move by line, and Ctrl-G cancels. | Preserve terminal Control/Meta input. Borrow Ctrl-N/P and Ctrl-G only inside Harness-owned pickers. |-| [tmux getting started](https://github.com/tmux/tmux/wiki/Getting-Started) | Prefix commands operate on persistent sessions, windows and panes. The default Ctrl-B prefix includes navigation, splitting, zoom, last-pane and command selection. | Keep the session/view distinction and reversible navigation. Do not intercept the inner tmux prefix by default. |-| [Zsh line editor](https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html) | Explicit keymaps support Emacs and vi editing, and bindkey customizes widgets and sequences. | Respect the user's shell keymap; do not try to infer or replace its editing mode. |-| [fzf shell integration](https://github.com/junegunn/fzf#key-bindings-for-command-line) and [binding defaults](https://github.com/junegunn/fzf/blob/master/man/man1/fzf.1) | Incremental narrowing, configurable actions, arrow/Ctrl-N/P navigation and cancellation. Shell integration uses Ctrl-R, Ctrl-T and Alt-C. | Keep these shell keys available. Use one picker and shared picker navigation; plain letters continue entering the query. |-| [VS Code shortcuts](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf) and [configuration](https://code.visualstudio.com/docs/configure/keybindings) | Quick Open is Cmd-P; commands are Cmd-Shift-P. Bindings have command identities, optional contexts, overrides and sequences. JSON and the visual editor configure the same system. | Keep Quick Open, add a small command mode backed by the existing actions, and make a text file the first customization interface. |-| [iTerm2 split panes](https://iterm2.com/documentation-one-page.html#split-panes) and [Ghostty actions](https://ghostty.org/docs/config/keybind/reference) | Directional split focus, reversible pane zoom and explicit split creation are first-class terminal operations. iTerm2 uses Cmd-Option-arrows for focus and Cmd-Shift-Enter for pane zoom. | Use that focus/zoom family. Reserve Cmd-D / Cmd-Shift-D for explicit splits when the layout feature exists. |-| [kitty configuration](https://sw.kovidgoyal.net/kitty/conf/#keyboard-shortcuts) | Tabs, inner windows, command navigation and configurable key mappings are separate concepts. Its defaults demonstrate that even terminal apps disagree on numeric navigation. | Choose and document Harness's object model consistently instead of mixing each app's defaults. |-| [Chrome shortcuts](https://support.google.com/chrome/answer/157179?hl=en) and [Mac conventions](https://support.apple.com/en-us/102650) | Familiar tab lifecycle, tab selection, back/forward, Find, and standard app commands. | Swarms are tabs. Keep that lifecycle familiar and restore standard Mac commands that current Harness bindings displaced. |--These references establish behavior, not a claim that every developer uses or prefers it. Control/Meta compatibility still needs exact input tests and native checks, including IME and modified-key encoding.--## Audit and proposed defaults--The current source is `desktop/lib/shortcuts/app_shortcuts.dart`, the Swarm screen's handlers, native menus in `SwarmTitlebar.swift` and `MainMenu.xib`, the terminal's handlers and the picker implementations. The legacy workspace and debug-only bindings were reviewed too.--The proposed macOS family is **Command for Swarms and common app actions; Command-Option for individual panes**. Shift reverses traversal or modifies a related action where that is already familiar. Terminal applications keep Control/Meta, ordinary keys, Escape and Tab by default. The app owns navigation keys inside its own picker.--| Action | Current binding | Proposed decision |-| --- | --- | --- |-| Quick Open / jump | Cmd-P | Keep. Return focuses an existing destination or explicitly opens an unviewed agent. |-| Add an existing agent here | Cmd-Shift-F, separate picker | Consolidated into Cmd-P by the user's latest decision. Return focuses an existing pane or opens its first view here. A visible Add to this swarm action (Cmd-Enter inside the picker) adds a shared view here. No separate default launcher, including Cmd-O. |-| Search app commands | None; Cmd-Shift-P pins | Cmd-Shift-P, reusing the picker with command mode. |-| New agent | Cmd-N; menu omits its shortcut | Keep and make menu/help agree. |-| New / close / reopen Swarm | Cmd-T / Cmd-W / Cmd-Shift-T | Keep. Closing a view does not end an agent. |-| Next / previous Swarm | Cmd-Shift-] / Cmd-Shift-[, plus Ctrl-Tab pair | Keep Command brackets; release the Control pair to terminal programs by default. Users can assign it explicitly. |-| Direct numeric selection | Cmd-1…9 focuses panes | Cmd-1…8 selects Swarm tabs; Cmd-9 selects the last tab. Cmd-Option-1…9 focuses pane positions. This is a deliberate default change to match the tab object model. |-| Back / forward | Cmd-[ / Cmd-] | Keep navigation history. |-| Full session history | Cmd-Y | Keep. |-| Directional pane focus | Cmd-arrows and Cmd-h/j/k/l | Cmd-Option-arrows. Vim-style letters are user mappings; Cmd-Option-H itself conflicts with native Hide Others and is not a safe default alias. |-| Rearrange pane | Cmd-Shift-arrows and Cmd-Shift-h/j/k/l | Cmd-Option-Shift-arrows, with distinct command IDs. |-| Zoom pane / restore | Cmd-Enter | Cmd-Shift-Enter, following established terminal apps. |-| Close pane view | Cmd-Shift-W | Cmd-Option-W. Keep normal window closing separate. |-| Last pane | Cmd-; | Retain as a searchable command. Quick Open / Return and history already support the common return loop. |-| Pin pane | Cmd-Shift-P | Retain as a searchable/context command; release Command Palette's familiar shortcut. |-| Choose layout | Cmd-S | Retain in View/commands; release Save's familiar shortcut. |-| Rename Swarm | Cmd-Shift-R | Retain in tab context menu and commands; avoid a surprising use of the reload family. |-| Needs input | Cmd-Shift-I | Keep: I identifies input, and this is an agent-specific action. |-| Find / next / previous | Cmd-F / Cmd-G / Cmd-Shift-G | Keep in the current terminal. |-| Refresh machines/agents | Cmd-R | Keep with an accurate label and explicit semantics; never reinterpret Ctrl-R history search. |-| Task routing | Cmd-B | Remove its default binding. Existing explicit/hardware entry points are a separate capability decision. |-| Settings / shortcuts help | Cmd-, / Cmd-/ | Keep and show effective configured bindings. |-| Debug inspector | Cmd-D in developer builds | Use a secondary inspector command; release split creation's familiar key. |-| Legacy sidebar toggle | Cmd-backslash, absent from Swarms | Keep absent from the active Swarm keymap. |-| Copy / paste / select all / undo / redo | Standard Mac keys through native/Flutter owners | Preserve. Audit actual event ownership, not just labels; native menu equivalents must not swallow the terminal's action. |-| Hide / Hide Others / minimize / quit / full screen | Hide's Cmd-H removed; other native defaults present | Restore Cmd-H. Preserve native app/window conventions and avoid assigning the same chord elsewhere. |-| Picker movement / acceptance / cancellation | Arrows, Ctrl-N/P, Return, Escape | The unified picker also accepts Ctrl-J/K and Ctrl-G. Return browses a machine/project or activates a destination; group opening is an explicit button. A composing-text guard has an isolated check; native IME behavior still needs validation. No global plain-letter Vim navigation in a search field. |--Do not advertise unimplemented splitting, global transcript search, terminal scrolling, or arbitrary remapping as working. Freeing a key does not by itself implement its expected action.+Updated 2026-09-13 after the user's review. **The earlier proposed modifier-heavy defaults are withdrawn.** The user explicitly chose to retain Cmd-H/J/K/L and Cmd-arrows for pane movement, Cmd-S for layout, Cmd-R for refresh, and Cmd-B for Boss mode. Cmd-L stays move right. File remapping is not enabled in the running preview yet.-## File-first customization+## Product contract++Harness is a workspace for directing agents such as Claude Code and Codex. The research should borrow effective interaction patterns from developer tools and adapt them to this workflow. It must not turn Harness into a general-purpose terminal or optimize its defaults around hypothetical nested Vim/Emacs/tmux sessions.++Command is the easy Harness prefix: one modifier plus a key for frequent actions. Preserve existing effective bindings. Additional modifiers are appropriate only for less frequent related variants, such as rearranging rather than focusing a pane. Do not impose three-key combinations on frequent navigation just because another application uses them.++Keep ordinary typing and editing predictable inside the actual agent CLI, search field, or dialog. This is input correctness, not a requirement to support a new shell or editor product. Composition must finish without accidentally submitting a search result or moving to another agent.++## Decisions now agreed++| Action | Decision |+| --- | --- |+| Focus adjacent pane | Keep Cmd-H/J/K/L and Cmd-arrows. |+| Layout | Keep Cmd-S. The user explicitly resolved the Cmd-L conflict in favor of the complete H/J/K/L family. |+| Refresh machines/agents | Keep Cmd-R. The user considered using it for relayout and chose to preserve refresh. |+| Boss mode / task routing | Keep Cmd-B. |+| Search and open agents/swarms | Keep Cmd-P and the same direct-open behavior in both search fields. |+| Machine/project search result | Open its swarm directly; no intermediate Browse agents step. |+| Other existing shortcuts | Preserve until a concrete problem justifies a reviewed change. Do not silently switch Cmd-number navigation, zoom, tab traversal, or closing to the earlier proposed alternatives. |+| File customization | One commented config file with reload; menus, help and dispatch must agree. |+| Commands in search | Approved: optional `>` mode for existing actions. Preserve existing defaults, including Cmd-Shift-P for pin; no new conflicting command shortcut. |-Use one declarative, versioned text configuration, with sensible defaults inherited automatically. Proposed location: `$XDG_CONFIG_HOME/harness/keybindings.jsonc`, defaulting to `~/.config/harness/keybindings.jsonc`. Keep it separate from credentials and session state. JSON with comments follows the editor workflow without introducing an executable configuration language.+The previous full default-binding audit is preserved in Git history. Its evidence is useful, but its proposed defaults do not override these decisions.++## What the research contributes++| Primary source | Useful interaction pattern for Harness |+| --- | --- |+| [Vim window commands](https://github.com/vim/vim/blob/master/runtime/doc/windows.txt) | Spatial H/J/K/L movement and a clear distinction between focusing and rearranging. Keep the user's simpler Command prefix. |+| [tmux](https://github.com/tmux/tmux/wiki/Getting-Started) | Stable sessions, predictable pane navigation, last-pane return and zoom. Borrow the operations, not the cumbersome Ctrl-B prefix. |+| [GNU Emacs](https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf) | Consistent command families, configurable bindings, and immediate cancellation. |+| [Zsh line editor](https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html) | Named actions and explicit configuration rather than guessing a user's editing mode. |+| [fzf bindings](https://github.com/junegunn/fzf/blob/master/man/man1/fzf.1) | Incremental narrowing, clear selection, configurable actions and an optional preview when it helps identification. |+| [VS Code configuration](https://code.visualstudio.com/docs/configure/keybindings) | Stable command IDs, overrides, unbinding, contexts, and a file that a future visual editor can also edit. |+| [iTerm2](https://iterm2.com/documentation-one-page.html#split-panes) and [Ghostty](https://ghostty.org/docs/config/keybind/reference) | Direct pane control and reversible zoom. Their particular modifier combinations are not automatically appropriate for Harness. |+| [kitty configuration](https://sw.kovidgoyal.net/kitty/conf/#keyboard-shortcuts) | Customizable command mappings with a clear distinction between tabs and panes. |+| [Chrome shortcuts](https://support.google.com/chrome/answer/157179?hl=en) | Familiar tab lifecycle, History and Find where those behaviors fit the agent workspace. |++These sources document tool behavior; they do not establish one universal expert keymap. The user's actual workflow and daily-use evidence govern the choices.++## File-first customization-The app provides **Open Keyboard Config…**, effective bindings in help and menus, and automatic reload. A full visual keybinding editor is deferred; any future editor should modify the same file. Reading a missing config uses defaults and does not create files. Opening the config explicitly can create a small commented template.+Location: `$XDG_CONFIG_HOME/harness/keybindings.jsonc`, defaulting to `~/.config/harness/keybindings.jsonc`. Use declarative JSON with comments, inherited defaults, stable command IDs, individual overrides, explicit unbinding, contexts and optional user-defined sequences. No executable configuration language is needed.-The engine needs stable command IDs; aliases for modifier/key names; individual overrides; explicit unbinding; scoped bindings; and user-defined sequences. It should validate unknown commands, malformed keys, duplicate/ambiguous prefixes and conflicting native owners. Invalid reloads retain the last good map and report a useful error. Watch the containing directory so editor atomic-save replacement is supported, with bounded reload work and no polling per keystroke.+Opening Keyboard Config can create a commented template; simply starting the app with no config should create nothing. Automatic reload must tolerate atomic editor saves. An invalid edit keeps the last good bindings and shows a useful error. A full visual editor is deferred; it should edit this same file if later needed.-Resolve bindings when config or context changes. Ordinary input should perform a bounded lookup, with no disk, network or parsing work. Sequence handling must be explicit and cancelable; never introduce a delay to disambiguate a default single-key command, or replay an unsuccessful prefix into a real agent. Unbinding restores the normal terminal/platform route; what bytes a modified key can represent depends on the terminal protocol.+Parse and resolve when configuration changes, never on each keystroke. A lookup must perform no disk or network work. Sequences must be cancelable and must not replay a failed prefix as a message to an agent. Default frequent actions need no prefix timeout.-## Implementation and verification order+## Implementation status and next steps-1. Build the command/config model, parser, validation and temporary-file reload tests. Keep current production defaults intact until dispatch and menu integration are ready.-2. Apply the coherent defaults and integrate one runtime resolver with native menus, the command/agent picker, help, tooltips and focused-terminal dispatch. Handle app, terminal and picker context explicitly.-3. Verify Control/Meta passthrough, exact key destinations, custom bindings, unbinding, sequences, modal/IME behavior and reload during active use with isolated sessions. Check all native menu equivalents against the same resolved definitions.-4. Rebuild/relaunch the authorized V2 preview, review the menus/help and navigation without typing tests into real agents, and publish the reviewed `app-v2` changes.-5. Resume native performance measurement after the keyboard work stabilizes. The isolated benchmark is currently calibration work, not a validated performance result. Foreground measurement is paused while the user is actively discussing the key system.+1. **Built and tested in isolation:** parser, resolver, validation, overrides/unbinding, sequences and file reload core. These are not yet connected to production dispatch.+2. **Needs revision:** the unused draft command catalog still contains the withdrawn defaults. Reconcile it with the current `app_shortcuts.dart` bindings before enabling it. The preserved runtime integration patch also needs rebasing onto the two search fields and direct group opening.+3. **Next implementation:** one runtime binding system for the agent workspace, search, native menus, help and tooltips, retaining the agreed defaults above. Audit native owners for conflicts with those defaults instead of assuming system conventions win.+4. **Validation:** exact action and focus destinations, custom remaps, unbinding, repeated movement, sequences, cancellation, modal/IME behavior, and live config reload in isolated agent fixtures. Do not type tests into real agents.+5. **Delivery:** rebuild and inspect the preview only after integration passes. The broader [working queue](harness-v2-developer-tools-research.md) tracks product proposals separately from authorized fixes.diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.mdindex 535812430..ccd74f7c6 100644--- a/docs/harness-v2-progress.md+++ b/docs/harness-v2-progress.md@@ -2,7 +2,21 @@Updated 2026-09-13 with Models, combined closed-work History and faster unified search. This is a working preview, not a release.-## Current continuation: Models, closed agents and search performance+## Active follow-up: in-place New swarm search and account-based Models++- Latest corrections rebuilt: Models has a 440-point minimum width and measured native text-cell insets so status strings fit in full. Swarm History rows show the sole machine name or the distinct machine count; empty swarms have no invented machine. Offline agents count and setup-only panes do not. Both Flutter search surfaces/full History and native History use the four-pane `square.split.2x2` icon. Search result rows no longer repeat actions; the footer uses readable light text and Go to agent/Go to swarm.+- Latest checks: **37 focused Flutter tests and 291 AppKit checks passed**, followed by a successful Release build (`/private/tmp/harness-v2-menu-consistency-{tests,native,build}.log`). A synthetic search render passed and was visually inspected (`/private/tmp/harness-v2-search-consistency.png`). Its headless font fallback/disabled-shadow artifacts are not the native app rendering. Normally quit PID 31652 and launched one rebuilt preview, **PID 43778** at last check. Live Models accessibility confirms consistent account IDs and complete status strings. Menu capture falls back to the main window, so do not claim a live menu screenshot. The current four saved tabs (Today, autonomous-workshop, iMac -Home, New swarm) were retained; no real-agent input was sent.+- The user is going to bed for eight hours and explicitly authorizes autonomous product decisions without waiting for further approval. Continue all agreed work, then further focused research adapted to agent workflows. New priorities: coordinated palette choice in Appearance and first-run onboarding that reaches a useful agent quickly. Preserve the explicit simple-key decisions and disabled Models placeholders.++- New user direction: typing in the New swarm field must stay there, with results attached beneath it. Both search surfaces share ranking/actions. Selecting a machine/project directly opens its swarm with all selected-result members; no intermediate Browse agents screen. Reuse a matching open swarm or the empty target tab, preserve existing shared sessions, and refuse oversized or removed memberships without a partial swarm.+- Implemented `SwarmInlineSearch` with its own editable field/caret, layout-following overlay, cached search controller, shared result rows/keys, cancellation and IME guard. Removed the scoped/browse step from Flutter and native search commands. Result copy now says Open agent/Open swarm.+- Models follow-up: subscription rows show provider/account on the left and remaining allowance on the right, with no submenu or action. After the user requested consistency, every identified account uses the same short fingerprint (`Account aabbcc`); the unused email-reading additions were removed. Known accounts still deduplicate across machines. API placeholders are OpenRouter and fal.ai; Local placeholders are DeepSeek V4 Flash and Qwen3.8-27B; all remain disabled, as does Add Model.+- Verification so far: 1,114 full Flutter tests pass with one existing skip; analyzer has no errors/warnings (12 existing vendored infos); 288 native AppKit checks pass including hidden-window layout. Added direct-open/reuse tests, in-place geometry/cancellation/IME/native-field isolation tests, exact first-key agent focus tests, and display-identity tests. Logs: `/private/tmp/harness-v2-inline-models-{full-tests,analyze}.log`, `/private/tmp/harness-v2-inline-behavior-tests.log`, `/private/tmp/harness-v2-account-menu-native.log`. **Release rebuilt successfully** (`/private/tmp/harness-v2-inline-models-build.log`). Normally quit PID 511 and launched one preview, PID 31652 at last check. Live CUA visually verified an actual caret and results directly beneath the New swarm field, with the native titlebar field inactive. A query-entry attempt and temporary-tab cleanup attempt were declined by the CUA stale-state guard while the user changed workspaces; no query was sent. Live interaction was paused. One empty New swarm opened for review may still be present; re-observe before any cleanup, and never remove it if the user has added work. The user’s current layout differs from earlier snapshots and must be preserved. Models layout/alignment is verified by AppKit checks, not yet by a live menu screenshot.+- Concurrent changes from another user session are present in `app_state.dart`, `swarm_state_test.dart`, History serialization in `swarm_screen.dart`, History title layout/icon resolution in `SwarmTitlebar.swift`, and corresponding History/native tests. Preserve that work and stage this batch selectively; do not claim those edits as this session's implementation.+- **Keyboard correction is authoritative:** retain Cmd-H/J/K/L and Cmd-arrows for focus, Cmd-S for layout, Cmd-R for refresh, Cmd-B for Boss mode. The user explicitly rejected modifier-heavy navigation and a general-purpose-terminal product assumption. Rewrite the unused draft catalog before enabling remapping. The runtime patch was saved and removed from the working tree before this search follow-up: `/private/tmp/harness-v2-keyboard-wiring-before-inline-search.patch`. Do not apply it blindly: both search surfaces and the agreed defaults have changed.+- [The revised keyboard plan](harness-v2-keyboard-system.md) and [prototype evidence](harness-v2-prototype-review.md) are current. Manual splits/resizing, optional lightweight search preview and commands in search are now explicitly approved; editor/diff handoff, structured output navigation and automation API are parked. The user is still actively reviewing product decisions; do not assume they are asleep.++## Previous batch: Models, closed agents and search performance- **Latest scope:** the user authorized replacing the redundant Swarm menu with Models. Models has Subscription, API and Local sections, then Add Model. Subsequent instructions explicitly make **API, Local and Add Model disabled placeholders**. No provider connection, key entry, local discovery, download or benchmark runs from those placeholders.- Subscription reads the existing Claude/OpenAI usage sources and grouped remote accounts on demand. A native cached menu opens immediately; requests coalesce and are limited to one refresh per minute, with no startup or background polling. Rows show remaining allowance for the most constrained reported window, with individual windows/reset times in a native submenu. Unknown, failed, expired and non-finite readings never become invented percentages. Distinct remote accounts retain machine context; account identifiers/credentials are not sent to AppKit.@@ -309,10 +323,10 @@ Earlier logs contain superseded failures. Temporary logs and toolchains are loca1. Measure native terminal input and tab-switch responsiveness under output load, including p50/p95/p99 and cold/warm paths. Live Cmd+P destination focus/quick return, branch headers, project associations, New swarm cleanup and native History are verified. Keep typing/transport measurements in disposable fixtures; the user's real agent terminals are not test inputs.2. Audit native drag/reorder, overflow, close-last-tab, renaming and accessibility without changing the user's saved agent memberships. Keep any integration runner separate and out of the foreground review app.-3. Verify real remote reconnect, nested tmux/Vim, paste, selection and IME against disposable local/remote processes. The AppNotifier/keyframe and stale completion regressions now pass; they do not prove every network or native editing condition. Preserve immediate first-input flush and shared retained renderers.+3. Verify real remote reconnect, agent input, paste, selection and IME against disposable local/remote processes. The AppNotifier/keyframe and stale completion regressions now pass; they do not prove every network or native editing condition. Preserve immediate first-input flush and shared retained renderers.4. Visually confirm app-menu modal behavior and overflow accessibility in AppKit; route/shortcut behavior is covered by passing Flutter tests.5. Build/review Linux and Windows when their toolchains are available. Remote full project/branch metadata requires daemons running the new wire format; do not upgrade them automatically.-6. Follow the bounded prototype recommendation: optional retained-context preview/highlights in Cmd+P, then deliberate right/down splits with compatible layout persistence. Verify ordinary-shell creation, remappable keys and prefix passthrough before promising a complete terminal replacement. Keep the rejected shelf/hierarchy/dashboard/manager surfaces absent.+6. Follow the bounded prototype recommendation: optional retained-context preview/highlights in Cmd+P, then deliberate right/down splits with compatible layout persistence. Integrate remappable keys and existing-command search; ordinary-shell creation is outside the current agent-workspace scope. Keep the rejected shelf/hierarchy/dashboard/manager surfaces absent.7. Audit local Git watch failure/removal and relocated-worktree invalidation before broadening that compatibility path. It deliberately reads a small subset of Git metadata; prefer richer daemon metadata as available. Continue the active goal using the current research status list, distinguishing shipped reductions from proposed follow-ups.## Toolchain and workflowdiff --git a/docs/harness-v2-prototype-review.md b/docs/harness-v2-prototype-review.mdindex 7fe88ed8c..9cefc93d3 100644--- a/docs/harness-v2-prototype-review.md+++ b/docs/harness-v2-prototype-review.md@@ -2,6 +2,8 @@Reviewed 2026-09-13. The source is the clean local checkout of [autonomous-ai/harness-new-ui](https://github.com/autonomous-ai/harness-new-ui) at `19ced37`, with its matching origin. The public GitHub page could not be fetched by the web tool; the source and running `http://127.0.0.1:5173/` were inspected directly.+**Current direction after user review:** this is an agent workspace, not a general-purpose terminal. The user has approved manual splits/resizing, optional lightweight search preview, and commands in search. They must add no permanent clutter or latency to the existing fast path. The earlier nested-shell compatibility rationale is withdrawn. Keep Cmd-H/J/K/L, Cmd-arrows, Cmd-S layout and Cmd-B Boss mode.+**Keep the scope small: durable terminals, immediate navigation, and a dependable way to handle an interruption and return.** The prototypes provide useful interaction experiments. They do not establish native terminal correctness, measured performance, or what exceptional developers universally prefer.## What was reviewed@@ -19,6 +21,18 @@ Source review covered `App.tsx`, `SwarmsV4Workspace.tsx`, `data/swarmsV4.ts`, `H| Swarms v4 | Stable sessions, explicit right/down splits, contextual search preview, draft/caret recovery, and an attention round trip address daily friction. | Borrow these behaviors selectively. Do not inherit its permanent session strip, footer, second metadata row, or default replacement of the focused pane. || Swarms + Models | Model/account details can be inspected on demand, but per-pane model controls and a top-level library compete with the work. | Keep the dashboard absent. Existing usage and hardware capabilities stay secondary; they do not justify a new daily navigation surface. |+## Evidence for the three approved additions++Checked primary documentation again on 2026-09-13 at the user's request. These are established behaviors, not evidence that every exceptional developer wants the same feature set in Harness.++| Proposal | Concrete precedents | Harness judgment |+| --- | --- | --- |+| Manual splits/resizing | [tmux](https://github.com/tmux/tmux/wiki/Getting-Started#resizing-and-zooming-panes) has manual resizing alongside preset layouts. [iTerm2](https://iterm2.com/documentation-one-page.html#shell--split-verticallyhorizontally) supports vertical/horizontal splits and draggable dividers. | Strong fit for giving one active agent more room while keeping others visible. Preserve quick Cmd-S relayout. |+| Optional search preview | [fzf](https://github.com/junegunn/fzf#preview-window) and [Telescope](https://github.com/nvim-telescope/telescope.nvim#previewers) preview a selected candidate. [tmux tree mode](https://github.com/tmux/tmux/wiki/Getting-Started#choosing-sessions-windows-and-panes) previews actual session/window/pane content before switching. | The tmux behavior is the closest precedent. Use bounded already-retained agent output; make preview optional and verify that it reduces wrong destinations without slowing search. |+| Commands in search | [VS Code](https://code.visualstudio.com/docs/editing/getting-started/userinterface#command-palette) shares an interactive window between commands and navigation. [JetBrains Search Everywhere](https://www.jetbrains.com/help/idea/searching-everywhere.html) searches files, actions and settings from one entry point. | Strong fit for discovering occasional actions. Reuse the existing command catalog, show actual remapped shortcuts, and add no permanent panel. |++After reviewing this evidence, the user accepted the recommendation to build these three additions. Keep preview optional and lightweight; preserve existing fast navigation, simple shortcuts and quick relayout. Implement after the current search/menu corrections and alongside the coherent remapping work.+## The three promises, with concrete changes### 1. Work stays where you left it@@ -41,7 +55,7 @@ Carry the following into one bounded follow-up:This follows [fzf's incremental narrowing and preview design](https://github.com/junegunn/fzf). `git ls-files | fzf` illustrates its small composable contract: receive candidates, narrow them, return the chosen value. Harness should reuse that interaction model, not run shell preview commands on every search keystroke. V4's own scorer is a small custom fuzzy matcher, not an embedded fzf runtime.-The prototype's `>` command mode could eventually expose the existing app command catalog in the same picker. Defer a second registry or a large command system; first verify that people cannot already find the relevant command through native menus and the shortcut sheet.+The prototype's `>` command mode is now approved for the existing app command catalog in the same picker. Share commands with menus and remapping; no second registry or conflicting new shortcut is needed.### 3. Handle a decision and return to the same place@@ -54,15 +68,15 @@ V4's editable handoff is an interesting later idea. A production version needs a## What stays out, or becomes smaller- **No mandatory primary/supporting hierarchy, session shelf, extra footer, duplicate project tree or permanent context row.** Use the terminal area for output; disclose context in the compact header, picker, tooltip and menu.-- **No copied Ctrl+B prefix by default.** A real nested tmux session already uses it. Configurable keymaps and deliberate passthrough need runtime tests; the browser's prefix simulation cannot prove compatibility.+- **Use Command as Harness's easy prefix.** Keep the current two-key movement, layout and Boss mode shortcuts. Borrow tmux's useful operations, not its Ctrl-B prefix.- **No model/compute dashboard, marketplace, autonomous manager, full IDE/Git client or generic handoff system in this milestone.** Existing agents, shells and editors already perform much of this work.- **No backdrop blur, artificial transition delay, replaying output animation or repeated healthy-state spinner.** A quiet working surface and measured response are more valuable than constant signs of activity.- **Wallpaper remains in empty New swarm only.** Appearance controls belong in View/context menus. Active Swarms keep one flat color continuous with the selected tab.## Remaining foundations the prototypes cannot prove-An ordinary local/remote shell must be easy to open in the correct directory. Remappable commands must coexist with Vim, zsh, tmux, IME and accessibility keys. [Ghostty's shell integration](https://ghostty.org/docs/features/shell-integration) offers useful examples of directory inheritance, prompt navigation and output selection; these should use real terminal signals rather than guessed screen text. CLI/API operations should use the same stable session identities as the UI.+Remappable commands must preserve correct editing in the actual agent CLI and in Harness search/dialogs, including IME and accessibility. General-purpose shell creation is outside the current product direction. Prompt/output navigation and editor/diff handoff remain research ideas; they require actual agent signals rather than guessed screen text. Any later CLI/API should use the same stable agent identities as the UI.-Those are gaps to verify and prioritize, not a checklist to implement all at once. Current order: finish the reliability/menu/header/project work; measure real input and navigation under output load; then add the bounded Cmd+P preview/highlight improvement. Explicit splits and keymap/shell compatibility follow with their own focused validation. The [working queue](harness-v2-developer-tools-research.md) remains the single status list.+Those are gaps to verify and prioritize, not a checklist to implement all at once. Current order: finish the approved search/menu corrections, integrate remapping with the agreed simple defaults, then add commands in search, controlled splits/resizing and optional bounded preview. Measure real input and navigation under output load. General-purpose shell/editor compatibility is outside this milestone. The [working queue](harness-v2-developer-tools-research.md) remains the single status list.Success means fewer wrong destinations, no surprise layout changes, no lost editing or reading context, and less effort to resume work. Real daily use with local and remote agents must establish that result; attractive sample screens and simulated reviewers cannot.