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.

Refine the Harness start page and separate Open from New

deeb4baf6815f23
diff --git a/desktop/assets/harness_device.webp b/desktop/assets/harness_device.webp
new file mode 100644
index 000000000..1d21dfbbe
Binary files /dev/null and b/desktop/assets/harness_device.webp differ
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 5b0316f0d..506d1d8fa 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -4,7 +4,6 @@ import 'dart:io' show Platform;
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import '../core/desktop_window.dart';
@@ -32,7 +31,7 @@ import '../state/swarm_search.dart';
import '../state/swarm.dart';
import '../widgets/layout_palette.dart';
import '../widgets/engine_identity.dart';
-import '../widgets/harness_creation_option.dart';
+import '../widgets/harness_start_page.dart';
import '../widgets/link_machine_screen.dart';
import '../widgets/machines_manager.dart';
import '../widgets/new_agent_dialog.dart';
@@ -42,7 +41,6 @@ import '../widgets/swarm_dialogs.dart';
import '../widgets/swarm_search_input.dart';
import '../widgets/swarm_attention.dart';
import '../widgets/swarm_switcher.dart';
-import '../widgets/swarm_wallpaper.dart';
import '../widgets/swarm_icon.dart';
import '../widgets/task_palette.dart';
@@ -215,7 +213,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
void _runShortcut(String id) {
if (id == 'agent.new' && _search != null) {
- unawaited(_newAgentFromSearch(chooseFolderFirst: false));
+ final target = _search!.targetId;
+ final split = _search!.split;
+ _closeSearch();
+ unawaited(_newAgent(swarmId: target, split: split));
return;
}
if (!_canExecuteCommand(id)) return;
@@ -234,26 +235,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
final workspace = (app.activeSwarmId, app.panes.isEmpty);
if (_lastWorkspace == workspace) return;
- final firstBuild = _lastWorkspace == null;
_lastWorkspace = workspace;
- if (workspace.$2 && _shortcutsEnabled) {
- void open() {
- // Open once on entering an empty workspace. Dismissal, discovery and
- // other rebuilds must not reopen it or take focus from a creation form.
- if (mounted && _lastWorkspace == workspace && app.panes.isEmpty) {
- _openSearch(adding: true);
- }
- }
-
- if (!firstBuild &&
- SchedulerBinding.instance.schedulerPhase == SchedulerPhase.idle) {
- // Native tab actions acknowledge the next frame. Insert now so that
- // frame includes the picker and its focus tree, rather than a blank gap.
- open();
- } else {
- WidgetsBinding.instance.addPostFrameCallback((_) => open());
- }
- }
}
int get _attention =>
@@ -450,14 +432,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
if (call.method == 'newAgent' && _search != null) {
- unawaited(_newAgentFromSearch(chooseFolderFirst: false));
+ _runShortcut('agent.new');
await WidgetsBinding.instance.endOfFrame;
return;
}
_closeSearch(restoreFocus: false);
switch (call.method) {
case 'new':
- _newHarness();
+ _newTab();
case 'reopen':
app.reopenClosed();
case 'reopenHistory':
@@ -597,11 +579,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
String? swarmId,
PaneSplitRequest? split,
bool chooseFolderFirst = false,
- String returnToAddQuery = '',
- ({SwarmSearchDraft search, TextEditingValue editing})? returnToAdd,
}) async {
final targetId = swarmId ?? app.activeSwarmId;
- NewAgentDialogResult? result;
await _dialog(() async {
final focused = app.focusedPane;
// A general New Agent action starts on this computer. Most launches are
@@ -684,7 +663,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
}
- result = await showNewAgentDialog(
+ await showNewAgentDialog(
context,
app,
id,
@@ -693,57 +672,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
initialEngineProbe: initialEngineProbe,
swarmId: targetId,
split: split,
- offerFindExisting: true,
- offerBackToSearch: returnToAdd != null,
);
}, restoreEntry: false);
- final findingExisting = result == NewAgentDialogResult.findExisting;
- final returningToAdd =
- result == NewAgentDialogResult.backToSearch && returnToAdd != null;
- if (!mounted) return;
- if (!findingExisting && !returningToAdd) {
- await _ensureEmptyEntry(targetId: targetId, cancelDraft: result == null);
- return;
- }
- // The pop result arrives before the screen observes its current route.
- // Let that frame release modal keyboard ownership before opening Add.
- await WidgetsBinding.instance.endOfFrame;
- if (!mounted ||
- !_routeIsCurrent ||
- _dialogOpen ||
- _spokenPaletteOpen ||
- _search != null) {
- return;
- }
- // Back restores the prior picker only while its swarm remains current.
- // An explicit Find existing action can return to the original destination.
- if (returningToAdd && app.activeSwarmId != targetId) return;
- final targetExists = app.swarms.any((swarm) => swarm.id == targetId);
- final splitChanged = split != null && !app.isPaneSplitCurrent(split);
- if (!targetExists || splitChanged) {
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(
- content: Text(
- !targetExists
- ? 'That harness was closed. Open New Harness to find your work.'
- : 'That split changed. Split the pane again to choose a position.',
- ),
- ),
- );
- return;
- }
- if (app.activeSwarmId != targetId) {
- app.selectSwarm(targetId, attachPending: false);
- }
- _openSearch(
- adding: true,
- split: split,
- query: returnToAddQuery,
- draft: returnToAdd?.search,
- );
- if (returnToAdd != null && _search?.targetId == targetId) {
- _searchText.value = returnToAdd.editing;
- }
+ await _ensureEmptyEntry();
}
Future<void> _splitAgent(PaneResizeAxis axis, {int? paneId}) async {
@@ -797,7 +728,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
bool adding = false,
PaneSplitRequest? split,
String query = '',
- SwarmSearchDraft? draft,
}) {
if (_search != null ||
!mounted ||
@@ -823,7 +753,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
split: split,
catalog: _searchCatalog,
)..setQuery(query);
- if (draft != null) _search!.restoreDraft(draft);
_search!.addListener(_syncSearch);
_searchOverlay = OverlayEntry(builder: _buildSearchOverlay);
Overlay.of(context).insert(_searchOverlay!);
@@ -893,68 +822,16 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
}
- bool get _canDismissSearch =>
- app.panes.isNotEmpty ||
- app.swarms.any(
- (swarm) => swarm.id != app.activeSwarmId && swarm.panes.isNotEmpty,
- );
+ bool get _canDismissSearch => true;
- void _dismissSearch() {
- if (app.panes.isNotEmpty) {
- _closeSearch();
- return;
- }
- // An empty first workspace is the starting screen. Commands can return to
- // the same picker, but dismissal must never expose a blank canvas.
- if (!_canDismissSearch) {
- if (_search?.isCommandMode == true) {
- _closeSearch(restoreFocus: false);
- _openSearch(adding: true);
- } else {
- _focusSearch();
- }
- return;
- }
- _closeSearch(restoreFocus: false);
- _returnFromEmptyHarness();
- }
-
- void _returnFromEmptyHarness() {
- _preparePaneFocus();
- if (app.cancelSwarmDraft(app.activeSwarmId)) return;
- // A restored or deliberately renamed empty workspace is real saved work.
- // Leave it intact and return to the most recently visited populated one.
- final previous = _navigation.recent
- .where((id) => id.startsWith('swarm:'))
- .map(
- (id) => app.swarms
- .where((swarm) => swarmDestinationId(swarm.id) == id)
- .firstOrNull,
- )
- .where((swarm) => swarm != null && swarm.panes.isNotEmpty)
- .firstOrNull;
- final destination =
- previous ??
- app.swarms.where((swarm) => swarm.panes.isNotEmpty).lastOrNull;
- if (destination != null) app.selectSwarm(destination.id);
- }
+ void _dismissSearch() => _closeSearch();
- Future<void> _ensureEmptyEntry({
- String? targetId,
- bool cancelDraft = false,
- }) async {
+ Future<void> _ensureEmptyEntry() async {
if (!mounted || app.panes.isNotEmpty) return;
- // A popped dialog releases route and keyboard ownership on this frame.
await WidgetsBinding.instance.endOfFrame;
- if (!_shortcutsEnabled || app.panes.isNotEmpty) {
- return;
- }
- if (cancelDraft &&
- (targetId == null || app.activeSwarmId == targetId) &&
- _canDismissSearch) {
- _returnFromEmptyHarness();
+ if (mounted && _shortcutsEnabled && app.panes.isEmpty) {
+ _restoreEmptyFocus();
}
- if (app.panes.isEmpty) _openSearch(adding: true);
}
Future<void> _chooseSearch(SwarmSearchSelection choice) async {
@@ -965,45 +842,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
await _activateSearch(choice, target, split: split);
if (mounted) {
if (app.activeSwarmId != target) app.cancelSwarmDraft(target);
- await _ensureEmptyEntry(targetId: target);
+ await _ensureEmptyEntry();
}
}
- Future<void> _newAgentFromSearch({bool chooseFolderFirst = true}) async {
- final search = _search;
- if (search == null || !search.canCreate) return;
- final target = search.targetId;
- final split = search.split;
- final query = search.query;
- final draft = search.adding
- ? (
- search: search.draft,
- editing: _searchText.value.copyWith(composing: TextRange.empty),
- )
- : null;
- // Let the creation dialog remember the original focus for dismissal. Blocking
- // canvas focus during the picker intentionally cleared route focus history.
- _closeSearch();
- FocusManager.instance.applyFocusChangesIfNeeded();
- await _newAgent(
- swarmId: target,
- split: split,
- chooseFolderFirst:
- chooseFolderFirst &&
- split == null &&
- !app.allPanes.any((pane) => pane.agentId != null) &&
- !swarmAgents(app).any((entry) => entry.agent.terminalAvailable) &&
- app.machineStates.values.any(
- (machine) =>
- machine.isLocalMachine &&
- !machine.needsLink &&
- machine.nodeOnline != false,
- ),
- returnToAddQuery: query,
- returnToAdd: draft,
- );
- }
-
Widget _buildSearchOverlay(BuildContext context) {
final search = _search!;
// Keep the command editor mounted as its query changes so every keystroke
@@ -1064,11 +906,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
onClose: _dismissSearch,
onChanged: search.setQuery,
showClose: _canDismissSearch || commandsOnly,
- onNewAgent: search.adding
- ? () => _newAgentFromSearch(
- chooseFolderFirst: false,
- )
- : null,
+ onNewAgent: () => _runShortcut('agent.new'),
),
const Divider(height: 1, color: Colors.white12),
Expanded(
@@ -1082,23 +920,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
),
),
- if (search.adding)
- Padding(
- padding: const EdgeInsets.fromLTRB(20, 32, 20, 0),
- child: Material(
- type: MaterialType.transparency,
- child: HarnessCreationOption(
- notifier: app,
- buttonKey: const ValueKey('swarm-search-new-agent'),
- onPressed: search.canCreate
- ? _newAgentFromSearch
- : null,
- onLinkMachine: () => _dialog(
- () => showSwarmLinkDialog(context, app),
- ),
- ),
- ),
- ),
],
),
),
@@ -1131,9 +952,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
_openSearch(adding: true);
}
- void _newHarness() {
- if (app.panes.isNotEmpty) app.newSwarm(draft: true);
- if (app.panes.isEmpty) _openSearch(adding: true);
+ void _newTab() {
+ if (app.panes.isNotEmpty) app.newSwarm();
}
Future<void> _addProject() => _dialog(() async {
@@ -1208,7 +1028,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
// Keyboard actions and search commands execute the same callbacks.
late final Map<ShortcutAction, VoidCallback> _actionHandlers = {
- ShortcutAction.newSwarm: _newHarness,
+ ShortcutAction.newSwarm: _newTab,
ShortcutAction.reopenClosedSwarm: app.reopenClosed,
ShortcutAction.closeSwarm: () => app.closeSwarm(app.activeSwarmId),
ShortcutAction.renameSwarm: () => _rename(app.activeSwarmId),
@@ -1367,22 +1187,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
autofocus: true,
child: Scaffold(
backgroundColor: grid.AppPalette.swarmField,
- floatingActionButtonLocation:
- FloatingActionButtonLocation.endFloat,
- floatingActionButton: Padding(
- padding: const EdgeInsets.only(right: 12, bottom: 12),
- child: FloatingActionButton.small(
- key: const ValueKey('swarm-add-agent-button'),
- tooltip: _keymap.hint('agent.add') == null
- ? 'Add Harness'
- : 'Add Harness (${_keymap.hint('agent.add')})',
- onPressed: () => _openSearch(adding: true),
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmField,
- shape: const CircleBorder(),
- child: const Icon(Icons.add, size: 24),
- ),
- ),
body: Column(
children: [
if (!_native) _tabStrip(),
@@ -1468,7 +1272,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
fit: StackFit.expand,
children: [
if (app.panes.isEmpty)
- const RepaintBoundary(child: SwarmWallpaper()),
+ ColoredBox(
+ color: grid.AppPalette.swarmField,
+ key: const ValueKey('harness-start-background'),
+ ),
Padding(
padding: app.panes.isEmpty
? EdgeInsets.zero
@@ -1485,7 +1292,28 @@ class _SwarmScreenState extends State<SwarmScreen> {
onSplit: (paneId, axis) => unawaited(
_splitAgent(axis, paneId: paneId),
),
- empty: const SizedBox.expand(),
+ empty: app.panes.isEmpty
+ ? HarnessStartPage(
+ key: ValueKey(
+ 'harness-start:${app.activeSwarmId}',
+ ),
+ createSearch: () =>
+ SwarmSearchController(
+ app,
+ _navigation.recent,
+ projects: _projects,
+ commands: _searchCommands,
+ adding: true,
+ catalog: _searchCatalog,
+ ),
+ onNew: _newAgent,
+ onChoose: (selection) =>
+ _activateSearch(
+ selection,
+ app.activeSwarmId,
+ ),
+ )
+ : null,
),
),
],
@@ -1509,6 +1337,19 @@ class _SwarmScreenState extends State<SwarmScreen> {
color: grid.AppPalette.swarmTabBar,
child: Row(
children: [
+ IconButton(
+ key: const ValueKey('swarm-notifications-button'),
+ tooltip: withEffectiveShortcutHint(
+ context,
+ 'Harnesses needing input',
+ ShortcutAction.showAttention,
+ ),
+ onPressed: _notifications,
+ icon: Badge(
+ isLabelVisible: _attention > 0,
+ child: const Icon(Icons.notifications_none, size: 20),
+ ),
+ ),
const SizedBox(width: 10),
Expanded(
child: ReorderableListView.builder(
@@ -1595,29 +1436,24 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
),
IconButton(
- key: const ValueKey('swarm-new-agent-button'),
+ key: const ValueKey('swarm-new-tab-button'),
tooltip: withEffectiveShortcutHint(
context,
- 'New Harness',
+ 'New Tab',
ShortcutAction.newSwarm,
),
- onPressed: app.swarms.length < AppNotifier.maxSwarms
- ? _newHarness
- : null,
+ onPressed: app.swarms.length < AppNotifier.maxSwarms ? _newTab : null,
icon: const Icon(Icons.add, size: 18),
),
- IconButton(
- key: const ValueKey('swarm-notifications-button'),
- tooltip: withEffectiveShortcutHint(
- context,
- 'Harnesses needing input',
- ShortcutAction.showAttention,
- ),
- onPressed: _notifications,
- icon: Badge(
- isLabelVisible: _attention > 0,
- child: const Icon(Icons.notifications_none, size: 20),
- ),
+ TextButton(
+ key: const ValueKey('swarm-new-harness-button'),
+ onPressed: _newAgent,
+ child: const Text('New Harness'),
+ ),
+ TextButton(
+ key: const ValueKey('swarm-open-harness-button'),
+ onPressed: _addAgent,
+ child: const Text('Open Harness'),
),
const SizedBox(width: 6),
],
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index a536e772b..d613a054e 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -101,15 +101,13 @@ class SwarmSearchController extends ChangeNotifier {
) &&
(split == null || app.isPaneSplitCurrent(split!));
- bool get opensFirstAgent => adding && capacity == AppNotifier.maxPanes;
- String get addVerb => opensFirstAgent ? 'Open' : 'Add';
String get commandQuery =>
query.trimLeft().replaceFirst(RegExp(r'^>\s*'), '');
String get primaryAction => switch (split?.axis) {
PaneResizeAxis.x => 'Split right',
PaneResizeAxis.y => 'Split down',
- null => opensFirstAgent ? 'Open Harness' : 'Add Harness',
+ null => 'Open Harness',
};
String actionLabel(SwarmDestination? row) => row?.isCommand == true
@@ -119,7 +117,7 @@ class SwarmSearchController extends ChangeNotifier {
row.agentId == null &&
split == null &&
_missingIds(row).length > 1
- ? '$addVerb ${_missingIds(row).length} Harnesses'
+ ? 'Open ${_missingIds(row).length} Harnesses'
: primaryAction
: row == null
? 'Go to'
diff --git a/desktop/lib/widgets/harness_creation_option.dart b/desktop/lib/widgets/harness_creation_option.dart
deleted file mode 100644
index ad36fa5b8..000000000
--- a/desktop/lib/widgets/harness_creation_option.dart
+++ /dev/null
@@ -1,145 +0,0 @@
-import 'package:flutter/material.dart';
-
-import '../shared/theme/app_theme.dart' as grid;
-import '../state/app_state.dart';
-import '../state/swarm_catalog.dart';
-
-/// A separate creation choice below the shared search card.
-class HarnessCreationOption extends StatefulWidget {
- const HarnessCreationOption({
- super.key,
- required this.buttonKey,
- required this.onPressed,
- required this.notifier,
- required this.onLinkMachine,
- });
-
- final Key buttonKey;
- final VoidCallback? onPressed;
- final AppNotifier notifier;
- final VoidCallback onLinkMachine;
-
- @override
- State<HarnessCreationOption> createState() => _HarnessCreationOptionState();
-}
-
-class _HarnessCreationOptionState extends State<HarnessCreationOption> {
- bool _reconnecting = false;
-
- Future<void> _reconnect() async {
- if (_reconnecting) return;
- setState(() => _reconnecting = true);
- try {
- await widget.notifier.retryMachines();
- } finally {
- if (mounted) setState(() => _reconnecting = false);
- }
- }
-
- @override
- Widget build(BuildContext context) => ListenableBuilder(
- listenable: widget.notifier,
- builder: (context, _) {
- final app = widget.notifier;
- bool ready(MachineState machine) =>
- !machine.needsLink && machine.nodeOnline != false;
- final canCreate =
- app.machineStates.values.any(ready) ||
- app.allPanes.any((pane) => pane.agentId != null) ||
- swarmAgents(app).any((entry) => entry.agent.terminalAvailable);
- final finding =
- _reconnecting ||
- app.machinesLoading ||
- app.machineStates.values.any(
- (machine) =>
- ready(machine) &&
- (machine.agentLoadStatus == AgentLoadStatus.idle ||
- machine.agentLoadStatus == AgentLoadStatus.loading),
- );
- final needsLink =
- app.machineStates.isEmpty ||
- app.machineStates.values.every((machine) => machine.needsLink);
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- const SizedBox(
- width: 160,
- child: Row(
- children: [
- Expanded(child: Divider(color: Colors.white12)),
- Padding(
- padding: EdgeInsets.symmetric(horizontal: 16),
- child: Text(
- 'or',
- style: TextStyle(fontSize: 12, color: Colors.white38),
- ),
- ),
- Expanded(child: Divider(color: Colors.white12)),
- ],
- ),
- ),
- const SizedBox(height: 32),
- NewHarnessButton(
- key: widget.buttonKey,
- onPressed: widget.onPressed == null
- ? null
- : canCreate
- ? widget.onPressed
- : finding
- ? null
- : needsLink
- ? widget.onLinkMachine
- : _reconnect,
- icon: canCreate ? Icons.add : Icons.computer_outlined,
- label: canCreate
- ? 'New Harness'
- : finding
- ? 'Finding computers…'
- : needsLink
- ? 'Link a machine'
- : 'Reconnect',
- ),
- ],
- );
- },
- );
-}
-
-/// The fresh-harness action below search results.
-class NewHarnessButton extends StatelessWidget {
- const NewHarnessButton({
- super.key,
- required this.onPressed,
- this.label = 'New Harness',
- this.icon = Icons.add,
- });
-
- final VoidCallback? onPressed;
- final String label;
- final IconData icon;
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return FilledButton.icon(
- onPressed: onPressed,
- icon: Icon(icon, size: 18),
- label: Text(label, textAlign: TextAlign.center),
- style: FilledButton.styleFrom(
- minimumSize: const Size(180, 48),
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
- backgroundColor: grid.AppPalette.swarmAccent,
- foregroundColor: grid.AppPalette.swarmTabBar,
- disabledBackgroundColor: Colors.white12,
- disabledForegroundColor: Colors.white38,
- textStyle: TextStyle(
- fontFamily: grid.AppFont.sans,
- fontFamilyFallback: grid.AppFont.sansFallback,
- fontSize: 14,
- fontWeight: FontWeight.w500,
- ),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
- ),
- );
- }
-}
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
new file mode 100644
index 000000000..1b85c1217
--- /dev/null
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -0,0 +1,237 @@
+import 'package:flutter/material.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+import '../shared/theme/app_theme.dart' as grid;
+import '../state/swarm_navigation.dart';
+import '../state/swarm_search.dart';
+import 'swarm_search_input.dart';
+import 'swarm_switcher.dart';
+
+/// The Open Harness input, results and navigation, revealed on the start page
+/// only when the user chooses to search.
+class HarnessStartPage extends StatefulWidget {
+ const HarnessStartPage({
+ super.key,
+ required this.createSearch,
+ required this.onNew,
+ required this.onChoose,
+ });
+ final SwarmSearchController Function() createSearch;
+ final VoidCallback onNew;
+ final ValueChanged<SwarmSearchSelection> onChoose;
+ @override
+ State<HarnessStartPage> createState() => _HarnessStartPageState();
+}
+
+class _HarnessStartPageState extends State<HarnessStartPage> {
+ final _query = TextEditingController();
+ final _focus = FocusNode(debugLabel: 'Start page search');
+ final _searchGroup = Object();
+ late final _search = widget.createSearch();
+ bool _showResults = false;
+
+ void _open() {
+ if (!_showResults) setState(() => _showResults = true);
+ _focus.requestFocus();
+ }
+
+ void _close() {
+ if (_showResults) setState(() => _showResults = false);
+ _focus.unfocus();
+ }
+
+ void _choose(SwarmSearchSelection selection) {
+ _close();
+ widget.onChoose(selection);
+ }
+
+ void _new() {
+ _close();
+ widget.onNew();
+ }
+
+ @override
+ void dispose() {
+ _search.dispose();
+ _query.dispose();
+ _focus.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ return LayoutBuilder(
+ builder: (context, constraints) => SingleChildScrollView(
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ 24,
+ (constraints.maxHeight * 0.21).clamp(72, 220),
+ 24,
+ 64,
+ ),
+ child: Center(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 640),
+ child: Column(
+ children: [
+ const Text(
+ 'Harness',
+ style: TextStyle(
+ fontSize: 48,
+ fontWeight: FontWeight.w600,
+ letterSpacing: -1.5,
+ ),
+ ),
+ const SizedBox(height: 32),
+ TextFieldTapRegion(
+ groupId: _searchGroup,
+ child: Material(
+ color: _showResults
+ ? grid.AppPalette.swarmSearchSurface
+ : Colors.transparent,
+ elevation: _showResults ? 12 : 0,
+ shadowColor: Colors.black54,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(
+ _showResults ? 12 : 30,
+ ),
+ side: _showResults
+ ? const BorderSide(color: Colors.white24)
+ : BorderSide.none,
+ ),
+ clipBehavior: Clip.antiAlias,
+ child: Column(
+ children: [
+ Semantics(
+ label: 'Find a harness',
+ child: SwarmSearchInput(
+ inputKey: const ValueKey('harness-start-search'),
+ controller: _query,
+ focusNode: _focus,
+ search: _showResults ? _search : null,
+ onChoose: _choose,
+ onClose: _close,
+ onChanged: (value) {
+ _search.setQuery(value);
+ _open();
+ },
+ onOpen: _open,
+ onNewAgent: _new,
+ onTapOutside: _close,
+ groupId: _searchGroup,
+ autofocus: false,
+ showClose: _showResults,
+ hintText: '',
+ rounded: true,
+ ),
+ ),
+ if (_showResults) ...[
+ const Divider(height: 1, color: Colors.white12),
+ SizedBox(
+ height: (constraints.maxHeight * 0.4).clamp(
+ 168,
+ 336,
+ ),
+ child: SwarmSearchResults(
+ key: const ValueKey('harness-start-results'),
+ search: _search,
+ onChoose: _choose,
+ onRefocus: _focus.requestFocus,
+ ),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
+ const SizedBox(height: 20),
+ Wrap(
+ alignment: WrapAlignment.center,
+ spacing: 12,
+ runSpacing: 12,
+ children: [
+ FilledButton(
+ key: const ValueKey('harness-start-open'),
+ onPressed: _open,
+ style: FilledButton.styleFrom(
+ minimumSize: const Size(160, 44),
+ backgroundColor: grid.AppPalette.swarmSearchSurface,
+ foregroundColor: Colors.white,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ child: const Text('Open Harness'),
+ ),
+ FilledButton.icon(
+ key: const ValueKey('harness-start-new'),
+ onPressed: _new,
+ icon: const Icon(Icons.add, size: 18),
+ label: const Text('New Harness'),
+ style: FilledButton.styleFrom(
+ minimumSize: const Size(160, 44),
+ backgroundColor: grid.AppPalette.swarmAccent,
+ foregroundColor: grid.AppPalette.swarmTabBar,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 160),
+ Semantics(
+ link: true,
+ child: InkWell(
+ key: const ValueKey('harness-device-link'),
+ onTap: () => launchUrl(
+ Uri.parse('https://www.autonomous.ai/harness-device'),
+ mode: LaunchMode.externalApplication,
+ ),
+ borderRadius: BorderRadius.circular(12),
+ child: Padding(
+ padding: const EdgeInsets.all(12),
+ child: Column(
+ children: [
+ ClipRRect(
+ borderRadius: BorderRadius.circular(10),
+ child: Image.asset(
+ 'assets/harness_device.webp',
+ width: 192,
+ height: 120,
+ fit: BoxFit.cover,
+ semanticLabel: 'Harness Device',
+ ),
+ ),
+ const SizedBox(height: 16),
+ const Text(
+ 'Meet Harness Device ↗',
+ style: TextStyle(
+ fontSize: 13,
+ color: Colors.white70,
+ ),
+ ),
+ const SizedBox(height: 6),
+ const Text(
+ 'Voice control for your agents, right on your desk.',
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.white54,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index 3c0570d1a..9571eab41 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -488,9 +488,9 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
return AlertDialog(
title: Text(switch (widget.split?.axis) {
- PaneResizeAxis.x => 'Create Harness to the right',
- PaneResizeAxis.y => 'Create Harness below',
- null => 'Create Harness',
+ PaneResizeAxis.x => 'New Harness to the right',
+ PaneResizeAxis.y => 'New Harness below',
+ null => 'New Harness',
}),
titleTextStyle: Theme.of(context).textTheme.titleMedium,
content: SizedBox(
@@ -540,25 +540,26 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
),
),
actions: [
- TextButton(
- onPressed: _submitting
- ? null
- : () => Navigator.of(context).pop(
- widget.offerBackToSearch && !_confirmationPending
- ? NewAgentDialogResult.backToSearch
- : null,
- ),
- style: TextButton.styleFrom(
- foregroundColor: grid.AppPalette.textSecondary,
- ),
- child: Text(
- _confirmationPending
- ? 'Close'
- : widget.offerBackToSearch
- ? 'Back to Search'
- : 'Cancel',
+ if (_confirmationPending || widget.offerBackToSearch)
+ TextButton(
+ onPressed: _submitting
+ ? null
+ : () => Navigator.of(context).pop(
+ widget.offerBackToSearch && !_confirmationPending
+ ? NewAgentDialogResult.backToSearch
+ : null,
+ ),
+ style: TextButton.styleFrom(
+ foregroundColor: grid.AppPalette.textSecondary,
+ ),
+ child: Text(
+ _confirmationPending
+ ? 'Close'
+ : widget.offerBackToSearch
+ ? 'Back to Search'
+ : 'Back to Search',
+ ),
),
- ),
if (widget.offerFindExisting &&
_confirmationPending &&
(!_submitting || _checkingCreation))
@@ -600,7 +601,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
],
),
)
- : Text(_confirmationPending ? 'Check status' : 'Create Harness'),
+ : Text(_confirmationPending ? 'Check status' : 'New Harness'),
),
],
);
diff --git a/desktop/pubspec.yaml b/desktop/pubspec.yaml
index b8fda5b49..466796676 100644
--- a/desktop/pubspec.yaml
+++ b/desktop/pubspec.yaml
@@ -96,6 +96,7 @@ flutter:
# loaded from the bundle: Flutter can't read an .icns, and About should show
# the mark the Dock shows, not a stand-in drawn in Dart.
- assets/app_icon.png
+ - assets/harness_device.webp
# To add assets to your application, add an assets section, like this:
# assets:
diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dart
index 86b23676f..6dcf0c5e6 100644
--- a/desktop/test/new_agent_codex_profile_test.dart
+++ b/desktop/test/new_agent_codex_profile_test.dart
@@ -197,7 +197,7 @@ void main() {
expect(find.text('Link a profile folder…'), findsOneWidget);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -218,7 +218,7 @@ void main() {
expect(find.text('Link a profile folder…'), findsOneWidget);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/custom/work-login');
expect(tester.takeException(), isNull);
@@ -237,7 +237,7 @@ void main() {
);
expect(machineField.options.single.label, 'This Mac — Remote');
expect(
- find.widgetWithText(FilledButton, 'Create Harness'),
+ find.widgetWithText(FilledButton, 'New Harness'),
findsOneWidget,
);
expect(
@@ -294,7 +294,7 @@ void main() {
await open(tester, notifier: notifier);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- final createButton = find.widgetWithText(FilledButton, 'Create Harness');
+ final createButton = find.widgetWithText(FilledButton, 'New Harness');
expect(tester.widget<FilledButton>(createButton).onPressed, isNull);
expect(notifier.calls, isEmpty);
notifier.pending!.complete();
@@ -326,7 +326,7 @@ void main() {
expectProfile(tester, 'codex1');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/accounts/codex1');
});
@@ -350,7 +350,7 @@ void main() {
expectProfile(tester, 'Default profile');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -363,7 +363,7 @@ void main() {
expectProfile(tester, 'codex2');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls, [
{'engine': 'codex', 'codexHome': '/accounts/codex2', 'folder': '/work'},
@@ -438,7 +438,7 @@ void main() {
);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
expect(notifier.calls.single['engine'], 'claude');
@@ -458,7 +458,7 @@ void main() {
);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
},
diff --git a/desktop/test/new_agent_engine_check_test.dart b/desktop/test/new_agent_engine_check_test.dart
index 35e19cfe6..6175a4dc2 100644
--- a/desktop/test/new_agent_engine_check_test.dart
+++ b/desktop/test/new_agent_engine_check_test.dart
@@ -184,7 +184,7 @@ void main() {
findsOneWidget,
);
expect(app.launches, isEmpty);
- await tester.tap(find.widgetWithText(FilledButton, 'Create Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
await tester.pump();
expect(app.launches.single, {
'machine': 'machine-1',
diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dart
index 90750a110..6e9dab88d 100644
--- a/desktop/test/swarm_add_agent_test.dart
+++ b/desktop/test/swarm_add_agent_test.dart
@@ -13,7 +13,7 @@ import 'swarm_state_test.dart' show createApp;
void main() {
testWidgets(
- 'floating Add harness keeps the destination and reuses the chosen session',
+ 'Open Harness in the header reuses the chosen session in this workspace',
(tester) async {
final app = createApp();
final input = <TerminalBinaryFrame>[];
@@ -25,20 +25,14 @@ void main() {
await mount(tester, app);
tester.view.physicalSize = const Size(880, 560);
await tester.pump();
- final add = find.byKey(const ValueKey('swarm-add-agent-button'));
- expect(tester.getRect(add).left, greaterThan(780));
- expect(tester.getRect(add).right, closeTo(880 - 28, 1));
- expect(tester.getRect(add).bottom, closeTo(560 - 28, 1));
- expect(
- tester.getRect(find.byKey(existing.cellKey)).bottom,
- closeTo(550, 1),
- );
+ final add = find.byKey(const ValueKey('swarm-open-harness-button'));
+ expect(tester.getRect(add).top, lessThan(44));
+ expect(find.byType(FloatingActionButton), findsNothing);
expect(
tester
.getRect(find.byKey(existing.cellKey))
.overlaps(tester.getRect(add)),
- isTrue,
- reason: 'Add floats over the pane instead of reserving a footer',
+ isFalse,
);
await tester.tap(add);
await tester.pump();
@@ -47,9 +41,15 @@ void main() {
'Agent 0',
);
await tester.pump();
- expect(find.text('Add Harness'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('swarm-row-action')),
+ matching: find.text('Open Harness'),
+ ),
+ findsOneWidget,
+ );
expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
- expect(find.text('Open Harness'), findsNothing);
+
expect(find.byType(AlertDialog), findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dart
index 4b059e43b..a41b5878d 100644
--- a/desktop/test/swarm_commands_test.dart
+++ b/desktop/test/swarm_commands_test.dart
@@ -74,7 +74,13 @@ void main() {
await tester.pump();
expect(find.text('⌘⇧P'), findsNothing);
expect(find.text('⇧⌘P'), findsNothing);
- expect(find.text('Add Harness'), findsNothing);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('swarm-search-results')),
+ matching: find.text('Open Harness'),
+ ),
+ findsNothing,
+ );
expect(find.byKey(const ValueKey('command:pane.pin')), findsOneWidget);
expect(app.isPanePinned(pane), isFalse);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
@@ -111,7 +117,7 @@ void main() {
final app = createApp();
await mount(tester, app);
final input = find.byKey(const ValueKey('swarm-search-input'));
- await tester.tap(input);
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.enterText(input, '> rename');
await tester.pump();
expect(
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index aa1f08cd9..3f2f27b58 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -10,178 +10,238 @@ import 'swarm_state_test.dart' show createApp, MemoryStore;
final _input = find.byKey(const ValueKey('swarm-search-input'));
final _results = find.byKey(const ValueKey('swarm-search-results'));
+final _startInput = find.byKey(const ValueKey('harness-start-search'));
void main() {
- for (final native in [false, true]) {
- testWidgets(
- 'the starting picker cannot leave a blank page (native=$native)',
- (tester) async {
- const channel = MethodChannel('harness/swarm_tabs');
- tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
- channel,
- (_) async => true,
- );
- addTearDown(
- () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
- channel,
- null,
- ),
- );
- final app = createApp();
- await mount(tester, app, nativeTabs: native);
- void ready() {
- expect(_results, findsOneWidget);
- expect(
- tester.widget<TextField>(_input).focusNode!.hasPrimaryFocus,
- isTrue,
- );
- expect(find.byKey(const ValueKey('welcome-title')), findsNothing);
- expect(find.text('> Commands'), findsNothing);
- expect(
- find.byKey(const ValueKey('swarm-search-new-agent')),
- findsOneWidget,
- );
- }
-
- ready();
- final original = app.activeSwarmId;
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pump();
- ready();
- expect(find.text('esc'), findsNothing);
- app.renameSwarm(original, 'Empty workspace');
- await tester.pump();
- ready();
- expect(app.activeSwarmId, original);
- await chord(tester, LogicalKeyboardKey.keyO);
- ready();
- expect(app.swarms, hasLength(1));
- await chord(tester, LogicalKeyboardKey.keyT);
- await tester.pump();
- ready();
- expect(app.swarms, hasLength(1));
- expect(app.activeSwarmId, original);
- expect(app.panes, isEmpty);
- await tester.tapAt(const Offset(20, 200));
- await tester.pump();
- ready();
- app.dismissError();
- await tester.pump();
- ready();
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- expect(tester.takeException(), isNull);
- },
- );
-
- for (final dismissal in ['outside', 'escape']) {
- testWidgets('cancel a new draft on $dismissal (native=$native)', (
- tester,
- ) async {
- final app = createApp();
- final frames = <TerminalBinaryFrame>[];
- final pane = app.adoptSessionForTest(terminal('a0', frames));
- final original = app.activeSwarmId;
- await mount(tester, app, nativeTabs: native);
- await chord(tester, LogicalKeyboardKey.keyT);
- await tester.pump();
- final draft = app.activeSwarmId;
- expect(draft, isNot(original));
- expect(app.isDraftSwarm(draft), isTrue);
- expect(_results, findsOneWidget);
- // Repeated New Harness reuses the untouched draft.
- await chord(tester, LogicalKeyboardKey.keyT);
- expect(app.swarms, hasLength(2));
- if (dismissal == 'outside') {
- await tester.tapAt(const Offset(20, 200));
- } else {
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- }
- await tester.pump();
- expect(_results, findsNothing);
- expect(app.activeSwarmId, original);
- expect(app.swarms, hasLength(1));
- expect(app.closedHistory, isEmpty);
- expect(app.focusedPane, same(pane));
- await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
- await tester.pump();
- expect(frames.single.bytes, [27, 91, 66]);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- expect(tester.takeException(), isNull);
- });
- }
- }
-
- testWidgets('discovery preserves picker composition and Escape ownership', (
+ testWidgets('start-page results filter and open with arrows and Enter', (
tester,
) async {
final app = createApp();
await mount(tester, app);
- await tester.enterText(_input, 'Agent 12');
+ await tester.tap(_startInput);
+ await tester.enterText(_startInput, 'Agent 1');
await tester.pump();
- final text = tester.widget<TextField>(_input).controller!;
- final composing = text.value.copyWith(
- selection: const TextSelection.collapsed(offset: 7),
- composing: const TextRange(start: 6, end: 8),
- );
- text.value = composing;
- app.renameSwarm(app.activeSwarmId, 'Updated in the background');
- await tester.pump();
- expect(text.value, composing);
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
- await tester.pump();
- expect(_results, findsOneWidget);
- text.clearComposing();
- await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
- expect(_results, findsOneWidget);
- await chord(tester, LogicalKeyboardKey.keyP, shift: true);
- expect(tester.widget<TextField>(_input).controller!.text, '> ');
+ final selected = find.byWidgetPredicate(
+ (widget) => widget is ListTile && widget.selected,
+ );
expect(
- tester.widget<TextField>(_input).decoration!.hintText,
- 'Search commands…',
+ find.descendant(of: selected, matching: find.text('Agent 10')),
+ findsOneWidget,
);
+ expect(
+ find.descendant(of: selected, matching: find.text('Open Harness')),
+ findsOneWidget,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(app.panes.single.agentId, 'a10');
+ expect(_startInput, findsNothing);
await tester.pumpWidget(const SizedBox());
app.dispose();
});
+ for (final native in [false, true]) {
+ testWidgets('start page separates Open and New Harness (native=$native)', (
+ tester,
+ ) async {
+ const channel = MethodChannel('harness/swarm_tabs');
+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ (_) async => true,
+ );
+ addTearDown(
+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
+ channel,
+ null,
+ ),
+ );
+ final app = createApp();
+ await mount(tester, app, nativeTabs: native);
+ final original = app.activeSwarmId;
+ expect(_results, findsNothing);
+ expect(_startInput, findsOneWidget);
+ expect(find.byType(FloatingActionButton), findsNothing);
+ expect(tester.getSize(_startInput).width, lessThanOrEqualTo(640));
+ expect(
+ tester.widget<TextField>(_startInput).decoration!.hintText,
+ isEmpty,
+ );
+ expect(
+ tester.widget<TextField>(_startInput).focusNode!.hasFocus,
+ isFalse,
+ );
+ expect(find.byKey(const ValueKey('harness-device-link')), findsOneWidget);
+ expect(find.byType(ListTile), findsNothing);
+ await tester.tap(_startInput);
+ await tester.pump();
+ expect(
+ find.byKey(const ValueKey('harness-start-results')),
+ findsOneWidget,
+ );
+ await tester.enterText(_startInput, 'Agent 1');
+
+ await tester.pump();
+ expect(
+ find.byKey(const ValueKey('harness-start-results')),
+ findsOneWidget,
+ );
+ expect(_results, findsNothing);
+ expect(tester.widget<TextField>(_startInput).controller!.text, 'Agent 1');
+ expect(
+ find.byKey(const ValueKey('swarm-search-new-agent')),
+ findsNothing,
+ );
+ expect(find.text('> Commands'), findsNothing);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(_results, findsNothing);
+ expect(_startInput, findsOneWidget);
+ expect(find.byKey(const ValueKey('harness-start-results')), findsNothing);
+ expect(
+ tester.widget<TextField>(_startInput).focusNode!.hasFocus,
+ isFalse,
+ );
+ expect(tester.widget<TextField>(_startInput).controller!.text, 'Agent 1');
+ expect(app.activeSwarmId, original);
+ app.renameSwarm(original, 'Background update');
+ await tester.pump();
+ expect(_results, findsNothing);
+ 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 Harness'),
+ ),
+ 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);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ expect(tester.takeException(), isNull);
+ });
+
+ for (final dismissal in ['outside', 'escape']) {
+ testWidgets(
+ 'New Tab has a usable page after $dismissal (native=$native)',
+ (tester) async {
+ final app = createApp();
+ final frames = <TerminalBinaryFrame>[];
+ final pane = app.adoptSessionForTest(terminal('a0', frames));
+ final original = app.activeSwarmId;
+ await mount(tester, app, nativeTabs: native);
+ await chord(tester, LogicalKeyboardKey.keyT);
+ await tester.pump();
+ final page = app.activeSwarmId;
+ expect(page, isNot(original));
+ expect(_results, findsNothing);
+ expect(_startInput, findsOneWidget);
+ await chord(tester, LogicalKeyboardKey.keyO);
+ expect(_results, findsOneWidget);
+ if (dismissal == 'outside') {
+ await tester.tapAt(const Offset(20, 200));
+ } else {
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ }
+ await tester.pump();
+ expect(_results, findsNothing);
+ expect(_startInput, findsOneWidget);
+ expect(app.activeSwarmId, page);
+ await app.closeSwarm(page);
+ await tester.pump();
+ expect(app.activeSwarmId, original);
+ expect(app.closedHistory, isEmpty);
+ expect(app.focusedPane, same(pane));
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
+ await tester.pump();
+ expect(frames.single.bytes, [27, 91, 66]);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
+ }
+ }
+
testWidgets(
- 'a first selection opens here and hands the terminal its next key',
+ 'discovery preserves search composition and Escape returns home',
(tester) async {
final app = createApp();
- app.machineStates['m']!.nodeOnline = true;
- final frames = <TerminalBinaryFrame>[];
- final pane = app.adoptSessionForTest(terminal('a0', frames));
- final original = app.activeSwarm;
- app.newSwarm(draft: true);
- final destination = app.activeSwarmId;
await mount(tester, app);
- await tester.enterText(_input, 'Agent 0');
+ await chord(tester, LogicalKeyboardKey.keyO);
+ await tester.enterText(_input, 'Agent 12');
+ await tester.pump();
+ final text = tester.widget<TextField>(_input).controller!;
+ final composing = text.value.copyWith(
+ selection: const TextSelection.collapsed(offset: 7),
+ composing: const TextRange(start: 6, end: 8),
+ );
+ text.value = composing;
+ app.renameSwarm(app.activeSwarmId, 'Updated in the background');
await tester.pump();
- expect(frames, isEmpty);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ expect(text.value, composing);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ expect(_results, findsOneWidget);
+ text.clearComposing();
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
- expect(app.activeSwarmId, destination);
- expect(original.panes.single, same(pane));
- expect(app.panes.single, same(pane));
- expect(app.isDraftSwarm(destination), isFalse);
expect(_results, findsNothing);
+ expect(_startInput, findsOneWidget);
+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);
+ expect(tester.widget<TextField>(_input).controller!.text, '> ');
expect(
- tester
- .widget<TerminalView>(find.byType(TerminalView))
- .focusNode!
- .hasFocus,
- isTrue,
+ tester.widget<TextField>(_input).decoration!.hintText,
+ 'Search commands…',
);
- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
- await tester.pump(const Duration(milliseconds: 10));
- expect(frames.single.bytes, [27, 91, 68]);
await tester.pumpWidget(const SizedBox());
app.dispose();
},
);
+ testWidgets('Open reuses a session and hands the terminal its next key', (
+ tester,
+ ) async {
+ final app = createApp();
+ app.machineStates['m']!.nodeOnline = true;
+ final frames = <TerminalBinaryFrame>[];
+ final pane = app.adoptSessionForTest(terminal('a0', frames));
+ final original = app.activeSwarm;
+ app.newSwarm();
+ final destination = app.activeSwarmId;
+ await mount(tester, app);
+ await chord(tester, LogicalKeyboardKey.keyO);
+ await tester.enterText(_input, 'Agent 0');
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ expect(app.activeSwarmId, destination);
+ expect(original.panes.single, same(pane));
+ expect(app.panes.single, same(pane));
+ expect(_results, findsNothing);
+ expect(
+ tester
+ .widget<TerminalView>(find.byType(TerminalView))
+ .focusNode!
+ .hasFocus,
+ isTrue,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
+ await tester.pump(const Duration(milliseconds: 10));
+ expect(frames.single.bytes, [27, 91, 68]);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
+
test(
'drafts are omitted from persistence and cancellation history',
() async {
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index e6868a352..a8809cd00 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -70,7 +70,7 @@ void main() {
(tester) async {
final app = createApp();
await mount(tester, app);
- await tester.tap(find.byKey(const ValueKey('swarm-search-input')));
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
expect(app.panes, isEmpty);
await tester.enterText(
@@ -282,7 +282,7 @@ void main() {
expect(app.swarms, hasLength(1));
expect(app.panes, isEmpty);
expect(app.activeSwarmId, isNot(anyOf(first, second)));
- expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.byKey(const ValueKey('harness-start-search')), findsOneWidget);
final starter = app.activeSwarmId;
await activate('new');
expect(app.swarms, hasLength(1));
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
index 84cf44411..03c5ec6f7 100644
--- a/desktop/test/swarm_picker_activation_test.dart
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -9,7 +9,7 @@ import 'swarm_state_test.dart' show createApp;
import 'swarm_interactions_test.dart' show chord;
void main() {
- testWidgets('Command-N opens Add and Shift-Command-N creates a fresh agent', (
+ testWidgets('Open and New are separate popups with one dismissal', (
tester,
) async {
final app = createApp();
@@ -18,36 +18,26 @@ void main() {
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
- final create = find.byKey(const ValueKey('swarm-search-new-agent'));
+ final results = find.byKey(const ValueKey('swarm-search-results'));
expect(field, findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
- expect(
- tester.getRect(create).top,
- greaterThan(
- tester
- .getRect(find.byKey(const ValueKey('swarm-search-results')))
- .bottom,
- ),
- );
- expect(tester.getRect(create).width, greaterThanOrEqualTo(180));
- expect(
- tester.getRect(field).width,
- tester.getRect(find.byKey(const ValueKey('swarm-search-results'))).width,
- );
- expect(find.text('Find a harness'), findsOneWidget);
- expect(
- find.descendant(of: create, matching: find.text('New Harness')),
- findsOneWidget,
- );
- expect(app.panes, [pane]);
+ expect(find.byKey(const ValueKey('swarm-search-new-agent')), findsNothing);
+ expect(tester.getRect(field).width, tester.getRect(results).width);
await chord(tester, LogicalKeyboardKey.keyN);
expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'Create Harness'), findsOneWidget);
+ expect(find.widgetWithText(FilledButton, 'New Harness'), findsOneWidget);
+ expect(results, findsNothing);
+ expect(find.text('Back to Search'), findsNothing);
expect(app.panes, [pane]);
expect(input, isEmpty);
- await tester.tap(find.text('Back to Search'));
+ await tester.tapAt(const Offset(20, 200));
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(find.byType(AlertDialog), findsNothing);
+ expect(results, findsNothing);
+ expect(app.panes, [pane]);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
- expect(tester.takeException(), isNull);
+ expect(input.single.bytes, [27, 91, 66]);
await tester.pumpWidget(const SizedBox());
app.dispose();
});
@@ -70,7 +60,13 @@ void main() {
expect(find.byType(Checkbox), findsNothing);
expect(app.panes, isEmpty);
expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
- expect(find.text('Open Harness'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('swarm-row-action')),
+ matching: find.text('Open Harness'),
+ ),
+ findsOneWidget,
+ );
expect(find.byKey(const ValueKey('swarm-search-accept')), findsNothing);
if (activate == 'click') {
await tester.tap(find.byKey(ValueKey(agentDestinationId('m', 'a0'))));
@@ -88,29 +84,24 @@ void main() {
app.dispose();
});
}
- testWidgets(
- 'a recent harness opens here and stays deduplicated across tabs',
- (tester) async {
- final app = createApp();
- final input = <TerminalBinaryFrame>[];
- final existing = terminal('a0', input);
- app.adoptSessionForTest(existing);
- app.newSwarm();
- final target = app.activeSwarm;
- await mount(tester, app);
- final recent = find.byKey(ValueKey(agentDestinationId('m', 'a0')));
- expect(recent, findsOneWidget);
- await tester.tap(recent);
- await tester.pump();
- expect(app.activeSwarm, same(target));
- expect(target.panes.single.session, same(existing));
- app.newSwarm();
- await tester.pump();
- expect(recent, findsOneWidget);
- expect(app.activeSwarm.panes, isEmpty);
- expect(input, isEmpty);
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- },
- );
+ testWidgets('start-page search opens a retained harness', (tester) async {
+ final app = createApp();
+ final input = <TerminalBinaryFrame>[];
+ final existing = terminal('a0', input);
+ app.adoptSessionForTest(existing);
+ app.newSwarm();
+ final target = app.activeSwarm;
+ await mount(tester, app);
+ final field = find.byKey(const ValueKey('harness-start-search'));
+ await tester.tap(field);
+ await tester.enterText(field, 'Agent 0');
+ await tester.pump();
+ await tester.tap(find.byKey(ValueKey(agentDestinationId('m', 'a0'))));
+ await tester.pump();
+ expect(app.activeSwarm, same(target));
+ expect(target.panes.single.session, same(existing));
+ expect(input, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ });
}
diff --git a/desktop/test/swarm_project_members_test.dart b/desktop/test/swarm_project_members_test.dart
index efff21790..4395a5783 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-agent-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-open-harness-button')));
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index d1903c4bf..20f0166bd 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -81,7 +81,7 @@ void main() {
await mount(tester, app, nativeTabs: native);
expect(tab.name, 'New Harness');
expect(
- find.byKey(const ValueKey('swarm-search-results')),
+ find.byKey(const ValueKey('harness-start-search')),
findsOneWidget,
);
@@ -139,7 +139,7 @@ void main() {
);
await mount(tester, app);
expect(find.text('Existing project'), findsNothing);
- await tester.tap(find.byKey(const ValueKey('swarm-search-input')));
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -170,12 +170,12 @@ void main() {
final app = createApp();
await mount(tester, app);
expect(
- find.byKey(const ValueKey('swarm-search-results')),
+ find.byKey(const ValueKey('harness-start-search')),
findsOneWidget,
);
expect(find.text('Models'), findsNothing);
expect(find.text('Machines'), findsNothing);
- await tester.tap(find.byKey(const ValueKey('swarm-search-input')));
+ await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -191,7 +191,7 @@ void main() {
await tester.pump(const Duration(milliseconds: 200));
final zoom = app.zoomedPaneId;
final before = tester.getSize(find.byType(PaneGrid));
- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));
+ await tester.tap(find.byKey(const ValueKey('swarm-open-harness-button')));
await tester.pump(const Duration(milliseconds: 300));
expect(
find.byKey(const ValueKey('swarm-search-results')),
diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dart
index 4f121a5ab..0f64516a2 100644
--- a/desktop/test/swarm_search_render_test.dart
+++ b/desktop/test/swarm_search_render_test.dart
@@ -333,20 +333,14 @@ void main() {
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyO);
final field = find.byKey(const ValueKey('swarm-search-input'));
- final create = find.descendant(
- of: find.byKey(const ValueKey('swarm-search-new-agent')),
- matching: find.byWidgetPredicate((widget) => widget is ButtonStyleButton),
- );
await tester.enterText(field, 'Agent');
await tester.pump();
final editor = tester.widget<TextField>(field).controller;
- expect(tester.widget<ButtonStyleButton>(create).onPressed, isNotNull);
for (var i = 0; i < AppNotifier.maxPanes - 1; i++) {
app.adoptSessionForTest(terminal('a$i', input));
}
app.dismissError(); // Publish the sessions assembled through the test seam.
await tester.pump();
- expect(tester.widget<ButtonStyleButton>(create).onPressed, isNull);
final row = find.byKey(ValueKey(agentDestinationId('m', 'a0')));
expect(tester.widget<ListTile>(row).enabled, isFalse);
expect(
@@ -355,7 +349,6 @@ void main() {
);
await app.closePane(app.panes.last.id);
await tester.pump();
- expect(tester.widget<ButtonStyleButton>(create).onPressed, isNotNull);
expect(tester.widget<TextField>(field).controller, same(editor));
expect(editor!.text, 'Agent');
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dart
index a5b4fc415..1987115f4 100644
--- a/desktop/test/swarm_search_test.dart
+++ b/desktop/test/swarm_search_test.dart
@@ -309,7 +309,13 @@ void main() {
await tester.enterText(jumpField, 'Agent 0');
await tester.pump();
expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
- expect(find.text('Add Harness'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('swarm-row-action')),
+ matching: find.text('Open Harness'),
+ ),
+ findsOneWidget,
+ );
await chord(tester, LogicalKeyboardKey.enter);
expect(find.byType(Dialog), findsNothing);
expect(app.activeSwarm, same(target));
@@ -340,7 +346,9 @@ void main() {
app.newSwarm();
final target = app.activeSwarm;
await mount(tester, app);
- final field = find.byKey(ValueKey('swarm-search-input'));
+ final field = find.byKey(
+ ValueKey(adding ? 'swarm-search-input' : 'harness-start-search'),
+ );
if (adding) {
await chord(tester, LogicalKeyboardKey.keyO);
await tester.pump();
@@ -356,7 +364,12 @@ void main() {
);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
- expect(find.byKey(ValueKey('swarm-search-results')), findsOneWidget);
+ expect(
+ find.byKey(
+ ValueKey(adding ? 'swarm-search-results' : 'harness-start-results'),
+ ),
+ findsOneWidget,
+ );
expect(find.byType(Dialog), findsNothing);
expect(app.panes, isEmpty);
controller.clearComposing();
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index 5f1ae6ffe..9dd1400f0 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -111,7 +111,7 @@ void main() {
expect(search, findsOneWidget);
expect(
find.byKey(const ValueKey('swarm-search-new-agent')),
- findsOneWidget,
+ findsNothing,
);
expect(app.focusedPaneId, first.id);
await tester.enterText(search, 'Existing helper');
@@ -329,9 +329,9 @@ void main() {
expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
expect(find.text('Split right'), findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
- await tester.tap(find.byKey(const ValueKey('swarm-search-new-agent')));
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
- expect(find.text('Create Harness to the right'), findsOneWidget);
+ expect(find.text('New Harness to the right'), findsOneWidget);
expect(find.text('/work/checkout'), findsOneWidget);
expect(app.panes, [pane]);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 8368964b9..1950569d5 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -17,7 +17,7 @@ Finder get selectedRow =>
void main() {
for (final nativeTabs in [false, true]) {
testWidgets(
- 'New Agent opens existing work in a new view and preserves its runtime (native=$nativeTabs)',
+ 'New Tab offers Open Harness and preserves the selected runtime (native=$nativeTabs)',
(tester) async {
const channel = MethodChannel('harness/swarm_tabs');
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
@@ -52,7 +52,7 @@ void main() {
await opening;
} else {
await tester.tap(
- find.byKey(const ValueKey('swarm-new-agent-button')),
+ find.byKey(const ValueKey('swarm-new-tab-button')),
);
await tester.pump();
}
@@ -61,6 +61,7 @@ void main() {
expect(opened.name, 'New Harness');
expect(opened.panes, isEmpty);
expect(find.byType(AlertDialog), findsNothing);
+ 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');
@@ -111,7 +112,7 @@ void main() {
expect(app.activeSwarm.name, 'New Harness');
expect(app.panes, isEmpty);
expect(app.allPanes, contains(pane));
- expect(find.byKey(const ValueKey('swarm-search-input')), findsOneWidget);
+ expect(find.byKey(const ValueKey('harness-start-search')), findsOneWidget);
expect(frames, isEmpty);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index e72014ebd..8671f67c9 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -5,54 +5,39 @@ one or several harnesses without a selection basket or a separate group-creation
This is the latest product direction; it supersedes earlier swarm and multi-select
proposals in the progress log.
-## New Harness
-
-The tab-bar plus and **Cmd-T / New Tab** open a draft workspace and immediately
-show the same centered picker as **Cmd-O / Find Harness** and floating +. First launch, reopening an
-empty workspace, and closing its last pane use this entry point too. There is no
-separate start page, inline search, or recent-work list to maintain.
-
-The picker has a full-width **Find a harness** field and single-choice results.
-A click or Enter opens one result immediately in the destination, reusing its
-runtime. Machine and project groups remain searchable as starting points. There
-is no checkbox, selection count, or separate group-creation step. Closing the
-picker discards an unused draft and returns to the previous harness. Drafts are
-not persisted or added to History. Selecting an existing harness or successfully
-creating one commits the draft. Repeated New Tab while the starter is empty reuses
-it. If no populated workspace exists, dismissal keeps the picker ready; the app
-never strands the user on a blank page. Named empty layouts are preserved.
-
-Results show a prominent session name and secondary **project · branch · machine**
-metadata, omitting missing fields. The containing workspace name remains searchable
-but is omitted from the subtitle. Only the highlighted row shows **Open Harness**,
-**Add Harness**, or **Split right/down**, according to the destination. There is no
-Commands footer or repeated action. Unavailable results still explain why they
-cannot open. Command search remains available through Shift-Cmd-P and by typing
-`>` in ordinary search; the shortcuts guide documents it.
-
-A short **or** divider and accented **+ New Harness** button sit outside and
-below the card. The divider spans 160 logical pixels, with 32 pixels of breathing
-room above and below. Popups use a 90% black overlay. The button starts fresh
-creation in the picker’s destination, including its split position. First-use
-folder selection, discovery, linking, reconnect and creation recovery remain
-available through this shared entry point.
-
-Clicking outside creation or pressing Escape dismisses the entire flow and
-restores terminal keyboard focus. **Back to Search** deliberately restores its
-query, text selection, highlighted row and split target. Direct creation retains
-**Cancel**; an uncertain request retains **Close** and explicit search recovery.
-A new empty workspace appearing behind a dialog cannot reopen search over it.
-Success opens the harness directly.
-
-**Harness** names the work users open, create, rename, and close. **Agent** names
-the engine inside it: Codex, Claude Code, Cursor, or another coding agent. The
-creation dialog is **Create Harness**, with the same CTA on every machine;
-**Clone repository** has no trailing ellipsis. Internal agent IDs, RPCs and stored
-session/layout schemas remain compatible.
-
-There is no Navigate action, compass button, or Cmd-P directory. Command search
-remains on Shift-Cmd-P and stays in command mode when its query is cleared.
-Typing `>` in harness search also finds commands.
+## Open and New Harness
+
+**Cmd-T / New Tab** and the tab-bar plus open the Harness start page. Its solid
+background matches the selected tab. The centered title and search controls sit
+lower with generous empty space. The field is no wider than 640 logical pixels,
+with **Open Harness** and accented **+ New Harness** buttons underneath.
+
+The field starts empty and unfocused. Clicking it or Open Harness reveals the
+same input, results, highlight, action arrow and keyboard navigation as Cmd-O.
+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.
+A small product image and introduction sit well below the controls and link to
+https://www.autonomous.ai/harness-device. The bundled image is the official
+product photo from https://cdn.autonomous.ai/production/ecm/260731/2.webp.
+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. Explicit **New Harness** and **Open Harness** buttons sit on the right.
+There is no floating +. Cmd-N opens creation directly; Cmd-O opens existing-work
+search. Each has its own popup, with no creation CTA or “or” divider in search,
+no Back to Search button in creation, and no stacked dialog on dismissal.
+The creation dialog title and CTA are **New Harness**. Cancel is removed; Escape
+and clicking outside dismiss it. Launch-in-progress and uncertain-outcome states
+retain their existing safeguards and recovery actions.
+
+The Open popup keeps its full-width **Find a harness** field, single-choice
+results and 90% black backdrop. Only the highlighted row shows **Open Harness**,
+**Open N Harnesses**, or **Split right/down**, depending on context.
+Secondary text is **project · branch · machine**. Missing metadata is omitted
+and the containing workspace name is not repeated.
+The Commands footer stays removed; Shift-Cmd-P and typing `>` expose commands.
+An explicit Cmd-N while choosing a split replaces search with creation in that
+split position; dismissing creation still returns directly to the terminal.
## Tabs and menus
@@ -64,7 +49,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 Tab, New Harness, Find Harness, Rename Harness, Close Harness**;
+Window, Help**. File groups **New Tab, New Harness, Open Harness, Rename Harness, Close Harness**;
then **Split Right, Split Down, Zoom Pane, Close Pane**. Pin/Unpin and Add Project
are removed from this menu. Machines starts with **Open Machines Manager**, then
linked computers with their status, followed by Link Machine and Refresh Machines.
@@ -73,7 +58,7 @@ machine rename API. It reports failures inline and refreshes names in the menu
and pane headers immediately after success. Selecting a computer opens the shared search with its
name filled in; no agent is opened until the user chooses a result.
-**Cmd-T** opens a new tab with the shared picker, **Cmd-N** opens Create Harness
+**Cmd-T** opens the start page, **Cmd-N** opens New Harness
directly, and **Cmd-O** finds an existing harness. **Cmd-S** opens Layout.
**Cmd-H/J/K/L** and **Cmd-arrows** focus panes; **Shift-Cmd-arrows** move them.
**Cmd-1…Cmd-9** select tabs in their visible order; missing numbers do nothing.
@@ -100,7 +85,7 @@ Close removes only this view. Keyboard toggles the remote message composer.
Resize grips are invisible while idle and appear on divider hover, keyboard
focus or active drag. Their hit targets and resize behavior stay the same. The
-right/bottom edge plus controls continue to open Add at that split position, and
+right/bottom edge plus controls continue to open search at that split position, and
keyboard split commands remain available.
## Latest terminal output
@@ -117,3 +102,14 @@ Find keeps its selected match. Hidden terminals retain their renderer and consum
output without scheduling paints. Regression fixtures cover delayed history and
reconnects for local and remote sessions, multi-pane resize, retained-pane reuse,
hidden output, and input arriving between output and the next layout.
+
+A relayout request also reaches panes whose dimensions are unchanged, including
+neighbors of an added pane and a reapplied preset. Returning to live output cancels
+in-flight scroll animation and dial inertia, so their next tick cannot pull the
+viewport back into history. Focused tests reproduce both failures before the fix.
+
+On macOS, Codex can clear history and repaint in several output frames after
+resize. The renderer now corrects the tail before publishing the shortened
+scroll extent, preventing the OS from starting a bounce toward the old origin.
+A platform-specific regression reproduces the jump to offset zero before this
+fix and passes for macOS and Linux afterward.
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index 9707188d7..116e0950d 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -1,71 +1,81 @@
# Harness v2: goal, plan, and continuation handoff
**Latest UI direction:** [Harness entry and pane controls](harness-agent-first-tabs.md)
-is the current contract. The former separate start page is removed; all entry
-uses one centered picker with single-choice results. Session names sit above
-**project · branch · machine**, without the redundant workspace title. Only the
-highlighted result shows its action, with consistent **Add Harness / Add N Harnesses**
-capitalization. No Commands footer; Shift-Cmd-P and typing `>` still find commands.
-A short **or** divider and **+ New Harness** button sit outside the card over a
-90% black backdrop.
-
-**Cmd-T = New Tab**, **Cmd-N = New Harness** (creation form), **Cmd-O = Find Harness**,
+is the current contract. **New and Open Harness are separate actions and popups.**
+The titlebar has the bell beside the traffic lights and readable New Harness / Open
+Harness buttons on the right. There is no floating +. The Google-like New Tab page
+is restored, with a solid background matching the selected tab, lower centered
+controls and generous whitespace. The blank search field is unfocused initially;
+clicking it opens the same results, highlighting, arrow navigation and Enter action
+as Cmd-O. The five recent-agent rows are replaced by a small official device photo
+and introduction linking to `https://www.autonomous.ai/harness-device`.
+
+Session names sit above **project · branch · machine**, without the repeated
+workspace title. Only the highlighted result shows **Open Harness / Open N Harnesses**.
+The modal search retains the 90% black backdrop. It has no Commands footer,
+creation CTA or “or” divider. Shift-Cmd-P and typing `>` still find commands.
+Creation uses **New Harness** for both title and CTA, with no Cancel button.
+Escape or one click outside dismisses it without reopening search. The pending
+creation receipt and Check status recovery safeguards remain intact.
+
+**Cmd-T = New Tab**, **Cmd-N = New Harness** (creation form), **Cmd-O = Open Harness**,
**Cmd-S = Layout**, **Cmd-H/J/K/L and Cmd-arrows = pane navigation**.
Cmd-1…9 select tabs, Shift-Cmd-arrows move panes, and Shift-Cmd-T reopens closed
work. User overrides retain precedence. File groups tab/harness actions first,
then pane actions. Pin/Unpin and Add Project are absent. Machines follows Models
and starts with **Open Machines Manager**, with a visible **Rename** on each machine.
-New Tab is a temporary draft until its first harness is opened or created.
-Dismissing the picker or creation discards the untouched draft and returns to
-previous work. If there is no populated workspace, the picker remains the starting
-screen. Renamed/saved empty layouts are preserved. Drafts are omitted from saved
-layout and navigation history. Closing an unused default-name empty page never
-adds it to Recently Closed, including pages from older builds. Closed single-agent
-harnesses retain their engine icon; groups keep the group icon.
+New Tab remains a useful start page after dismissing a popup. Closing an unused
+default-name empty page never adds it to Recently Closed, including pages from
+older builds. Closed single-agent harnesses retain their engine icon; groups keep
+the group icon.
Terminal scrolling now follows the latest output on new attachment, restored or
reopened work, reconnect, returning to a workspace, reuse of a retained pane,
relayout, resize, zoom and font changes. Regression tests reproduced a retained
pane stuck at its old scroll offset and a late-output/input race 200 lines short
of the bottom. Alignment now resolves against the current buffer during layout.
+An additional live Codex failure came from incremental resize repaint: clearing
+history briefly reduced the scroll extent to zero, which started a macOS bounce
+that kept pulling the viewport up after history returned. The renderer now corrects
+the tail **before** publishing content dimensions. Explicit relayout also reaches
+unchanged-size neighbors and cancels in-flight scroll animations and dial inertia.
Manual scrollback within an unchanged pane and active Find are preserved; hidden
output still causes no unnecessary frames. Local and remote delayed history,
reconnect and multi-pane transitions are covered with fake sessions.
-Clicking outside creation or pressing Escape dismisses the whole flow back to the
-terminal. Back to Search deliberately restores the query and target. The title
-and submit action are **Create Harness**; Agent names only the engine choice.
-
The current Release preview is built from **`/Users/ab/code/autonomous-harness`**
-and running at `desktop/build/macos/Build/Products/Release/Harness.app` (PID **63310**;
-recheck before acting). Its signature and copied bundle both verified. Build log:
-`/private/tmp/harness-current-features-release.log`. The visible shared picker was
-confirmed through the exact app path, including the removed footer and separate
-New Harness button. The installed `/Applications/Harness.app` remains separate
-(PID 1722). The other checkout's Debug app is no longer running. The user asked
-the other agent to pause development there to avoid conflicting previews; do not
-launch that checkout to review this work.
-
-Verification: **86 current-flow regression checks** passed in
-`/private/tmp/harness-current-ui-final-tests.log`; its two additional manager
-checks were corrected to use an online fixture and both pass in
-`/private/tmp/harness-machines-final-tests.log`. The fixture had incorrectly tried
-to type into an intentionally read-only offline terminal. **361 AppKit menu/window
-checks** pass in `/private/tmp/harness-final-native-menus.log`, and **84 native
-keyboard checks** pass against Dart's exported bindings. Static analysis has no
-errors or warnings, with the same 14 existing infos, in
-`/private/tmp/harness-current-features-analyze.log`. The earlier full-suite run
-passed 1,409 tests with one skip and four failures; those four were outdated
-expectations or the offline fixture, and all passed on focused reruns. The user
-subsequently asked to keep verification on the current experience, rather than
-revisiting retired UI fixtures. No latency benchmark was run.
-
-Publication: the user explicitly requested **commit and push** for this accumulated
-UI work, then added the scrolling, remapping, machine manager and empty-history
-fixes. That fresh authorization supersedes the earlier checkpoint's pending request
-for approval. These verified changes are the next commit on main. The broader goal
-and native latency benchmarks remain paused by user instruction.
+and running at `desktop/build/macos/Build/Products/Release/Harness.app`.
+Build log: `/private/tmp/harness-final-entry-release.log`. The current app framework
+and copied bundle signatures verified after refreshing the outer ad-hoc signature.
+The prior bundle is preserved at `/private/tmp/harness-before-final-entry-0bmbrwl5/Harness.app`.
+Only this checkout's preview was replaced; `/Applications/Harness.app` remains separate.
+The other checkout is paused by the user: **do not launch its retired UI**.
+
+Live verification in this exact preview: both idle workshop Codex panes retained
+their latest message and prompt across rows → columns → rows → columns, including
+the delayed repaint. The app v2 Codex/Claude workspace also retained its bottom
+after restoring columns. Both workspaces were left in their original columns.
+The start page was visually checked for its continuous background, whitespace,
+device photo, absent initial caret, click-to-search, filtering and arrow selection.
+The New Harness title/CTA, absence of Cancel, one-click outside dismissal and
+separate Open Harness popup were verified live. The start page is left open.
+
+Verification: **35 focused terminal-lifecycle and current-entry checks** pass in
+`/private/tmp/harness-tail-and-entry-final.log`, including the macOS incremental
+repaint regression and inline search keyboard activation. The other current UI
+fixtures passed in `/private/tmp/harness-current-ui-tests.log`; that run's two
+ambiguous New Harness button finders were corrected and pass in the final entry
+run. **348 AppKit checks** pass in `/private/tmp/harness-header-final-checks.log`.
+Static analysis has no errors or warnings and four existing infos in
+`/private/tmp/harness-final-entry-analyze.log`. No retired UI or latency benchmark
+was exercised.
+
+Publication: the user explicitly requests **frequent commits and pushes**.
+`e8960fc` (separate titlebar actions) and `9288ea4` (terminal redraw scrolling) are
+pushed to main. The accompanying UI checkpoint contains the revised start page,
+shared inline search, device asset and New Harness dialog. The broader goal and
+native latency benchmarks remain paused by user instruction.
Updated September 14, 2026. **Read this first when resuming on another computer.**
This is the current product contract and next-work order. It supersedes conflicting
@@ -96,7 +106,8 @@ Divider grips are invisible until hover, keyboard focus or resize drag.
Hover near a pane's right or bottom edge to reveal an inset **+** for that
direction. Clicking it opens the shared harness picker, supporting an existing
-harness or **Create Harness** in the chosen position. Keyboard split commands remain
+harness in the chosen position; Cmd-N opens **New Harness** for that split.
+Keyboard split commands remain
available. Hover does not change focus or rebuild the terminal; the resize gaps
remain draggable. Controls stay hidden while zoomed or dragging, and a pane too
small for the chosen split explains the required width/height in its tooltip.
@@ -122,22 +133,14 @@ it never creates another agent. A confirmed agent returns to the original swarm
or stays discoverable in Add if that destination changed. Older CLIs can still
create normally, but cannot recover a lost result through this new status RPC.
Form intents currently last for that open dialog; do not claim app-restart recovery.
-An uncertain form also offers **Find a harness**, which opens shared Add
-after the modal releases keyboard focus. Creation opened from search carries its
-query back to Add and retains its original swarm/split. A closed swarm or changed
-split gets an explanation instead of redirecting the addition. A background
-empty tab cannot take focus from the open creation dialog.
-
-Opening **New Harness** from centered Add or either split closes that picker.
-Clicking outside creation or pressing Escape dismisses everything back to the
-terminal, including restoration of terminal keyboard input. The explicit
-**Back to Search** button restores the query, text selection, highlighted result
-and original split. **Find a harness** on an uncertain request also preserves that
-draft. A successful creation leaves Add closed. Back to Search does not select a
-different tab if the original one is no longer current; stale splits get an
-explanation. Direct creation retains Cancel, and uncertain requests retain Close.
-There is no multi-select or checked-agent draft. This remains in-memory search
-recovery, not a saved creation intent.
+New and Open Harness now have separate entry points. Cmd-N while search is open
+closes it before opening creation and retains the original swarm/split destination.
+A closed swarm or changed split gets an explanation instead of redirecting the
+addition. A background empty tab cannot take focus from the open creation dialog.
+Outside click and Escape dismiss the form directly; no picker is restored and no
+Back to Search or Cancel action is shown. Uncertain requests retain Check status
+and Close. There is no multi-select or checked-agent draft, and creation intent
+recovery still lasts only for that open dialog.
Browser sign-in now offers **Open browser**, **Copy link** and immediate **Cancel**
while waiting for authorization. Reopening uses the current link without starting