Skip to content

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

Simplify harness entry and reveal pane actions on hover

dee4d6242ac4bc0
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index ce903a76a..9adba312a 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -295,6 +295,21 @@ class _SwarmScreenState extends State<SwarmScreen> {
},
],
'attention': _attention,
+ 'machines': [
+ for (final machine in app.machineStates.values)
+ {
+ 'id': machine.machine.machineId,
+ 'name': machine.machine.displayName,
+ 'local': machine.isLocalMachine,
+ 'status': machine.needsLink
+ ? 'Link required'
+ : machine.nodeOnline == false
+ ? 'Offline'
+ : machine.nodeOnline == true
+ ? 'Online'
+ : 'Connecting…',
+ },
+ ],
'history': [
for (final entry in _navigation.menuDestinations(app))
{
@@ -461,6 +476,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
await _addProject();
case 'linkMachine':
await _dialog(() => showSwarmLinkDialog(context, app));
+ case 'refreshMachines':
+ unawaited(app.retryMachines());
+ case 'machineDestination':
+ final machine = args['id'] is String ? app.stateOf(args['id']) : null;
+ if (machine != null) {
+ _openSearch(adding: true, query: machine.machine.displayName);
+ }
case 'commands':
_showSearchCommands();
case 'historyDestination':
@@ -502,6 +524,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
'splitDown',
'zoomPane',
'pinPane',
+ 'machineDestination',
}.contains(call.method)) {
// Native tab controls wait for this reply before releasing keyboard
// ownership. The destination's actual focus tree must be ready first.
@@ -659,7 +682,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
SnackBar(
content: Text(
!targetExists
- ? 'That tab was closed. Open New Agent to find the agent.'
+ ? 'That tab was closed. Open New Harness to find the agent.'
: 'That split changed. Open Add Agent again to choose a position.',
),
),
@@ -1309,6 +1332,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
empty: SwarmWelcome(
key: ValueKey(app.activeSwarmId),
notifier: app,
+ recent: _navigation.recent,
+ onRecent: (entry) => _activateSearch(
+ SwarmSearchSelection(
+ entry,
+ SwarmSearchAction.addHere,
+ ),
+ app.activeSwarmId,
+ ),
onNewAgent: _newAgent,
onChooseFirstFolder: () =>
_newAgent(chooseFolderFirst: true),
@@ -1441,7 +1472,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
key: const ValueKey('swarm-new-agent-button'),
tooltip: withEffectiveShortcutHint(
context,
- 'New Agent',
+ 'New Harness',
ShortcutAction.newSwarm,
),
onPressed: app.swarms.length < AppNotifier.maxSwarms
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index e232e0289..43d8c070b 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -422,7 +422,7 @@ const kSwarmShortcuts = [
AppShortcut(
action: ShortcutAction.newSwarm,
activator: SingleActivator(LogicalKeyboardKey.keyT, meta: true),
- label: 'New Agent',
+ label: 'New Harness',
group: ShortcutGroup.navigate,
),
AppShortcut(
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index c9af58688..f4caa8373 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -56,7 +56,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'swarm.new',
- 'New Agent',
+ 'New Harness',
ShortcutGroup.navigate,
action: ShortcutAction.newSwarm,
nativeAction: 'new',
@@ -361,13 +361,6 @@ final harnessCommands = <HarnessCommand>[
extraKeys: ['enter'],
context: KeymapContext.picker,
),
- const HarnessCommand(
- 'picker.toggle_selection',
- 'Select or deselect an agent',
- ShortcutGroup.actions,
- extraKeys: ['shift+enter'],
- context: KeymapContext.picker,
- ),
const HarnessCommand(
'picker.add_here',
'Add the selected agent to this tab',
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 26495afb3..3070fff0c 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -459,7 +459,7 @@ class AppNotifier extends ChangeNotifier {
Iterable<TerminalPane> get allPanes => swarms.expand((s) => s.panes).toSet();
String get activeSwarmId => activeSwarm.id;
- void newSwarm({String name = 'New Agent'}) {
+ void newSwarm({String name = 'New Harness'}) {
if (swarms.length >= maxSwarms) return;
while (swarms.any((s) => s.id == 'swarm-$_nextSwarmId')) {
_nextSwarmId++;
@@ -557,7 +557,7 @@ class AppNotifier extends ChangeNotifier {
// welcome tabs, evicting the real work from recently closed history.
if (swarms.length == 1 &&
swarms.single.panes.isEmpty &&
- swarms.single.name == 'New Agent' &&
+ swarms.single.name == 'New Harness' &&
swarms.single.presets.isEmpty) {
return;
}
@@ -3876,7 +3876,7 @@ class AppNotifier extends ChangeNotifier {
if (_creationPlacementError(targetId, split) != null) {
_lastError =
'The agent was created, but its original tab or layout changed. '
- 'Find it with New Agent.';
+ 'Find it with New Harness.';
_lastErrorRetryable = false;
notifyListeners();
return null;
@@ -4339,7 +4339,7 @@ class AppNotifier extends ChangeNotifier {
target.arranged = split.after;
target.arrangedKey = key;
}
- if (firstAgent && target.name == 'New Agent') {
+ if (firstAgent && target.name == 'New Harness') {
final name = agent.name.trim();
if (name.isNotEmpty) {
target.name = name.length > 80 ? name.substring(0, 80) : name;
@@ -4867,7 +4867,7 @@ class AppNotifier extends ChangeNotifier {
0,
(raw['name'] as String).length.clamp(0, 80),
)
- : 'New Agent',
+ : 'New Harness',
);
for (final item in (raw['panes'] as List).take(maxPanes)) {
final entry = PaneLayoutEntry.fromJson(item);
diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dart
index ca4ef0c20..f8b69c3fd 100644
--- a/desktop/lib/state/swarm.dart
+++ b/desktop/lib/state/swarm.dart
@@ -8,8 +8,10 @@ import 'terminal_pane.dart';
/// Shared agents reuse the same pane/session across swarms, so the daemon has
/// exactly one controller and switching tabs cannot take over our own stream.
class Swarm {
- Swarm({required this.id, String name = 'New Agent'})
- : name = const {'New swarm', 'New tab'}.contains(name) ? 'New Agent' : name;
+ Swarm({required this.id, String name = 'New Harness'})
+ : name = const {'New swarm', 'New tab', 'New Agent'}.contains(name)
+ ? 'New Harness'
+ : name;
final String id;
String name;
@@ -173,7 +175,7 @@ class ClosedSwarm extends ClosedWork {
bool replacesUntouchedWelcome(Swarm swarm) =>
swarm.id == replacementId &&
- swarm.name == 'New Agent' &&
+ swarm.name == 'New Harness' &&
swarm.panes.isEmpty &&
swarm.presets.isEmpty;
}
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index 2b199ac05..a8d720ebb 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -524,7 +524,7 @@ Future<bool> activateSwarmSearchSelection(
)) {
return false;
}
- if (target.panes.isEmpty && target.name == 'New Agent') {
+ if (target.panes.isEmpty && target.name == 'New Harness') {
app.renameSwarm(target.id, destination.title);
}
// Every membership is recorded before awaiting any attachment. A slow
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index f3ffda1ef..301a0a1be 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -8,15 +8,9 @@ import 'swarm_navigation.dart';
/// An in-memory Add draft for a temporary detour into New agent. Membership and
/// availability are revalidated against a fresh catalog when the picker returns.
class SwarmSearchDraft {
- const SwarmSearchDraft._(
- this.targetId,
- this.query,
- this.selectedId,
- this.checked,
- );
+ const SwarmSearchDraft._(this.targetId, this.query, this.selectedId);
final String targetId, query;
final String? selectedId;
- final List<SwarmDestination> checked;
}
/// One search session, shared by the native/Flutter input and its results.
@@ -64,7 +58,6 @@ class SwarmSearchController extends ChangeNotifier {
final SwarmSearchCatalog _cache;
final SwarmLocationCatalog _locations;
List<SwarmDestination> _catalog = const [];
- Set<String> _catalogIds = const {};
Set<String> _commandIds = const {};
List<SwarmDestination> rows = const [];
String query = '';
@@ -72,31 +65,14 @@ class SwarmSearchController extends ChangeNotifier {
int cursor = 0;
bool? _splitCurrent;
Set<String> _presentIds = const {};
- final _checked = <String, SwarmDestination>{};
- List<SwarmDestination> get checked => List.unmodifiable(_checked.values);
- int get checkedCount => _checked.length;
- bool get multiSelect => adding && split == null && !isCommandMode;
- bool get hasSelection => multiSelect && _checked.isNotEmpty;
-
SwarmSearchDraft get draft =>
- SwarmSearchDraft._(targetId, query, selected?.id, checked);
+ SwarmSearchDraft._(targetId, query, selected?.id);
void restoreDraft(SwarmSearchDraft draft) {
if (!adding || draft.targetId != targetId) return;
query = draft.query;
_selectedId = draft.selectedId;
cursor = 0;
- _checked.clear();
- if (split == null) {
- final current = {for (final row in _catalog) row.id: row};
- for (final row in draft.checked) {
- if (!_presentIds.contains(row.id)) {
- // Keep unavailable choices visible for removal instead of silently
- // accepting a smaller set. Activation still checks the entire set.
- _checked[row.id] = current[row.id] ?? row;
- }
- }
- }
_filter();
notifyListeners();
}
@@ -108,54 +84,7 @@ class SwarmSearchController extends ChangeNotifier {
return target == null ? 0 : AppNotifier.maxPanes - target.panes.length;
}
- bool isChecked(SwarmDestination row) {
- final ids = _missingIds(row);
- return ids.isNotEmpty && ids.every(_checked.containsKey);
- }
-
- bool canToggle(SwarmDestination row) =>
- multiSelect &&
- !row.isCommand &&
- (isChecked(row) ||
- (canAdd(row) &&
- _checked.length +
- _missingIds(row)
- .where((id) => !_checked.containsKey(id))
- .length <=
- capacity));
-
- void toggle([SwarmDestination? row]) {
- row ??= selected;
- if (row == null || !canToggle(row)) return;
- final ids = _missingIds(row);
- if (isChecked(row)) {
- _checked.removeWhere((id, _) => ids.contains(id));
- } else {
- for (final entry in _catalog) {
- if (entry.agentId != null && ids.contains(entry.id)) {
- _checked[entry.id] = entry;
- }
- }
- }
- notifyListeners();
- }
-
- void removeChecked(String id) {
- if (_checked.remove(id) != null) notifyListeners();
- }
-
- void clearChecked() {
- if (_checked.isEmpty) return;
- _checked.clear();
- notifyListeners();
- }
-
- bool get canSubmitSelection =>
- hasSelection &&
- _checked.length <= capacity &&
- _checked.values.every((row) => canAdd(row)) &&
- _checked.keys.every(_catalogIds.contains);
- bool get canAccept => hasSelection ? canSubmitSelection : canSubmit(selected);
+ bool get canAccept => canSubmit(selected);
SwarmDestination? get selected => rows.isEmpty ? null : rows[cursor];
String get hint => isCommandMode
@@ -189,8 +118,6 @@ class SwarmSearchController extends ChangeNotifier {
String actionLabel(SwarmDestination? row) => row?.isCommand == true
? action(row!)
- : hasSelection
- ? '$addVerb $checkedCount ${checkedCount == 1 ? 'agent' : 'agents'}'
: adding
? row != null &&
row.agentId == null &&
@@ -205,10 +132,6 @@ class SwarmSearchController extends ChangeNotifier {
String get unavailableMessage =>
split != null && !app.isPaneSplitCurrent(split!)
? 'The layout changed. Split the agent again.'
- : hasSelection && checkedCount > capacity
- ? 'This tab has room for $capacity more agents.'
- : hasSelection && !canSubmitSelection
- ? 'A selected agent is unavailable. Remove it or search again.'
: selected != null && alreadyHere(selected!)
? 'This agent is already in this tab.'
: 'This tab has no room for another agent.';
@@ -226,7 +149,6 @@ class SwarmSearchController extends ChangeNotifier {
return;
}
_catalog = next;
- _catalogIds = {for (final row in next) row.id};
_splitCurrent = splitCurrent;
_presentIds = {
for (final swarm in app.swarms.where((s) => s.id == targetId))
@@ -234,7 +156,6 @@ class SwarmSearchController extends ChangeNotifier {
if (pane.agentId != null)
agentDestinationId(pane.machineId, pane.agentId!),
};
- _checked.removeWhere((id, _) => _presentIds.contains(id));
_filter();
notifyListeners();
}
@@ -301,9 +222,6 @@ class SwarmSearchController extends ChangeNotifier {
}
SwarmSearchSelection? submit([SwarmDestination? row]) {
- if (row == null && hasSelection) {
- return canSubmitSelection ? SwarmSearchSelection.multiple(checked) : null;
- }
final destination = row ?? selected;
if (destination == null || !canSubmit(destination)) return null;
if (destination.isCommand &&
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index eac50cec4..31539f3f8 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -13,61 +13,143 @@ class PaneHeaderActions extends StatelessWidget {
this.onZoom,
this.onDelete,
this.onClose,
+ this.onToggleComposer,
+ this.composerVisible = false,
+ this.details,
});
final String name;
- final bool zoomed;
- final VoidCallback? onZoom, onDelete, onClose;
+ final bool zoomed, composerVisible;
+ final VoidCallback? onZoom, onDelete, onClose, onToggleComposer;
+
+ /// Folder, branch and machine share the controls' space while idle. Both
+ /// layers keep their size so hovering never changes the title's width.
+ final Widget? details;
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
- Widget action(
- String tooltip,
- IconData icon,
- VoidCallback? callback, {
- bool destructive = false,
- }) => IconButton(
- tooltip: tooltip,
- onPressed: callback,
- icon: Icon(icon, size: 18),
- style: ButtonStyle(
- fixedSize: const WidgetStatePropertyAll(Size(28, 28)),
- minimumSize: const WidgetStatePropertyAll(Size(28, 28)),
- padding: const WidgetStatePropertyAll(EdgeInsets.zero),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- visualDensity: VisualDensity.standard,
- shape: WidgetStatePropertyAll(
- RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
+ Widget action(String tooltip, IconData icon, VoidCallback? callback) =>
+ IconButton(
+ tooltip: tooltip,
+ onPressed: callback,
+ icon: Icon(icon, size: 16),
+ style: ButtonStyle(
+ fixedSize: const WidgetStatePropertyAll(Size(28, 28)),
+ minimumSize: const WidgetStatePropertyAll(Size(28, 28)),
+ padding: const WidgetStatePropertyAll(EdgeInsets.zero),
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ visualDensity: VisualDensity.standard,
+ shape: WidgetStatePropertyAll(
+ RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
+ ),
+ foregroundColor: WidgetStateProperty.resolveWith((states) {
+ if (states.contains(WidgetState.disabled)) {
+ return grid.AppPalette.textFaint;
+ }
+ if (states.contains(WidgetState.hovered) ||
+ states.contains(WidgetState.focused)) {
+ return AppColors.text;
+ }
+ return AppColors.mutedStrong.withValues(alpha: .8);
+ }),
+ overlayColor: WidgetStatePropertyAll(grid.AppSurface.hoverFill),
+ ),
+ );
+
+ final visible = _PaneHeaderVisibility.of(context);
+ final controls = IgnorePointer(
+ ignoring: !visible,
+ child: AnimatedOpacity(
+ opacity: visible ? 1 : 0,
+ alwaysIncludeSemantics: true,
+ duration: MediaQuery.disableAnimationsOf(context)
+ ? Duration.zero
+ : const Duration(milliseconds: 100),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (onToggleComposer != null) ...[
+ action(
+ composerVisible
+ ? 'Hide message composer'
+ : 'Show message composer',
+ LucideIcons.keyboard,
+ onToggleComposer,
+ ),
+ const SizedBox(width: 2),
+ ],
+ action(
+ zoomed ? 'Restore agents' : 'Zoom $name',
+ zoomed ? LucideIcons.minimize : LucideIcons.maximize,
+ onZoom,
+ ),
+ const SizedBox(width: 2),
+ action('Delete agent', LucideIcons.trash2, onDelete),
+ const SizedBox(width: 2),
+ action('Close pane', LucideIcons.x, onClose),
+ ],
),
- foregroundColor: WidgetStateProperty.resolveWith((states) {
- if (states.contains(WidgetState.disabled)) {
- return grid.AppPalette.textFaint;
- }
- if (states.contains(WidgetState.hovered) ||
- states.contains(WidgetState.focused)) {
- return destructive ? AppColors.danger : AppColors.text;
- }
- return AppColors.mutedStrong;
- }),
- overlayColor: WidgetStatePropertyAll(grid.AppSurface.hoverFill),
),
);
-
- return Row(
- mainAxisSize: MainAxisSize.min,
+ if (details == null) return controls;
+ return Stack(
+ alignment: Alignment.centerRight,
children: [
- action(
- zoomed ? 'Restore agents' : 'Zoom $name',
- zoomed ? LucideIcons.minimize : LucideIcons.maximize,
- onZoom,
+ IgnorePointer(
+ ignoring: visible,
+ child: AnimatedOpacity(
+ key: const ValueKey('pane-header-details'),
+ opacity: visible ? 0 : 1,
+ duration: MediaQuery.disableAnimationsOf(context)
+ ? Duration.zero
+ : const Duration(milliseconds: 100),
+ child: ExcludeSemantics(excluding: visible, child: details!),
+ ),
),
- const SizedBox(width: 2),
- action('Delete agent', LucideIcons.trash2, onDelete, destructive: true),
- const SizedBox(width: 2),
- action('Close pane', LucideIcons.x, onClose),
+ controls,
],
);
}
}
+
+/// Only header controls depend on this hover state, so the terminal and title
+/// are retained as the pointer crosses the bar. Keyboard focus reveals them too.
+class PaneHeaderHover extends StatefulWidget {
+ const PaneHeaderHover({super.key, required this.child});
+ final Widget child;
+ @override
+ State<PaneHeaderHover> createState() => _PaneHeaderHoverState();
+}
+
+class _PaneHeaderHoverState extends State<PaneHeaderHover> {
+ bool _hovered = false, _focused = false;
+ @override
+ Widget build(BuildContext context) => MouseRegion(
+ onEnter: (_) => setState(() => _hovered = true),
+ onExit: (_) => setState(() => _hovered = false),
+ child: Focus(
+ canRequestFocus: false,
+ includeSemantics: false,
+ onFocusChange: (value) => setState(() => _focused = value),
+ child: _PaneHeaderVisibility(
+ visible: _hovered || _focused,
+ child: widget.child,
+ ),
+ ),
+ );
+}
+
+class _PaneHeaderVisibility extends InheritedWidget {
+ const _PaneHeaderVisibility({required this.visible, required super.child});
+ final bool visible;
+ static bool of(BuildContext context) =>
+ context
+ .dependOnInheritedWidgetOfExactType<_PaneHeaderVisibility>()
+ ?.visible ??
+ true;
+ @override
+ bool updateShouldNotify(_PaneHeaderVisibility oldWidget) =>
+ visible != oldWidget.visible;
+}
diff --git a/desktop/lib/widgets/pane_resize_handle.dart b/desktop/lib/widgets/pane_resize_handle.dart
index 7e5bdc853..b261b0871 100644
--- a/desktop/lib/widgets/pane_resize_handle.dart
+++ b/desktop/lib/widgets/pane_resize_handle.dart
@@ -201,14 +201,16 @@ class _PaneResizeHandleState extends State<PaneResizeHandle> {
),
Center(
child: AnimatedContainer(
- duration: const Duration(milliseconds: 100),
+ duration: MediaQuery.disableAnimationsOf(context)
+ ? Duration.zero
+ : const Duration(milliseconds: 100),
width: _horizontal ? 3 : 36,
height: _horizontal ? 36 : 3,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: _hover || _focused || _start != null
? grid.AppPalette.swarmAccent
- : Colors.white24,
+ : Colors.transparent,
),
),
),
diff --git a/desktop/lib/widgets/swarm_inline_search.dart b/desktop/lib/widgets/swarm_inline_search.dart
index a481e1d50..1b78bf50d 100644
--- a/desktop/lib/widgets/swarm_inline_search.dart
+++ b/desktop/lib/widgets/swarm_inline_search.dart
@@ -12,7 +12,7 @@ import '../state/swarm_search.dart';
import 'swarm_switcher.dart';
import 'swarm_search_input.dart';
-/// New Agent owns its input and caret, sharing the same Add agent results and
+/// New Harness owns its input and caret, sharing the same Add agent results and
/// actions as the floating button and splits.
class SwarmInlineSearch extends StatefulWidget {
const SwarmInlineSearch({
@@ -40,7 +40,7 @@ class SwarmInlineSearch extends StatefulWidget {
class _SwarmInlineSearchState extends State<SwarmInlineSearch> {
final _text = TextEditingController();
- final _focus = FocusNode(debugLabel: 'New Agent search');
+ final _focus = FocusNode(debugLabel: 'New Harness search');
final _overlay = OverlayPortalController();
final _tapGroup = Object();
final _catalog = SwarmSearchCatalog();
@@ -54,7 +54,7 @@ class _SwarmInlineSearchState extends State<SwarmInlineSearch> {
}
void _focusChanged() {
- // New Agent gives the field its caret immediately, but the welcome
+ // New Harness gives the field its caret immediately, but the welcome
// choices stay visible until a click, edit or result-navigation key.
if (!_focus.hasFocus) _close();
}
@@ -182,6 +182,8 @@ class _SwarmInlineSearchState extends State<SwarmInlineSearch> {
);
},
child: SwarmSearchInput(
+ hintText: 'Find a harness…',
+ rounded: true,
inputKey: const ValueKey('swarm-welcome-search-input'),
controller: _text,
focusNode: _focus,
diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dart
index fa6ad9bc2..30ddfbb38 100644
--- a/desktop/lib/widgets/swarm_search_input.dart
+++ b/desktop/lib/widgets/swarm_search_input.dart
@@ -23,6 +23,8 @@ class SwarmSearchInput extends StatelessWidget {
this.onTapOutside,
this.showClose = false,
this.autofocus = true,
+ this.hintText,
+ this.rounded = false,
});
final Key inputKey;
@@ -37,14 +39,22 @@ class SwarmSearchInput extends StatelessWidget {
final Object? groupId;
final VoidCallback? onTapOutside;
final bool showClose, autofocus;
+ final String? hintText;
+ final bool rounded;
@override
Widget build(BuildContext context) {
final open = search != null;
final border = OutlineInputBorder(
borderRadius: BorderRadius.vertical(
- top: const Radius.circular(12),
- bottom: Radius.circular(open ? 0 : 12),
+ top: Radius.circular(rounded && !open ? 30 : 12),
+ bottom: Radius.circular(
+ open
+ ? 0
+ : rounded
+ ? 30
+ : 12,
+ ),
),
borderSide: BorderSide(color: open ? Colors.transparent : Colors.white24),
);
@@ -69,7 +79,9 @@ class SwarmSearchInput extends StatelessWidget {
cursorColor: grid.AppPalette.swarmAccent,
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
- hintText: search?.hint ?? 'Find an existing agent…',
+ hintText: search?.isCommandMode == true
+ ? search!.hint
+ : hintText ?? search?.hint ?? 'Find an existing agent…',
hintStyle: const TextStyle(fontSize: 16, color: Colors.white60),
prefixIcon: const Icon(Icons.search, size: 20, color: Colors.white60),
prefixIconConstraints: const BoxConstraints(
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index d62e04691..df3e5824f 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -158,8 +158,6 @@ class SwarmSearchKeys extends StatelessWidget {
actions: {
if (onNewAgent != null) 'agent.new': () => run(onNewAgent!),
if (search != null || onOpen != null) ...{
- if (search?.multiSelect == true)
- 'picker.toggle_selection': () => run(search!.toggle),
'picker.accept': () => choose(false),
'picker.add_here': () => choose(true),
'picker.next': () => move(1),
@@ -186,13 +184,6 @@ class SwarmSearchKeys extends StatelessWidget {
bindings: search == null && onOpen == null
? {}
: {
- if (search?.multiSelect == true)
- const SingleActivator(
- LogicalKeyboardKey.enter,
- shift: true,
- includeRepeats: false,
- ): () =>
- run(search!.toggle),
if (onNewAgent != null)
const SingleActivator(
LogicalKeyboardKey.keyN,
@@ -270,8 +261,7 @@ double swarmSearchResultsHeight(
) =>
search.rows.length.clamp(4, 7) *
swarmSearchRowHeight(scale, commands: search.isCommandMode) +
- 52 +
- (search.hasSelection ? 48 : 0);
+ 52;
/// Shared Add agent results, also used for commands and History.
class SwarmSearchResults extends StatefulWidget {
@@ -387,19 +377,12 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
final row = search.rows[index];
final highlighted = index == search.cursor;
final canSubmit = search.canSubmit(row);
- final multiSelect = search.multiSelect;
- final checked = multiSelect && search.isChecked(row);
- final canToggle =
- multiSelect && search.canToggle(row);
final alreadyHere = search.alreadyHere(row);
final presentation = (
row,
search.query,
highlighted,
canSubmit,
- multiSelect,
- checked,
- canToggle,
alreadyHere,
highlighted
? (search.canAccept, search.actionLabel(row))
@@ -433,30 +416,6 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
leading: Row(
mainAxisSize: MainAxisSize.min,
children: [
- if (multiSelect) ...[
- SizedBox(
- width: 28,
- child: Tooltip(
- message: checked
- ? 'Deselect ${row.title}'
- : 'Select ${row.title}',
- child: Checkbox(
- key: ValueKey('select:${row.id}'),
- value: checked,
- onChanged: canToggle
- ? (_) {
- search.toggle(row);
- widget.onRefocus();
- }
- : null,
- activeColor:
- grid.AppPalette.swarmAccent,
- checkColor: grid.AppPalette.swarmField,
- ),
- ),
- ),
- const SizedBox(width: 10),
- ],
row.isCommand
? const Icon(
Icons.keyboard_command_key,
@@ -527,11 +486,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
color: Colors.white60,
),
),
- onTap: canSubmit
- ? () => search.hasSelection
- ? search.toggle(row)
- : _submit(row)
- : null,
+ onTap: canSubmit ? () => _submit(row) : null,
);
_rowWidgets[row.id] = (
presentation: presentation,
@@ -544,66 +499,6 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
},
),
),
- if (search.hasSelection) ...[
- const Divider(height: 1, color: Colors.white12),
- SizedBox(
- height: 46,
- child: Row(
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 12),
- child: Text(
- '${search.checkedCount} selected',
- style: const TextStyle(
- fontSize: 12,
- color: Colors.white70,
- ),
- ),
- ),
- Expanded(
- child: ListView(
- key: const ValueKey('swarm-selected-agents'),
- scrollDirection: Axis.horizontal,
- children: [
- for (final agent in search.checked)
- Padding(
- padding: const EdgeInsets.only(right: 6),
- child: InputChip(
- label: ConstrainedBox(
- constraints: const BoxConstraints(
- maxWidth: 180,
- ),
- child: Text(
- agent.title,
- overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
- ),
- ),
- onDeleted: () {
- search.removeChecked(agent.id);
- widget.onRefocus();
- },
- deleteButtonTooltipMessage:
- 'Remove ${agent.title}',
- ),
- ),
- ],
- ),
- ),
- TextButton(
- onPressed: search.clearChecked,
- style: TextButton.styleFrom(
- foregroundColor: Colors.white70,
- ),
- child: const Text(
- 'Clear',
- style: TextStyle(fontSize: 12),
- ),
- ),
- ],
- ),
- ),
- ],
const Divider(height: 1, color: Colors.white12),
SizedBox(
height: 48,
@@ -623,8 +518,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
style: TextStyle(fontSize: 12),
),
),
- if ((search.hasSelection && !search.canSubmitSelection) ||
- (selected != null && !search.canSubmit(selected)) ||
+ if ((selected != null && !search.canSubmit(selected)) ||
search.adding && !search.canCreate)
Expanded(
child: Text(
diff --git a/desktop/lib/widgets/swarm_welcome.dart b/desktop/lib/widgets/swarm_welcome.dart
index 25a9491d1..d6b977daf 100644
--- a/desktop/lib/widgets/swarm_welcome.dart
+++ b/desktop/lib/widgets/swarm_welcome.dart
@@ -3,6 +3,8 @@ 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 'engine_identity.dart';
class SwarmWelcome extends StatefulWidget {
const SwarmWelcome({
@@ -12,20 +14,25 @@ class SwarmWelcome extends StatefulWidget {
required this.searchField,
required this.onLinkMachine,
this.onChooseFirstFolder,
+ this.recent = const [],
+ this.onRecent,
});
final AppNotifier notifier;
final VoidCallback onNewAgent, onLinkMachine;
final VoidCallback? onChooseFirstFolder;
final Widget searchField;
+ final List<String> recent;
+ final ValueChanged<SwarmDestination>? onRecent;
@override
State<SwarmWelcome> createState() => _SwarmWelcomeState();
}
-/// First launch and every empty tab offer the same two entry points.
+/// One quiet starting point for first launch and every empty tab.
class _SwarmWelcomeState extends State<SwarmWelcome> {
bool _reconnecting = false;
+ final _catalog = SwarmSearchCatalog();
Future<void> _reconnect() async {
if (_reconnecting) return;
@@ -64,78 +71,51 @@ class _SwarmWelcomeState extends State<SwarmWelcome> {
app.machineStates.values.every((machine) => machine.needsLink);
final chooseFolder =
!existing && local != null && widget.onChooseFirstFolder != null;
- final find = _AgentEntryCard(
- key: const ValueKey('welcome-find-agent'),
- icon: Icons.search_rounded,
- title: 'Find an agent',
- description:
- 'Pick up where you left off. Search by agent, machine, or project.',
- action: widget.searchField,
- );
- final create = _AgentEntryCard(
- key: const ValueKey('welcome-create-agent'),
- icon: Icons.add_rounded,
- title: 'Create a new agent',
- description:
- 'Start fresh. Choose an agent, a machine, and a working folder.',
- action: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.min,
- children: [
- FilledButton.icon(
- key: const ValueKey('swarm-start-primary'),
- onPressed: chooseFolder
- ? widget.onChooseFirstFolder
- : canCreate
- ? widget.onNewAgent
- : finding
- ? null
- : needsLink
- ? widget.onLinkMachine
- : _reconnect,
- icon: Icon(
- canCreate ? Icons.add : Icons.computer_outlined,
- size: 20,
- ),
- label: Text(
- canCreate
- ? 'Create Agent'
- : finding
- ? 'Finding your computers…'
- : needsLink
- ? 'Link a machine'
- : 'Reconnect',
- ),
- style: FilledButton.styleFrom(
- minimumSize: const Size(0, 58),
- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18),
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmTabBar,
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
- ),
- ),
- ),
- if (!canCreate && !finding) ...[
- const SizedBox(height: 12),
- Text(
- needsLink
- ? 'Connect a computer to create your first agent.'
- : 'Your computers are offline. Reconnect to create an agent.',
- style: const TextStyle(
- fontSize: 12,
- height: 1.5,
- color: Colors.white60,
- ),
- ),
- ],
- ],
+ final catalog = _catalog.read(app, const [], recent: widget.recent);
+ final agents = {
+ for (final row in catalog)
+ if (row.agentId != null) row.id: row,
+ };
+ final recent = <SwarmDestination>[
+ for (final id in {
+ ...widget.recent,
+ ...agents.values.where((row) => row.hasView).map((row) => row.id),
+ })
+ ?agents[id],
+ ].take(6).toList();
+ final create = FilledButton.icon(
+ key: const ValueKey('swarm-start-primary'),
+ onPressed: chooseFolder
+ ? widget.onChooseFirstFolder
+ : canCreate
+ ? widget.onNewAgent
+ : finding
+ ? null
+ : needsLink
+ ? widget.onLinkMachine
+ : _reconnect,
+ icon: Icon(canCreate ? Icons.add : Icons.computer_outlined, size: 20),
+ label: Text(
+ canCreate
+ ? 'Create harness'
+ : finding
+ ? 'Finding computers…'
+ : needsLink
+ ? 'Link a machine'
+ : 'Reconnect',
+ ),
+ style: FilledButton.styleFrom(
+ minimumSize: const Size(180, 56),
+ padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 18),
+ backgroundColor: grid.AppPalette.swarmAccent,
+ foregroundColor: grid.AppPalette.swarmTabBar,
+ textStyle: TextStyle(
+ fontFamily: grid.AppFont.sans,
+ fontFamilyFallback: grid.AppFont.sansFallback,
+ fontSize: 15,
+ fontWeight: FontWeight.w600,
+ ),
+ shape: const StadiumBorder(),
),
);
@@ -146,65 +126,105 @@ class _SwarmWelcomeState extends State<SwarmWelcome> {
builder: (context, constraints) {
final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;
final padding = constraints.maxWidth < 600 ? 24.0 : 48.0;
+ final recentWidth =
+ ((constraints.maxWidth - padding * 2 - 60) / 6).clamp(
+ 104.0,
+ 128.0,
+ ) *
+ textScale.clamp(1.0, 1.5);
return SingleChildScrollView(
key: const ValueKey('swarm-welcome-scroll'),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: constraints.maxHeight),
child: Padding(
- padding: EdgeInsets.symmetric(
- horizontal: padding,
- vertical: 48,
+ padding: EdgeInsets.fromLTRB(
+ padding,
+ (constraints.maxHeight * .16).clamp(40.0, 132.0),
+ padding,
+ 40,
),
child: Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 1040),
+ constraints: const BoxConstraints(maxWidth: 920),
child: Column(
mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
- 'New Agent',
+ 'New Harness',
key: ValueKey('welcome-title'),
+ textAlign: TextAlign.center,
style: TextStyle(
- fontSize: 32,
- height: 1.2,
+ fontSize: 44,
+ height: 1.15,
fontWeight: FontWeight.w600,
+ letterSpacing: -1,
color: Colors.white,
),
),
- const SizedBox(height: 12),
- const Text(
- 'Resume existing work or start something new.',
- style: TextStyle(
- fontSize: 15,
- height: 1.5,
- color: Colors.white70,
- ),
- ),
const SizedBox(height: 32),
LayoutBuilder(
builder: (context, size) {
- if (size.maxWidth < 840 * textScale) {
+ if (size.maxWidth < 700 * textScale) {
return Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- find,
- const SizedBox(height: 20),
+ widget.searchField,
+ const SizedBox(height: 16),
create,
],
);
}
return Row(
- crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Expanded(child: find),
- const SizedBox(width: 24),
- Expanded(child: create),
+ Expanded(child: widget.searchField),
+ const SizedBox(width: 14),
+ create,
],
);
},
),
+ if (!canCreate && !finding) ...[
+ const SizedBox(height: 14),
+ Text(
+ needsLink
+ ? 'Connect a computer to create your first harness.'
+ : 'Your computers are offline. Reconnect to start something new.',
+ textAlign: TextAlign.center,
+ style: const TextStyle(
+ fontSize: 13,
+ height: 1.5,
+ color: Colors.white60,
+ ),
+ ),
+ ],
+ if (recent.isNotEmpty && widget.onRecent != null) ...[
+ const SizedBox(height: 32),
+ const Text(
+ 'Recent harnesses',
+ style: TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w500,
+ color: Colors.white60,
+ ),
+ ),
+ const SizedBox(height: 16),
+ Wrap(
+ alignment: WrapAlignment.center,
+ spacing: 12,
+ runSpacing: 12,
+ children: [
+ for (final row in recent)
+ SizedBox(
+ width: recentWidth,
+ child: _RecentHarness(
+ key: ValueKey('welcome-recent:${row.id}'),
+ entry: row,
+ onPressed: () => widget.onRecent!(row),
+ ),
+ ),
+ ],
+ ),
+ ],
],
),
),
@@ -218,63 +238,63 @@ class _SwarmWelcomeState extends State<SwarmWelcome> {
}
}
-class _AgentEntryCard extends StatelessWidget {
- const _AgentEntryCard({
+class _RecentHarness extends StatelessWidget {
+ const _RecentHarness({
super.key,
- required this.icon,
- required this.title,
- required this.description,
- required this.action,
+ required this.entry,
+ required this.onPressed,
});
-
- final IconData icon;
- final String title, description;
- final Widget action;
+ final SwarmDestination entry;
+ final VoidCallback onPressed;
@override
- Widget build(BuildContext context) => Container(
- constraints: const BoxConstraints(minHeight: 320),
- padding: const EdgeInsets.all(28),
- decoration: BoxDecoration(
- color: grid.AppPalette.swarmSearchSurface.withValues(alpha: .94),
- borderRadius: BorderRadius.circular(24),
- border: Border.all(color: Colors.white.withValues(alpha: .16)),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- width: 44,
- height: 44,
- decoration: BoxDecoration(
- color: grid.AppPalette.swarmAccent.withValues(alpha: .12),
- borderRadius: BorderRadius.circular(12),
- ),
- child: Icon(icon, size: 26, color: grid.AppPalette.swarmAccent),
- ),
- const SizedBox(height: 24),
- Text(
- title,
- style: const TextStyle(
- fontSize: 23,
- height: 1.2,
- fontWeight: FontWeight.w600,
- color: Colors.white,
- ),
- ),
- const SizedBox(height: 12),
- Text(
- description,
- style: const TextStyle(
- fontSize: 14,
- height: 1.6,
- color: Colors.white70,
+ Widget build(BuildContext context) => Tooltip(
+ message: '${entry.title}\n${entry.detail}',
+ child: Material(
+ color: Colors.transparent,
+ child: InkWell(
+ onTap: onPressed,
+ borderRadius: BorderRadius.circular(16),
+ hoverColor: Colors.white.withValues(alpha: .05),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ width: 56,
+ height: 56,
+ decoration: BoxDecoration(
+ color: grid.AppPalette.swarmSearchSurface,
+ shape: BoxShape.circle,
+ ),
+ alignment: Alignment.center,
+ child: EngineMark(engine: entry.engine, size: 28),
+ ),
+ const SizedBox(height: 12),
+ Text(
+ entry.title,
+ textAlign: TextAlign.center,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: const TextStyle(
+ fontSize: 13,
+ height: 1.3,
+ color: Colors.white,
+ ),
+ ),
+ const SizedBox(height: 4),
+ Text(
+ entry.machineLabel,
+ textAlign: TextAlign.center,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: const TextStyle(fontSize: 11, color: Colors.white54),
+ ),
+ ],
),
),
- const SizedBox(height: 28),
- action,
- ],
+ ),
),
);
}
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index a59fb4838..f5f148e91 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -1268,11 +1268,14 @@ class _TerminalPanelState extends State<TerminalPanel>
error: session.errorMessage ?? session.errorCode,
link: session.linkMode,
machine: machine?.machine,
+ local: machine?.isLocalMachine,
agent: agent,
project: agent == null ? null : machine?.projectOf(agent),
compact: widget.compactHeader,
close: widget.onClose != null,
delete: widget.onDelete != null,
+ composer: widget.composerVisible,
+ toggleComposer: widget.onToggleComposer != null,
zoomed: widget.zoomed,
zoom: widget.onToggleZoom != null,
dragId: widget.paneDrag?.ref.paneId,
@@ -1294,6 +1297,10 @@ class _TerminalPanelState extends State<TerminalPanel>
onDelete: widget.onDelete == null
? null
: () => widget.onDelete?.call(),
+ composerVisible: widget.composerVisible,
+ onToggleComposer: widget.onToggleComposer == null
+ ? null
+ : () => widget.onToggleComposer?.call(),
paneDrag: widget.paneDrag,
);
}
@@ -1314,6 +1321,8 @@ class _TerminalHeader extends StatelessWidget {
final bool compact;
final VoidCallback? onToggleZoom;
final bool zoomed;
+ final VoidCallback? onToggleComposer;
+ final bool composerVisible;
/// This strip's drag gesture, or null when there is nothing to drag.
///
@@ -1336,6 +1345,8 @@ class _TerminalHeader extends StatelessWidget {
this.onToggleZoom,
this.zoomed = false,
this.paneDrag,
+ this.onToggleComposer,
+ this.composerVisible = false,
});
@override
@@ -1403,186 +1414,183 @@ class _TerminalHeader extends StatelessWidget {
if (profile != null) 'Codex profile: $profile',
'Double-click to rename',
].join('\n');
- final strip = SizedBox(
- height: compact ? 38 : 46,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: _stripPadding),
- child: LayoutBuilder(
- builder: (context, constraints) => Row(
- children: [
- EngineMark(engine: session.engineId, size: 17),
- const SizedBox(width: 10),
- Expanded(
- // Double click the NAME to rename — the same dialog the rail's
- // row opens, so one name has one way to change wherever it is
- // shown. Scoped to the text rather than the whole strip: the
- // strip is the drag handle, and a double click that both renamed
- // and looked like the start of a drag would be two answers to one
- // gesture.
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onDoubleTap: () => unawaited(
- showAgentRenameDialog(
- context,
- notifier,
- session.machineId,
- session.agentId,
- session.agentName,
- ),
- ),
+ final remoteComposer = machine != null && !machine.isLocalMachine
+ ? onToggleComposer
+ : null;
+ final actionsWidth = remoteComposer == null ? 88.0 : 118.0;
+ final folder =
+ project?.cwd
+ .split(RegExp(r'[/\\]'))
+ .where((part) => part.isNotEmpty)
+ .lastOrNull ??
+ project?.name;
+ final details = [
+ if (folder?.isNotEmpty == true) folder!,
+ if (project?.branch?.trim().isNotEmpty == true) project!.branch!,
+ machineName,
+ ];
+ final strip = PaneHeaderHover(
+ child: SizedBox(
+ height: compact ? 38 : 46,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _stripPadding),
+ child: LayoutBuilder(
+ builder: (context, constraints) => Row(
+ children: [
+ EngineMark(engine: session.engineId, size: 17),
+ const SizedBox(width: 10),
+ Expanded(
child: Tooltip(
message: identityDetail,
waitDuration: const Duration(milliseconds: 700),
- child: Text(
- // The profile path's basename used to trail the name here, but for the
- // default profile that basename is literally the hidden `.codex` folder —
- // meaningless clutter on every ordinary codex agent. The tooltip above still
- // carries the full path for whoever actually needs it.
- session.agentName,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 13,
- fontWeight: FontWeight.w600,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onDoubleTap: () => unawaited(
+ showAgentRenameDialog(
+ context,
+ notifier,
+ session.machineId,
+ session.agentId,
+ session.agentName,
+ ),
+ ),
+ child: Text(
+ session.agentName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ color: AppColors.text,
+ fontFamily: AppFonts.sans,
+ fontSize: 13,
+ fontWeight: FontWeight.w600,
+ ),
),
),
),
),
- ),
- if (compact &&
- constraints.maxWidth >= 360 &&
- status == null &&
- project?.branch != null) ...[
- const SizedBox(width: 16),
- Tooltip(
- message: '${project!.branch}\n${project.cwd}',
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- LucideIcons.gitBranch,
- size: 12,
- color: AppColors.mutedStrong,
- ),
- const SizedBox(width: 5),
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: math.min(112, constraints.maxWidth * .22),
+ const SizedBox(width: 8),
+ if (status != null)
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: math.max(
+ 0,
+ math.min(
+ constraints.maxWidth * .3,
+ constraints.maxWidth - actionsWidth - 110,
),
- child: Text(
- project.branch!,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: AppColors.textSoft,
+ ),
+ ),
+ child: Align(
+ alignment: Alignment.centerRight,
+ child: Tooltip(
+ message: status.detail,
+ child: TextButton(
+ onPressed: canReconnect
+ ? () => notifier.selectAgent(
+ session.machineId,
+ session.agentId,
+ )
+ : null,
+ style: TextButton.styleFrom(
+ foregroundColor: color,
+ disabledForegroundColor: AppColors.textSoft,
+ minimumSize: Size.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 6,
+ vertical: 4,
+ ),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(status.icon, size: 14),
+ const SizedBox(width: 6),
+ Flexible(
+ child: Text(
+ status.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: const TextStyle(fontSize: 11),
+ ),
+ ),
+ ],
),
),
),
- ],
- ),
- ),
- ],
- if (compact && status == null) ...[
- const SizedBox(width: 16),
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: math.min(156, constraints.maxWidth * .28),
+ ),
+ )
+ else if (!compact)
+ Padding(
+ padding: const EdgeInsets.all(4),
+ child: Icon(Icons.circle, size: 8, color: color),
),
- child: Tooltip(
- message: machineName,
- child: constraints.maxWidth < 380 && project?.branch != null
- ? Icon(
- machine?.isLocalMachine == true
- ? Icons.laptop_mac
- : Icons.desktop_mac,
- size: 14,
- color: AppColors.mutedStrong,
- )
- : Text(
- machineName,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 11,
- color: AppColors.mutedStrong,
- ),
- ),
+ // Which of the three paths carries this pane's bytes. Absent for a local machine's own
+ // terminal, which has no such distinction and so gets no badge.
+ //
+ // The wire word and the word a person reads differ for the middle state, deliberately:
+ // the CLI sends 'turn' (it is a TURN allocation) but both middle and last are relays to
+ // a reader, so they read as "relay" and "ws". 'relay' on the wire kept its original
+ // meaning — the backend WebSocket — so an older CLI is never mislabelled.
+ if (!compact && session.linkMode != null)
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 2),
+ child: _LinkModeMark(mode: session.linkMode!),
),
- ),
- ],
- const SizedBox(width: 8),
- if (status != null)
ConstrainedBox(
constraints: BoxConstraints(
- maxWidth: constraints.maxWidth * .42,
+ maxWidth: math.max(
+ actionsWidth,
+ constraints.maxWidth * (status == null ? .55 : .3),
+ ),
),
- child: Align(
- alignment: Alignment.centerRight,
- child: Tooltip(
- message: status.detail,
- child: TextButton(
- onPressed: canReconnect
- ? () => notifier.selectAgent(
- session.machineId,
- session.agentId,
- )
- : null,
- style: TextButton.styleFrom(
- foregroundColor: color,
- disabledForegroundColor: AppColors.textSoft,
- minimumSize: Size.zero,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- vertical: 4,
- ),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(status.icon, size: 14),
- const SizedBox(width: 6),
+ child: PaneHeaderActions(
+ name: session.agentName,
+ zoomed: zoomed,
+ onZoom: onToggleZoom,
+ onDelete: onDelete,
+ onClose: onClose,
+ onToggleComposer: remoteComposer,
+ composerVisible: composerVisible,
+ details: Tooltip(
+ message: [
+ if (project != null) project.cwd,
+ if (project?.branch?.isNotEmpty == true)
+ 'Branch: ${project!.branch}',
+ machineName,
+ ].join('\n'),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ for (var i = 0; i < details.length; i++) ...[
+ if (i > 0)
+ Text(
+ ' • ',
+ style: TextStyle(
+ fontSize: 10,
+ color: AppColors.mutedStrong,
+ ),
+ ),
Flexible(
child: Text(
- status.label,
+ details[i],
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: const TextStyle(fontSize: 11),
+ style: TextStyle(
+ fontFamily: AppFonts.sans,
+ fontSize: 12,
+ color: AppColors.mutedStrong,
+ ),
),
),
],
- ),
+ ],
),
),
),
- )
- else if (!compact)
- Padding(
- padding: const EdgeInsets.all(4),
- child: Icon(Icons.circle, size: 8, color: color),
),
- // Which of the three paths carries this pane's bytes. Absent for a local machine's own
- // terminal, which has no such distinction and so gets no badge.
- //
- // The wire word and the word a person reads differ for the middle state, deliberately:
- // the CLI sends 'turn' (it is a TURN allocation) but both middle and last are relays to
- // a reader, so they read as "relay" and "ws". 'relay' on the wire kept its original
- // meaning — the backend WebSocket — so an older CLI is never mislabelled.
- if (!compact && session.linkMode != null)
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 2),
- child: _LinkModeMark(mode: session.linkMode!),
- ),
- PaneHeaderActions(
- name: session.agentName,
- zoomed: zoomed,
- onZoom: onToggleZoom,
- onDelete: onDelete,
- onClose: onClose,
- ),
- ],
+ ],
+ ),
),
),
),
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index e46a26b46..69e1b43f8 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -23,6 +23,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
private var closedHistory: [SwarmHistoryEntry] = []
private let historyIcons = SwarmHistoryIcons()
private let modelsMenu = NSMenu(title: "Models")
+ private let machinesMenu = NSMenu(title: "Machines")
+ private var machines: [SwarmMachineEntry] = []
private var subscriptions: [SwarmSubscriptionEntry] = []
private var keymap: HarnessNativeKeymap?
private var flutterKeyContext = "workspace"
@@ -53,6 +55,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
self.canGoForward = state["canGoForward"] as? Bool == true
self.canCreateSwarm = (state["tabs"] as? [Any] ?? []).count < 24
self.updateHistory(state["history"] as? [[String: Any]] ?? [], closed: state["closedHistory"] as? [[String: Any]] ?? [])
+ self.updateMachines(state["machines"] as? [[String: Any]] ?? [])
self.strip.update(state)
self.window?.backgroundColor = self.strip.palette.tabBar
result(nil)
@@ -92,7 +95,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func sendTabAction(_ method: String, arguments: Any?) {
- guard ["select", "close", "new", "rename", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane"].contains(method) else {
+ guard ["select", "close", "new", "rename", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination"].contains(method) else {
channel.invokeMethod(method, arguments: arguments)
return
}
@@ -111,7 +114,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
private func setKeymap(_ map: HarnessNativeKeymap) {
keymap = map
let hint = map.hint(for: "swarm.new", context: "workspace")
- strip.newButton.toolTip = hint.map { "New Agent (\($0))" } ?? "New Agent"
+ strip.newButton.toolTip = hint.map { "New Harness (\($0))" } ?? "New Harness"
if let main = NSApp.mainMenu, let window {
let menu = main as? HarnessKeymapMenu ?? HarnessKeymapMenu.replacing(main)
if NSApp.mainMenu !== menu { NSApp.mainMenu = menu }
@@ -196,24 +199,23 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
main.insertItem(item, at: index)
}
if let file = main.item(withTitle: "File") { main.removeItem(file) }
- let agent = NSMenu(title: "Agent")
- add(agent, "New Agent", "t", "new")
- add(agent, "Add Agent…", "n", "addAgent")
- add(agent, "Create Agent…", "n", "newAgent", [.command, .shift])
- agent.addItem(.separator())
- add(agent, "Split Right…", "", "splitRight")
- add(agent, "Split Down…", "", "splitDown")
- agent.addItem(.separator())
- add(agent, "Zoom Agent", "", "zoomPane")
- add(agent, "Pin or Unpin Agent", "", "pinPane")
- agent.addItem(.separator())
- add(agent, "Rename Tab…", "r", "renameActive", [.command, .shift])
- add(agent, "Close Agent Pane", "w", "closePane", [.command, .shift])
- add(agent, "Close Tab", "w", "closeActive")
- agent.addItem(.separator())
- add(agent, "Link Machine…", "", "linkMachine")
- add(agent, "Add Project…", "", "addProject")
- install(agent, at: 1)
+ let file = NSMenu(title: "File")
+ add(file, "New Harness", "t", "new")
+ add(file, "Add Agent…", "n", "addAgent")
+ add(file, "Create Agent…", "n", "newAgent", [.command, .shift])
+ file.addItem(.separator())
+ add(file, "Split Right…", "", "splitRight")
+ add(file, "Split Down…", "", "splitDown")
+ file.addItem(.separator())
+ add(file, "Zoom Agent", "", "zoomPane")
+ add(file, "Pin or Unpin Agent", "", "pinPane")
+ file.addItem(.separator())
+ add(file, "Rename Tab…", "r", "renameActive", [.command, .shift])
+ add(file, "Close Agent Pane", "w", "closePane", [.command, .shift])
+ add(file, "Close Tab", "w", "closeActive")
+ file.addItem(.separator())
+ add(file, "Add Project…", "", "addProject")
+ install(file, at: 1)
rebuildHistoryMenu()
install(historyMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)
@@ -231,6 +233,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
modelsMenu.delegate = self
rebuildModelsMenu()
install(modelsMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)
+ rebuildMachinesMenu()
+ install(machinesMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)
installTerminalFindMenu(main)
}
@@ -242,6 +246,41 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
channel.invokeMethod("modelsOpened", arguments: nil)
}
+ private func updateMachines(_ rows: [[String: Any]]) {
+ let entries = rows.prefix(128).compactMap(SwarmMachineEntry.init)
+ guard entries != machines else { return }
+ machines = entries
+ rebuildMachinesMenu()
+ }
+
+ private func rebuildMachinesMenu() {
+ machinesMenu.removeAllItems()
+ for machine in machines {
+ let item = NSMenuItem(title: machine.name, action: #selector(machineAction(_:)), keyEquivalent: "")
+ item.target = self
+ item.representedObject = machine.id
+ let label = NSMutableAttributedString(string: machine.name)
+ label.append(NSAttributedString(string: " " + machine.status, attributes: [.foregroundColor: NSColor.secondaryLabelColor]))
+ item.attributedTitle = label
+ item.toolTip = "Find harnesses on " + machine.name
+ item.image = NSImage(systemSymbolName: machine.local ? "laptopcomputer" : "desktopcomputer", accessibilityDescription: nil)
+ machinesMenu.addItem(item)
+ }
+ if machines.isEmpty {
+ let empty = NSMenuItem(title: "No Machines Linked", action: nil, keyEquivalent: "")
+ empty.isEnabled = false
+ machinesMenu.addItem(empty)
+ }
+ machinesMenu.addItem(.separator())
+ for (title, action) in [("Link Machine…", "linkMachine"), ("Refresh Machines", "refreshMachines")] {
+ let item = NSMenuItem(title: title, action: #selector(menuAction(_:)), keyEquivalent: "")
+ item.target = self
+ item.representedObject = action
+ item.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + action)
+ machinesMenu.addItem(item)
+ }
+ }
+
private func updateModels(_ rows: [[String: Any]]) {
let entries = rows.prefix(32).compactMap(SwarmSubscriptionEntry.init)
guard entries != subscriptions else { return }
@@ -376,6 +415,9 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
let action = menuItem.representedObject as? String ?? ""
+ if menuItem.action == #selector(machineAction(_:)) {
+ return actionsEnabled && machines.contains(where: { $0.id == action })
+ }
if menuItem.action == #selector(historyAction(_:)) {
return actionsEnabled && history.contains(where: { $0.id == action })
}
@@ -393,6 +435,11 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
sendTabAction(action, arguments: nil)
}
+ @objc private func machineAction(_ sender: NSMenuItem) {
+ guard validateMenuItem(sender), let id = sender.representedObject as? String else { return }
+ sendTabAction("machineDestination", arguments: ["id": id])
+ }
+
@objc private func historyAction(_ sender: NSMenuItem) {
guard validateMenuItem(sender), let id = sender.representedObject as? String else { return }
channel.invokeMethod("historyDestination", arguments: ["id": id])
@@ -409,6 +456,21 @@ private enum SwarmIdentity {
static let menuIcon = NSImage(systemSymbolName: "square.split.2x2", accessibilityDescription: nil)
}
+private struct SwarmMachineEntry: Equatable {
+ let id: String
+ let name: String
+ let status: String
+ let local: Bool
+ init?(_ row: [String: Any]) {
+ guard let id = row["id"] as? String, !id.isEmpty,
+ let name = row["name"] as? String, !name.isEmpty else { return nil }
+ self.id = id
+ self.name = String(name.prefix(128))
+ status = String((row["status"] as? String ?? "").prefix(80))
+ local = row["local"] as? Bool == true
+ }
+}
+
private struct SwarmSubscriptionEntry: Equatable {
let title: String
let account: String
@@ -687,8 +749,8 @@ private final class SwarmTabStrip: NSView {
button.setAccessibilityLabel(label)
addSubview(button)
}
- button(newButton, "plus", "New Agent (⌘T)", #selector(newSwarm))
- newButton.setAccessibilityLabel("New Agent")
+ button(newButton, "plus", "New Harness (⌘T)", #selector(newSwarm))
+ newButton.setAccessibilityLabel("New Harness")
newButton.isEnabled = false
button(notificationButton, "bell", "Notifications", #selector(openNotifications))
notificationButton.isEnabled = false
@@ -723,13 +785,13 @@ private final class SwarmTabStrip: NSView {
guard let id = row["id"] as? String else { return nil }
let tab = previous[id] ?? SwarmTabButton(id: id)
tab.palette = palette
- tab.name = row["name"] as? String ?? "New Agent"
+ tab.name = row["name"] as? String ?? "New Harness"
let count = row["agentCount"] as? Int ?? 0
tab.icon = count == 1
? icons.image(engine: row["engine"] as? String, asset: row["iconAsset"] as? String)
: count > 1
? SwarmIdentity.menuIcon
- : NSImage(systemSymbolName: "plus.square", accessibilityDescription: "New Agent")
+ : NSImage(systemSymbolName: "plus.square", accessibilityDescription: "New Harness")
tab.selected = id == activeId
tab.actionsEnabled = actionsEnabled
tab.attention = (row["attention"] as? Int ?? 0) > 0
@@ -849,7 +911,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
didSet { if palette != oldValue { needsDisplay = true } }
}
let swarmId: String
- var name = "New Agent" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
+ var name = "New Harness" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }
var attention = false { didSet { if attention != oldValue { needsDisplay = true; updateAccessibility() } } }
var showsDivider = false { didSet { if showsDivider != oldValue { needsDisplay = true } } }
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 9baab6fed..eaa44bc1f 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -111,20 +111,12 @@ void main() {
}
await tester.enterText(field, 'Agent 1');
await tester.pump();
- if (entry == 'Add') {
- await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
- await tester.pump();
- expect(find.text('1 selected'), findsOneWidget);
- }
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
final before = tester
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
.search;
final selected = before.selected!.id;
- final checked = before.checked.map((row) => row.id).toList();
final editing = tester.widget<TextField>(field).controller!;
editing.selection = const TextSelection(baseOffset: 0, extentOffset: 5);
final value = editing.value;
@@ -144,7 +136,6 @@ void main() {
expect(tester.widget<TextField>(field).controller!.value, value);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
expect(restored.selected!.id, selected);
- expect(restored.checked.map((row) => row.id), checked);
expect(restored.targetId, target.id);
if (entry != 'Add') expect(restored.primaryAction, entry);
expect(app.activeSwarm, same(target));
@@ -220,11 +211,6 @@ void main() {
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent 12');
await tester.pump();
- await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
- await tester.pump();
- expect(find.text('1 selected'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('swarm-search-new-agent')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('new-agent-folder')));
@@ -250,7 +236,7 @@ void main() {
await tester.pumpAndSettle();
expect(tester.widget<TextField>(field).controller!.text, 'Agent 12');
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
- expect(find.text('1 selected'), findsOneWidget);
+ expect(find.byType(Checkbox), findsNothing);
expect(app.panes, [existing]);
}
expect(connection.calls.map((call) => call.type), ['agent_create']);
@@ -585,7 +571,7 @@ void main() {
app.stateOf('m')!.agents.any((agent) => agent.id == 'created'),
isTrue,
);
- expect(app.lastError, contains('Find it with New Agent'));
+ expect(app.lastError, contains('Find it with New Harness'));
});
testWidgets(
diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dart
index 0bcbc8801..76bb0e04e 100644
--- a/desktop/test/boot_flow_widget_test.dart
+++ b/desktop/test/boot_flow_widget_test.dart
@@ -829,7 +829,7 @@ void main() {
),
);
await tester.pumpAndSettle();
- expect(find.text('New Agent'), findsWidgets);
+ expect(find.text('New Harness'), findsWidgets);
expect(find.text('Create Agent'), findsNothing);
expect(find.text('Add project'), findsNothing);
await tester.ensureVisible(find.text('Link a machine'));
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index dda23245e..7960f010e 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -117,8 +117,8 @@ void main() {
),
);
await mount(tester, app, projects: projects);
- expect(find.text('Find an agent'), findsOneWidget);
- expect(find.text('Create a new agent'), findsOneWidget);
+ expect(find.text('Find a harness…'), findsOneWidget);
+ expect(find.text('Create harness'), findsOneWidget);
expect(
find.byKey(const ValueKey('swarm-welcome-search-input')),
findsOneWidget,
@@ -146,7 +146,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- expect(find.text('Finding your computers…'), findsOneWidget);
+ expect(find.text('Finding computers…'), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
expect(picker.opened, 0);
@@ -154,7 +154,7 @@ void main() {
app.machinesLoading = false;
app.dismissError();
await tester.pump();
- expect(find.text('Create Agent'), findsOneWidget);
+ expect(find.text('Create harness'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('swarm-start-primary')));
await tester.pump();
expect(picker.opened, 1);
@@ -176,7 +176,7 @@ void main() {
expect(find.text('Reconnect'), findsOneWidget);
await tester.tap(find.text('Reconnect'));
await tester.pump();
- expect(find.text('Finding your computers…'), findsOneWidget);
+ expect(find.text('Finding computers…'), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
expect(app.reconnects, 1);
@@ -228,7 +228,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- expect(find.text('Create Agent'), findsOneWidget);
+ expect(find.text('Create harness'), findsOneWidget);
expect(find.text('Machines'), findsNothing);
await tester.tap(find.byKey(const ValueKey('swarm-start-primary')));
await tester.pump();
@@ -579,7 +579,7 @@ void main() {
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- expect(find.text('New Agent'), findsWidgets);
+ expect(find.text('New Harness'), findsWidgets);
expect(find.text('Machines'), findsNothing);
expect(find.text('Projects'), findsNothing);
expect(app.launches, isEmpty);
@@ -644,7 +644,7 @@ void main() {
];
await mount(tester, app);
expect(app.panes, isEmpty);
- expect(find.text('Find an agent'), findsOneWidget);
+ expect(find.text('Find a harness…'), findsOneWidget);
expect(find.text('Go to an agent'), findsNothing);
await tester.enterText(
find.byKey(const ValueKey('swarm-welcome-search-input')),
@@ -658,8 +658,8 @@ void main() {
final pane = app.panes.single;
app.newSwarm();
await tester.pump();
- expect(find.text('Find an agent'), findsOneWidget);
- expect(find.text('Create Agent'), findsOneWidget);
+ expect(find.text('Find a harness…'), findsOneWidget);
+ expect(find.text('Create harness'), findsOneWidget);
expect(find.text('Go to an agent'), findsNothing);
await tester.enterText(
find.byKey(const ValueKey('swarm-welcome-search-input')),
@@ -675,7 +675,7 @@ void main() {
app.newSwarm();
await tester.pump();
expect(app.closedHistory, isNotEmpty);
- expect(find.text('Find an agent'), findsOneWidget);
+ expect(find.text('Find a harness…'), findsOneWidget);
expect(app.launches, isEmpty);
expect(find.text('Go to an agent'), findsNothing);
expect(tester.takeException(), isNull);
@@ -693,9 +693,9 @@ void main() {
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await tester.tap(find.text('Create Agent'));
+ await tester.tap(find.text('Create harness'));
await tester.pump();
- await tester.tap(find.text('Create Agent'));
+ await tester.tap(find.text('Create harness'));
await tester.pump();
expect(picker.opened, 1);
expect(app.probes, 1);
@@ -746,7 +746,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await tester.tap(find.text('Create Agent'));
+ await tester.tap(find.text('Create harness'));
await tester.pump();
switch (change) {
case 'swarm':
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index 970a56fad..aa220618f 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -118,7 +118,7 @@ void main() {
for (final inline in [false, true]) {
testWidgets(
- 'configured picker actions and hints stay in ${inline ? 'New Agent' : 'titlebar'} search',
+ 'configured picker actions and hints stay in ${inline ? 'New Harness' : 'titlebar'} search',
(tester) async {
final map = MemoryKeymap()
..apply('''{"bindings":[
diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dart
index bec9a2a6d..0106f304b 100644
--- a/desktop/test/swarm_commands_test.dart
+++ b/desktop/test/swarm_commands_test.dart
@@ -18,7 +18,7 @@ void main() {
addTearDown(app.dispose);
final command = SwarmDestination(
id: 'command:swarm.new',
- title: 'New Agent',
+ title: 'New Harness',
detail: 'Navigate',
swarmId: null,
current: false,
@@ -32,7 +32,7 @@ void main() {
commands: () => available ? [command] : [],
);
addTearDown(search.dispose);
- search.setQuery('New Agent');
+ search.setQuery('New Harness');
expect(search.rows.any((row) => row.isCommand), isFalse);
search.setQuery('> new');
expect(search.selected, same(command));
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index edeec5234..036e2ab1b 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/auth/auth_session.dart';
@@ -139,14 +140,33 @@ void main() {
final controls = find.byType(PaneHeaderActions).first;
expect(
find.descendant(of: controls, matching: find.byType(IconButton)),
- findsNWidgets(3),
+ findsNWidgets(4),
);
+ expect(find.byTooltip('Delete agent').first.hitTestable(), findsNothing);
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: const Offset(1, 1));
+ Future<void> hover() async {
+ await mouse.moveTo(tester.getCenter(controls));
+ await tester.pump(const Duration(milliseconds: 120));
+ }
+
+ await hover();
+ await tester.tap(find.byTooltip('Show message composer').first);
+ await tester.pump();
+ expect(pane.composerVisible, isTrue);
+ await hover();
+ await tester.tap(find.byTooltip('Hide message composer').first);
+ await tester.pump();
+ expect(pane.composerVisible, isFalse);
+ await hover();
await tester.tap(find.byTooltip('Zoom Session a0'));
await tester.pump();
expect(app.zoomedPaneId, pane.id);
+ await hover();
await tester.tap(find.byTooltip('Restore agents'));
await tester.pump();
expect(app.zoomedPaneId, isNull);
+ await hover();
await tester.tap(
find.descendant(of: controls, matching: find.byTooltip('Delete agent')),
@@ -158,11 +178,13 @@ void main() {
await tester.tap(find.text('Cancel'));
await tester.pumpAndSettle();
expect(app.panes, contains(pane));
+ await hover();
await tester.tap(
find.descendant(of: controls, matching: find.byTooltip('Close pane')),
);
await tester.pump();
+ await mouse.removePointer();
expect(app.panes.single.agentId, 'a1');
expect(original.panes.single.session, same(session));
app.selectSwarm(original.id);
@@ -262,7 +284,7 @@ void main() {
expect(app.swarms, hasLength(1));
expect(app.panes, isEmpty);
expect(app.activeSwarmId, isNot(anyOf(first, second)));
- expect(find.text('New Agent'), findsOneWidget);
+ expect(find.text('New Harness'), findsOneWidget);
await activate('new');
expect(app.swarms, hasLength(2));
expect(input, hasLength(2));
diff --git a/desktop/test/swarm_multi_add_test.dart b/desktop/test/swarm_multi_add_test.dart
deleted file mode 100644
index 167beee81..000000000
--- a/desktop/test/swarm_multi_add_test.dart
+++ /dev/null
@@ -1,278 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:harness/state/app_state.dart';
-import 'package:harness/state/swarm_navigation.dart';
-import 'package:harness/state/swarm_search.dart';
-import 'package:harness/terminal/terminal_binary.dart';
-
-import 'swarm_screen_test.dart' show mount, terminal;
-import 'swarm_state_test.dart' show createApp;
-import 'swarm_interactions_test.dart' show chord;
-
-void main() {
- testWidgets('Command-N opens Add and Shift-Command-N creates a fresh agent', (
- tester,
- ) async {
- final app = createApp();
- final input = <TerminalBinaryFrame>[];
- final pane = app.adoptSessionForTest(terminal('a0', input));
- await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
- final field = find.byKey(const ValueKey('swarm-search-input'));
- final create = find.byKey(const ValueKey('swarm-search-new-agent'));
- expect(field, findsOneWidget);
- expect(find.byType(AlertDialog), findsNothing);
- expect(
- tester.getRect(create).center.dy,
- closeTo(tester.getRect(field).center.dy, 1),
- );
- expect(tester.getRect(create).width, greaterThanOrEqualTo(148));
- expect(app.panes, [pane]);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
- expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.text('Create on Test host'), findsOneWidget);
- expect(app.panes, [pane]);
- expect(input, isEmpty);
- await tester.tap(find.text('Cancel'));
- await tester.pump();
- expect(tester.takeException(), isNull);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
-
- test(
- 'selection survives queries and adds exact runtimes to its captured swarm',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- final input = <TerminalBinaryFrame>[];
- final first = app.adoptSessionForTest(terminal('a0', input));
- final second = app.adoptSessionForTest(terminal('a1', input));
- final source = app.activeSwarm;
- app.newSwarm(name: 'Review');
- final target = app.activeSwarm;
- final search = SwarmSearchController(app, [], adding: true);
- addTearDown(search.dispose);
- search.setQuery('Agent 0');
- search.toggle();
- search.setQuery('Agent 1');
- search.toggle();
- search.setQuery('nothing matches this');
- expect(search.rows, isEmpty);
- expect(search.checked.map((row) => row.agentId), ['a0', 'a1']);
- expect(target.panes, isEmpty);
- expect(search.canAccept, isTrue);
- final selection = search.submit()!;
- app.selectSwarm(source.id);
- expect(
- await activateSwarmSearchSelection(
- app,
- selection,
- destinationSwarmId: search.targetId,
- ),
- isTrue,
- );
- expect(app.activeSwarm, same(source));
- expect(target.panes, [first, second]);
- expect(source.panes, [first, second]);
- expect(input, isEmpty);
- expect(
- search.checked,
- isEmpty,
- reason: 'Added memberships leave the selection',
- );
- },
- );
-
- test(
- 'returning Add drafts revalidate membership, missing agents and target',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- final target = app.activeSwarm;
- final search = SwarmSearchController(app, [], adding: true);
- search.setQuery('Agent 0');
- search.toggle();
- search.setQuery('Agent 1');
- search.toggle();
- final draft = search.draft;
- search.dispose();
- app.adoptSessionForTest(terminal('a0', []));
- app.machineStates['m']!.agents.removeWhere((agent) => agent.id == 'a1');
- final restored = SwarmSearchController(app, [], adding: true)
- ..restoreDraft(draft);
- addTearDown(restored.dispose);
- expect(restored.checked.map((row) => row.agentId), ['a1']);
- expect(restored.query, 'Agent 1');
- expect(restored.canAccept, isFalse);
- expect(restored.submit(), isNull);
- expect(restored.unavailableMessage, contains('unavailable'));
- expect(target.panes.map((pane) => pane.agentId), ['a0']);
- app.newSwarm();
- final elsewhere = SwarmSearchController(app, [], adding: true)
- ..restoreDraft(draft);
- addTearDown(elsewhere.dispose);
- expect(elsewhere.checked, isEmpty);
- expect(elsewhere.query, isEmpty);
- expect(app.panes, isEmpty);
- },
- );
-
- test(
- 'a stale selection cannot partially add its remaining available agents',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- final target = app.activeSwarm;
- final search = SwarmSearchController(app, [], adding: true);
- addTearDown(search.dispose);
- search.setQuery('Agent 0');
- search.toggle();
- search.setQuery('Agent 1');
- search.toggle();
- final chosen = search.submit()!;
- app.machineStates['m']!.agents.removeWhere((agent) => agent.id == 'a1');
- app.dismissError();
- expect(search.checkedCount, 2);
- expect(search.canAccept, isFalse);
- expect(search.unavailableMessage, contains('unavailable'));
- expect(
- await activateSwarmSearchSelection(
- app,
- chosen,
- destinationSwarmId: target.id,
- ),
- isFalse,
- );
- expect(target.panes, isEmpty);
- search.removeChecked(agentDestinationId('m', 'a1'));
- expect(search.canAccept, isTrue);
- expect(search.submit()!.agents.single.agentId, 'a0');
- },
- );
-
- test(
- 'capacity changes are validated for the entire selection before adding',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- final search = SwarmSearchController(app, [], adding: true);
- addTearDown(search.dispose);
- search.setQuery('Agent 68');
- search.toggle();
- search.setQuery('Agent 69');
- search.toggle();
- final chosen = search.submit()!;
- for (var i = 0; i < AppNotifier.maxPanes - 1; i++) {
- app.adoptSessionForTest(terminal('a$i', []));
- }
- app.dismissError();
- expect(search.capacity, 1);
- expect(search.canAccept, isFalse);
- expect(
- await activateSwarmSearchSelection(
- app,
- chosen,
- destinationSwarmId: search.targetId,
- ),
- isFalse,
- );
- expect(app.panes, hasLength(AppNotifier.maxPanes - 1));
- expect(
- app.panes.any((pane) => pane.agentId == 'a68' || pane.agentId == 'a69'),
- isFalse,
- );
- search.clearChecked();
- search.toggle();
- expect(search.checkedCount, 1);
- search.setQuery('Agent 68');
- expect(search.canToggle(search.selected!), isFalse);
- },
- );
-
- test('group and individual selections deduplicate by machine and agent', () {
- final app = createApp();
- addTearDown(app.dispose);
- app.adoptSessionForTest(terminal('a0', []));
- app.adoptSessionForTest(terminal('a1', []));
- final source = app.activeSwarm;
- app.newSwarm();
- final search = SwarmSearchController(app, [], adding: true);
- addTearDown(search.dispose);
- search.setQuery('Agent 0');
- search.toggle();
- search.setQuery('');
- final group = search.rows.singleWhere(
- (row) => row.id == swarmDestinationId(source.id),
- );
- search.toggle(group);
- expect(search.checked.map((row) => row.agentId), ['a0', 'a1']);
- expect(search.isChecked(group), isTrue);
- search.toggle(group);
- expect(search.checked, isEmpty);
- expect(app.panes, isEmpty);
- });
-
- testWidgets('checkbox and keyboard selection share one list across queries', (
- tester,
- ) async {
- final app = createApp();
- final input = <TerminalBinaryFrame>[];
- final first = app.adoptSessionForTest(terminal('a0', input));
- final second = app.adoptSessionForTest(terminal('a1', input));
- final source = app.activeSwarm;
- app.newSwarm();
- final target = app.activeSwarm;
- await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
- await tester.pump();
- final field = find.byKey(const ValueKey('swarm-search-input'));
- await tester.enterText(field, 'Agent 0');
- await tester.pump();
- expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
- expect(
- find.byKey(const ValueKey('swarm-search-new-agent')),
- findsOneWidget,
- );
- expect(
- tester.widget(find.byKey(const ValueKey('swarm-search-new-agent'))),
- isA<FilledButton>(),
- );
- await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
- await tester.pump();
- expect(find.text('1 selected'), findsOneWidget);
- expect(target.panes, isEmpty);
- await tester.enterText(field, 'Agent 1');
- await tester.pump();
- await tester.tap(
- find.byKey(ValueKey('select:${agentDestinationId('m', 'a1')}')),
- );
- await tester.pump();
- expect(find.text('2 selected'), findsOneWidget);
- expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
- await tester.tap(find.byTooltip('Remove Agent 0'));
- await tester.pump();
- expect(find.text('1 selected'), findsOneWidget);
- await tester.enterText(field, 'Agent 0');
- await tester.pump();
- await tester.tap(
- find.byKey(ValueKey('select:${agentDestinationId('m', 'a0')}')),
- );
- await tester.pump();
- await tester.enterText(field, 'no results here');
- await tester.pump();
- expect(find.text('Open 2 agents'), findsOneWidget);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pump();
- expect(target.panes, [second, first]);
- expect(source.panes, [first, second]);
- expect(app.activeSwarm, same(target));
- expect(input, isEmpty);
- expect(tester.takeException(), isNull);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
-}
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
new file mode 100644
index 000000000..5579d1779
--- /dev/null
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -0,0 +1,103 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/terminal/terminal_binary.dart';
+import 'package:harness/state/swarm_navigation.dart';
+
+import 'swarm_screen_test.dart' show mount, terminal;
+import 'swarm_state_test.dart' show createApp;
+import 'swarm_interactions_test.dart' show chord;
+
+void main() {
+ testWidgets('Command-N opens Add and Shift-Command-N creates a fresh agent', (
+ tester,
+ ) async {
+ final app = createApp();
+ final input = <TerminalBinaryFrame>[];
+ final pane = app.adoptSessionForTest(terminal('a0', input));
+ await mount(tester, app);
+ await chord(tester, LogicalKeyboardKey.keyN);
+ final field = find.byKey(const ValueKey('swarm-search-input'));
+ final create = find.byKey(const ValueKey('swarm-search-new-agent'));
+ expect(field, findsOneWidget);
+ expect(find.byType(AlertDialog), findsNothing);
+ expect(
+ tester.getRect(create).center.dy,
+ closeTo(tester.getRect(field).center.dy, 1),
+ );
+ expect(tester.getRect(create).width, greaterThanOrEqualTo(148));
+ expect(app.panes, [pane]);
+ await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(find.text('Create on Test host'), findsOneWidget);
+ expect(app.panes, [pane]);
+ expect(input, isEmpty);
+ await tester.tap(find.text('Cancel'));
+ await tester.pump();
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+ for (final activate in ['click', 'enter']) {
+ testWidgets('$activate opens one existing agent immediately in this tab', (
+ tester,
+ ) async {
+ final app = createApp();
+ final input = <TerminalBinaryFrame>[];
+ final existing = terminal('a0', input);
+ app.adoptSessionForTest(existing);
+ final source = app.activeSwarm;
+ app.newSwarm();
+ final target = app.activeSwarm;
+ await mount(tester, app);
+ await chord(tester, LogicalKeyboardKey.keyN);
+ final field = find.byKey(const ValueKey('swarm-search-input'));
+ await tester.enterText(field, 'Agent 0');
+ await tester.pump();
+ expect(find.byType(Checkbox), findsNothing);
+ expect(app.panes, isEmpty);
+ expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
+ if (activate == 'click') {
+ await tester.tap(find.byKey(ValueKey(agentDestinationId('m', 'a0'))));
+ } else {
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ }
+ await tester.pump();
+ expect(field, findsNothing);
+ expect(app.activeSwarm, same(target));
+ expect(target.panes, hasLength(1));
+ expect(target.panes.single.session, same(existing));
+ expect(source.panes, hasLength(1));
+ expect(input, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+ }
+ testWidgets(
+ 'a recent harness opens here and stays deduplicated across tabs',
+ (tester) async {
+ final app = createApp();
+ final input = <TerminalBinaryFrame>[];
+ final existing = terminal('a0', input);
+ app.adoptSessionForTest(existing);
+ app.newSwarm();
+ final target = app.activeSwarm;
+ await mount(tester, app);
+ final recent = find.byKey(
+ ValueKey('welcome-recent:${agentDestinationId('m', 'a0')}'),
+ );
+ expect(recent, findsOneWidget);
+ await tester.tap(recent);
+ await tester.pump();
+ expect(app.activeSwarm, same(target));
+ expect(target.panes.single.session, same(existing));
+ app.newSwarm();
+ await tester.pump();
+ expect(recent, findsOneWidget);
+ expect(app.activeSwarm.panes, isEmpty);
+ expect(input, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
+}
diff --git a/desktop/test/swarm_reopen_test.dart b/desktop/test/swarm_reopen_test.dart
index c8bee28e1..751f35926 100644
--- a/desktop/test/swarm_reopen_test.dart
+++ b/desktop/test/swarm_reopen_test.dart
@@ -175,7 +175,7 @@ void main() {
expect(app.swarms, hasLength(AppNotifier.maxSwarms));
await app.closeSwarm(app.activeSwarmId);
app.reopenClosedSwarm();
- expect(app.activeSwarm.name, 'New Agent');
+ expect(app.activeSwarm.name, 'New Harness');
// Free slots directly without adding newer close records to this check.
app.swarms.removeRange(1, app.swarms.length);
app.selectSwarm(app.swarms.single.id);
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 5a9143f92..be5784f38 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -79,8 +79,8 @@ void main() {
final app = createApp();
final tab = app.activeSwarm;
await mount(tester, app, nativeTabs: native);
- expect(tab.name, 'New Agent');
- expect(find.text('New Agent'), findsWidgets);
+ expect(tab.name, 'New Harness');
+ expect(find.text('New Harness'), findsWidgets);
await app.addAgentToSwarm('m', 'a0');
await tester.pump();
@@ -168,7 +168,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- expect(find.text('New Agent'), findsWidgets);
+ expect(find.text('New Harness'), findsWidgets);
expect(find.text('Models'), findsNothing);
expect(find.text('Machines'), findsNothing);
await tester.tap(
diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dart
index 416897bbb..60bc8cd23 100644
--- a/desktop/test/swarm_search_render_test.dart
+++ b/desktop/test/swarm_search_render_test.dart
@@ -151,9 +151,7 @@ void main() {
final oldRow = first.selected!;
expect(oldRow.agentId, 'a0');
expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);
- first.toggle();
await tester.pump();
- expect(first.checkedCount, 1);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
session.terminal.write('Newest useful output.\r\n');
@@ -163,7 +161,6 @@ void main() {
await tester.enterText(field, 'Agent 0');
await tester.pump();
final next = inputWidget().search!;
- expect(next.checkedCount, 0);
expect(find.textContaining('Newest useful output.'), findsNothing);
expect(next.selected, same(oldRow));
expect(machine.projectReads, 0, reason: 'Agent metadata did not change');
@@ -302,27 +299,24 @@ void main() {
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
- final row = find.byKey(ValueKey(agentDestinationId('m', 'a0')));
- final checkbox = find.byKey(
- ValueKey('select:${agentDestinationId('m', 'a0')}'),
- );
- await tester.tap(checkbox);
- await tester.pump();
- expect(tester.widget<Checkbox>(checkbox).value, isTrue);
+ final search = tester
+ .widget<SwarmSearchInput>(
+ find.ancestor(of: field, matching: find.byType(SwarmSearchInput)),
+ )
+ .search!;
+ final row = find.byKey(ValueKey(search.selected!.id));
+ expect(find.byType(Checkbox), findsNothing);
+ expect(tester.widget<ListTile>(row).selected, isTrue);
final height = tester.getSize(row).height;
grid.AppTheme.palette.value = HarnessPalette.ember;
await tester.pump();
- expect(
- tester.widget<Checkbox>(checkbox).activeColor,
- HarnessPalette.ember.accent,
- );
- expect(tester.widget<Checkbox>(checkbox).value, isTrue);
+ expect(tester.widget<ListTile>(row).selected, isTrue);
tester.platformDispatcher.textScaleFactorTestValue = 2;
await tester.pump();
expect(tester.getSize(row).height, greaterThan(height));
expect(tester.widget<TextField>(field).controller!.text, 'Agent');
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
- expect(find.text('1 selected'), findsOneWidget);
+ expect(tester.widget<ListTile>(row).selected, isTrue);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dart
index cb5da9f3b..6b2b7cec2 100644
--- a/desktop/test/swarm_search_test.dart
+++ b/desktop/test/swarm_search_test.dart
@@ -332,7 +332,7 @@ void main() {
for (final adding in [false, true]) {
testWidgets(
- 'Return waits for composing text in ${adding ? 'Add' : 'New Agent'}',
+ 'Return waits for composing text in ${adding ? 'Add' : 'New Harness'}',
(tester) async {
final app = createApp();
app.adoptSessionForTest(terminal('a0', []));
diff --git a/desktop/test/swarm_state_test.dart b/desktop/test/swarm_state_test.dart
index 905b7a1e9..208bba51c 100644
--- a/desktop/test/swarm_state_test.dart
+++ b/desktop/test/swarm_state_test.dart
@@ -58,27 +58,29 @@ AppNotifier createApp({
}
void main() {
- test(
- 'old empty swarm names restore as tabs and still name the first agent',
- () async {
- final store = MemoryStore();
- final original = createApp(store: store);
- original.renameSwarm(original.activeSwarmId, 'New swarm');
- await original.flushPaneLayout();
- // Retain the old payload exactly as previous versions wrote it.
- expect(
- store.values.values.any((value) => value.contains('New swarm')),
- isTrue,
- );
- original.dispose();
- final restored = createApp(store: store);
- addTearDown(restored.dispose);
- await restored.restorePaneLayoutForTest();
- expect(restored.activeSwarm.name, 'New Agent');
- await restored.addAgentToSwarm('m', 'a0');
- expect(restored.activeSwarm.name, 'Agent 0');
- },
- );
+ for (final legacy in ['New swarm', 'New tab', 'New Agent']) {
+ test(
+ '$legacy empty tabs restore as New Harness and still name the first agent',
+ () async {
+ final store = MemoryStore();
+ final original = createApp(store: store);
+ original.renameSwarm(original.activeSwarmId, legacy);
+ await original.flushPaneLayout();
+ // Retain the old payload exactly as previous versions wrote it.
+ expect(
+ store.values.values.any((value) => value.contains(legacy)),
+ isTrue,
+ );
+ original.dispose();
+ final restored = createApp(store: store);
+ addTearDown(restored.dispose);
+ await restored.restorePaneLayoutForTest();
+ expect(restored.activeSwarm.name, 'New Harness');
+ await restored.addAgentToSwarm('m', 'a0');
+ expect(restored.activeSwarm.name, 'Agent 0');
+ },
+ );
+ }
test(
'first agent names a swarm and survives closing and reopening',
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 23a137df4..db9d19257 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -58,7 +58,7 @@ void main() {
}
final opened = app.activeSwarm;
expect(opened, isNot(same(original)));
- expect(opened.name, 'New Agent');
+ expect(opened.name, 'New Harness');
expect(opened.panes, isEmpty);
expect(find.byType(AlertDialog), findsNothing);
final field = find.byKey(const ValueKey('swarm-welcome-search-input'));
@@ -108,7 +108,7 @@ void main() {
expect(harnessCommandById['agent.new']!.label, 'Create Agent');
await tester.tap(find.byKey(const ValueKey('command:swarm.new')));
await tester.pump();
- expect(app.activeSwarm.name, 'New Agent');
+ expect(app.activeSwarm.name, 'New Harness');
expect(app.panes, isEmpty);
expect(app.allPanes, contains(pane));
expect(
diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dart
index 9766f2c6d..f541e2e13 100644
--- a/desktop/test/terminal_panel_presentation_test.dart
+++ b/desktop/test/terminal_panel_presentation_test.dart
@@ -1,8 +1,11 @@
import 'package:flutter/material.dart';
+import 'package:flutter/gestures.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'package:harness/widgets/terminal_panel.dart';
+import 'package:harness/widgets/pane_header_actions.dart';
+import 'package:xterm/xterm.dart';
import 'swarm_screen_test.dart' show terminal;
import 'swarm_state_test.dart' show createApp;
@@ -17,6 +20,7 @@ void main() {
final closed = <int>[];
final deleted = <int>[];
final zoomed = <int>[];
+ final composed = <int>[];
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(1100, 700);
addTearDown(tester.view.reset);
@@ -33,6 +37,7 @@ void main() {
onDelete: () => deleted.add(version),
onToggleZoom: () => zoomed.add(version),
zoomed: version >= 2,
+ onToggleComposer: () => composed.add(version),
),
),
),
@@ -40,6 +45,12 @@ void main() {
await tester.pump();
revision.value = 1;
await tester.pump();
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(
+ location: tester.getCenter(find.text(session.agentName)),
+ );
+ await tester.pump(const Duration(milliseconds: 120));
+ await tester.tap(find.byTooltip('Show message composer'));
await tester.tap(find.byTooltip('Zoom ${session.agentName}'));
await tester.tap(find.byTooltip('Delete agent'));
await tester.tap(find.byTooltip('Close pane'));
@@ -47,6 +58,7 @@ void main() {
expect(closed, [1]);
expect(deleted, [1]);
expect(zoomed, [1]);
+ expect(composed, [1]);
session.agentName = 'Renamed terminal';
app.machineStates['m']!.agents = [
const Agent(
@@ -65,7 +77,7 @@ void main() {
await tester.pump();
expect(find.text('Renamed terminal'), findsOneWidget);
expect(find.text('fast-focus'), findsOneWidget);
- expect(find.byTooltip('fast-focus\n/work/terminal'), findsOneWidget);
+ expect(find.text('terminal'), findsOneWidget);
expect(find.byTooltip('Restore agents'), findsOneWidget);
session.status = TerminalSessionStatus.takenOver;
revision.value = 3;
@@ -77,10 +89,102 @@ void main() {
),
findsOneWidget,
);
+ await mouse.removePointer();
await tester.pumpWidget(const SizedBox());
revision.dispose();
session.dispose();
app.dispose();
},
);
+ for (final local in [true, false]) {
+ testWidgets(
+ '${local ? 'local' : 'remote'} header swaps details for actions without moving its title',
+ (tester) async {
+ final app = createApp();
+ app.stateOf('m')!.localOnly = local;
+ app.stateOf('m')!.agents = [
+ const Agent(
+ id: 'a0',
+ name: 'Onboarding',
+ engine: 'codex',
+ terminalAvailable: true,
+ project: AgentProject(
+ name: 'Harness project',
+ cwd: '/work/harness',
+ branch: 'main',
+ ),
+ ),
+ ];
+ final session = terminal('a0', []);
+ session.agentName = 'Onboarding';
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(720, 300);
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: TerminalPanel(
+ notifier: app,
+ session: session,
+ focused: false,
+ compactHeader: true,
+ onClose: () {},
+ onDelete: () {},
+ onToggleZoom: () {},
+ onToggleComposer: () {},
+ ),
+ ),
+ );
+ await tester.pump();
+ final title = find.text('Onboarding');
+ final details = find.byKey(const ValueKey('pane-header-details'));
+ final controls = find.byType(PaneHeaderActions);
+ final terminalWidget = tester.widget<TerminalView>(
+ find.byType(TerminalView),
+ );
+ final titleBounds = tester.getRect(title);
+ expect(tester.widget<AnimatedOpacity>(details).opacity, 1);
+ expect(find.text('harness'), findsOneWidget);
+ expect(find.text('main'), findsOneWidget);
+ expect(
+ tester.getRect(find.text('harness')).left,
+ greaterThan(titleBounds.right),
+ );
+ expect(
+ tester.getRect(find.text('main')).left,
+ greaterThan(tester.getRect(find.text('harness')).right),
+ );
+ expect(
+ tester.getRect(find.text('Test host')).left,
+ greaterThan(tester.getRect(find.text('main')).right),
+ );
+ expect(find.byTooltip('Delete agent').hitTestable(), findsNothing);
+ expect(
+ find.descendant(of: controls, matching: find.byType(IconButton)),
+ findsNWidgets(local ? 3 : 4),
+ );
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: tester.getCenter(title));
+ await tester.pump(const Duration(milliseconds: 120));
+ expect(tester.widget<AnimatedOpacity>(details).opacity, 0);
+ expect(find.byTooltip('Delete agent').hitTestable(), findsOneWidget);
+ expect(tester.getRect(title), titleBounds);
+ expect(
+ tester.widget<TerminalView>(find.byType(TerminalView)),
+ same(terminalWidget),
+ );
+ await mouse.moveTo(const Offset(300, 200));
+ await tester.pump(const Duration(milliseconds: 120));
+ expect(tester.widget<AnimatedOpacity>(details).opacity, 1);
+ expect(find.byTooltip('Delete agent').hitTestable(), findsNothing);
+ // Keyboard users can reveal and reach the same actions without a mouse.
+ Focus.of(tester.element(find.byTooltip('Delete agent'))).nextFocus();
+ await tester.pump(const Duration(milliseconds: 120));
+ expect(find.byTooltip('Delete agent').hitTestable(), findsOneWidget);
+ await mouse.removePointer();
+ await tester.pumpWidget(const SizedBox());
+ session.dispose();
+ app.dispose();
+ },
+ );
+ }
}
diff --git a/desktop/test/welcome_entry_layout_test.dart b/desktop/test/welcome_entry_layout_test.dart
index b9c34a192..8bd1cb469 100644
--- a/desktop/test/welcome_entry_layout_test.dart
+++ b/desktop/test/welcome_entry_layout_test.dart
@@ -10,6 +10,9 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'support/real_fonts.dart';
import 'swarm_state_test.dart' show createApp;
+import 'swarm_screen_test.dart' show terminal;
+
+import 'package:harness/core/models.dart';
void main() {
setUpAll(() async {
@@ -21,16 +24,35 @@ void main() {
for (final (width, height, scale) in [
(1280.0, 800.0, 1.0),
(760.0, 900.0, 1.0),
+ (880.0, 560.0, 1.0),
(600.0, 900.0, 1.7),
]) {
testWidgets(
- 'two welcome actions remain usable at $width with text scale $scale',
+ 'centered start and recent harnesses remain usable at $width with text scale $scale',
(tester) async {
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = Size(width, height);
addTearDown(tester.view.reset);
final app = createApp();
app.machineStates['m']!.nodeOnline = true;
+ for (var i = 0; i < 6; i++) {
+ final name = [
+ 'Harness desktop',
+ 'NYC chess set',
+ 'Marketing',
+ 'Landing page',
+ 'Training H1',
+ 'New onboarding',
+ ][i];
+ app.machineStates['m']!.agents[i] = Agent(
+ id: 'a$i',
+ name: name,
+ engine: i.isEven ? 'codex' : 'claude',
+ terminalAvailable: true,
+ );
+ app.adoptSessionForTest(terminal('a$i', []));
+ }
+ app.newSwarm();
final boundaryKey = GlobalKey();
await tester.pumpWidget(
RepaintBoundary(
@@ -47,26 +69,25 @@ void main() {
),
);
await tester.pumpAndSettle();
- final findCard = find.byKey(const ValueKey('welcome-find-agent'));
- final createCard = find.byKey(const ValueKey('welcome-create-agent'));
final field = find.byKey(const ValueKey('swarm-welcome-search-input'));
- expect(find.text('Find an agent'), findsOneWidget);
- expect(find.text('Create a new agent'), findsOneWidget);
- expect(find.text('Machines'), findsNothing);
- expect(find.text('Projects'), findsNothing);
+ final create = find.byKey(const ValueKey('swarm-start-primary'));
+ expect(find.text('Find a harness…'), findsOneWidget);
+ expect(find.text('Create harness'), findsOneWidget);
+ expect(find.text('Recent harnesses'), findsOneWidget);
+ expect(find.byType(Checkbox), findsNothing);
expect(
find.byKey(const ValueKey('swarm-add-agent-button')),
findsNothing,
);
- final findRect = tester.getRect(findCard);
- final createRect = tester.getRect(createCard);
- if (width == 1280) {
+ final findRect = tester.getRect(field);
+ final createRect = tester.getRect(create);
+ if (width == 1280 || width == 880) {
expect(createRect.left, greaterThan(findRect.right));
- expect(createRect.top, findRect.top);
- expect(createRect.height, closeTo(findRect.height, 1));
+ expect(createRect.center.dy, closeTo(findRect.center.dy, 1));
} else {
expect(createRect.top, greaterThan(findRect.bottom));
}
+ expect(create.hitTestable(), findsOneWidget);
expect(tester.takeException(), isNull);
final output = Platform.environment['HARNESS_WELCOME_CAPTURE_DIR'];
if (output != null) {
@@ -91,6 +112,7 @@ void main() {
const ValueKey('swarm-welcome-search-results'),
);
expect(results, findsOneWidget);
+ expect(tester.getRect(results).height, greaterThan(140));
expect(tester.getRect(results).width, tester.getRect(field).width);
expect(
find.byKey(const ValueKey('swarm-search-preview')),
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 65be0d4af..044c155da 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -111,7 +111,7 @@ private extension SwarmTabStrip {
try checkTitlebar(tabs[0].showsDivider && tabs[1].showsDivider, "Separators return when the pointer leaves")
try checkTitlebar(!tabs[10].showsDivider && !tabs[11].showsDivider, "Selected tab remains joined without neighboring separators")
try checkTitlebar(tabs.count == 24, "All overflow tabs exist")
- try checkTitlebar(!newButton.isEnabled, "New Agent is disabled at capacity")
+ try checkTitlebar(!newButton.isEnabled, "New Harness is disabled at capacity")
for (index, tab) in tabs.enumerated() {
try tab.checkAccessibility(expectedName: "Swarm \(index)", active: index == 11)
}
@@ -149,9 +149,9 @@ private extension SwarmTabStrip {
update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0"))
try checkTitlebar(tabs.count == 1 && tabs[0] === original, "Closing tabs retains the surviving control")
try original.checkAccessibility(expectedName: "Renamed tab", active: true)
- try checkTitlebar(newButton.isEnabled, "New Agent returns below capacity")
- try checkTitlebar(newButton.toolTip?.contains("⌘T") == true, "New Agent advertises its keyboard shortcut")
- try checkTitlebar(newButton.frame.maxX < notificationButton.frame.minX, "New Agent and the bell have separate targets")
+ try checkTitlebar(newButton.isEnabled, "New Harness returns below capacity")
+ try checkTitlebar(newButton.toolTip?.contains("⌘T") == true, "New Harness advertises its keyboard shortcut")
+ try checkTitlebar(newButton.frame.maxX < notificationButton.frame.minX, "New Harness and the bell have separate targets")
try checkTitlebar(!subviews.contains(where: { $0 is NSTextField }), "The titlebar has no competing text editor")
events.removeAll()
newButton.performClick(nil)
@@ -413,8 +413,8 @@ private extension SwarmTitlebar {
"The menu yields the remapped search shortcut to Flutter")
try checkTitlebar(!main.performKeyEquivalent(with: open), "Menu equivalents defer before input dispatch")
setKeymap(defaults)
- try checkTitlebar(strip.newButton.toolTip == "New Agent (⌘T)", "Reload refreshes the New Agent button hint")
- try checkTitlebar(strip.newButton.accessibilityLabel() == "New Agent", "The plus announces New Agent")
+ try checkTitlebar(strip.newButton.toolTip == "New Harness (⌘T)", "Reload refreshes the New Harness button hint")
+ try checkTitlebar(strip.newButton.accessibilityLabel() == "New Harness", "The plus announces New Harness")
try checkTitlebar(!main.defersToInput(event("p", 35, .command)), "Command-P no longer opens Navigate")
try checkTitlebar(main.defersToInput(event("p", 35, [.command, .shift])), "Command-Shift-P reaches command search")
flutterKeyContext = "picker"
@@ -468,12 +468,12 @@ private extension SwarmTitlebar {
try strip.checkStartupPalette(startupPalette)
try checkTitlebar(window.firstResponder === window.contentViewController,
"Adding toolbar buttons does not take initial keyboard focus from the workspace")
- try checkTitlebar(main.items.map(\.title) == ["Harness", "Agent", "Edit", "View", "History", "Models", "Window", "Help"], "Agent leads the standard macOS menus without a separate Swarm menu")
+ try checkTitlebar(main.items.map(\.title) == ["Harness", "File", "Edit", "View", "History", "Models", "Machines", "Window", "Help"], "File leads the standard macOS menus, with Machines after Models")
let settings = appItem.submenu!.items[0]
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
- let agent = main.item(withTitle: "Agent")!.submenu!
+ let agent = main.item(withTitle: "File")!.submenu!
let historyMenu = main.item(withTitle: "History")!.submenu!
- try checkTitlebar(agent.items.compactMap { $0.representedObject as? String } == ["new", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "renameActive", "closePane", "closeActive", "linkMachine", "addProject"], "Agent groups tab, creation and pane actions without changing their command identities")
+ try checkTitlebar(agent.items.compactMap { $0.representedObject as? String } == ["new", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "renameActive", "closePane", "closeActive", "addProject"], "File groups tab, creation and pane actions without changing their command identities")
let addAgent = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!
let newAgent = agent.items.first(where: { $0.representedObject as? String == "newAgent" })!
try checkTitlebar(addAgent.keyEquivalent == "n" && addAgent.keyEquivalentModifierMask == [.command], "Command-N opens the shared Add agent picker")
@@ -481,7 +481,7 @@ private extension SwarmTitlebar {
let commands = edit.submenu!.items.first(where: { $0.representedObject as? String == "commands" })!
try checkTitlebar(commands.keyEquivalent == "p" && commands.keyEquivalentModifierMask == [.command, .shift], "Command search keeps its native menu owner")
try checkTitlebar(edit.submenu!.items.allSatisfy { $0.representedObject as? String != "jump" }, "Edit has no Navigate action")
- try checkTitlebar(agent.items.first?.title == "New Agent" && newAgent.title == "Create Agent…", "New Agent opens the chooser while Create Agent opens the creation form")
+ try checkTitlebar(agent.items.first?.title == "New Harness" && newAgent.title == "Create Agent…", "New Harness opens the chooser while Create Agent opens the creation form")
let reopen = historyMenu.items.first(where: { $0.representedObject as? String == "reopen" })!
actionsEnabled = true
canReopen = false
@@ -498,6 +498,38 @@ private extension SwarmTitlebar {
try checkTitlebar(!validateMenuItem(create), "Native New Swarm respects the tab capacity")
canCreateSwarm = true
try checkTitlebar(validateMenuItem(create), "Native New Swarm returns below capacity")
+ let machineRows: [[String: Any]] = [
+ ["id": "office", "name": "iMac – Office", "status": "Online", "local": true],
+ ["id": "home", "name": "iMac – Home", "status": "Offline", "local": false],
+ ]
+ updateMachines(machineRows)
+ let machineMenu = main.item(withTitle: "Machines")!.submenu!
+ let destinations = machineMenu.items.filter { $0.action == #selector(machineAction(_:)) }
+ try checkTitlebar(destinations.map { $0.representedObject as? String } == ["office", "home"],
+ "Machines lists each linked computer as a destination")
+ try checkTitlebar(destinations[0].attributedTitle?.string.contains("Online") == true &&
+ destinations[1].attributedTitle?.string.contains("Offline") == true,
+ "Machine availability is visible before opening its agent search")
+ try checkTitlebar(machineMenu.items.compactMap { $0.representedObject as? String }.suffix(2) == ["linkMachine", "refreshMachines"],
+ "Machines exposes Link and Refresh after the computer list")
+ let machineCallCount = messenger.calls.count
+ machineAction(destinations[0])
+ try checkTitlebar(messenger.calls.count == machineCallCount + 1 &&
+ messenger.calls.last?.method == "machineDestination" &&
+ (messenger.calls.last?.arguments as? [String: String])?["id"] == "office",
+ "A computer sends its stable id to the shared agent search")
+ actionsEnabled = false
+ machineAction(destinations[1])
+ try checkTitlebar(!validateMenuItem(destinations[1]) && messenger.calls.count == machineCallCount + 1,
+ "A modal blocks machine destinations")
+ actionsEnabled = true
+ updateMachines(machineRows)
+ try checkTitlebar(machineMenu.items.contains(where: { $0 === destinations[0] }),
+ "Unchanged machine data retains menu controls")
+ updateMachines([])
+ try checkTitlebar(!validateMenuItem(destinations[0]) &&
+ machineMenu.item(withTitle: "No Machines Linked")?.isEnabled == false,
+ "Unlinking computers clears destinations and invalidates stale actions")
let recentRows: [[String: Any]] = (0..<20).map { index -> [String: Any] in
["id": "agent:\(index)", "title": "Agent \(index) — Machine",
"detail": "Project \(index)", "current": index == 0,
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index f528b716a..0f0297b8c 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -1,42 +1,68 @@
-# Agent-first entry
+# Harness entry and pane controls
-Users start with an agent and group agents when useful. A tab holds one or
-several agents without a separate swarm creation flow.
+Users start with one harness immediately and add panes when useful. A tab holds
+one or several agents without a selection basket or a separate group-creation step.
+This is the latest product direction; it supersedes earlier swarm and multi-select
+proposals in the progress log.
-## New Agent
+## New Harness
-The plus button and Cmd-T open **New Agent**, a new tab that lets the user
-choose existing work or create a fresh agent. First launch uses this same page.
+The tab-bar plus and Cmd-T open **New Harness**. First launch and every empty tab
+use the same centered page: a **New Harness** heading, a **Find a harness…** search
+field, a prominent **Create harness** button, and up to six recent harnesses below.
+Search and Create sit together on desktop and stack on narrow or large-text layouts.
+Recent shortcuts use existing navigation history, with open/restored sessions as
+fallbacks. They are deduplicated by machine and agent, even across several tabs.
-The welcome page has exactly two sections:
+A click or Enter on a search result opens it immediately in the current tab and
+reuses its runtime. A recent shortcut does the same. There is no checkbox,
+selection count, Shift-Enter staging, or second confirmation step. Machine and
+project groups remain searchable as a single starting-point choice. A new user
+can still choose a folder first; linking, discovery, offline retry and the existing
+creation recovery remain available.
-- **Find an agent**: a focused search field for agents, machines, and projects.
-- **Create a new agent**: a **Create Agent** button opening the existing local-first
- machine, engine, and working-folder flow.
-
-Machine and project directories and recent-agent lists are removed from the
-welcome page. Machines and projects remain grouped search results. Search shows
-one full-width result list, without terminal output or group previews.
+**Add Agent** and split right/down use the same single-choice search and prominent
+**Create Agent** button. Canceling creation returns to the original query, text
+selection, highlighted row and split target. Success opens the agent directly.
+The new-tab page calls its creation entry **Create harness**; the existing form
+and pane operations still use agent terminology.
There is no Navigate action, compass button, or Cmd-P directory. Command search
remains on Shift-Cmd-P and stays in command mode when its query is cleared.
-Typing `>` in the agent search also finds commands.
-
-Selecting an existing agent opens it in the new tab and reuses its runtime.
-**Add Agent** and split right/down choose or create agents within the current tab.
-Actions that directly start a fresh agent are labeled **Create Agent**.
+Typing `>` in agent search also finds commands.
## Tabs and menus
One agent shows its engine mark; multiple agents use the group mark. Returning
to one restores the engine mark. Tab names remain editable. Former default names
-`New swarm` and `New tab` restore as `New Agent`.
+`New swarm`, `New tab`, and `New Agent` restore as `New Harness` and still take
+the first agent's name when opened.
-The macOS menus are **Harness, Agent, Edit, View, History, Models, Window, Help**.
-Agent contains New Agent, Add Agent, Create Agent, split and pane controls,
-Rename Tab, Close Agent Pane, Close Tab, Link Machine, and Add Project.
+The macOS menus are **Harness, File, Edit, View, History, Models, Machines,
+Window, Help**. File contains New Harness, Add Agent, Create Agent, split and
+pane controls, Rename Tab, Close Agent Pane, Close Tab, and Add Project.
+Machines lists linked computers with their status, followed by Link Machine
+and Refresh Machines. Selecting a computer opens the shared search with its
+name filled in; no agent is opened until the user chooses a result.
-Cmd-T opens New Agent, Cmd-N opens Add Agent, Shift-Cmd-N opens Create Agent,
+Cmd-T opens New Harness, Cmd-N opens Add Agent, Shift-Cmd-N opens Create Agent,
Cmd-W closes the tab, and Shift-Cmd-W closes the focused pane. Closing views
-keeps agent runtimes alive. The stored layout format and internal command IDs
-remain compatible; product language uses agents, tabs, and groups.
+keeps agent runtimes alive. Stored layout formats and internal command IDs remain
+compatible.
+
+## Pane chrome
+
+The left side contains only the agent icon and session name. The right side
+shows **folder • branch • machine**, omitting unavailable folder/branch data.
+Long details truncate, with full context in the session-name tooltip.
+
+Hovering anywhere on the header replaces the details with small, muted controls:
+**Zoom, Delete, Close**, with **Keyboard** first for remote sessions. Keyboard
+focus also reveals the controls. The title keeps the same space during the swap,
+and hovering retains the terminal renderer. Delete uses the existing confirmation;
+Close removes only this view. Keyboard toggles the remote message composer.
+
+Resize grips are invisible while idle and appear on divider hover, keyboard
+focus or active drag. Their hit targets and resize behavior stay the same. The
+right/bottom edge plus controls continue to open Add at that split position, and
+keyboard split commands remain available.
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index 90460bdde..a0926d07c 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -1,17 +1,18 @@
# Harness v2: goal, plan, and continuation handoff
-**Latest UI direction:** [Agent-first tabs](harness-agent-first-tabs.md) supersedes
-the swarm terminology in the historical notes below. First launch and New Tab
-offer existing-agent search alongside New agent. Single-agent tabs show engine
-icons; groups show the group icon. The macOS Agent menu now includes tab actions,
-with no separate Swarm menu. Existing creation, split and session behavior remains.
+**Latest UI direction:** [Harness entry and pane controls](harness-agent-first-tabs.md)
+is the current contract. **New Harness** is a centered search with recent harnesses
+and a prominent creation button. Pick one result and open it immediately; multi-select
+is removed. **File** replaces Agent in the macOS menu, and **Machines** follows Models.
+The latest header keeps icon/name left, folder/branch/machine right, swapping the
+right side for muted actions on hover. This supersedes older swarm/onboarding notes.
Updated September 14, 2026. **Read this first when resuming on another computer.**
This is the current product contract and next-work order. It supersedes conflicting
historical checkpoints in [the progress log](harness-v2-progress.md). The user
requested a portable checkpoint and later paused the broader goal pending a
breaking change. The goal remains unfinished and is currently blocked. The latest
-pane-header and hover-edge controls are separately authorized, bounded changes; wait for
+entry-page, picker, menu and pane-chrome changes are separately authorized; wait for
the user's instruction before resuming the broader backlog.
**Latest priority:** the user explicitly deferred native benchmarking and further
@@ -25,12 +26,13 @@ explicit Archive/Resume plus bulk cleanup, preserving ordinary view closure.
This is a proposal for discussion, not implemented behavior or authorization to
archive/delete existing user sessions.
-Pane headers now have three direct outline icons, in order: **Zoom**, **Delete
-agent**, **Close pane**. The overflow menu, split actions and pin control are gone
-from the header. Delete opens the existing confirmation; Close removes only this
-view and keeps the agent running. The native/menu close-view action is now
-**Close Agent Pane**. Narrow headers give the name priority over the branch
-label; the identity tooltip retains the branch and working folder.
+Pane headers show only the agent icon and session name on the left. The right
+side shows **folder • branch • machine**, replaced on header hover by **Zoom**,
+**Delete**, **Close**, with **Keyboard** first for remote sessions. These controls
+are small and muted, remain keyboard accessible and reserve the same width as
+the metadata. Delete uses the existing confirmation; Close preserves the runtime.
+The session tooltip retains full metadata when a narrow header truncates it.
+Divider grips are invisible until hover, keyboard focus or resize drag.
Hover near a pane's right or bottom edge to reveal an inset **+** for that
direction. Clicking it opens the shared Add Agent picker, supporting an existing
@@ -38,8 +40,8 @@ agent or **Create Agent** in the chosen position. Keyboard split commands remain
available. Hover does not change focus or rebuild the terminal; the resize gaps
remain draggable. Controls stay hidden while zoomed or dragging, and a pane too
small for the chosen split explains the required width/height in its tooltip.
-This was integrated after the team's agent-first update on main (`16716d0`).
-Twenty-four affected checks pass, with no analyzer errors or warnings. The arm64
+The preceding edge-control checkpoint was integrated after the team's agent-first
+update on main (`16716d0`). Its twenty-four affected checks passed, with no analyzer errors or warnings. The arm64
Release build was reopened from the exact workspace bundle at the user's request
and confirmed active (PID 18687). Recheck the process before future app actions;
this does not verify native latency. Log: `/private/tmp/harness-split-edges-release.log`.
@@ -66,13 +68,13 @@ query back to Add and retains its original swarm/split. A closed swarm or change
split gets an explanation instead of redirecting the addition. A background
empty tab cannot take focus from the open creation dialog.
-Opening **New agent** from centered Add or either split now preserves that
-picker for cancellation. Cancel/Escape restores the query, text selection,
-highlighted result, checked agents and original split. **Find existing agent…**
-also preserves that draft. A successful creation leaves Add closed. Cancel does
-not return to a swarm that is no longer current; stale splits get an explanation.
-Returning revalidates membership/capacity and keeps unavailable checked agents
-visible for removal. This is an in-memory picker draft, not saved creation intent.
+Opening **Create Agent** from centered Add or either split preserves that picker
+for cancellation. Cancel/Escape restores the query, text selection, highlighted
+result and original split. **Find existing agent…** also preserves that draft.
+A successful creation leaves Add closed. Cancel does not return to a tab that is
+no longer current; stale splits get an explanation. There is no multi-select or
+checked-agent draft anymore. This remains in-memory search recovery, not a saved
+creation intent.
Browser sign-in now offers **Open browser**, **Copy link** and immediate **Cancel**
while waiting for authorization. Reopening uses the current link without starting
diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.md
index 6289a3cc1..92a70973e 100644
--- a/docs/harness-v2-progress.md
+++ b/docs/harness-v2-progress.md
@@ -6,6 +6,23 @@ Updated 2026-09-14 after integrating the continuation into main. This is a worki
## Continue directly on main
+- Applied the latest simple-entry direction: **New Harness** replaces New Agent
+ on empty tabs. The centered start page has **Find a harness…**, a prominent
+ **Create harness** action, and up to six recent shortcuts, with responsive
+ layouts. Opening a recent or search result immediately reuses that runtime.
+ Removed multi-select checkboxes, selection count/tray and Shift-Enter staging
+ from shared Add; creation cancellation retains query/highlight/target.
+ **File** replaces Agent, with **Machines** after Models for computer status,
+ search, linking and refresh. The header now has icon/name left and
+ folder/branch/machine right; hover swaps the right side for muted Zoom,
+ Delete and Close, with Keyboard first remotely. The title and terminal stay
+ fixed during hover, and resize grips only appear on hover/focus/drag.
+ Focused Flutter workflow checks and 204 native menu/keyboard checks pass;
+ real-font renders cover the welcome page and 280/430/720px headers at normal
+ and large text. Analysis reports zero errors/warnings and 14 existing infos.
+ Logs: `/private/tmp/harness-new-harness-*.log` and
+ `/private/tmp/harness-header-render.log`. The next bounded request is to make
+ Command-number select tabs; build/reopen follows that keyboard change.
- Added hover split controls inside the right and bottom pane edges. Each **+**
opens shared Add Agent at that position; existing-agent reuse and Create Agent
both remain available. Headers retain only Zoom, Delete and Close. Hover is