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.

Restore separate New Agent and Open Agent actions

deeaa327c099004
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 69b2a867c..5190d1dc3 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -42,6 +42,7 @@ import '../widgets/swarm_search_input.dart';
import '../widgets/swarm_attention.dart';
import '../widgets/swarm_switcher.dart';
import '../widgets/swarm_wallpaper.dart';
+import '../widgets/agent_action_icons.dart';
import '../widgets/swarm_icon.dart';
import '../widgets/task_palette.dart';
@@ -80,16 +81,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
final _searchCatalog = SwarmSearchCatalog();
final _searchText = TextEditingController();
final _searchFocus = FocusNode(debugLabel: 'Find an agent');
- final _creationFocus = FocusNode(debugLabel: 'New agent choices');
- final _inlineCreationFocus = FocusNode(
- debugLabel: 'New Harness agent choices',
- );
- int _inlineCreationRevision = 0;
- String? _creationMachineId, _creationFolder;
- bool _creationBusy = false;
SwarmSearchController? _search;
OverlayEntry? _searchOverlay;
- (String, bool, bool)? _searchHeaderState;
+ (String, bool)? _searchHeaderState;
FocusNode? _searchReturnFocus;
(String, bool)? _lastWorkspace;
bool _spokenPaletteOpen = false;
@@ -145,9 +139,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
final current = ModalRoute.isCurrentOf(context) ?? true;
if (_routeIsCurrent == current) return;
_routeIsCurrent = current;
- if (!current && _search != null && !_creationBusy) {
+ if (!current && _search != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
- if (mounted && !_routeIsCurrent && !_creationBusy) {
+ if (mounted && !_routeIsCurrent) {
_closeSearch(restoreFocus: false);
}
});
@@ -167,8 +161,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
_searchOverlay?.dispose();
_search?.dispose();
_searchFocus.dispose();
- _creationFocus.dispose();
- _inlineCreationFocus.dispose();
_searchText.dispose();
_canvasFocus.dispose();
_shellFocus.dispose();
@@ -225,15 +217,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
bool get _shortcutsEnabled =>
- mounted &&
- _routeIsCurrent &&
- !_dialogOpen &&
- !_spokenPaletteOpen &&
- !_creationBusy;
+ mounted && _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen;
void _runShortcut(String id) {
- if (id == 'agent.new' && _search?.adding == true) {
- if (!_creationBusy) _creationFocus.requestFocus();
+ if (id == 'agent.new' && _search != null) {
+ final target = _search!.targetId;
+ final split = _search!.split;
+ _closeSearch(restoreFocus: false);
+ unawaited(_newAgent(swarmId: target, split: split));
return;
}
if (!_canExecuteCommand(id)) return;
@@ -246,7 +237,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
void _recordNavigation() {
_navigation.record(app);
if (_search != null &&
- !_creationBusy &&
(_search!.targetId != app.activeSwarmId ||
(_lastWorkspace?.$2 == true && app.panes.isNotEmpty))) {
_closeSearch(restoreFocus: false);
@@ -300,11 +290,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
void _syncNative() {
_syncMachines();
final payload = {
- 'enabled':
- _routeIsCurrent &&
- !_dialogOpen &&
- !_spokenPaletteOpen &&
- !_creationBusy,
+ 'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,
'activeId': app.activeSwarmId,
'canOpenNewTab': app.canOpenNewTab,
'palette': grid.AppTheme.palette.value.nativeColors,
@@ -463,7 +449,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
if (!mounted ||
- _creationBusy ||
_dialogOpen ||
_spokenPaletteOpen ||
ModalRoute.of(context)?.isCurrent == false) {
@@ -715,23 +700,41 @@ class _SwarmScreenState extends State<SwarmScreen> {
String? swarmId,
PaneSplitRequest? split,
}) async {
- if (swarmId != null && app.activeSwarmId != swarmId) return;
- if (_search?.adding == true) {
- if (!_creationBusy) _creationFocus.requestFocus();
- return;
- }
- _closeSearch(restoreFocus: false);
- if (app.panes.isEmpty) _searchReturnFocus = _shellFocus;
- _openSearch(
- adding: true,
- split: split,
- machineId: machineId,
- folder: folder,
- );
- await WidgetsBinding.instance.endOfFrame;
- if (mounted && _search?.adding == true && !_creationBusy) {
- _creationFocus.requestFocus();
- }
+ final target = swarmId ?? _search?.targetId ?? app.activeSwarmId;
+ final requestedSplit = split ?? _search?.split;
+ if (app.activeSwarmId != target) return;
+ final focused = requestedSplit == null ? null : app.focusedPane;
+ final machine = focused == null ? null : app.stateOf(focused.machineId);
+ final agent = machine?.agents
+ .where((agent) => agent.id == focused?.agentId)
+ .firstOrNull;
+ final id =
+ machineId ??
+ machine?.machine.machineId ??
+ app.machineStates.values
+ .where((machine) => machine.isLocalMachine)
+ .firstOrNull
+ ?.machine
+ .machineId ??
+ app.machineStates.keys.firstOrNull;
+ final initialFolder =
+ folder ?? (agent == null ? null : machine?.projectOf(agent)?.cwd);
+ await _dialog(() async {
+ if (id == null) {
+ await showSwarmLinkDialog(context, app);
+ return;
+ }
+ await showNewAgentDialog(
+ context,
+ app,
+ id,
+ source: 'swarm',
+ initialFolder: initialFolder,
+ swarmId: target,
+ split: requestedSplit,
+ );
+ }, restoreEntry: false);
+ await _ensureEmptyEntry();
}
Future<void> _splitAgent(PaneResizeAxis axis, {int? paneId}) async {
@@ -785,8 +788,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
bool adding = false,
PaneSplitRequest? split,
String query = '',
- String? machineId,
- String? folder,
}) {
if (_search != null ||
!mounted ||
@@ -795,22 +796,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
!_routeIsCurrent) {
return;
}
- final focused = split == null ? null : app.focusedPane;
- final machine = focused == null ? null : app.stateOf(focused.machineId);
- final agent = machine?.agents
- .where((agent) => agent.id == focused?.agentId)
- .firstOrNull;
- _creationMachineId =
- machineId ??
- machine?.machine.machineId ??
- app.machineStates.values
- .where((m) => m.isLocalMachine)
- .firstOrNull
- ?.machine
- .machineId ??
- app.machineStates.keys.firstOrNull;
- _creationFolder =
- folder ?? (agent == null ? null : machine?.projectOf(agent)?.cwd);
_searchReturnFocus ??= FocusManager.instance.primaryFocus == _searchFocus
? null
: FocusManager.instance.primaryFocus;
@@ -831,14 +816,13 @@ class _SwarmScreenState extends State<SwarmScreen> {
_search!.addListener(_syncSearch);
_searchOverlay = OverlayEntry(builder: _buildSearchOverlay);
Overlay.of(context).insert(_searchOverlay!);
- if (app.panes.isEmpty) setState(() {});
_syncSearch();
// The overlay and focus nodes update independently of the retained canvas.
_focusSearch();
}
void _focusSearch({bool selectAll = false}) {
- if (_search == null || _creationBusy) return;
+ if (_search == null) return;
_searchFocus.requestFocus();
if (selectAll) {
_searchText.selection = TextSelection(
@@ -866,7 +850,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
// Results listen to their controller directly. Rebuilding the entire
// overlay on every arrow also rebuilt the unchanged text editor/button.
- final header = (search.hint, search.canCreate, _canDismissSearch);
+ final header = (search.hint, search.canCreate);
if (_searchHeaderState != header) {
_searchHeaderState = header;
_searchOverlay?.markNeedsBuild();
@@ -884,13 +868,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
_search!.removeListener(_syncSearch);
_search!.dispose();
_search = null;
- if (mounted && app.panes.isEmpty) setState(() {});
_searchHeaderState = null;
- final wasBusy = _creationBusy;
- _creationBusy = false;
- _creationMachineId = null;
- _creationFolder = null;
- if (wasBusy && _native) _syncNative();
_searchText.clear();
_searchFocus.unfocus();
final previous = _searchReturnFocus;
@@ -904,56 +882,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
}
- bool get _canDismissSearch => !_creationBusy;
-
- void _dismissSearch() {
- if (_canDismissSearch) _closeSearch();
- }
-
- void _creationActivity(bool busy) {
- if (!mounted || _creationBusy == busy) return;
- setState(() => _creationBusy = busy);
- _syncSearch();
- if (_native) _syncNative();
- }
-
- void _creationFinished() {
- _creationActivity(false);
- _closeSearch(restoreFocus: false);
- if (app.focusedPane?.session?.focusInput() != true) {
- _shellFocus.requestFocus();
- }
- unawaited(_ensureEmptyEntry());
- }
-
- Widget? _startPageCreation() {
- final machineId =
- app.machineStates.values
- .where((machine) => machine.isLocalMachine)
- .firstOrNull
- ?.machine
- .machineId ??
- app.machineStates.keys.firstOrNull;
- if (machineId == null) return null;
- return Offstage(
- offstage: _search != null,
- child: NewAgentComposer(
- key: ValueKey(
- 'inline-agent-composer:${app.activeSwarmId}:$_inlineCreationRevision',
- ),
- notifier: app,
- machineId: machineId,
- swarmId: app.activeSwarmId,
- focusNode: _inlineCreationFocus,
- onBusyChanged: _creationActivity,
- onFinished: () {
- _inlineCreationRevision++;
- _creationFinished();
- },
- onDismiss: _startSearchFocus.requestFocus,
- ),
- );
- }
+ void _dismissSearch() => _closeSearch();
Future<void> _ensureEmptyEntry() async {
if (!mounted || app.panes.isNotEmpty) return;
@@ -964,7 +893,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
Future<void> _chooseSearch(SwarmSearchSelection choice) async {
- if (_creationBusy) return;
final target = _search?.targetId;
final split = _search?.split;
if (target == null) return;
@@ -1009,6 +937,18 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
),
),
+ if (!commandsOnly && search.split != null)
+ KeymapRegion(
+ contextKind: KeymapContext.workspace,
+ child: TextButton.icon(
+ key: const ValueKey('harness-picker-new'),
+ onPressed: search.canCreate
+ ? () => _runShortcut('agent.new')
+ : null,
+ icon: const Icon(AgentActionIcons.create, size: 18),
+ label: const Text('New Agent'),
+ ),
+ ),
if (!commandsOnly)
TextButton(
onPressed: _dismissSearch,
@@ -1068,14 +1008,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
240.0,
commandsOnly ? 600.0 : 760.0,
);
- // Keep room for the search heading, field, and at least one result
- // when large text makes the creation form taller. Its fields scroll.
- final minimumSearchHeight =
- 172 + MediaQuery.textScalerOf(context).scale(72);
- final creationHeight = (height - minimumSearchHeight - 24).clamp(
- 64.0,
- height * .55,
- );
return Stack(
children: [
Positioned.fill(
@@ -1093,62 +1025,15 @@ class _SwarmScreenState extends State<SwarmScreen> {
commandsOnly ? 720.0 : 1120.0,
),
height: height,
- child: Column(
- children: [
- Expanded(
- child: AbsorbPointer(
- absorbing: _creationBusy,
- child: ExcludeFocus(
- excluding: _creationBusy,
- child: SwarmSearchKeys(
- search: search,
- editing: _searchText,
- onChoose: _chooseSearch,
- onClose: _dismissSearch,
- onOpen: _focusSearch,
- onNewAgent: () => _runShortcut('agent.new'),
- onRefocus: _focusSearch,
- child: panel,
- ),
- ),
- ),
- ),
- if (!commandsOnly) ...[
- const SizedBox(height: 24),
- ConstrainedBox(
- constraints: BoxConstraints(
- maxHeight: creationHeight,
- ),
- child: SingleChildScrollView(
- child: _creationMachineId == null
- ? FilledButton(
- onPressed: () {
- _closeSearch();
- _dialog(
- () => showSwarmLinkDialog(context, app),
- );
- },
- child: const Text(
- 'Link a machine to create an agent',
- ),
- )
- : NewAgentComposer(
- key: const ValueKey('agent-composer'),
- notifier: app,
- machineId: _creationMachineId!,
- initialFolder: _creationFolder,
- swarmId: search.targetId,
- split: search.split,
- available: search.canCreate,
- focusNode: _creationFocus,
- onBusyChanged: _creationActivity,
- onFinished: _creationFinished,
- onDismiss: _dismissSearch,
- ),
- ),
- ),
- ],
- ],
+ child: SwarmSearchKeys(
+ search: search,
+ editing: _searchText,
+ onChoose: _chooseSearch,
+ onClose: _dismissSearch,
+ onOpen: _focusSearch,
+ onNewAgent: () => _runShortcut('agent.new'),
+ onRefocus: _focusSearch,
+ child: panel,
),
),
),
@@ -1335,7 +1220,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
bool _canExecuteCommand(String id) {
if (!_commands.containsKey(id) ||
- _creationBusy ||
!_routeIsCurrent ||
_dialogOpen ||
_spokenPaletteOpen) {
@@ -1538,21 +1422,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
adding: true,
catalog: _searchCatalog,
),
- onNew: () {
- if (app.machineStates.isEmpty) {
- _dialog(
- () => showSwarmLinkDialog(
- context,
- app,
- ),
- );
- } else {
- _inlineCreationFocus
- .requestFocus();
- }
- },
- creation: _startPageCreation(),
- creationBusy: _creationBusy,
+ onNew: _newAgent,
onChoose: (selection) =>
_activateSearch(
selection,
@@ -1697,16 +1567,20 @@ class _SwarmScreenState extends State<SwarmScreen> {
onPressed: app.canOpenNewTab ? _newTab : null,
icon: const Icon(Icons.add, size: 18, semanticLabel: 'New Harness'),
),
- _harnessButton(),
+ _harnessButton(create: true),
+ const SizedBox(width: 10),
+ _harnessButton(create: false),
const SizedBox(width: 12),
],
),
);
- Widget _harnessButton() {
- return TextButton(
- key: const ValueKey('swarm-add-harness-button'),
- onPressed: _addAgent,
+ Widget _harnessButton({required bool create}) {
+ return TextButton.icon(
+ key: ValueKey(
+ create ? 'swarm-new-agent-button' : 'swarm-open-agent-button',
+ ),
+ onPressed: create ? _newAgent : _addAgent,
style: TextButton.styleFrom(
enabledMouseCursor: SystemMouseCursors.click,
minimumSize: const Size(122, 34),
@@ -1714,11 +1588,23 @@ class _SwarmScreenState extends State<SwarmScreen> {
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
textStyle: Theme.of(context).textTheme.labelLarge
?.copyWith(fontSize: 12, fontWeight: FontWeight.w500),
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmTabBar,
- shape: const StadiumBorder(),
+ backgroundColor: create
+ ? grid.AppPalette.swarmAccent
+ : Colors.transparent,
+ foregroundColor: create
+ ? grid.AppPalette.swarmTabBar
+ : grid.AppPalette.textPrimary,
+ shape: StadiumBorder(
+ side: create
+ ? BorderSide.none
+ : const BorderSide(color: Colors.white24),
+ ),
+ ),
+ icon: Icon(
+ create ? AgentActionIcons.create : AgentActionIcons.open,
+ size: 16,
),
- child: const Text('Add Agent'),
+ label: Text(create ? 'New Agent' : 'Open Agent'),
);
}
}
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index 5ef88a682..8d151f227 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -279,11 +279,7 @@ const List<AppShortcut> kAppShortcuts = [
// --- actions --------------------------------------------------------------
AppShortcut(
action: ShortcutAction.newAgent,
- activator: SingleActivator(
- LogicalKeyboardKey.keyN,
- meta: true,
- shift: true,
- ),
+ activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),
label: 'New Agent',
group: ShortcutGroup.actions,
),
@@ -345,8 +341,8 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) => [
const kSwarmShortcuts = [
AppShortcut(
action: ShortcutAction.addAgent,
- activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),
- label: 'Add Agent',
+ activator: SingleActivator(LogicalKeyboardKey.keyO, meta: true),
+ label: 'Open Agent',
group: ShortcutGroup.actions,
),
AppShortcut(
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index 10c81f474..d1e24e1c1 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -272,7 +272,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'agent.add',
- 'Add Agent',
+ 'Open Agent',
ShortcutGroup.actions,
action: ShortcutAction.addAgent,
nativeAction: 'addAgent',
diff --git a/desktop/lib/widgets/agent_action_icons.dart b/desktop/lib/widgets/agent_action_icons.dart
new file mode 100644
index 000000000..f70cd7f2b
--- /dev/null
+++ b/desktop/lib/widgets/agent_action_icons.dart
@@ -0,0 +1,8 @@
+import 'package:lucide_icons_flutter/lucide_icons.dart';
+
+/// Agent actions use + to create and ↗ to open. Search fields keep their lens.
+/// The native menu/titlebar match these with `plus` and `arrow.up.right`.
+abstract final class AgentActionIcons {
+ static const create = LucideIcons.plus300;
+ static const open = LucideIcons.arrowUpRight300;
+}
diff --git a/desktop/lib/widgets/harness_entry_actions.dart b/desktop/lib/widgets/harness_entry_actions.dart
index 092ec5dbc..d5bf58a7a 100644
--- a/desktop/lib/widgets/harness_entry_actions.dart
+++ b/desktop/lib/widgets/harness_entry_actions.dart
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
+import 'agent_action_icons.dart';
-/// The same search-or-create choice on New Harness and in the Add Agent picker.
+/// Separate Open Agent and New Agent actions on the Harness start page.
class HarnessEntryActions extends StatelessWidget {
const HarnessEntryActions({
super.key,
@@ -60,7 +60,7 @@ class HarnessEntryActions extends StatelessWidget {
_keyboardAction(
context,
onOpen,
- OutlinedButton(
+ OutlinedButton.icon(
key: openKey,
onPressed: onOpen,
style: OutlinedButton.styleFrom(
@@ -76,7 +76,8 @@ class HarnessEntryActions extends StatelessWidget {
: const BorderSide(color: Colors.white24),
shape: const StadiumBorder(),
),
- child: const Text('Open Agent'),
+ icon: const Icon(AgentActionIcons.open, size: 18),
+ label: const Text('Open Agent'),
),
),
_keyboardAction(
@@ -85,7 +86,7 @@ class HarnessEntryActions extends StatelessWidget {
FilledButton.icon(
key: newKey,
onPressed: onNew,
- icon: const Icon(LucideIcons.plus300, size: 18),
+ icon: const Icon(AgentActionIcons.create, size: 18),
label: const Text('New Agent'),
style: FilledButton.styleFrom(
enabledMouseCursor: SystemMouseCursors.click,
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
index 4b2f452bc..ff3b2433e 100644
--- a/desktop/lib/widgets/harness_start_page.dart
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -17,15 +17,11 @@ class HarnessStartPage extends StatefulWidget {
required this.createSearch,
required this.onNew,
required this.onChoose,
- this.creation,
- this.creationBusy = false,
});
final FocusNode focusNode;
final SwarmSearchController Function() createSearch;
final VoidCallback onNew;
final ValueChanged<SwarmSearchSelection> onChoose;
- final Widget? creation;
- final bool creationBusy;
@override
State<HarnessStartPage> createState() => _HarnessStartPageState();
}
@@ -43,7 +39,6 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
bool get _showResults => _search != null;
void _open() {
- if (widget.creationBusy) return;
// Commands can replace the editor value without a TextField onChanged.
// Reveal results for the visible text, including on keyboard-only entry.
if (_search == null) {
@@ -58,7 +53,6 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
}
void _close() {
- if (widget.creationBusy) return;
final search = _search;
if (search != null) {
_draft = search.draft;
@@ -69,13 +63,11 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
}
void _choose(SwarmSearchSelection selection) {
- if (widget.creationBusy) return;
_close();
widget.onChoose(selection);
}
void _new() {
- if (widget.creationBusy) return;
_close();
widget.onNew();
}
@@ -295,58 +287,25 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
.clamp(72.0, 220.0)
.clamp(
0.0,
- (entryConstraints.maxHeight -
- (widget.creation == null ? 320 : 460))
- .clamp(24.0, 220.0),
- );
- final available = entryConstraints.maxHeight - top;
- final minimumSearchHeight =
- 112 + MediaQuery.textScalerOf(context).scale(56);
- final creationHeight =
- (available - minimumSearchHeight - 24).clamp(
- 64.0,
- available * .55,
+ (entryConstraints.maxHeight - 320).clamp(
+ 24.0,
+ 220.0,
+ ),
);
return Padding(
padding: EdgeInsets.only(top: top),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (widget.creation != null) ...[
- Expanded(
- child: Align(
- alignment: Alignment.topCenter,
- child: AbsorbPointer(
- absorbing: widget.creationBusy,
- child: ExcludeFocus(
- excluding: widget.creationBusy,
- child: _searchPanel(),
- ),
- ),
- ),
- ),
- const SizedBox(height: 24),
- ConstrainedBox(
- constraints: BoxConstraints(
- maxHeight: creationHeight,
- ),
- child: SingleChildScrollView(
- child: widget.creation!,
- ),
+ Flexible(child: _searchPanel()),
+ if (!_showResults) ...[
+ const SizedBox(height: 20),
+ HarnessEntryActions(
+ onOpen: _open,
+ onNew: _new,
+ openKey: const ValueKey('harness-start-open'),
+ newKey: const ValueKey('harness-start-new'),
),
- ] else ...[
- Flexible(child: _searchPanel()),
- if (!_showResults) ...[
- const SizedBox(height: 20),
- HarnessEntryActions(
- onOpen: _open,
- onNew: _new,
- openKey: const ValueKey(
- 'harness-start-open',
- ),
- newKey: const ValueKey('harness-start-new'),
- ),
- ],
],
],
),
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index b969d0f6e..a17035d5d 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -2,7 +2,6 @@ import 'dart:async';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../analytics/analytics.dart';
@@ -18,8 +17,6 @@ import '../shared/widgets/app_dialog.dart';
import '../shared/widgets/app_select_field.dart';
import '../shared/widgets/labeled_field.dart';
import '../state/app_state.dart';
-import '../shortcuts/app_keymap.dart';
-import '../shortcuts/keymap.dart';
import 'engine_identity.dart';
import 'codex_profile_field.dart';
import 'agent_picker.dart';
@@ -82,49 +79,6 @@ Future<NewAgentDialogResult?> showNewAgentDialog(
);
}
-/// Creation stays mounted beside search, so editing a query never resets it.
-class NewAgentComposer extends StatelessWidget {
- const NewAgentComposer({
- super.key,
- required this.notifier,
- required this.machineId,
- required this.swarmId,
- required this.onFinished,
- required this.onBusyChanged,
- required this.onDismiss,
- this.initialFolder,
- this.split,
- this.focusNode,
- this.available = true,
- });
-
- final AppNotifier notifier;
- final String machineId, swarmId;
- final String? initialFolder;
- final PaneSplitRequest? split;
- final FocusNode? focusNode;
- final bool available;
- final VoidCallback onFinished, onDismiss;
- final ValueChanged<bool> onBusyChanged;
-
- @override
- Widget build(BuildContext context) => _NewAgentDialog(
- notifier: notifier,
- machineId: machineId,
- swarmId: swarmId,
- initialFolder: initialFolder,
- split: split,
- offerFindExisting: false,
- offerBackToSearch: false,
- embedded: true,
- available: available,
- creationFocus: focusNode,
- onFinished: onFinished,
- onBusyChanged: onBusyChanged,
- onDismiss: onDismiss,
- );
-}
-
class _NewAgentDialog extends StatefulWidget {
final AppNotifier notifier;
final String machineId;
@@ -134,10 +88,6 @@ class _NewAgentDialog extends StatefulWidget {
final Future<void>? initialEngineProbe;
final bool offerFindExisting;
final bool offerBackToSearch;
- final bool embedded, available;
- final FocusNode? creationFocus;
- final VoidCallback? onFinished, onDismiss;
- final ValueChanged<bool>? onBusyChanged;
const _NewAgentDialog({
required this.notifier,
@@ -148,12 +98,6 @@ class _NewAgentDialog extends StatefulWidget {
this.initialEngineProbe,
required this.offerFindExisting,
required this.offerBackToSearch,
- this.embedded = false,
- this.available = true,
- this.creationFocus,
- this.onFinished,
- this.onBusyChanged,
- this.onDismiss,
});
@override
@@ -165,10 +109,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
final _actionFocus = FocusNode(debugLabel: 'Create or check agent');
final _repositoryFocus = FocusNode(debugLabel: 'Repository URL');
final _repository = TextEditingController();
- late _FolderSource _folderSource =
- widget.embedded && widget.initialFolder == null
- ? _FolderSource.newProject
- : _FolderSource.local;
+ _FolderSource _folderSource = _FolderSource.local;
String? _preparedFolder;
AgentCreationAttempt? _creation;
bool _checkingCreation = false;
@@ -213,14 +154,18 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
// engine and is only ever read on this screen. Deferred a frame so the
// probe's first notifyListeners() does not land mid-build.
//
- // Explicit standalone creation refreshes availability. The shared search
- // surface reuses the cached answer, so opening search doesn't repeat a
- // sweep of interactive shells. Launch still checks the selected engine.
+ // `force`, every time this dialog opens. A cached answer is worth nothing
+ // here: engines arrive and leave through a terminal this app never sees —
+ // `npm i -g opencode-ai`, `npm uninstall -g`, a venv deleted out from under
+ // a symlink — and an install this very dialog started makes its own stored
+ // answer stale the moment it finishes. Re-asking is bounded (one sweep, on
+ // a deliberate user action) and the stored rows keep rendering until the new
+ // answer lands, so nothing blanks.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
// The modal's fallback focus can win autofocus. Claim the first
// actionable control once the route and its focus tree are mounted.
- if (!widget.embedded) _folderFocus.requestFocus();
+ _folderFocus.requestFocus();
unawaited(_probeEngines(initialProbe: widget.initialEngineProbe));
unawaited(_loadAgentPreference());
}
@@ -259,7 +204,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
final machineId = _machineId;
final revision = _machineRevision;
await (initialProbe ??
- widget.notifier.probeEngines(machineId, force: !widget.embedded));
+ widget.notifier.probeEngines(machineId, force: true));
if (!mounted ||
revision != _machineRevision ||
_choicesLocked ||
@@ -428,7 +373,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
// remote filesystem over the `fs_list_dir` RPC.
var acceptedFolder = false;
setState(() => _picking = true);
- _reportBusy();
final pickingRevision = _machineRevision;
try {
final picked = _machineIsThisComputer
@@ -459,7 +403,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
}
});
} finally {
- if (mounted) _reportBusy();
if (mounted && restoreFocus) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted &&
@@ -485,8 +428,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
final folder =
_preparedFolder ??
(_folderSource == _FolderSource.local ? _folder : null);
- if ((!widget.available && !_confirmationPending) ||
- (folder == null && project == null) ||
+ if ((folder == null && project == null) ||
_submitting ||
(!_confirmationPending && _waitingForCodexProfile)) {
return;
@@ -501,7 +443,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_submitting = true;
_error = null;
});
- _reportBusy();
final error = await widget.notifier.createAgent(
_machineId,
engine: engine,
@@ -524,24 +465,15 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_submitting = false;
_error = error;
});
- _reportBusy();
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _actionFocus.requestFocus();
});
return;
}
analytics.agentCreated(engine: engine, bypassPermission: bypassPermission);
- if (widget.embedded) {
- widget.onFinished!();
- } else {
- Navigator.of(context).pop(NewAgentDialogResult.created);
- }
+ Navigator.of(context).pop(NewAgentDialogResult.created);
}
- void _reportBusy() => widget.onBusyChanged?.call(
- _submitting || _picking || _confirmationPending,
- );
-
ProjectFolderRequest? get _projectFolder => switch (_folderSource) {
_FolderSource.newProject => const ProjectFolderRequest.newProject(),
_FolderSource.local => null,
@@ -560,7 +492,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
});
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
- if (widget.embedded && source != _FolderSource.remote) return;
switch (source) {
case _FolderSource.local:
_folderFocus.requestFocus();
@@ -584,422 +515,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
// The launch request cannot be cancelled after it is sent. Keep its
// outcome visible instead of allowing an accidental second launch.
canPop: !_submitting,
- child: widget.embedded
- ? _buildComposer(context)
- : _buildDialog(context),
- ),
- );
- }
-
- void _selectEngine(String value) {
- if (value == _engine || _choicesLocked || _picking) return;
- setState(() {
- unawaited(widget.notifier.agentPreference.select(value));
- _engineChosenByUser = true;
- _engine = value;
- _error = null;
- _codexProfile = null;
- _codexProfilesBusy = true;
- if (!kEngineBypassPermissionFlag.containsKey(value)) {
- _bypassPermission = false;
- }
- });
- }
-
- void _selectMachine(String id) {
- if (id == _machineId || _choicesLocked) return;
- setState(() {
- _machineRevision++;
- _machineId = id;
- _folder = null;
- _preparedFolder = null;
- if (widget.embedded && _folderSource == _FolderSource.local) {
- _folderSource = _FolderSource.newProject;
- }
- _codexProfile = null;
- _codexProfilesBusy = true;
- _error = null;
- });
- unawaited(_probeEngines());
- }
-
- String _folderName(String path) =>
- path
- .replaceAll(r'\', '/')
- .split('/')
- .where((part) => part.isNotEmpty)
- .lastOrNull ??
- path;
-
- String get _projectValue => switch (_folderSource) {
- _FolderSource.newProject => 'new',
- _FolderSource.remote => 'remote',
- _FolderSource.local => _folder == null ? 'unselected' : 'folder:$_folder',
- };
-
- String get _projectLabel => switch (_folderSource) {
- _FolderSource.newProject => 'New project',
- _FolderSource.remote => 'Remote repository',
- _FolderSource.local =>
- _folder == null ? 'Local folder…' : _folderName(_folder!),
- };
-
- List<SelectOption<String>> get _projectOptions {
- return [
- SelectOption(
- value: 'new',
- label: 'New project',
- detail: 'Create a folder in ~/Harness Projects',
- leading: () => const Icon(LucideIcons.folderPlus, size: 18),
- ),
- SelectOption(
- value: 'browse',
- label: 'Local folder…',
- detail: 'Choose an existing folder on $_machineName',
- leading: () => const Icon(LucideIcons.folderOpen, size: 18),
- ),
- SelectOption(
- value: 'remote',
- label: 'Remote repository…',
- detail: 'Clone a GitHub repository on $_machineName',
- leading: () => const Icon(LucideIcons.gitBranch, size: 18),
- ),
- if (_folder case final folder?)
- SelectOption(
- value: 'folder:$folder',
- label: _folderName(folder),
- detail: folder,
- leading: () => const Icon(LucideIcons.folder, size: 18),
- ),
- ];
- }
-
- Future<void> _selectProject(String value) async {
- if (_choicesLocked || _picking) return;
- if (value == 'new') {
- _selectFolderSource(_FolderSource.newProject);
- } else if (value == 'remote') {
- _selectFolderSource(_FolderSource.remote);
- } else if (value == 'browse') {
- _selectFolderSource(_FolderSource.local);
- await _browse();
- } else if (value.startsWith('folder:')) {
- setState(() {
- _folderSource = _FolderSource.local;
- _folder = value.substring('folder:'.length);
- _preparedFolder = null;
- _error = null;
- });
- }
- }
-
- Widget _composerSelect({
- required String label,
- required String value,
- required String selectedLabel,
- required Widget icon,
- required List<SelectOption<String>> options,
- required ValueChanged<String> onChanged,
- FocusNode? focusNode,
- }) => Semantics(
- label: label,
- child: Tooltip(
- message: selectedLabel,
- child: AppSelectField<String>(
- key: ValueKey('agent-composer-${label.toLowerCase()}'),
- value: value,
- options: options,
- onChanged: onChanged,
- focusNode: focusNode,
- fillColor: grid.AppPalette.agentEntryField,
- height: 64 * MediaQuery.textScalerOf(context).scale(1).clamp(1.0, 1.5),
- trigger: Row(
- children: [
- icon,
- const SizedBox(width: 10),
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- label,
- style: TextStyle(
- fontSize: 11,
- color: grid.AppPalette.textSecondary,
- ),
- ),
- const SizedBox(height: 2),
- Text(
- selectedLabel,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: const TextStyle(
- fontSize: 15,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- ),
- const SizedBox(width: 8),
- Icon(
- Icons.expand_more_rounded,
- size: 18,
- color: grid.AppPalette.textSecondary,
- ),
- ],
- ),
- ),
- ),
- );
-
- bool get _canSubmit =>
- (widget.available || _confirmationPending) &&
- (_preparedFolder != null ||
- (_folderSource == _FolderSource.local
- ? _folder != null
- : _projectFolder != null)) &&
- !_picking &&
- !_submitting &&
- (_confirmationPending || !_waitingForCodexProfile);
-
- Widget _buildComposer(BuildContext context) {
- final bypassFlag = kEngineBypassPermissionFlag[_engine];
- final scale = MediaQuery.textScalerOf(context).scale(1);
- final height = 64 * scale.clamp(1.0, 1.5);
- final fields = <Widget>[
- _composerSelect(
- label: 'Agent',
- value: _engine,
- selectedLabel: _engine == 'claude'
- ? 'Claude Code'
- : engineIdentity(_engine).label,
- icon: EngineMark(engine: _engine, size: 20),
- focusNode: widget.creationFocus,
- options: [
- for (final identity in allEngines)
- SelectOption(
- value: identity.id,
- label: identity.id == 'claude' ? 'Claude Code' : identity.label,
- note: _engineInstallNote(identity.id),
- leading: () => EngineMark(engine: identity.id, size: 18),
- ),
- ],
- onChanged: _selectEngine,
- ),
- _composerSelect(
- label: 'Project',
- value: _projectValue,
- selectedLabel: _projectLabel,
- icon: Icon(
- _folderSource == _FolderSource.remote
- ? LucideIcons.gitBranch
- : LucideIcons.folder,
- size: 20,
- ),
- options: _projectOptions,
- onChanged: _selectProject,
- ),
- _composerSelect(
- label: 'Machine',
- value: _machineId,
- selectedLabel: _machineName,
- icon: Icon(
- _machineIsThisComputer ? LucideIcons.laptop : LucideIcons.monitor,
- size: 20,
- ),
- options: [
- for (final machine in widget.notifier.machineStates.values)
- SelectOption(
- value: machine.machine.machineId,
- label: machine.machine.displayName,
- detail: _machineDetail(machine),
- leading: () => Icon(
- machine.isLocalMachine
- ? LucideIcons.laptop
- : LucideIcons.monitor,
- size: 18,
- ),
- ),
- ],
- onChanged: _selectMachine,
- ),
- ];
- final create = SizedBox(
- height: height,
- child: FilledButton(
- key: const ValueKey('create-agent-submit'),
- focusNode: _actionFocus,
- onPressed: _canSubmit ? _submit : null,
- style: FilledButton.styleFrom(
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmTabBar,
- disabledBackgroundColor: Colors.white12,
- disabledForegroundColor: Colors.white38,
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontSize: 17,
- fontWeight: FontWeight.w600,
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
- ),
- ),
- child: _submitting
- ? Semantics(
- liveRegion: true,
- label: _checkingCreation
- ? 'Checking agent status'
- : 'Creating agent',
- child: const SizedBox(
- width: 18,
- height: 18,
- child: CircularProgressIndicator(strokeWidth: 2),
- ),
- )
- : Text(_confirmationPending ? 'Check status' : 'Create'),
- ),
- );
- return KeymapRegion(
- // Search navigation must never handle an arrow or Enter in a form/menu.
- contextKind: KeymapContext.workspace,
- actions: {'agent.new': () => widget.creationFocus?.requestFocus()},
- child: CallbackShortcuts(
- bindings: {
- const SingleActivator(LogicalKeyboardKey.escape): () {
- if (!_submitting && !_picking && !_confirmationPending) {
- widget.onDismiss?.call();
- }
- },
- },
- child: Material(
- color: grid.AppPalette.agentEntrySurface,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(20),
- side: const BorderSide(color: Colors.white12),
- ),
- clipBehavior: Clip.antiAlias,
- child: Padding(
- padding: const EdgeInsets.fromLTRB(28, 24, 28, 18),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Row(
- children: [
- Expanded(
- child: Text(
- switch (widget.split?.axis) {
- PaneResizeAxis.x => 'New Agent · split right',
- PaneResizeAxis.y => 'New Agent · split down',
- null => 'New Agent',
- },
- style: const TextStyle(
- fontSize: 26,
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- if (_confirmationPending)
- TextButton(
- onPressed: _submitting ? null : widget.onFinished,
- child: const Text('Close'),
- ),
- ],
- ),
- const SizedBox(height: 20),
- LayoutBuilder(
- builder: (context, constraints) {
- final wide =
- constraints.maxWidth >= 700 * scale.clamp(1.0, 1.5);
- Widget choices(Widget child) => AbsorbPointer(
- absorbing: _choicesLocked || _picking,
- child: ExcludeFocus(
- excluding: _choicesLocked || _picking,
- child: child,
- ),
- );
- if (wide) {
- return Row(
- children: [
- for (var i = 0; i < fields.length; i++) ...[
- Expanded(child: choices(fields[i])),
- const SizedBox(width: 12),
- ],
- SizedBox(
- width: 160 * scale.clamp(1.0, 1.5),
- child: create,
- ),
- ],
- );
- }
- final width = constraints.maxWidth >= 440
- ? (constraints.maxWidth - 10) / 2
- : constraints.maxWidth;
- return Wrap(
- spacing: 10,
- runSpacing: 10,
- children: [
- for (final field in fields)
- SizedBox(width: width, child: choices(field)),
- SizedBox(width: width, child: create),
- ],
- );
- },
- ),
- if (_folderSource == _FolderSource.remote) ...[
- const SizedBox(height: 12),
- TextField(
- key: const ValueKey('new-agent-repository'),
- controller: _repository,
- focusNode: _repositoryFocus,
- enabled: !_choicesLocked,
- decoration: const InputDecoration(
- hintText: 'GitHub URL or owner/repository',
- ),
- onChanged: (_) => setState(() {
- _preparedFolder = null;
- _error = null;
- }),
- onSubmitted: (_) {
- if (_canSubmit) _submit();
- },
- ),
- ],
- if (_waitingForCodexProfile && !_confirmationPending) ...[
- const SizedBox(height: 12),
- const Text(
- 'Loading Codex profiles…',
- style: TextStyle(fontSize: 13, color: Colors.white60),
- ),
- ],
- if (_error != null) ...[
- const SizedBox(height: 10),
- Semantics(
- liveRegion: true,
- child: Text(
- _error!,
- style: TextStyle(
- fontSize: 13,
- color: _confirmationPending
- ? grid.AppPalette.textSecondary
- : Theme.of(context).colorScheme.error,
- ),
- ),
- ),
- ],
- AbsorbPointer(
- absorbing: _choicesLocked || _picking,
- child: ExcludeFocus(
- excluding: _choicesLocked || _picking,
- child: _details(bypassFlag),
- ),
- ),
- ],
- ),
- ),
- ),
+ child: _buildDialog(context),
),
);
}
@@ -1157,7 +673,19 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
),
),
],
- onChanged: _selectMachine,
+ onChanged: (id) {
+ if (id == _machineId || _choicesLocked) return;
+ setState(() {
+ _machineRevision++;
+ _machineId = id;
+ _folder = null;
+ _preparedFolder = null;
+ _codexProfile = null;
+ _codexProfilesBusy = true;
+ _error = null;
+ });
+ unawaited(_probeEngines());
+ },
),
const SizedBox(height: _gapField),
],
@@ -1247,138 +775,139 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
: null,
),
],
- onChanged: _selectEngine,
+ onChanged: (value) => setState(() {
+ unawaited(widget.notifier.agentPreference.select(value));
+ _engineChosenByUser = true;
+ _engine = value;
+ _error = null;
+ _codexProfile = null;
+ _codexProfilesBusy = true;
+ if (!kEngineBypassPermissionFlag.containsKey(value)) {
+ _bypassPermission = false;
+ }
+ }),
),
- _details(bypassFlag),
- ],
- );
- }
-
- Widget _details(String? bypassFlag) => Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- // Unconditional now: Codex here is always on its own login, so the
- // profile it runs under is always a live question.
- // WHAT THE SUMMARY'S HEADING USED TO SAY, minus the half that had
- // somewhere else to live.
- //
- // Four states were printed on that card. Two of them already have a
- // home: "not installed" is a note on the engine's own row, and "pick a
- // folder" is the Create button being disabled. These two had nowhere
- // else, and losing them would have made a machine that Harness has not
- // managed to reach look exactly like one it has.
- if (!_confirmationPending && (_willInstall || _engineCheckFailed)) ...[
- const SizedBox(height: 6),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Text(
- _willInstall
- ? 'Harness will install ${engineIdentity(_engine).label} before starting.'
- : 'Couldn’t check whether ${engineIdentity(_engine).label} is installed. '
- 'You can still try creating an agent.',
- style: Theme.of(context).textTheme.bodySmall?.copyWith(
- color: _willInstall
- ? grid.AppPalette.accentOnSurface
- : grid.AppPalette.textSecondary,
+ // Unconditional now: Codex here is always on its own login, so the
+ // profile it runs under is always a live question.
+ // WHAT THE SUMMARY'S HEADING USED TO SAY, minus the half that had
+ // somewhere else to live.
+ //
+ // Four states were printed on that card. Two of them already have a
+ // home: "not installed" is a note on the engine's own row, and "pick a
+ // folder" is the Create button being disabled. These two had nowhere
+ // else, and losing them would have made a machine that Harness has not
+ // managed to reach look exactly like one it has.
+ if (!_confirmationPending && (_willInstall || _engineCheckFailed)) ...[
+ const SizedBox(height: 6),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Text(
+ _willInstall
+ ? 'Harness will install ${engineIdentity(_engine).label} before starting.'
+ : 'Couldn’t check whether ${engineIdentity(_engine).label} is installed. '
+ 'You can still try creating an agent.',
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(
+ color: _willInstall
+ ? grid.AppPalette.accentOnSurface
+ : grid.AppPalette.textSecondary,
+ ),
),
),
- ),
+ if (_engineCheckFailed) ...[
+ const SizedBox(width: 12),
+ TextButton(
+ key: const Key('new-agent-retry-check'),
+ onPressed: _checkingEngines ? null : _retryEngineCheck,
+ child: Text(_checkingEngines ? 'Checking…' : 'Retry'),
+ ),
+ ],
+ ],
+ ),
+ ],
+ // THE FOLD. What is behind it is what most people never touch: a Codex
+ // home to run under, and the flag that turns the approvals off. Leaving
+ // them in the main column made this a four-question dialog to do a
+ // two-question job.
+ //
+ // The row REPORTS ITS OWN STATE on the right, and that is what makes
+ // folding them away safe rather than merely tidy. A drawer that hides
+ // what it is set to is a drawer people open every time to check.
+ const SizedBox(height: _gapBlock),
+ _Advanced(
+ open: _advancedOpen,
+ state: _advancedState(),
+ onToggle: () => setState(() => _advancedOpen = !_advancedOpen),
+ children: [
if (_engineCheckFailed) ...[
- const SizedBox(width: 12),
- TextButton(
- key: const Key('new-agent-retry-check'),
- onPressed: _checkingEngines ? null : _retryEngineCheck,
- child: Text(_checkingEngines ? 'Checking…' : 'Retry'),
+ Text(
+ 'If $_machineName uses an older Harness CLI, update it to enable engine checks.',
+ style: Theme.of(context).textTheme.bodySmall
+ ?.copyWith(color: grid.AppPalette.textSecondary),
),
+ const SizedBox(height: 10),
],
- ],
- ),
- ],
- // THE FOLD. What is behind it is what most people never touch: a Codex
- // home to run under, and the flag that turns the approvals off. Leaving
- // them in the main column made this a four-question dialog to do a
- // two-question job.
- //
- // The row REPORTS ITS OWN STATE on the right, and that is what makes
- // folding them away safe rather than merely tidy. A drawer that hides
- // what it is set to is a drawer people open every time to check.
- SizedBox(height: widget.embedded ? 6 : _gapBlock),
- _Advanced(
- compact: widget.embedded,
- open: _advancedOpen,
- state: _advancedState(),
- onToggle: () => setState(() => _advancedOpen = !_advancedOpen),
- children: [
- if (_engineCheckFailed) ...[
- Text(
- 'If $_machineName uses an older Harness CLI, update it to enable engine checks.',
- style: Theme.of(context).textTheme.bodySmall
- ?.copyWith(color: grid.AppPalette.textSecondary),
- ),
- const SizedBox(height: 10),
- ],
- if (_engine == 'codex') ...[
- if (_availability('codex')?.supportsCodexHome == true)
- CodexProfileField(
- notifier: widget.notifier,
- machineId: _machineId,
- machineIsThisComputer: _machineIsThisComputer,
- value: _codexProfile,
- observedPaths: {
- for (final agent
- in widget.notifier.stateOf(_machineId)!.agents)
- if (agent.engine == 'codex' && agent.codexHome != null)
- agent.codexHome!,
- },
- onChanged: (profile) {
- if (!_choicesLocked) {
- setState(() => _codexProfile = profile);
- }
- },
- onBusyChanged: (busy) {
- if (_codexProfilesBusy != busy) {
- setState(() => _codexProfilesBusy = busy);
- }
- },
+ if (_engine == 'codex') ...[
+ if (_availability('codex')?.supportsCodexHome == true)
+ CodexProfileField(
+ notifier: widget.notifier,
+ machineId: _machineId,
+ machineIsThisComputer: _machineIsThisComputer,
+ value: _codexProfile,
+ observedPaths: {
+ for (final agent
+ in widget.notifier.stateOf(_machineId)!.agents)
+ if (agent.engine == 'codex' && agent.codexHome != null)
+ agent.codexHome!,
+ },
+ onChanged: (profile) {
+ if (!_choicesLocked) {
+ setState(() => _codexProfile = profile);
+ }
+ },
+ onBusyChanged: (busy) {
+ if (_codexProfilesBusy != busy) {
+ setState(() => _codexProfilesBusy = busy);
+ }
+ },
+ )
+ else
+ Text(
+ _availability('codex') == null
+ ? _engineCheckFailed && !_checkingEngines
+ ? 'Retry the agent check above to load Codex profiles.'
+ : 'Checking whether $_machineName supports Codex profiles…'
+ : 'Update Harness CLI on $_machineName to choose a Codex profile.',
+ style: Theme.of(context).textTheme.bodySmall,
+ ),
+ ],
+ if (_engine == 'codex') ...[
+ const SizedBox(height: 12),
+ Divider(height: 1, color: grid.AppGlass.hair),
+ const SizedBox(height: 16),
+ ],
+ const FieldLabel('Permissions'),
+ if (bypassFlag != null)
+ _BypassCheck(
+ value: _bypassPermission,
+ flag: bypassFlag,
+ hovered: _bypassHovered,
+ onHover: (value) => setState(() => _bypassHovered = value),
+ onChanged: (value) => setState(() => _bypassPermission = value),
)
else
+ // Not silence: an engine with no checkbox looks identical to one whose
+ // checkbox the user simply missed.
Text(
- _availability('codex') == null
- ? _engineCheckFailed && !_checkingEngines
- ? 'Retry the agent check above to load Codex profiles.'
- : 'Checking whether $_machineName supports Codex profiles…'
- : 'Update Harness CLI on $_machineName to choose a Codex profile.',
+ 'Managed by ${engineIdentity(_engine).label}.',
style: Theme.of(context).textTheme.bodySmall,
),
],
- if (_engine == 'codex') ...[
- const SizedBox(height: 12),
- Divider(height: 1, color: grid.AppGlass.hair),
- const SizedBox(height: 16),
- ],
- const FieldLabel('Permissions'),
- if (bypassFlag != null)
- _BypassCheck(
- value: _bypassPermission,
- flag: bypassFlag,
- hovered: _bypassHovered,
- onHover: (value) => setState(() => _bypassHovered = value),
- onChanged: (value) => setState(() => _bypassPermission = value),
- )
- else
- // Not silence: an engine with no checkbox looks identical to one whose
- // checkbox the user simply missed.
- Text(
- 'Managed by ${engineIdentity(_engine).label}.',
- style: Theme.of(context).textTheme.bodySmall,
- ),
- ],
- ),
- ],
- );
+ ),
+ ],
+ );
+ }
}
/// Room for three readable machine choices and the overflow control in one row.
@@ -1474,14 +1003,13 @@ const double _gapField = 16;
/// already what this app gives that flag wherever else it appears.
class _Advanced extends StatelessWidget {
const _Advanced({
- this.compact = false,
required this.open,
required this.state,
required this.onToggle,
required this.children,
});
- final bool open, compact;
+ final bool open;
/// What is set, in a few words — see `_advancedState`. Empty says nothing.
final String state;
@@ -1496,13 +1024,13 @@ class _Advanced extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
- if (!compact) Divider(height: 1, color: grid.AppGlass.hair),
+ Divider(height: 1, color: grid.AppGlass.hair),
InkWell(
key: const Key('new-agent-advanced'),
onTap: onToggle,
borderRadius: BorderRadius.circular(6),
child: Padding(
- padding: EdgeInsets.symmetric(vertical: compact ? 6 : 9),
+ padding: const EdgeInsets.symmetric(vertical: 9),
child: Row(
children: [
// Rotated rather than swapped for a second glyph: one shape
@@ -1519,15 +1047,13 @@ class _Advanced extends StatelessWidget {
),
const SizedBox(width: 6),
Text(
- compact ? 'Options' : 'Advanced',
- style:
- (compact
- ? theme.textTheme.bodySmall
- : theme.textTheme.bodyMedium)
- ?.copyWith(color: grid.AppPalette.textSecondary),
+ 'Advanced',
+ style: theme.textTheme.bodyMedium?.copyWith(
+ color: grid.AppPalette.textSecondary,
+ ),
),
const Spacer(),
- if (!open && !compact)
+ if (!open)
Flexible(
child: Text(
key: const Key('new-agent-advanced-state'),
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 05ac8a59a..8cb56eaf6 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -216,7 +216,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
item.representedObject = action
item.identifier = NSUserInterfaceItemIdentifier(HarnessKeymapMenu.actionPrefix + action)
let symbols = [
- "new": "plus.square", "newAgent": "plus", "addAgent": "plus",
+ "new": "plus.square", "newAgent": "plus", "addAgent": "arrow.up.right",
"renameActive": "pencil", "closeActive": "xmark",
"splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",
"zoomPane": "viewfinder", "closePane": "xmark",
@@ -235,7 +235,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
if let file = main.item(withTitle: "File") { main.removeItem(file) }
let file = NSMenu(title: "File")
add(file, "New Harness", "t", "new")
- add(file, "Add Agent…", "n", "addAgent")
+ add(file, "New Agent…", "n", "newAgent")
+ add(file, "Open Agent…", "o", "addAgent")
add(file, "Rename Harness…", "r", "renameActive", [.command, .shift])
add(file, "Close Harness", "w", "closeActive")
file.addItem(.separator())
@@ -854,7 +855,11 @@ private final class SwarmActionButton: NSButton {
.foregroundColor: labelColor,
])
let size = label.size()
- label.draw(at: NSPoint(x: (bounds.width - size.width) / 2, y: (bounds.height - size.height) / 2))
+ let iconWidth: CGFloat = image == nil ? 0 : 20
+ let left = (bounds.width - size.width - iconWidth) / 2
+ image?.withSymbolConfiguration(NSImage.SymbolConfiguration(paletteColors: [labelColor]))?
+ .draw(in: NSRect(x: left, y: (bounds.height - 14) / 2, width: 14, height: 14))
+ label.draw(at: NSPoint(x: left + iconWidth, y: (bounds.height - size.height) / 2))
}
}
@@ -866,6 +871,7 @@ private final class SwarmTabStrip: NSView {
fileprivate let newButton = NSButton()
fileprivate let notificationButton = SwarmNotificationButton()
fileprivate let openButton = SwarmActionButton()
+ fileprivate let createButton = SwarmActionButton()
private var tabs: [SwarmTabButton] = []
private let icons = SwarmHistoryIcons()
private var activeId = ""
@@ -911,9 +917,12 @@ private final class SwarmTabStrip: NSView {
button.isEnabled = false
addSubview(button)
}
- textButton(openButton, "Add Agent", #selector(openHarness))
+ textButton(createButton, "New Agent", #selector(createAgent))
+ textButton(openButton, "Open Agent", #selector(openHarness))
+ createButton.image = NSImage(systemSymbolName: "plus", accessibilityDescription: nil)
+ openButton.image = NSImage(systemSymbolName: "arrow.up.right", accessibilityDescription: nil)
updateActionColors()
- setAccessibilityChildren([notificationButton, scroll, newButton, openButton])
+ setAccessibilityChildren([notificationButton, scroll, newButton, createButton, openButton])
registerForDraggedTypes([swarmPasteboardType])
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@@ -930,8 +939,11 @@ private final class SwarmTabStrip: NSView {
}
private func updateActionColors() {
- openButton.fillColor = palette.accent
- openButton.labelColor = palette.tabBar
+ createButton.fillColor = palette.accent
+ createButton.labelColor = palette.tabBar
+ openButton.fillColor = .clear
+ openButton.labelColor = palette.accent
+ openButton.borderColor = palette.accent.withAlphaComponent(0.3)
}
func update(_ state: [String: Any]) {
@@ -977,6 +989,7 @@ private final class SwarmTabStrip: NSView {
newButton.isEnabled = actionsEnabled && (state["canOpenNewTab"] as? Bool ?? (tabs.count < 24))
notificationButton.isEnabled = actionsEnabled
openButton.isEnabled = actionsEnabled
+ createButton.isEnabled = actionsEnabled
let attention = state["attention"] as? Int ?? 0
notificationButton.hasAttention = attention > 0
notificationButton.setAccessibilityLabel(attention > 0 ? "\(attention) agents need input" : "Notifications")
@@ -1005,7 +1018,7 @@ private final class SwarmTabStrip: NSView {
let spacious = bounds.width >= 480
let openWidth: CGFloat = spacious ? 122 : 108
let trailing: CGFloat = spacious ? 12 : 8
- let actionsWidth = openWidth + trailing
+ let actionsWidth = openWidth * 2 + 10 + trailing
newButton.isHidden = bounds.width < 420
let available = max(32, bounds.width - leading - actionsWidth - (newButton.isHidden ? 0 : 36))
let width = min(220, max(min(132, available), available / CGFloat(max(1, tabs.count))))
@@ -1021,6 +1034,7 @@ private final class SwarmTabStrip: NSView {
newButton.frame = NSRect(x: leading + occupied + 4, y: buttonY, width: 28, height: 28)
let actionY = (bounds.height - 34) / 2
openButton.frame = NSRect(x: bounds.width - trailing - openWidth, y: actionY, width: openWidth, height: 34)
+ createButton.frame = NSRect(x: openButton.frame.minX - 10 - openWidth, y: actionY, width: openWidth, height: 34)
let geometryChanged = scroll.frame.size != previousScrollSize || document.frame.size != previousDocumentSize
if let active, revealActiveAfterLayout || (activeWasVisible && (geometryChanged || tabOrderChanged)) {
document.scrollToVisible(active.frame)
@@ -1062,6 +1076,9 @@ private final class SwarmTabStrip: NSView {
@objc private func openHarness() {
if actionsEnabled { emit?("addAgent", nil) }
}
+ @objc private func createAgent() {
+ if actionsEnabled { emit?("newAgent", nil) }
+ }
private func draggedTab(_ sender: NSDraggingInfo) -> SwarmTabButton? {
guard actionsEnabled, sender.draggingSourceOperationMask.contains(.move),
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 50960d2e5..c0966c8ef 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -60,7 +60,6 @@ class _Connection extends WsConn {
Map<String, dynamic> payload = const {},
Duration timeout = const Duration(seconds: 20),
}) {
- if (type == 'agent_recent') return Future.value(<String, dynamic>{});
if (type == 'engines_probe') return Future.value({'engines': []});
if (type == 'codex_profiles_list') return Future.value({'profiles': []});
final request = _Request(type, Map.of(payload));
@@ -87,13 +86,6 @@ Future<void> _timeOut(
expect(attempt.awaitingConfirmation, isTrue);
}
-Future<void> _chooseLocal(WidgetTester tester) async {
- await tester.tap(find.byKey(const ValueKey('agent-composer-project')));
- await tester.pumpAndSettle();
- await tester.tap(find.text('Local folder…'));
- await tester.pumpAndSettle();
-}
-
void main() {
for (final entry in ['header', 'shortcut', 'search shortcut', 'start page']) {
for (final dismissal in ['outside', 'escape']) {
@@ -111,25 +103,23 @@ void main() {
switch (entry) {
case 'header':
await tester.tap(
- find.byKey(const ValueKey('swarm-add-harness-button')),
+ find.byKey(const ValueKey('swarm-new-agent-button')),
);
- await tester.pump();
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
case 'start page':
await chord(tester, LogicalKeyboardKey.keyT);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await tester.tap(find.byKey(const ValueKey('harness-start-new')));
case 'search shortcut':
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Agent 12',
);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
default:
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
}
await tester.pumpAndSettle();
- expect(find.byType(NewAgentComposer), findsOneWidget);
+ expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('Cancel'), findsNothing);
expect(find.text('Back to Search'), findsNothing);
if (dismissal == 'outside') {
@@ -138,10 +128,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
}
await tester.pumpAndSettle();
- expect(
- find.byType(NewAgentComposer),
- entry == 'start page' ? findsOneWidget : findsNothing,
- );
+ expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
if (entry == 'start page') {
expect(app.swarms, hasLength(2));
@@ -149,7 +136,7 @@ void main() {
final field = tester.widget<TextField>(
find.byKey(const ValueKey('harness-start-search')),
);
- expect(field.focusNode!.hasFocus, dismissal == 'escape');
+ expect(field.focusNode!.hasFocus, isFalse);
// The unused page remains usable and closes without a history entry.
await chord(tester, LogicalKeyboardKey.keyW);
}
@@ -175,13 +162,12 @@ void main() {
final connection = _Connection();
final app = createApp(connectionForTest: (_) => connection);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
- expect(find.byType(NewAgentComposer), findsOneWidget);
+ expect(find.byType(AlertDialog), findsOneWidget);
await tester.tapAt(const Offset(12, 72));
await tester.pumpAndSettle();
- expect(find.byKey(const ValueKey('agent-composer')), findsNothing);
- expect(find.byType(NewAgentComposer), findsOneWidget);
+ expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
expect(
tester
@@ -212,7 +198,7 @@ void main() {
await mount(tester, app);
final field = find.byKey(const ValueKey('swarm-search-input'));
if (entry == 'Open') {
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
} else {
await chord(tester, LogicalKeyboardKey.keyP, shift: true);
await tester.enterText(field, '> $entry');
@@ -221,19 +207,19 @@ void main() {
await tester.pump();
}
expect(find.byType(SwarmSearchResults), findsOneWidget);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
- expect(find.byType(NewAgentComposer), findsOneWidget);
- expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(find.byType(SwarmSearchResults), findsNothing);
expect(
find.text(switch (entry) {
- 'Split right' => 'New Agent · split right',
- 'Split down' => 'New Agent · split down',
+ 'Split right' => 'New Agent to the right',
+ 'Split down' => 'New Agent below',
_ => 'New Agent',
}),
findsWidgets,
);
- await _chooseLocal(tester);
+ await tester.tap(find.byKey(const Key('new-agent-folder')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
await tester.pump();
@@ -242,7 +228,7 @@ void main() {
// The fake new terminal has no handshake, so its spinner never settles.
await tester.pump();
await tester.pump(const Duration(milliseconds: 200));
- expect(find.byType(NewAgentComposer), findsNothing);
+ expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
expect(app.activeSwarm, same(target));
expect(target.panes.first, same(pane));
@@ -281,9 +267,9 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
}
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
- await _chooseLocal(tester);
+ await tester.tap(find.byKey(const Key('new-agent-folder')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
await tester.pump();
@@ -324,7 +310,7 @@ void main() {
check.created();
await tester.pump();
await tester.pump(const Duration(milliseconds: 200));
- expect(find.byKey(const ValueKey('agent-composer')), findsNothing);
+ expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
expect(app.activeSwarmId, current);
if (change == 'closed' || change == 'stale split') {
@@ -356,10 +342,10 @@ void main() {
final input = <TerminalBinaryFrame>[];
final pane = app.adoptSessionForTest(terminal('a0', input));
await mount(tester, app);
+ await chord(tester, LogicalKeyboardKey.keyO);
await chord(tester, LogicalKeyboardKey.keyN);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pumpAndSettle();
- await _chooseLocal(tester);
+ await tester.tap(find.byKey(const Key('new-agent-folder')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
await tester.pump();
@@ -374,7 +360,7 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
- expect(find.byType(NewAgentComposer), findsNothing);
+ expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
expect(app.panes, [pane]);
expect(connection.calls.map((c) => c.type), ['agent_create']);
@@ -382,9 +368,9 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
expect(input.single.bytes, [27, 91, 66]);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(find.byType(SwarmSearchResults), findsOneWidget);
- expect(find.byType(NewAgentComposer), findsOneWidget);
+ expect(find.byKey(const ValueKey('create-agent-submit')), findsNothing);
expect(connection.calls, hasLength(1));
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/entry_surfaces_render_test.dart b/desktop/test/entry_surfaces_render_test.dart
index 2cdc5c8f7..8e9f7691e 100644
--- a/desktop/test/entry_surfaces_render_test.dart
+++ b/desktop/test/entry_surfaces_render_test.dart
@@ -187,19 +187,19 @@ void main() {
}
}
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pumpAndSettle();
await capture('open');
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
await capture('new');
expect(tester.takeException(), isNull);
- for (final label in ['Agent', 'Project', 'Machine', 'Create']) {
+ for (final label in ['Codex', 'Claude Code', 'Cursor']) {
if (tester
.renderObject<RenderParagraph>(find.text(label))
.didExceedMaxLines) {
- issues.add('$label is truncated in the creation row');
+ issues.add('$label is truncated when choosing an agent');
}
}
expect(issues, isEmpty);
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 071a55ed6..8f309c821 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -138,7 +138,7 @@ void main() {
EngineAvailability(engine: 'hermes', installed: true),
]);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
FocusNode fieldFocus(String key) => tester
.widget<InkWell>(
@@ -383,7 +383,7 @@ void main() {
FileSelectorPlatform.instance = _FolderPicker();
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.tap(find.text('Browse…'));
await tester.pump();
@@ -492,12 +492,12 @@ void main() {
);
await runtime.mount(tester, app, map, native: native);
if (native) {
- final opening = runtime.native(tester, 'addAgent');
+ final opening = runtime.native(tester, 'newAgent');
await tester.pump();
await opening;
} else {
final addButton = find.byKey(
- const ValueKey('swarm-add-harness-button'),
+ const ValueKey('swarm-new-agent-button'),
);
final bell = find.byKey(const ValueKey('swarm-notifications-button'));
expect(
@@ -512,7 +512,6 @@ void main() {
await tester.tap(addButton);
await tester.pump();
}
- await tester.tap(find.byKey(const ValueKey('harness-picker-new')));
await tester.pump();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('/work/existing'), findsNothing);
@@ -573,7 +572,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
final folder = tester.widget<InkWell>(
@@ -627,7 +626,7 @@ void main() {
FileSelectorPlatform.instance = picker;
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const Key('new-agent-folder'));
await tester.tap(field);
await tester.pump();
@@ -786,7 +785,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
expect(picker.opened, 1);
expect(app.probes, 1);
expect(find.byType(AlertDialog), findsOneWidget);
@@ -852,7 +851,7 @@ void main() {
for (final chooseExplicitly in [false, true]) {
final app = _FirstUseApp()..probe = Completer<void>();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
if (chooseExplicitly) {
await tester.tap(
diff --git a/desktop/test/harness_picker_entry_test.dart b/desktop/test/harness_picker_entry_test.dart
index 2fe3a6cc8..56e4bdad8 100644
--- a/desktop/test/harness_picker_entry_test.dart
+++ b/desktop/test/harness_picker_entry_test.dart
@@ -10,8 +10,7 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shortcuts/app_keymap.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/widgets/swarm_switcher.dart';
-import 'package:harness/widgets/new_agent_dialog.dart';
-import 'package:harness/shared/widgets/app_select_field.dart';
+import 'package:harness/shared/widgets/app_choice_picker.dart';
import 'swarm_interactions_test.dart' show chord;
import 'swarm_screen_test.dart' show terminal;
@@ -41,114 +40,107 @@ void main() {
(const Size(760, 760), 1.0),
(const Size(600, 680), 2.0),
]) {
- testWidgets('Add Agent opens results and preview at $size, $scale', (
- tester,
- ) async {
- tester.view.devicePixelRatio = 1;
- tester.view.physicalSize = size;
- addTearDown(tester.view.reset);
- final app = createApp();
- await seedPreviews(app);
- final frames = <TerminalBinaryFrame>[];
- app.adoptSessionForTest(terminal('a69', frames));
- final pane = app.focusedPane;
- final keymap = AppKeymap();
- final boundaryKey = GlobalKey();
- await tester.pumpWidget(
- RepaintBoundary(
- key: boundaryKey,
- child: MaterialApp(
- debugShowCheckedModeBanner: false,
- theme: grid.buildAppTheme(brightness: Brightness.dark),
- builder: (context, child) => MediaQuery(
- data: MediaQuery.of(context)
- .copyWith(textScaler: TextScaler.linear(scale)),
- child: KeymapProvider(keymap: keymap, child: child!),
+ testWidgets(
+ 'Open Agent shows results separately from New Agent at $size, $scale',
+ (tester) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ final app = createApp();
+ await seedPreviews(app);
+ final frames = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a69', frames));
+ final pane = app.focusedPane;
+ final keymap = AppKeymap();
+ final boundaryKey = GlobalKey();
+ await tester.pumpWidget(
+ RepaintBoundary(
+ key: boundaryKey,
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context)
+ .copyWith(textScaler: TextScaler.linear(scale)),
+ child: KeymapProvider(keymap: keymap, child: child!),
+ ),
+ home: SwarmScreen(notifier: app, nativeTabs: false),
),
- home: SwarmScreen(notifier: app, nativeTabs: false),
),
- ),
- );
- await tester.pump(const Duration(milliseconds: 100));
- final field = find.byKey(const ValueKey('swarm-search-input'));
- await chord(tester, LogicalKeyboardKey.keyO);
- expect(field, findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
- expect(field, findsOneWidget);
- expect(find.byType(SwarmSearchResults), findsOneWidget);
- expect(
- find.byKey(const ValueKey('swarm-search-preview')),
- findsOneWidget,
- );
- expect(find.byKey(const ValueKey('harness-picker-open')), findsNothing);
- expect(tester.widget<TextField>(field).decoration!.hintText, '');
- expect(find.text('Find an agent'), findsOneWidget);
- expect(find.byType(NewAgentComposer), findsOneWidget);
- final create = find.byKey(const ValueKey('create-agent-submit'));
- final createRect = tester.getRect(create);
- final before = tester.getRect(field);
- final controller = tester.widget<TextField>(field).controller;
- expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+ );
+ await tester.pump(const Duration(milliseconds: 100));
+ final field = find.byKey(const ValueKey('swarm-search-input'));
+ await chord(tester, LogicalKeyboardKey.keyO);
+ expect(field, findsOneWidget);
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('swarm-search-preview')),
+ findsOneWidget,
+ );
+ expect(find.byKey(const ValueKey('harness-picker-open')), findsNothing);
+ expect(tester.widget<TextField>(field).decoration!.hintText, '');
+ expect(find.text('Find an agent'), findsOneWidget);
+ expect(find.byKey(const ValueKey('create-agent-submit')), findsNothing);
+ final before = tester.getRect(field);
+ final controller = tester.widget<TextField>(field).controller;
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
- Future<void> capture(String state) async {
- final output = Platform.environment['HARNESS_PICKER_CAPTURE_DIR'];
- if (output == null) return;
- await tester.runAsync(() async {
- await precacheImage(
- const AssetImage('assets/engine-icons/codex.png'),
- boundaryKey.currentContext!,
- );
- });
- await tester.pumpAndSettle();
- final boundary =
- boundaryKey.currentContext!.findRenderObject()!
- as RenderRepaintBoundary;
- await tester.runAsync(() async {
- final image = await boundary.toImage(pixelRatio: 1);
- final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
- await Directory(output).create(recursive: true);
- await File('$output/${size.width.toInt()}-$scale-$state.png')
- .writeAsBytes(bytes!.buffer.asUint8List());
- image.dispose();
- });
- }
+ Future<void> capture(String state) async {
+ final output = Platform.environment['HARNESS_PICKER_CAPTURE_DIR'];
+ if (output == null) return;
+ await tester.runAsync(() async {
+ await precacheImage(
+ const AssetImage('assets/engine-icons/codex.png'),
+ boundaryKey.currentContext!,
+ );
+ });
+ await tester.pumpAndSettle();
+ final boundary =
+ boundaryKey.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary;
+ await tester.runAsync(() async {
+ final image = await boundary.toImage(pixelRatio: 1);
+ final bytes = await image.toByteData(
+ format: ui.ImageByteFormat.png,
+ );
+ await Directory(output).create(recursive: true);
+ await File('$output/${size.width.toInt()}-$scale-$state.png')
+ .writeAsBytes(bytes!.buffer.asUint8List());
+ image.dispose();
+ });
+ }
- await capture('initial');
- expect(app.focusedPane, same(pane));
- await tester.enterText(field, 'idempotency');
- await tester.pump();
- expect(tester.getRect(field), before);
- expect(tester.widget<TextField>(field).controller, same(controller));
- expect(find.textContaining('Payment retries now reuse'), findsOneWidget);
- await capture('results');
- // Search leaves the creation row, selected choices and focus ownership intact.
- expect(tester.getRect(create), createRect);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
- await tester.pumpAndSettle();
- final agent = find.byKey(const ValueKey('agent-composer-agent'));
- expect(
- tester.widget<AppSelectField<String>>(agent).focusNode!.hasFocus,
- isTrue,
- );
- expect(field, findsOneWidget);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pumpAndSettle();
- await tester.sendKeyEvent(LogicalKeyboardKey.keyC, character: 'c');
- await tester.sendKeyEvent(LogicalKeyboardKey.keyL, character: 'l');
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pumpAndSettle();
- expect(tester.widget<AppSelectField<String>>(agent).value, 'claude');
- expect(tester.widget<TextField>(field).controller!.text, 'idempotency');
- expect(find.byType(AlertDialog), findsNothing);
- await capture('creation');
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pumpAndSettle();
- expect(app.focusedPane, same(pane));
- expect(frames, isEmpty);
- expect(tester.takeException(), isNull);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- keymap.dispose();
- });
+ await capture('initial');
+ expect(app.focusedPane, same(pane));
+ await tester.enterText(field, 'idempotency');
+ await tester.pump();
+ expect(tester.getRect(field), before);
+ expect(tester.widget<TextField>(field).controller, same(controller));
+ expect(
+ find.textContaining('Payment retries now reuse'),
+ findsOneWidget,
+ );
+ await capture('results');
+ await chord(tester, LogicalKeyboardKey.keyN);
+ await tester.pumpAndSettle();
+ expect(field, findsNothing);
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('create-agent-submit')),
+ findsOneWidget,
+ );
+ expect(find.byType(AppChoicePicker<String>), findsWidgets);
+ await capture('creation');
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(app.focusedPane, same(pane));
+ expect(frames, isEmpty);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ keymap.dispose();
+ },
+ );
}
}
diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dart
index bca2d5c0d..4f563a5d8 100644
--- a/desktop/test/keymap_host_test.dart
+++ b/desktop/test/keymap_host_test.dart
@@ -58,8 +58,8 @@ void main() {
('cmd+1', 'swarm.select_1'),
('cmd+9', 'swarm.select_9'),
('cmd+t', 'swarm.new'),
- ('cmd+shift+n', 'agent.new'),
- ('cmd+n', 'agent.add'),
+ ('cmd+n', 'agent.new'),
+ ('cmd+o', 'agent.add'),
('cmd+h', 'pane.focus_left'),
('cmd+j', 'pane.focus_below'),
('cmd+k', 'pane.focus_above'),
@@ -94,7 +94,7 @@ void main() {
expect(harnessCommandById[id]?.action, shortcut.action);
}
for (final retired in [
- 'cmd+o',
+ 'cmd+shift+n',
'cmd+shift+h',
'cmd+shift+j',
'cmd+shift+k',
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index 2ddd5ffdf..3edbd3fd3 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -1,8 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
-import 'package:harness/shared/widgets/app_select_field.dart';
-import 'package:harness/widgets/new_agent_dialog.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/screens/swarm_screen.dart';
@@ -382,7 +380,7 @@ void main() {
if (inline) {
await tester.tap(input);
} else {
- await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
}
await tester.enterText(input, 'Agent');
await tester.pump();
@@ -458,7 +456,7 @@ void main() {
expect(find.byType(SwarmSearchResults), findsNothing);
expect(tester.widget<TextField>(field).controller!.text, '> ');
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isFalse);
- await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
final modal = find.byKey(const ValueKey('swarm-search-input'));
expect(tester.widget<TextField>(modal).focusNode!.hasFocus, isTrue);
expect(tester.widget<TextField>(modal).controller!.text, isEmpty);
@@ -583,7 +581,7 @@ void main() {
(true, true),
]) {
testWidgets(
- 'New moves from inline search to the shared creation row (native=$fromMenu, result focused=$resultFocused)',
+ 'New closes inline search before opening its form (native=$fromMenu, result focused=$resultFocused)',
(tester) async {
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
nativeChannel,
@@ -611,20 +609,14 @@ void main() {
await tester.pump();
await opening;
} else {
- await key(tester, LogicalKeyboardKey.keyN, cmd: true, shift: true);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
}
await tester.pumpAndSettle();
- expect(find.byType(NewAgentComposer), findsOneWidget);
+ expect(find.byType(AlertDialog), findsOneWidget);
expect(find.byType(SwarmSearchResults), findsNothing);
- expect(
- find.byKey(const ValueKey('harness-start-results')),
- findsNothing,
- );
expect(
tester
- .widget<AppSelectField<String>>(
- find.byKey(const ValueKey('agent-composer-agent')),
- )
+ .widget<InkWell>(find.byKey(const Key('new-agent-folder')))
.focusNode!
.hasPrimaryFocus,
isTrue,
@@ -633,7 +625,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsNothing);
expect(find.byType(SwarmSearchResults), findsNothing);
- expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isFalse);
expect(tester.widget<TextField>(field).controller!.text, 'Agent 12');
expect(app.panes, isEmpty);
expect(tester.takeException(), isNull);
@@ -670,7 +662,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyO, cmd: true);
}
await tester.enterText(field, 'Agent');
await tester.pump();
diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dart
index 41091167d..bdf7ff172 100644
--- a/desktop/test/new_agent_codex_profile_test.dart
+++ b/desktop/test/new_agent_codex_profile_test.dart
@@ -142,7 +142,7 @@ void main() {
WidgetTester tester, {
bool local = true,
bool supported = true,
- bool composer = false,
+ bool revealOptions = true,
Iterable<String>? initialPaths,
_Notifier? notifier,
}) async {
@@ -172,39 +172,23 @@ void main() {
MaterialApp(
home: Builder(
builder: (context) => Scaffold(
- body: composer
- ? Center(
- child: SizedBox(
- width: 900,
- child: NewAgentComposer(
- notifier: n,
- machineId: 'machine',
- swarmId: n.activeSwarmId,
- onFinished: () {},
- onBusyChanged: (_) {},
- onDismiss: () {},
- ),
- ),
- )
- : TextButton(
- onPressed: () => showNewAgentDialog(
- context,
- n,
- 'machine',
- source: 'machine_row',
- ),
- child: const Text('open'),
- ),
+ body: TextButton(
+ onPressed: () => showNewAgentDialog(
+ context,
+ n,
+ 'machine',
+ source: 'machine_row',
+ initialFolder: revealOptions ? null : '/work',
+ ),
+ child: const Text('open'),
+ ),
),
),
),
);
- if (composer) {
- await tester.pumpAndSettle();
- return n;
- }
await tester.tap(find.text('open'));
await tester.pumpAndSettle();
+ if (!revealOptions) return n;
await tester.tap(find.byKey(const Key('new-agent-engine-field')));
await tester.pumpAndSettle();
await tester.tap(find.text('Codex').last);
@@ -230,7 +214,7 @@ void main() {
(tester) async {
final storage = _DelayedPreferenceStore();
final notifier = _Notifier(const ['/custom/work-login'], storage);
- await open(tester, notifier: notifier, composer: true);
+ await open(tester, notifier: notifier, revealOptions: false);
final create = find.byKey(const ValueKey('create-agent-submit'));
expect(tester.widget<FilledButton>(create).onPressed, isNotNull);
storage.preference.complete('codex');
@@ -244,18 +228,14 @@ void main() {
},
);
- testWidgets('compact creation explains a pending profile lookup', (
- tester,
- ) async {
+ testWidgets('creation waits for its selected Codex profile', (tester) async {
final pending = Completer<void>();
final notifier = _Notifier()..pending = pending;
- await open(tester, notifier: notifier, composer: true);
+ await open(tester, notifier: notifier, revealOptions: false);
final create = find.byKey(const ValueKey('create-agent-submit'));
- expect(find.text('Loading Codex profiles…'), findsOneWidget);
expect(tester.widget<FilledButton>(create).onPressed, isNull);
pending.complete();
await tester.pumpAndSettle();
- expect(find.text('Loading Codex profiles…'), findsNothing);
expect(tester.widget<FilledButton>(create).onPressed, isNotNull);
});
diff --git a/desktop/test/new_agent_project_folder_test.dart b/desktop/test/new_agent_project_folder_test.dart
index f15548760..5d8b413ab 100644
--- a/desktop/test/new_agent_project_folder_test.dart
+++ b/desktop/test/new_agent_project_folder_test.dart
@@ -1,7 +1,6 @@
import 'dart:async';
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/auth/auth_session.dart';
import 'package:harness/core/config.dart';
@@ -9,13 +8,9 @@ import 'package:harness/core/models.dart';
import 'package:harness/core/project_folder.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/app_state.dart';
-import 'package:harness/screens/swarm_screen.dart';
import 'package:harness/widgets/new_agent_dialog.dart';
import 'package:harness/ws/ws_conn.dart';
-import 'swarm_interactions_test.dart' show chord;
-import 'swarm_screen_test.dart' show terminal;
-
class _Connection extends WsConn {
_Connection()
: super(
@@ -35,9 +30,6 @@ class _Connection extends WsConn {
Map<String, dynamic> payload = const {},
Duration timeout = const Duration(seconds: 20),
}) {
- if (type != 'agent_create' && type != 'agent_create_status') {
- return Future.value(<String, dynamic>{});
- }
final result = Completer<Map<String, dynamic>>();
calls.add((type, payload, result));
return result.future;
@@ -78,234 +70,124 @@ class _App extends AppNotifier {
}
}
-Future<void> _mount(
- WidgetTester tester,
- _App app, {
- bool composer = false,
-}) async {
+Future<void> _mount(WidgetTester tester, _App app) async {
await app.agentPreference.select('claude');
await tester.pumpWidget(
MaterialApp(
theme: grid.buildAppTheme(brightness: Brightness.dark),
home: Scaffold(
- body: composer
- ? Center(
- child: SizedBox(
- width: 760,
- child: NewAgentComposer(
- notifier: app,
- machineId: 'm',
- swarmId: app.activeSwarmId,
- onFinished: () {},
- onBusyChanged: (_) {},
- onDismiss: () {},
- ),
- ),
- )
- : Builder(
- builder: (context) => TextButton(
- onPressed: () =>
- showNewAgentDialog(context, app, 'm', source: 'test'),
- child: const Text('Open'),
- ),
- ),
+ body: Builder(
+ builder: (context) => TextButton(
+ onPressed: () =>
+ showNewAgentDialog(context, app, 'm', source: 'test'),
+ child: const Text('Open'),
+ ),
+ ),
),
),
);
- if (!composer) await tester.tap(find.text('Open'));
+ await tester.tap(find.text('Open'));
await tester.pumpAndSettle();
}
void main() {
- for (final inline in [false, true]) {
- testWidgets(
- 'shared creation preserves its destination and blocks duplicate launch (inline=$inline)',
- (tester) async {
- tester.view.devicePixelRatio = 1;
- tester.view.physicalSize = const Size(1200, 900);
- addTearDown(tester.view.reset);
- final connection = _Connection();
- final app = _App(connection, local: true);
- await app.agentPreference.select('claude');
- if (!inline) app.adoptSessionForTest(terminal('a0', []));
- final original = app.activeSwarmId;
- addTearDown(() async {
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.dark),
- home: SwarmScreen(notifier: app, nativeTabs: false),
- ),
- );
- if (!inline) await chord(tester, LogicalKeyboardKey.keyR);
- await tester.pumpAndSettle();
- final composer = find.byType(NewAgentComposer);
- final split = tester.widget<NewAgentComposer>(composer).split;
- expect(split, inline ? isNull : isNotNull);
- expect(tester.widget<NewAgentComposer>(composer).swarmId, original);
- final submit = find.byKey(const ValueKey('create-agent-submit'));
- await tester.tap(submit);
- await tester.pump();
- expect(connection.calls, hasLength(1));
- final creationId = connection.calls.single.$2['creationId'];
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await chord(tester, LogicalKeyboardKey.keyT);
- await tester.tapAt(const Offset(10, 400));
- await tester.pump();
- expect(composer, findsOneWidget);
- expect(app.activeSwarmId, original);
- expect(tester.widget<NewAgentComposer>(composer).split, same(split));
- expect(connection.calls, hasLength(1));
- connection.calls.single.$3.completeError(
- const WsRequestTimeout('agent_create'),
- );
- await tester.pumpAndSettle();
- expect(find.text('Check status'), findsOneWidget);
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pump();
- expect(composer, findsOneWidget);
- await tester.tap(submit);
- await tester.pump();
- expect(connection.calls.last.$1, 'agent_create_status');
- expect(connection.calls.last.$2, {'creationId': creationId});
- connection.calls.last.$3.complete({
- 'creationId': creationId,
- 'state': 'created',
- 'agent': {
- 'id': 'created',
- 'name': 'Created agent',
- 'engine': 'claude',
- },
- });
- await tester.pump();
- await tester.pump(const Duration(milliseconds: 200));
- expect(composer, findsNothing);
- expect(app.activeSwarmId, original);
- expect(app.panes, hasLength(inline ? 1 : 2));
- expect(app.focusedPane?.agentId, 'created');
- },
- );
- }
-
- for (final composer in [false, true]) {
- for (final local in [true, false]) {
- testWidgets(
- 'New prepares only on the selected machine (local=$local, composer=$composer)',
- (tester) async {
- final connection = _Connection();
- final app = _App(connection, local: local);
- addTearDown(() async {
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
- await _mount(tester, app, composer: composer);
- expect(app.prepared, isEmpty);
- expect(connection.calls, isEmpty);
- if (!composer) {
- await tester.tap(
- find.byKey(const ValueKey('new-agent-folder-newProject')),
- );
- } else {
- expect(find.text('New project'), findsOneWidget);
- }
- await tester.pumpAndSettle();
- expect(
- app.prepared,
- isEmpty,
- reason: 'Selecting New does not create folders',
- );
- await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
- await tester.pump();
- final (_, payload, _) = connection.calls.single;
- if (local) {
- expect(app.prepared, hasLength(1));
- expect(payload['cwd'], '/local/Harness Projects/project-test');
- expect(
- payload.containsKey('projectSource'),
- isFalse,
- reason: 'Current local CLIs retain the existing cwd protocol',
- );
- } else {
- expect(app.prepared, isEmpty);
- expect(payload['projectSource'], 'new');
- expect(
- payload.containsKey('cwd'),
- isFalse,
- reason: 'An older remote CLI must refuse instead of starting in the wrong folder',
- );
- }
- connection.fail(
- folder: local ? null : '/remote/Harness Projects/project-test',
- );
- await tester.pumpAndSettle();
- await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
- await tester.pump();
- expect(
- connection.calls.last.$2['cwd'],
- '${local ? '/local' : '/remote'}/Harness Projects/project-test',
- );
- expect(
- connection.calls.last.$2.containsKey('projectSource'),
- isFalse,
- );
- expect(app.prepared.length, local ? 1 : 0);
- connection.fail();
- await tester.pumpAndSettle();
- },
+ for (final local in [true, false]) {
+ testWidgets('New prepares only on the selected machine (local=$local)', (
+ tester,
+ ) async {
+ final connection = _Connection();
+ final app = _App(connection, local: local);
+ addTearDown(() async {
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+ await _mount(tester, app);
+ expect(app.prepared, isEmpty);
+ expect(connection.calls, isEmpty);
+ await tester.tap(
+ find.byKey(const ValueKey('new-agent-folder-newProject')),
);
- }
-
- testWidgets(
- 'Remote keeps its URL and status retries never clone again (composer=$composer)',
- (tester) async {
- final connection = _Connection();
- final app = _App(connection, local: false);
- addTearDown(() async {
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
- await _mount(tester, app, composer: composer);
- if (composer) {
- await tester.tap(
- find.byKey(const ValueKey('agent-composer-project')),
- );
- await tester.pumpAndSettle();
- await tester.tap(find.text('Remote repository…'));
- } else {
- await tester.tap(
- find.byKey(const ValueKey('new-agent-folder-remote')),
- );
- }
- await tester.pumpAndSettle();
- final field = find.byKey(const ValueKey('new-agent-repository'));
- expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+ await tester.pumpAndSettle();
+ expect(
+ app.prepared,
+ isEmpty,
+ reason: 'Selecting New does not create folders',
+ );
+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.pump();
+ final (_, payload, _) = connection.calls.single;
+ if (local) {
+ expect(app.prepared, hasLength(1));
+ expect(payload['cwd'], '/local/Harness Projects/project-test');
expect(
- tester
- .widget<FilledButton>(
- find.byKey(const ValueKey('create-agent-submit')),
- )
- .onPressed,
- isNull,
+ payload.containsKey('projectSource'),
+ isFalse,
+ reason: 'Current local CLIs retain the existing cwd protocol',
);
- await tester.enterText(field, 'owner/repo');
- await tester.pump();
- await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
- await tester.pump();
- final (_, payload, result) = connection.calls.single;
- expect(payload['projectSource'], 'remote');
- expect(payload['repositoryUrl'], 'https://github.com/owner/repo.git');
+ } else {
expect(app.prepared, isEmpty);
- result.completeError(const WsRequestTimeout('agent_create'));
- await tester.pumpAndSettle();
- await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
- await tester.pump();
- expect(connection.calls.last.$1, 'agent_create_status');
- expect(connection.calls.last.$2, {'creationId': payload['creationId']});
- connection.fail();
- await tester.pumpAndSettle();
- },
- );
+ expect(payload['projectSource'], 'new');
+ expect(
+ payload.containsKey('cwd'),
+ isFalse,
+ reason: 'An older remote CLI must refuse instead of starting in the wrong folder',
+ );
+ }
+ connection.fail(
+ folder: local ? null : '/remote/Harness Projects/project-test',
+ );
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.pump();
+ expect(
+ connection.calls.last.$2['cwd'],
+ '${local ? '/local' : '/remote'}/Harness Projects/project-test',
+ );
+ expect(connection.calls.last.$2.containsKey('projectSource'), isFalse);
+ expect(app.prepared.length, local ? 1 : 0);
+ connection.fail();
+ await tester.pumpAndSettle();
+ });
}
+
+ testWidgets(
+ 'Remote uses its inline URL and status retries never clone again',
+ (tester) async {
+ final connection = _Connection();
+ final app = _App(connection, local: false);
+ addTearDown(() async {
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+ await _mount(tester, app);
+ await tester.tap(find.byKey(const ValueKey('new-agent-folder-remote')));
+ await tester.pumpAndSettle();
+ final field = find.byKey(const ValueKey('new-agent-repository'));
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+ expect(
+ tester
+ .widget<FilledButton>(
+ find.byKey(const ValueKey('create-agent-submit')),
+ )
+ .onPressed,
+ isNull,
+ );
+ await tester.enterText(field, 'owner/repo');
+ await tester.pump();
+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.pump();
+ final (_, payload, result) = connection.calls.single;
+ expect(payload['projectSource'], 'remote');
+ expect(payload['repositoryUrl'], 'https://github.com/owner/repo.git');
+ expect(app.prepared, isEmpty);
+ result.completeError(const WsRequestTimeout('agent_create'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.pump();
+ expect(connection.calls.last.$1, 'agent_create_status');
+ expect(connection.calls.last.$2, {'creationId': payload['creationId']});
+ connection.fail();
+ await tester.pumpAndSettle();
+ },
+ );
}
diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dart
index c5e98847e..6889c3970 100644
--- a/desktop/test/swarm_add_agent_test.dart
+++ b/desktop/test/swarm_add_agent_test.dart
@@ -25,7 +25,7 @@ void main() {
await mount(tester, app);
tester.view.physicalSize = const Size(880, 560);
await tester.pump();
- final add = find.byKey(const ValueKey('swarm-add-harness-button'));
+ final add = find.byKey(const ValueKey('swarm-open-agent-button'));
expect(tester.getRect(add).top, lessThan(44));
expect(find.byType(FloatingActionButton), findsNothing);
expect(
diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dart
index 226de897e..fe133bbdf 100644
--- a/desktop/test/swarm_commands_test.dart
+++ b/desktop/test/swarm_commands_test.dart
@@ -117,7 +117,7 @@ void main() {
final app = createApp();
await mount(tester, app);
final input = find.byKey(const ValueKey('swarm-search-input'));
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(input, '> rename');
await tester.pump();
expect(
diff --git a/desktop/test/swarm_content_search_test.dart b/desktop/test/swarm_content_search_test.dart
index b4de91981..182fb75dd 100644
--- a/desktop/test/swarm_content_search_test.dart
+++ b/desktop/test/swarm_content_search_test.dart
@@ -160,7 +160,7 @@ void main() {
app.adoptSessionForTest(terminal('a69', []));
app.newSwarm();
await mount(tester, app);
- if (!inline) await chord(tester, LogicalKeyboardKey.keyN);
+ if (!inline) await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(
ValueKey(inline ? 'harness-start-search' : 'swarm-search-input'),
);
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index fe9257b27..95e38c685 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -2,7 +2,6 @@ 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/widgets/new_agent_dialog.dart';
import 'package:xterm/xterm.dart';
import 'swarm_interactions_test.dart' show chord;
@@ -83,7 +82,7 @@ void main() {
});
for (final native in [false, true]) {
- testWidgets('start page combines search and New Agent (native=$native)', (
+ testWidgets('start page separates Open and New Agent (native=$native)', (
tester,
) async {
const channel = MethodChannel('harness/swarm_tabs');
@@ -105,7 +104,9 @@ void main() {
expect(find.byType(FloatingActionButton), findsNothing);
expect(
tester.getRect(_startInput).bottom,
- lessThan(tester.getRect(find.byType(NewAgentComposer)).top),
+ lessThan(
+ tester.getRect(find.byKey(const ValueKey('harness-start-open'))).top,
+ ),
);
expect(
tester.widget<TextField>(_startInput).decoration!.hintText,
@@ -148,8 +149,21 @@ void main() {
app.renameSwarm(original, 'Background update');
await tester.pump();
expect(_results, findsNothing);
- expect(find.byType(NewAgentComposer), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'Create'), findsOneWidget);
+ await tester.tap(find.byKey(const ValueKey('harness-start-new')));
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.widgetWithText(FilledButton, 'New Agent'),
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('Back to Search'), findsNothing);
+ expect(find.text('Cancel'), findsNothing);
+ expect(_results, findsNothing);
+ await tester.tapAt(const Offset(20, 200));
+ await tester.pump(const Duration(milliseconds: 200));
expect(find.byType(AlertDialog), findsNothing);
expect(_results, findsNothing);
expect(_startInput, findsOneWidget);
@@ -173,7 +187,7 @@ void main() {
expect(page, isNot(original));
expect(_results, findsNothing);
expect(_startInput, findsOneWidget);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(_results, findsOneWidget);
if (dismissal == 'outside') {
await tester.tapAt(const Offset(20, 200));
@@ -204,7 +218,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(_input, 'Agent 12');
await tester.pump();
final text = tester.widget<TextField>(_input).controller!;
@@ -247,7 +261,7 @@ void main() {
app.newSwarm();
final destination = app.activeSwarmId;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(_input, 'Agent 0');
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index 0e11e6108..f65578fad 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -67,102 +67,105 @@ Future<void> chord(
void main() {
for (final native in [false, true]) {
- testWidgets('New Harness actions reuse the existing page (native: $native)', (
- tester,
- ) async {
- const channel = MethodChannel('harness/swarm_tabs');
- const codec = StandardMethodCodec();
- final messenger = tester.binding.defaultBinaryMessenger;
- messenger.setMockMethodCallHandler(channel, (_) async => true);
- addTearDown(() => messenger.setMockMethodCallHandler(channel, null));
- final app = createApp();
- app.machineStates['m']!.nodeOnline = true;
- app.adoptSessionForTest(terminal('a0', []));
- final work = app.activeSwarmId;
- app.newSwarm();
- final starter = app.activeSwarmId;
- final projects = SwarmProjectStore(storage: MemoryStore());
- await tester.pumpWidget(
- MaterialApp(
- home: SwarmScreen(
- notifier: app,
- nativeTabs: native,
- projectStore: projects,
+ testWidgets(
+ 'New Harness actions reuse the existing page (native: $native)',
+ (tester) async {
+ const channel = MethodChannel('harness/swarm_tabs');
+ const codec = StandardMethodCodec();
+ final messenger = tester.binding.defaultBinaryMessenger;
+ messenger.setMockMethodCallHandler(channel, (_) async => true);
+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));
+ final app = createApp();
+ app.machineStates['m']!.nodeOnline = true;
+ app.adoptSessionForTest(terminal('a0', []));
+ final work = app.activeSwarmId;
+ app.newSwarm();
+ final starter = app.activeSwarmId;
+ final projects = SwarmProjectStore(storage: MemoryStore());
+ await tester.pumpWidget(
+ MaterialApp(
+ home: SwarmScreen(
+ notifier: app,
+ nativeTabs: native,
+ projectStore: projects,
+ ),
),
- ),
- );
- await tester.pumpAndSettle();
-
- Future<void> newFromChrome() async {
- if (!native) {
- await tester.tap(find.byKey(const ValueKey('swarm-new-tab-button')));
- return;
- }
- var replied = false;
- messenger.handlePlatformMessage(
- channel.name,
- codec.encodeMethodCall(const MethodCall('new')),
- (_) => replied = true,
);
- for (var i = 0; i < 5 && !replied; i++) {
- await tester.pump();
+ await tester.pumpAndSettle();
+
+ Future<void> newFromChrome() async {
+ if (!native) {
+ await tester.tap(
+ find.byKey(const ValueKey('swarm-new-tab-button')),
+ );
+ return;
+ }
+ var replied = false;
+ messenger.handlePlatformMessage(
+ channel.name,
+ codec.encodeMethodCall(const MethodCall('new')),
+ (_) => replied = true,
+ );
+ for (var i = 0; i < 5 && !replied; i++) {
+ await tester.pump();
+ }
+ expect(replied, isTrue);
}
- expect(replied, isTrue);
- }
- for (final action in <Future<void> Function()>[
- () => chord(tester, LogicalKeyboardKey.keyT),
- newFromChrome,
- () async {
- await chord(tester, LogicalKeyboardKey.keyP, shift: true);
- await tester.enterText(
- find.byKey(const ValueKey('swarm-search-input')),
- 'New Harness',
+ for (final action in <Future<void> Function()>[
+ () => chord(tester, LogicalKeyboardKey.keyT),
+ newFromChrome,
+ () async {
+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);
+ await tester.enterText(
+ find.byKey(const ValueKey('swarm-search-input')),
+ 'New Harness',
+ );
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ },
+ ]) {
+ app.selectSwarm(work);
+ await tester.pumpAndSettle();
+ await action();
+ await tester.pumpAndSettle();
+ expect(app.activeSwarmId, starter);
+ expect(app.swarms, hasLength(2));
+ await chord(tester, LogicalKeyboardKey.keyT);
+ expect(app.activeSwarmId, starter);
+ expect(app.swarms, hasLength(2));
+ final input = tester.widget<TextField>(
+ find.byKey(const ValueKey('harness-start-search')),
);
+ expect(input.focusNode!.hasFocus, isTrue);
+ expect(
+ find.byKey(const ValueKey('harness-start-results')),
+ findsNothing,
+ );
+ tester.testTextInput.enterText('Agent 1');
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- },
- ]) {
- app.selectSwarm(work);
- await tester.pumpAndSettle();
- await action();
- await tester.pumpAndSettle();
- expect(app.activeSwarmId, starter);
- expect(app.swarms, hasLength(2));
- await chord(tester, LogicalKeyboardKey.keyT);
- expect(app.activeSwarmId, starter);
- expect(app.swarms, hasLength(2));
- final input = tester.widget<TextField>(
- find.byKey(const ValueKey('harness-start-search')),
- );
- expect(input.focusNode!.hasFocus, isTrue);
- expect(
- find.byKey(const ValueKey('harness-start-results')),
- findsNothing,
- );
- tester.testTextInput.enterText('Agent 1');
- await tester.pump();
- expect(
- find.byKey(const ValueKey('harness-start-results')),
- findsOneWidget,
- );
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pump();
- expect(input.focusNode!.hasFocus, isFalse);
- await newFromChrome();
- await tester.pump();
- expect(app.activeSwarmId, starter);
- expect(app.swarms, hasLength(2));
- expect(input.focusNode!.hasFocus, isTrue);
- expect(
- find.byKey(const ValueKey('harness-start-results')),
- findsNothing,
- );
- }
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- projects.dispose();
- });
+ expect(
+ find.byKey(const ValueKey('harness-start-results')),
+ findsOneWidget,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(input.focusNode!.hasFocus, isFalse);
+ await newFromChrome();
+ await tester.pump();
+ expect(app.activeSwarmId, starter);
+ expect(app.swarms, hasLength(2));
+ expect(input.focusNode!.hasFocus, isTrue);
+ expect(
+ find.byKey(const ValueKey('harness-start-results')),
+ findsNothing,
+ );
+ }
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ projects.dispose();
+ },
+ );
}
testWidgets(
@@ -170,7 +173,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
expect(app.panes, isEmpty);
await tester.enterText(
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
index 32a37bc5b..a6304c7a9 100644
--- a/desktop/test/swarm_picker_activation_test.dart
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -16,14 +16,17 @@ void main() {
final input = <TerminalBinaryFrame>[];
final pane = app.adoptSessionForTest(terminal('a0', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
final results = find.byKey(const ValueKey('swarm-search-results'));
expect(field, findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
expect(find.byKey(const ValueKey('swarm-search-new-agent')), findsNothing);
- expect(tester.getRect(field).width, tester.getRect(results).width);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ final panelRect = tester.getRect(results);
+ final fieldRect = tester.getRect(field);
+ expect(fieldRect.left, panelRect.left + 28);
+ expect(fieldRect.right, panelRect.right - 28);
+ await chord(tester, LogicalKeyboardKey.keyN);
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.widgetWithText(FilledButton, 'New Agent'), findsOneWidget);
expect(results, findsNothing);
@@ -53,7 +56,7 @@ void main() {
app.newSwarm();
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
if (activate == 'click') {
await tester.enterText(field, 'Agent 0');
diff --git a/desktop/test/swarm_project_members_test.dart b/desktop/test/swarm_project_members_test.dart
index 51a10d0b8..4424491f5 100644
--- a/desktop/test/swarm_project_members_test.dart
+++ b/desktop/test/swarm_project_members_test.dart
@@ -92,7 +92,7 @@ void main() {
reason:
'Editing project membership does not attach or take over terminals',
);
- await tester.tap(find.byKey(const ValueKey('swarm-add-harness-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-open-agent-button')));
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index e7c51a886..4fc943dff 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -180,7 +180,7 @@ void main() {
);
await mount(tester, app);
expect(find.text('Existing project'), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -216,7 +216,7 @@ void main() {
);
expect(find.text('Models'), findsNothing);
expect(find.text('Machines'), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -228,11 +228,11 @@ void main() {
await tester.pump();
await app.addAgentToSwarm('m', 'a2');
app.toggleZoomPane();
- // The Add button appears when the first agent replaces the welcome page.
+ // The Open button appears when the first agent replaces the welcome page.
await tester.pump(const Duration(milliseconds: 200));
final zoom = app.zoomedPaneId;
final before = tester.getSize(find.byType(PaneGrid));
- await tester.tap(find.byKey(const ValueKey('swarm-add-harness-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-open-agent-button')));
await tester.pump(const Duration(milliseconds: 300));
expect(
find.byKey(const ValueKey('swarm-search-results')),
diff --git a/desktop/test/swarm_search_preview_test.dart b/desktop/test/swarm_search_preview_test.dart
index 498d84fdf..0ee7509b2 100644
--- a/desktop/test/swarm_search_preview_test.dart
+++ b/desktop/test/swarm_search_preview_test.dart
@@ -99,7 +99,7 @@ void main() {
await seedPreviews(app);
app.adoptSessionForTest(terminal('a69', []));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Workspace sync');
await tester.pump();
@@ -163,7 +163,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
}
await tester.enterText(field, 'Checkout retries');
await tester.pump();
@@ -276,7 +276,7 @@ void main() {
if (inline) {
await tester.tap(field);
} else {
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
}
await tester.enterText(field, 'Checkout retries');
await tester.pump();
@@ -371,7 +371,7 @@ void main() {
);
app.adoptSessionForTest(terminal('a69', []));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Checkout',
@@ -405,7 +405,7 @@ void main() {
await mount(tester, app);
tester.view.physicalSize = size;
await tester.pump();
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
'Checkout',
diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dart
index fa0b1d0d7..430dc8ff8 100644
--- a/desktop/test/swarm_search_render_test.dart
+++ b/desktop/test/swarm_search_render_test.dart
@@ -60,7 +60,7 @@ void main() {
final field = find.byKey(const ValueKey('swarm-search-input'));
Future<void> open() => chord(
tester,
- add ? LogicalKeyboardKey.keyN : LogicalKeyboardKey.keyP,
+ add ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
);
SwarmSearchKeys keys() => tester.widget<SwarmSearchKeys>(
find.ancestor(of: field, matching: find.byType(SwarmSearchKeys)),
@@ -144,7 +144,7 @@ void main() {
SwarmSearchInput inputWidget() => tester.widget<SwarmSearchInput>(
find.ancestor(of: field, matching: find.byType(SwarmSearchInput)),
);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(field, 'Agent 0');
await tester.pump();
final first = inputWidget().search!;
@@ -159,7 +159,7 @@ void main() {
await tester.pump();
session.terminal.write('Newest useful output.\r\n');
machine.projectReads = 0;
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
expect(tester.widget<TextField>(field).controller!.text, isEmpty);
await tester.enterText(field, 'Agent 0');
await tester.pump();
@@ -200,7 +200,7 @@ void main() {
try {
await chord(
tester,
- add ? LogicalKeyboardKey.keyN : LogicalKeyboardKey.keyP,
+ add ? LogicalKeyboardKey.keyO : LogicalKeyboardKey.keyP,
shift: !add,
);
expect(
@@ -242,7 +242,7 @@ void main() {
final input = <TerminalBinaryFrame>[];
app.adoptSessionForTest(terminal('a69', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump(const Duration(milliseconds: 200));
@@ -303,7 +303,7 @@ void main() {
),
),
);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
@@ -338,7 +338,7 @@ void main() {
final input = <TerminalBinaryFrame>[];
app.adoptSessionForTest(terminal('a69', input));
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
@@ -375,7 +375,7 @@ void main() {
app.adoptSessionForTest(terminal('a69', input));
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
await tester.enterText(field, 'Agent');
await tester.pump();
diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dart
index 0c6c4245a..1d8d05ee6 100644
--- a/desktop/test/swarm_search_test.dart
+++ b/desktop/test/swarm_search_test.dart
@@ -27,7 +27,7 @@ void main() {
await mount(tester, app);
final input = find.byKey(const ValueKey('swarm-search-input'));
expect(input, findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
final originalController = tester.widget<TextField>(input).controller;
await tester.enterText(input, 'a query only');
@@ -275,7 +275,7 @@ void main() {
.take(3)
.toList();
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(jumpField, 'Test host');
await tester.pump();
@@ -304,7 +304,7 @@ void main() {
app.adoptSessionForTest(terminal('a1', secondInputs));
final target = app.activeSwarm;
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(jumpField, 'Agent 0');
await tester.pump();
@@ -350,7 +350,7 @@ void main() {
ValueKey(adding ? 'swarm-search-input' : 'harness-start-search'),
);
if (adding) {
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
} else {
await tester.tap(field);
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index 1618df9cf..644ed2330 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -379,7 +379,7 @@ void main() {
expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
expect(find.text('New Agent to the right'), findsOneWidget);
expect(find.text('/work/checkout'), findsOneWidget);
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index f7a068e32..57010ee0c 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -59,7 +59,7 @@ void main() {
expect(opened.name, 'New Harness');
expect(opened.panes, isEmpty);
expect(find.byType(AlertDialog), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyN);
+ await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
await tester.enterText(field, 'Agent 0');
diff --git a/desktop/test/welcome_entry_layout_test.dart b/desktop/test/welcome_entry_layout_test.dart
index bd48aa7ab..4afa81cb6 100644
--- a/desktop/test/welcome_entry_layout_test.dart
+++ b/desktop/test/welcome_entry_layout_test.dart
@@ -94,10 +94,9 @@ void main() {
await tester.pump();
}
final field = find.byKey(const ValueKey('harness-start-search'));
- final create = find.byKey(const ValueKey('create-agent-submit'));
+ final create = find.byKey(const ValueKey('harness-start-new'));
+ final open = find.byKey(const ValueKey('harness-start-open'));
final device = find.byKey(const ValueKey('harness-device-link'));
- await tester.ensureVisible(create);
- await tester.pumpAndSettle();
expect(find.text('Harness'), findsNothing);
expect(
tester.widget<TextField>(field).decoration!.hintText,
@@ -107,14 +106,20 @@ void main() {
expect(find.byType(ListTile), findsNothing);
final fieldRect = tester.getRect(field);
final createRect = tester.getRect(create);
+ final openRect = tester.getRect(open);
final deviceRect = tester.getRect(device);
- expect(createRect.top, greaterThan(fieldRect.bottom));
+ expect(createRect.center.dy, closeTo(openRect.center.dy, 1));
+ expect(openRect.top, greaterThan(fieldRect.bottom));
+ expect(openRect.left, closeTo(fieldRect.left, 1));
+ expect(createRect.left, greaterThan(openRect.right));
expect(fieldRect.center.dx, closeTo(width / 2, 1));
expect(deviceRect.left, closeTo(fieldRect.left, 1));
expect(deviceRect.bottom, closeTo(height - 32, 1));
expect(find.text('Meet the Harness device'), findsOneWidget);
expect(create.hitTestable(), findsOneWidget);
+ expect(open.hitTestable(), findsOneWidget);
expect(createRect.bottom, lessThanOrEqualTo(height));
+ expect(openRect.bottom, lessThanOrEqualTo(height));
expect(deviceRect.top, greaterThanOrEqualTo(createRect.bottom + 24));
final output = Platform.environment['HARNESS_ENTRY_CAPTURE_DIR'];
if (output != null) {
@@ -139,7 +144,7 @@ void main() {
await tester.pump();
final results = find.byKey(const ValueKey('harness-start-results'));
expect(results, findsOneWidget);
- expect(tester.getRect(results).height, greaterThan(40));
+ expect(tester.getRect(results).height, greaterThan(140));
expect(tester.getRect(results).width, tester.getRect(field).width);
expect(tester.getRect(field).left, closeTo(fieldRect.left, 1));
expect(tester.getRect(field).right, closeTo(fieldRect.right, 1));
@@ -149,14 +154,22 @@ void main() {
tester.getRect(results).bottom,
lessThanOrEqualTo(deviceRect.top - 24),
);
- expect(tester.getRect(create), createRect);
- expect(create.hitTestable(), findsOneWidget);
+ expect(create, findsNothing);
+ expect(open, findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(tester.getRect(field).width, closeTo(fieldRect.width, 1));
expect(tester.getRect(device), deviceRect);
await tester.ensureVisible(create);
expect(create.hitTestable(), findsOneWidget);
+ await tester.tap(create);
+ await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(results, findsNothing);
+ expect(tester.takeException(), isNull);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsNothing);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isFalse);
await tester.ensureVisible(device);
await tester.pumpAndSettle();
diff --git a/desktop/tool/keymap_native_checks.swift b/desktop/tool/keymap_native_checks.swift
index b731a72b2..dfbb036c2 100644
--- a/desktop/tool/keymap_native_checks.swift
+++ b/desktop/tool/keymap_native_checks.swift
@@ -17,7 +17,7 @@ for (key, command) in [
("cmd+s", "pane.layout"), ("cmd+r", "pane.split_right"),
("cmd+d", "pane.split_down"),
("cmd+b", "task.route"), ("cmd+t", "swarm.new"),
- ("cmd+n", "agent.add"), ("cmd+shift+n", "agent.new"),
+ ("cmd+o", "agent.add"), ("cmd+n", "agent.new"),
("cmd+h", "pane.focus_left"), ("cmd+j", "pane.focus_below"),
("cmd+k", "pane.focus_above"), ("cmd+l", "pane.focus_right"),
] {
@@ -25,8 +25,8 @@ for (key, command) in [
"Preserve the current default for \(key)")
}
for context in ["workspace", "terminal", "picker"] {
- try checkKeymap(defaults.match([stroke("cmd+o")], context: context).binding == nil,
- "Command-O is unbound by default in \(context)")
+ try checkKeymap(defaults.match([stroke("cmd+shift+n")], context: context).binding == nil,
+ "Shift-Command-N is unbound by default in \(context)")
for number in 1...9 {
try checkKeymap(defaults.match([stroke("cmd+\(number)")], context: context).binding?.command == "swarm.select_\(number)",
"Command-number selects the corresponding tab from \(context)")
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 6c1050b6c..4aa177a12 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -233,17 +233,18 @@ private extension SwarmTabStrip {
"Titlebar actions add no hover hints")
try checkTitlebar(notificationButton.frame.maxX <= scroll.frame.minX,
"The bell is before the tabs beside the traffic lights")
- try checkTitlebar((newButton.isHidden || newButton.frame.maxX <= openButton.frame.minX) && scroll.frame.maxX <= openButton.frame.minX,
- "Add Agent has its own target on the right")
- try checkTitlebar(openButton.title == "Add Agent",
- "The titlebar has one Add Agent entry point")
+ try checkTitlebar((newButton.isHidden || newButton.frame.maxX <= createButton.frame.minX) && scroll.frame.maxX <= createButton.frame.minX && createButton.frame.maxX <= openButton.frame.minX,
+ "New and Open Agent have distinct targets on the right")
+ try checkTitlebar(openButton.title == "Open Agent" && createButton.title == "New Agent",
+ "The titlebar separates New and Open Agent")
try checkTitlebar(!subviews.contains(where: { $0 is NSTextField }), "The titlebar has no competing text editor")
events.removeAll()
newButton.performClick(nil)
notificationButton.performClick(nil)
+ createButton.performClick(nil)
openButton.performClick(nil)
- try checkTitlebar(events == ["new", "notifications", "addAgent"],
- "The new tab, notification and Add Agent buttons dispatch once")
+ try checkTitlebar(events == ["new", "notifications", "newAgent", "addAgent"],
+ "The tab, notification, New and Open buttons dispatch once")
try checkTitlebar(notificationButton.hasAttention, "The bell represents pending agent attention")
let oldButton = newButton
var themedState = state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0")
@@ -258,16 +259,17 @@ private extension SwarmTabStrip {
original.clickBothActions()
try checkTitlebar(events == ["select", "close"], "Native selection and close dispatch once each")
- let actionPixels = [openButton.renderedPixels()]
+ let actionPixels = [createButton.renderedPixels(), openButton.renderedPixels()]
events.removeAll()
update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0", enabled: false))
try original.checkEnabled(false)
- try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled && !openButton.isEnabled, "Titlebar actions disable with a modal")
- try checkTitlebar(actionPixels == [openButton.renderedPixels()],
- "Add Agent keeps its rendered colors when a workspace modal opens")
+ try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled && !openButton.isEnabled && !createButton.isEnabled, "Titlebar actions disable with a modal")
+ try checkTitlebar(actionPixels == [createButton.renderedPixels(), openButton.renderedPixels()],
+ "New and Open Agent retain their colors behind a workspace modal")
original.clickBothActions()
newButton.performClick(nil)
notificationButton.performClick(nil)
+ createButton.performClick(nil)
openButton.performClick(nil)
try checkTitlebar(events.isEmpty, "Disabled controls emit no actions")
try checkDragOperations()
@@ -476,8 +478,8 @@ private extension SwarmTitlebar {
"The main-menu dispatcher retains the actual Edit submenu and its targets")
try checkTitlebar(newSwarm.keyEquivalent == "t" && newSwarm.toolTip == nil,
"Native shortcuts display in the menu without duplicate hover hints")
- try checkTitlebar(addHarness.keyEquivalent == "n" && addHarness.keyEquivalentModifierMask == [.command],
- "The exported keymap keeps Add Agent on Command-N")
+ try checkTitlebar(addHarness.keyEquivalent == "o" && addHarness.keyEquivalentModifierMask == [.command],
+ "The exported keymap keeps Open Agent on Command-O")
setKeymap(changed)
try checkTitlebar(NSApp.mainMenu === main && newSwarm.keyEquivalent == "o",
"Hot reload updates the existing menu to the remapped key")
@@ -512,8 +514,8 @@ private extension SwarmTitlebar {
setKeymap(defaults)
try checkTitlebar(strip.newButton.toolTip == nil, "Keymap reload does not restore hover hints")
try checkTitlebar(strip.newButton.accessibilityLabel() == "New Harness", "The plus announces New Harness")
- try checkTitlebar(main.defersToInput(event("n", 45, .command)) && !main.defersToInput(event("o", 31, .command)),
- "Command-N reaches the shared chooser while Command-O stays unbound")
+ try checkTitlebar(main.defersToInput(event("n", 45, .command)) && main.defersToInput(event("o", 31, .command)),
+ "Command-N and Command-O reach their separate New and Open actions")
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"
@@ -573,10 +575,12 @@ private extension SwarmTitlebar {
try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")
let agent = main.item(withTitle: "File")!.submenu!
let addHarness = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!
- try checkTitlebar(addHarness.title == "Add Agent…" && addHarness.keyEquivalent == "n" && addHarness.keyEquivalentModifierMask == [.command],
- "The single Add Agent menu entry advertises Command-N")
+ try checkTitlebar(addHarness.title == "Open Agent…" && addHarness.keyEquivalent == "o" && addHarness.keyEquivalentModifierMask == [.command],
+ "Open Agent advertises Command-O")
+ try checkTitlebar(agent.items.contains { $0.title == "New Agent…" && $0.keyEquivalent == "n" && $0.keyEquivalentModifierMask == [.command] && $0.representedObject as? String == "newAgent" },
+ "New Agent has its own Command-N menu action")
let historyMenu = main.item(withTitle: "History")!.submenu!
- try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "addAgent", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups Harness and Pane actions, without Pin or Add Project clutter")
+ try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["new", "newAgent", "addAgent", "renameActive", "closeActive", "separator", "splitRight", "splitDown", "zoomPane", "closePane"], "File groups Harness and Pane actions, without Pin or Add Project clutter")
try checkTitlebar(agent.items.filter { !$0.isSeparatorItem }.allSatisfy { $0.image != nil && $0.toolTip == nil },
"Every File action has a native icon and no hover hint")
try checkTitlebar(agent.items.contains { $0.title == "Rename Harness…" && $0.representedObject as? String == "renameActive" }, "Rename Harness preserves its command")
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index a5e6b52aa..b597ef63a 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -6,103 +6,58 @@ This is the latest product direction; it supersedes earlier swarm and multi-sele
proposals in the progress log.
**Agent** is the user-facing name for a session and its actions: Open Agent,
-New Agent, Add Agent, Stop Agent, Restart Agent, and Find an agent. Harness
+New Agent, Stop Agent, Restart Agent, and Find an agent. Harness
also names the tab container, application, CLI and device. Custom saved names
and protocol identifiers are unchanged.
## Open and New Agent
-**Cmd-T / New Harness** and the tab-bar plus open the Harness start page over its
-Aurora mesh ground — the panel colour with three dim washes in the app's own
-accent, Claude and Codex colours, drawn rather than loaded (no photograph). A long search field, capped at 1120 logical pixels,
-has a prominent 64-pixel minimum height and shows **Find an agent** in place of
-a large heading. The same **New Agent** creation section used by Cmd-N sits below
-search, above the device footer. Search starts compact. Activating it keeps the
-field's position, width and 32-pixel outer corners fixed and reveals results and
-preview side by side at widths of 700 logical pixels and above. Results scroll
-in the space above creation; opening, filtering and closing them does not move
-the creation row or device. Escape retains the query. Without a linked machine,
-the page retains Open/New actions and New opens machine linking.
-
-The field starts empty and focused so typing works immediately. Typing, clicking
-it, or pressing an arrow reveals the same input, results,
-highlight, action arrow and keyboard navigation as the Cmd-N picker. Focus alone does not
-build a search catalog or reveal results. New Harness refocuses an existing unused
-page too. Typing filters immediately; arrows select and Enter opens. Escape or clicking
-outside closes the dropdown and hides the caret. The recent-agent list is removed.
-The closed page retains only search text and selection: it does not keep a live
-search subscription or build a catalog when an unused page closes. Reopening
-refreshes results against current app state. Command-mode shortcuts synchronize
-the field and results without adding editor rebuilds to arrow navigation.
-Opening the dropdown keeps its whole list viewport inside the window. Resizing
-or changing text size reveals the highlighted row without changing the selection.
-A product strip runs along the footer, the width of the search field, and
-links to https://www.autonomous.ai/harness-device: a glass band holding a
-cutout of the device (`assets/harness_device.png`, the render with its studio
-ground keyed out, so the device floats on the page's own ground), the title
-“Meet the Harness device”, the line “A device for your agents — scroll, switch
-panes, give voice commands.” and a Learn more pill. 120 points tall, 84 with
-the line dropped when the window is short.
-Unused default-name empty pages are excluded from Recently Closed.
-
-The titlebar places the bell beside the traffic lights, then the tabs and tab
-plus. A single accented **Add Agent** button sits on the right. It and
-**Cmd-N** open a combined panel with a focused **Find an agent** field, results
-and preview above a compact **New Agent** section. Both sections use an almost-black surface and large
-matching headings; the modal search field is blank beneath its heading. There is
-no Open Agent footer button. The highlighted row action or Enter opens a result. This supersedes the two-button modal and separate workspace creation
-dialog; the New Harness page remains compact until search is activated.
-
-The creation section stays anchored at the panel's bottom while queries and
-results change. Results scroll in the space above it. Search does not cover,
-push down or reset the creation controls. The main row is **Agent / Project /
-Machine / Create**, with three equal-width dropdowns displaying both a category
-and its selected value, beside a larger Create button. Defaults are the remembered agent, **New project**, and this
-computer. A split inherits the focused agent's machine and project instead.
-Project choices are **New project / Local folder… / Remote repository…**.
-Local browses the selected machine; Remote shows an inline repository field.
-Dropdowns support keyboard navigation and typeahead, and their arrow/Enter keys
-never activate search results. **Shift-Cmd-N** focuses the Agent control without
-clearing the query. Escape closes an open menu first, then the panel, restoring
-terminal focus. From inline search, Shift-Cmd-N collapses results and focuses the creation row
-already on the page. Escape there returns focus to its compact search field.
-
-The row wraps on narrow windows or at large text sizes; creation details scroll
-within a bounded section. **Options** keeps account and permissions controls
-available without expanding the initial form; its collapsed row omits the profile
-summary. A pending Codex profile lookup is explained beneath the controls. Loading
-a saved engine preference identical to the current selection preserves the loaded
-profile and submit readiness. Cached engine availability is
-reused when opening the combined surface. No project list is rebuilt from every
-agent on each query change. Existing standalone creation entry points retain
-their direct-choice dialog and share the same creation and recovery logic.
-
-New creates a unique folder under `~/Harness Projects` without a picker or name
-prompt. Remote accepts the existing GitHub HTTPS/SSH URL or `owner/repository`
-forms and clones under the same root on the selected machine. Nothing is created
-until **Create** is submitted. A prepared folder is reused after a refused launch.
-An uncertain launch keeps its original receipt and offers **Check status** and
-an explicit **Close**, without cloning or starting again. Search, destination
-changes and accidental dismissal are blocked while creating or awaiting status.
-Successful creation focuses the new agent, including its requested split.
-Remote folder preparation requires the accompanying CLI change; this computer
-prepares folders locally and keeps the existing create protocol.
-
-The titlebar button is a 34-point-high pill with generous padding and a 12-point
-right margin. Native menu and titlebar hover hints remain removed; accessible
-names and shortcut help identify the actions. Workspace modals preserve the
-button's normal colors while its actions remain blocked.
-
-The Open popup keeps its full-width **Find an agent** field, single-choice
-results and 90% black backdrop. Only the highlighted row shows **Open Agent**,
-**Open N Agents**, or **Split right/down**, depending on context.
-Both Open and inline start-page search show the same session preview. The Cmd-N
-surface can grow to 1120 logical pixels, placing the list and preview side by
-side. Narrow windows stack them with a compact preview heading. Both sections
-scroll independently; the expanded panel stays within view. Hover selects a
-preview without taking typing focus. Enter opens the highlighted result.
-Page Up/Down scrolls the preview while retaining the query, focus and selection.
-The bindings are configurable in the same Search keymap as result navigation.
+**New Agent (Cmd-N)** opens the dedicated creation dialog. **Open Agent (Cmd-O)**
+opens existing-agent search with results and preview immediately. The titlebar
+and File menu expose both actions. This replaces the combined Add Agent form
+at the user's request; there is no embedded creation section in search or on
+the New Harness page. Custom key bindings retain precedence. The internal
+`agent.add` command and native `addAgent` action remain stable, labeled Open Agent.
+Agent actions share **+** for New and **↗** for Open, including the native menu
+and titlebar. Find fields keep the magnifying glass for search.
+
+**Cmd-T / New Harness** opens the start page with a long, initially compact
+search field and **Open Agent / New Agent** buttons below it. The field is capped
+at 1120 logical pixels, has a 64-pixel minimum height and shows **Find an agent**.
+Its position, width and 32-pixel outer corners stay fixed when results open.
+Results and preview share the space above the fixed device footer. Typing,
+clicking or pressing an arrow opens search; focus alone does not build its catalog.
+Escape closes results and retains the query. The Aurora mesh ground and device
+product strip are preserved. New without a linked machine opens machine linking.
+
+Open Agent has a large **Find an agent** heading, a blank rounded input and an
+almost-black surface over a 90% black canvas veil. Results appear immediately;
+arrows select and Enter or a row click opens the agent. There is no footer
+button or New Agent form. Results and preview sit side by side from 700 logical
+pixels; narrower windows stack them. Both scroll independently. Hover updates
+the preview without taking typing focus. Page Up/Down scrolls the preview while
+retaining the query and selection. Native menus and the titlebar retain normal
+colors while modal actions are blocked.
+
+New Agent uses the wide direct-choice dialog: Machine, Working folder and Agent,
+with up to three machine/engine choices and an overflow control. A selected
+overflow choice replaces the third visible choice. **New / Local / Remote** mean
+create a folder, choose an existing folder and clone a GitHub repository onto
+the selected machine. Local is initially selected. New and Remote prepare a
+unique folder under `~/Harness Projects` only on submission. Advanced retains
+profiles and permissions. A late saved preference equal to the selected engine
+preserves loaded profile readiness. Failure keeps the choices and prepared folder;
+an uncertain launch retains its receipt and offers **Check status** and **Close**
+without cloning or starting again. Success focuses the new agent.
+
+Split Right/Down opens the existing-agent picker for that position. Its **New Agent**
+header action, or Cmd-N, replaces the picker with creation and preserves the split,
+machine and project. Dismissing creation returns directly to the original pane.
+Ordinary New Agent prefers this computer. Search and creation never stack.
+The restored flows pass 203 affected Flutter tests, 96 native keyboard checks,
+407 hidden AppKit checks, and analysis of all changed Dart/test files. Normal
+and larger-text render fixtures were inspected; live app inspection remains
+unavailable before installation of this change.
Working sessions lead with the current observed request and latest activity.
Idle sessions lead with an existing saved response or the latest response seen
@@ -121,18 +76,10 @@ Secondary text is **project · branch · machine**, with one small muted Git bra
mark immediately before the branch in search and pane headers. Missing metadata is omitted
and the containing workspace name is not repeated.
The Commands footer stays removed; Shift-Cmd-P and typing `>` expose commands.
-The creation row retains the requested split position. Shift-Cmd-N focuses it
-while search remains available; dismissing the panel returns to the terminal.
The input and result rows share one picker shortcut scope. Tab focus highlights
-the row that Enter will open. Arrow navigation and command-mode entry return
-focus to the input for continued typing; remapped or unbound navigation/Enter
-keys keep their meaning on a focused row. Closing the inline picker releases
-focus from the search surface. Escape from inline creation returns focus to the
-compact search input.
-Native New Agent and Search Commands actions use the focused picker's
-actions too. Command search stays in its field; the inline start-page dropdown
-closes before focusing its adjacent creation row. Native actions wait for the destination focus tree before
-handing keyboard ownership back to Flutter and preserve in-progress search composition.
+the row that Enter opens. Arrow navigation and command-mode entry return focus
+to the input; custom bindings retain their meaning. Native New Agent closes the
+picker before opening creation and restores keyboard ownership to Flutter.
Pane connection states (Connecting, Restoring and Reconnect) follow the session
name on the left. The project, branch and machine retain the same space on the
@@ -163,7 +110,7 @@ agent disappears from discovery. Tab names remain editable. Former default names
the first agent's name when opened.
The macOS menus are **Harness, File, Edit, View, History, Models, Machines,
-Window, Help**. File groups **New Harness, Add Agent…, Rename Harness, Close Harness**;
+Window, Help**. File groups **New Harness, New Agent…, Open Agent…, Rename Harness, Close Harness**;
then **Split Right, Split Down, Zoom Pane, Close Pane**. Pin/Unpin and Add Project
are removed from this menu. File actions have native system icons, with the same
four-corner Zoom and plain Close cross as the pane header. Machines starts with **Open Machines Manager**, then
@@ -183,8 +130,8 @@ machine rename API. It reports failures inline and refreshes names in the menu
and pane headers immediately after success. Find Agents opens the shared search
with the computer's name filled in; no agent is opened until the user chooses a result.
-**Cmd-T** opens the start page and **Cmd-N** opens Add Agent.
-**Shift-Cmd-N** focuses creation in the combined panel; Cmd-O is unbound by default. **Cmd-S** opens Layout.
+**Cmd-T** opens the start page, **Cmd-N** opens New Agent and **Cmd-O** opens
+Open Agent. **Cmd-S** opens Layout.
**Cmd-R** splits right and **Cmd-D** splits down, opening the shared picker for
that position. Refresh Machines stays in the Machines menu and command search,
without a default chord. The developer-only Debug shortcut is Shift-Cmd-D.
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index 5960b53b1..6144d1248 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -34,7 +34,28 @@ user for a benchmark window.
## Current product contract
-### September 15 continuation checkpoint
+### Latest: separate New Agent and Open Agent
+
+The user rejected combined Add Agent. **Cmd-N / New Agent** now opens the dedicated
+creation dialog; **Cmd-O / Open Agent** opens search/results/preview only. Both
+buttons and File menu actions are restored. New Harness has search and the two
+actions, without embedded creation. Split search can still transition to creation
+with its New Agent header action or Cmd-N and retain the requested destination.
+The profile readiness race fix and unrelated wallpaper, device, Machines and
+connection-status improvements are retained. See the current entry contract.
+
+Verification: 203 affected Flutter tests, 96 exported native keyboard checks,
+407 hidden AppKit checks and analysis of all 28 changed Dart/test files pass.
+Logs: `/private/tmp/harness-separate-entry-final-tests.log`,
+`/private/tmp/harness-separate-entry-keymap-native.log`, and
+`/private/tmp/harness-separate-entry-final-analyze.log`.
+Captures: `/private/tmp/harness-separate-entry-picker`.
+The installed preview is still **8873f27** until the next build/install.
+Push this rollback first. The user then requested Customize Harness, followed by
+distinct New/Open edge actions; implement and push each feature separately.
+
+### Earlier September 15 checkpoint (combined form superseded)
+
- The user renamed the session concept to **Agent**: Open/New/Add/Stop/Restart
Agent, Find an agent, counts and recovery copy throughout Flutter and native
@@ -215,14 +236,11 @@ Use [the detailed entry/pane contract](harness-agent-first-tabs.md) when editing
or validating UI. The decisions that previously conflicted with older handoffs
are:
-- **Add Agent unifies search and creation.** A single titlebar button and
- File → Add Agent… open results and preview immediately, with the search
- field focused, Open Agent below results and the compact creation row anchored
- beneath. This supersedes compact-first modal entry and separate creation;
- the New Harness page stays compact until activated. Creation preserves split
- placement. The bell stays beside the traffic lights.
-- **Cmd-T: New Harness; Cmd-N: Add Agent; Shift-Cmd-N: focus creation; Cmd-S: Layout.**
- Cmd-O is unbound by default.
+- **New Agent and Open Agent are separate.** New opens creation; Open shows
+ search and preview immediately. The titlebar and File menu expose both.
+ The New Harness page stays compact until search is activated. Split creation
+ retains its requested position. The bell stays beside the traffic lights.
+- **Cmd-T: New Harness; Cmd-N: New Agent; Cmd-O: Open Agent; Cmd-S: Layout.**
Cmd-H/J/K/L and Cmd-arrows focus panes; Cmd-1…9 select tabs. User bindings take
precedence. Cmd-R splits right and Cmd-D splits down. Native menus, help and actual
dispatch must agree; native menu and titlebar hover hints are removed.
@@ -239,8 +257,7 @@ are:
- Search is single-choice. Session names appear above **project · branch ·
machine**, without repeated workspace titles. Only the highlighted row shows
**Open Agent / Open N Agents**, or the explicit split action. The modal
- has a 90% black backdrop. Open Agent remains beneath results and the New agent
- creation row stays below; there is no Commands footer or “or” divider.
+ has a 90% black backdrop. There is no footer button or embedded creation form.
Commands remain available through Shift-Cmd-P or typing **>**.
- Both search entry points show existing session excerpts. Working sessions lead
with the observed request and activity; idle sessions show an existing response.
@@ -255,16 +272,10 @@ are:
both actions participate in the configurable Search keymap.
- The Harness application menu includes **Check for Updates…**, using the
existing manual update-check dialog, directly above Flash Firmware.
-- The combined panel uses **New Agent** for the creation heading and **Create**
- for its action. Agent, Project and Machine dropdowns show selected defaults;
- keyboard input stays with the active menu or field. Options contains account
- and permission settings. Escape or one outside click dismisses the panel;
- an in-progress launch cannot be dismissed accidentally. An uncertain outcome
- retains Close and Check status and the original receipt, never starting twice.
- Search/destination controls are blocked during launch or uncertainty.
- Opening a local/remote folder chooser preserves the mounted form and selections.
- Creation success focuses the newly created pane instead of the old terminal.
- The standalone direct-choice form remains for non-workspace entry points.
+- The dedicated **New Agent** form keeps Machine, Working folder, Agent and
+ Advanced choices. Pending creation cannot be dismissed accidentally; uncertain
+ results retain Close and Check status without creating again. Folder choosers
+ preserve the form, and successful creation focuses the new pane.
- A single-agent tab/search/history entry uses that agent's engine icon;
multiple agents use four outlined tiles. An empty tab uses a plain plus, and
tab close marks appear only on hover/focus. Only one unused New Harness page