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.

Unify agent terminology and improve creation and machine navigation

deee0493486ea79
diff --git a/desktop/lib/core/project_folder.dart b/desktop/lib/core/project_folder.dart
new file mode 100644
index 000000000..56b6ce465
--- /dev/null
+++ b/desktop/lib/core/project_folder.dart
@@ -0,0 +1,46 @@
+import 'dart:io';
+
+import 'package:path/path.dart' as p;
+
+import 'repository_clone.dart';
+
+/// Folder preparation is explicit and runs only when New Agent is submitted.
+/// Existing folders continue to use the ordinary agent_create cwd payload.
+class ProjectFolderRequest {
+ const ProjectFolderRequest.newProject() : repository = null;
+ const ProjectFolderRequest.remote(GitHubRepository value) : repository = value;
+
+ final GitHubRepository? repository;
+
+ Map<String, String> get payload => {
+ 'projectSource': repository == null ? 'new' : 'remote',
+ if (repository != null) 'repositoryUrl': repository!.url,
+ };
+
+ Future<String> prepareLocal({
+ String? projectHome,
+ RepositoryClone Function()? createClone,
+ }) async {
+ final home =
+ Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'];
+ if (projectHome == null && (home == null || !p.isAbsolute(home))) {
+ throw const RepositoryCloneException(
+ 'Could not find your home folder. Choose Local to select a folder.',
+ );
+ }
+ final root = Directory(projectHome ?? p.join(home!, 'Harness Projects'));
+ try {
+ await root.create(recursive: true);
+ if (repository case final repo?) {
+ return (createClone?.call() ?? RepositoryClone()).run(repo, root.path);
+ }
+ // The OS reserves a unique folder atomically. No name prompt or existing
+ // project is needed, and two deliberate creations cannot share a folder.
+ return (await root.createTemp('project-')).path;
+ } on FileSystemException {
+ throw const RepositoryCloneException(
+ 'Could not create a project folder. Choose Local to select a folder you can edit.',
+ );
+ }
+ }
+}
diff --git a/desktop/lib/screens/login_screen.dart b/desktop/lib/screens/login_screen.dart
index 5f930754b..76195d33f 100644
--- a/desktop/lib/screens/login_screen.dart
+++ b/desktop/lib/screens/login_screen.dart
@@ -78,14 +78,14 @@ class LoginScreen extends StatelessWidget {
const _AppMark(),
SizedBox(height: gap),
Text(
- 'All your harnesses, on one screen',
+ 'All your agents, on one screen',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Text(
'Work with Claude Code, Codex and other agents side by side. '
- 'Start with one harness and add panes as your work grows.',
+ 'Start with one agent and add panes as your work grows.',
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall,
),
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 0e9b8665e..2b3ceddc2 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -80,11 +80,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
final _navigation = SwarmNavigationHistory();
final _searchCatalog = SwarmSearchCatalog();
final _searchText = TextEditingController();
- final _searchFocus = FocusNode(debugLabel: 'Find a harness');
+ final _searchFocus = FocusNode(debugLabel: 'Find an agent');
SwarmSearchController? _search;
OverlayEntry? _searchOverlay;
- (String, bool, bool, bool)? _searchHeaderState;
- bool _searchResultsVisible = false;
+ (String, bool, bool)? _searchHeaderState;
FocusNode? _searchReturnFocus;
(String, bool)? _lastWorkspace;
bool _spokenPaletteOpen = false;
@@ -285,6 +284,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
void _syncNative() {
+ final openAgents = {
+ for (final tab in app.swarms)
+ for (final pane in tab.panes) (pane.machineId, pane.agentId),
+ };
final payload = {
'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,
'activeId': app.activeSwarmId,
@@ -316,6 +319,26 @@ class _SwarmScreenState extends State<SwarmScreen> {
'id': machine.machine.machineId,
'name': machine.machine.displayName,
'local': machine.isLocalMachine,
+ 'agentCount':
+ machine.agents.isNotEmpty ||
+ machine.agentLoadStatus == AgentLoadStatus.loaded
+ ? machine.agents.length
+ : null,
+ 'agents': [
+ for (final agent in machine.agents.take(512))
+ {
+ 'id': agent.id,
+ 'title': agent.name,
+ 'engine': agent.engine,
+ 'iconAsset': engineIdentity(agent.engine).asset,
+ 'canOpen':
+ agent.terminalAvailable ||
+ openAgents.contains((
+ machine.machine.machineId,
+ agent.id,
+ )),
+ },
+ ],
'status': machine.needsLink
? 'Link required'
: machine.nodeOnline == false
@@ -516,6 +539,30 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (machine != null) {
_openSearch(adding: true, query: machine.machine.displayName);
}
+ case 'machineAgent':
+ final machineId = args['machineId'], agentId = args['agentId'];
+ if (machineId is String &&
+ agentId is String &&
+ app
+ .stateOf(machineId)
+ ?.agents
+ .any((agent) => agent.id == agentId) ==
+ true) {
+ final entry = swarmDestinations(app)
+ .where(
+ (entry) => entry.id == agentDestinationId(machineId, agentId),
+ )
+ .firstOrNull;
+ if (entry != null) {
+ _closeSearch();
+ _preparePaneFocus();
+ await activateSwarmDestination(
+ app,
+ entry,
+ destinationSwarmId: app.activeSwarmId,
+ );
+ }
+ }
case 'commands':
_showSearchCommands();
case 'historyDestination':
@@ -560,6 +607,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
'zoomPane',
'pinPane',
'machineDestination',
+ 'machineAgent',
}.contains(call.method)) {
// Native tab controls wait for this reply before releasing keyboard
// ownership. The destination's actual focus tree must be ready first.
@@ -786,7 +834,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
catalog: _searchCatalog,
)..setQuery(query);
_search!.addListener(_syncSearch);
- _searchResultsVisible = !adding || query.isNotEmpty;
_searchOverlay = OverlayEntry(builder: _buildSearchOverlay);
Overlay.of(context).insert(_searchOverlay!);
_syncSearch();
@@ -823,27 +870,13 @@ 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.
- if (search.query.isNotEmpty) _searchResultsVisible = true;
- final header = (
- search.hint,
- search.canCreate,
- _canDismissSearch,
- _searchResultsVisible,
- );
+ final header = (search.hint, search.canCreate, _canDismissSearch);
if (_searchHeaderState != header) {
_searchHeaderState = header;
_searchOverlay?.markNeedsBuild();
}
}
- void _revealSearch() {
- if (_search == null) return;
- _searchResultsVisible = true;
- _search!.setQuery(_searchText.text);
- _syncSearch();
- _focusSearch();
- }
-
void _closeSearch({bool restoreFocus = true}) {
if (_search == null) return;
// Enable the chosen terminal synchronously, before activation requests its
@@ -898,15 +931,14 @@ class _SwarmScreenState extends State<SwarmScreen> {
// Keep the command editor mounted as its query changes so every keystroke
// retains focus and text editing ownership.
final commandsOnly = search.commandsOnly;
- final showResults = _searchResultsVisible || commandsOnly;
return KeymapProvider(
keymap: _keymap,
child: SwarmSearchKeys(
- search: showResults ? search : null,
+ search: search,
editing: _searchText,
onChoose: _chooseSearch,
onClose: _dismissSearch,
- onOpen: _revealSearch,
+ onOpen: _focusSearch,
onNewAgent: () => _runShortcut('agent.new'),
onRefocus: _focusSearch,
child: LayoutBuilder(
@@ -932,18 +964,12 @@ class _SwarmScreenState extends State<SwarmScreen> {
Flexible(
child: Material(
key: const ValueKey('swarm-search-results'),
- elevation: showResults ? 16 : 0,
+ elevation: 16,
shadowColor: Colors.black54,
- color: showResults
- ? grid.AppPalette.swarmSearchSurface
- : Colors.transparent,
+ color: grid.AppPalette.swarmSearchSurface,
shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(
- showResults ? 12 : 999,
- ),
- side: showResults
- ? const BorderSide(color: Colors.white24)
- : BorderSide.none,
+ borderRadius: BorderRadius.circular(12),
+ side: const BorderSide(color: Colors.white24),
),
clipBehavior: Clip.antiAlias,
child: Column(
@@ -967,27 +993,25 @@ class _SwarmScreenState extends State<SwarmScreen> {
inputKey: const ValueKey('swarm-search-input'),
controller: _searchText,
focusNode: _searchFocus,
- search: showResults ? search : null,
+ search: search,
onClose: _dismissSearch,
onChanged: search.setQuery,
- onOpen: _revealSearch,
- showClose: showResults,
+ onOpen: _focusSearch,
+ showClose: true,
rounded: true,
prominent: !commandsOnly,
),
- if (showResults) ...[
- const Divider(height: 1, color: Colors.white12),
- Flexible(
- child: SizedBox(
- height: 480,
- child: SwarmSearchResults(
- search: search,
- onChoose: _chooseSearch,
- onRefocus: _focusSearch,
- ),
+ const Divider(height: 1, color: Colors.white12),
+ Flexible(
+ child: SizedBox(
+ height: 480,
+ child: SwarmSearchResults(
+ search: search,
+ onChoose: _chooseSearch,
+ onRefocus: _focusSearch,
),
),
- ],
+ ),
],
),
),
@@ -1001,9 +1025,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
builder: (context, _) => HarnessEntryActions(
openKey: const ValueKey('harness-picker-open'),
newKey: const ValueKey('harness-picker-new'),
- onOpen: !showResults
- ? _revealSearch
- : search.canAccept
+ onOpen: search.canAccept
? () => _chooseSearch(search.submit()!)
: null,
onNew: search.canCreate
@@ -1442,7 +1464,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
Icons.notifications_none,
size: 20,
semanticLabel: _attention > 0
- ? '$_attention harnesses need input'
+ ? '$_attention agents need input'
: 'Notifications',
),
),
@@ -1568,7 +1590,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
foregroundColor: grid.AppPalette.swarmTabBar,
shape: const StadiumBorder(),
),
- child: const Text('Add Harness'),
+ child: const Text('Add Agent'),
);
}
}
diff --git a/desktop/lib/settings/appearance/palette_section.dart b/desktop/lib/settings/appearance/palette_section.dart
index a92c56fab..ec14a4cea 100644
--- a/desktop/lib/settings/appearance/palette_section.dart
+++ b/desktop/lib/settings/appearance/palette_section.dart
@@ -22,7 +22,7 @@ class PaletteSection extends StatelessWidget {
children: [
const SectionHeading(
'Color palette',
- subtitle: 'A coordinated look for your tabs, search and harnesses. Changes apply instantly.',
+ subtitle: 'A coordinated look for your tabs, search and agents. Changes apply instantly.',
),
LayoutBuilder(
builder: (context, constraints) {
diff --git a/desktop/lib/settings/appearance/typography_section.dart b/desktop/lib/settings/appearance/typography_section.dart
index 63e94d11f..1bb361080 100644
--- a/desktop/lib/settings/appearance/typography_section.dart
+++ b/desktop/lib/settings/appearance/typography_section.dart
@@ -266,7 +266,7 @@ class _TypePreview extends StatelessWidget {
Text('Preview', style: theme.textTheme.titleSmall),
const SizedBox(height: 10),
Text(
- 'Machines and the harnesses on them.',
+ 'Machines and the agents on them.',
style: theme.textTheme.titleMedium,
),
const SizedBox(height: 6),
diff --git a/desktop/lib/settings/sections/tracking_section.dart b/desktop/lib/settings/sections/tracking_section.dart
index 317b5bb36..eb918a5f0 100644
--- a/desktop/lib/settings/sections/tracking_section.dart
+++ b/desktop/lib/settings/sections/tracking_section.dart
@@ -137,7 +137,7 @@ class _TrackingSectionState extends State<TrackingSection> {
icon: LucideIcons.activity300,
title: 'No events yet',
message:
- 'Move around the app — opening a screen or creating a harness '
+ 'Move around the app — opening a screen or creating an agent '
'reports an event, and each one shows up here with what it sent.',
);
}
diff --git a/desktop/lib/shared/widgets/app_choice_picker.dart b/desktop/lib/shared/widgets/app_choice_picker.dart
index 9f125d520..db8a3dc08 100644
--- a/desktop/lib/shared/widgets/app_choice_picker.dart
+++ b/desktop/lib/shared/widgets/app_choice_picker.dart
@@ -18,6 +18,7 @@ class AppChoicePicker<T> extends StatefulWidget {
this.moreKey,
this.preferredValues = const [],
this.showDetails = false,
+ this.wrap = true,
});
final T value;
@@ -28,6 +29,7 @@ class AppChoicePicker<T> extends StatefulWidget {
final Key? moreKey;
final List<T> preferredValues;
final bool showDetails;
+ final bool wrap;
@override
State<AppChoicePicker<T>> createState() => _AppChoicePickerState<T>();
@@ -83,9 +85,8 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
@override
Widget build(BuildContext context) {
AppTheme.watch(context);
- final visible = _visibleOptions;
- if (visible.isEmpty) return const SizedBox.shrink();
- final hasMore = widget.options.length > visible.length;
+ final candidates = _visibleOptions;
+ if (candidates.isEmpty) return const SizedBox.shrink();
final textStyle = TextStyle(
fontFamily: AppFont.sans,
fontFamilyFallback: AppFont.sansFallback,
@@ -106,15 +107,19 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
textScaler: scaler,
);
var minimumWidth = 0.0;
- for (final option in visible) {
+ var controlHeight = height;
+ for (final option in candidates) {
painter.text = TextSpan(text: option.label, style: textStyle);
painter.layout();
var labelWidth = painter.width;
+ var textHeight = painter.height;
if (widget.showDetails && option.detail != null) {
painter.text = TextSpan(text: option.detail, style: detailStyle);
painter.layout();
labelWidth = math.max(labelWidth, painter.width);
+ textHeight += painter.height + 2;
}
+ controlHeight = math.max(controlHeight, textHeight + 20);
// Long custom names truncate with their full text in the tooltip.
// Larger system text gets wider choices and additional rows.
final width =
@@ -126,50 +131,77 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
painter.dispose();
const gap = 8.0;
const moreWidth = 44.0;
+ var visible = candidates;
+ if (!widget.wrap) {
+ var count = candidates.length;
+ while (count > 1) {
+ final needed =
+ minimumWidth * count +
+ gap * (count - 1) +
+ (widget.options.length > count ? moreWidth + gap : 0);
+ if (needed <= constraints.maxWidth) break;
+ count--;
+ }
+ visible = candidates.take(count).toList();
+ final selected = candidates
+ .where((option) => option.value == widget.value)
+ .firstOrNull;
+ if (selected != null &&
+ !visible.any((option) => option.value == widget.value)) {
+ visible[visible.length - 1] = selected;
+ }
+ }
+ final hasMore = widget.options.length > visible.length;
final rowWidth =
(constraints.maxWidth -
(hasMore ? moreWidth + gap : 0) -
gap * (visible.length - 1)) /
visible.length;
final pairWidth = (constraints.maxWidth - gap) / 2;
- final buttonWidth = rowWidth >= minimumWidth
+ final buttonWidth = !widget.wrap || rowWidth >= minimumWidth
? rowWidth
: pairWidth >= minimumWidth
? pairWidth
: constraints.maxWidth;
- return Wrap(
- spacing: gap,
- runSpacing: gap,
- children: [
- for (final option in visible)
- SizedBox(
- width: buttonWidth,
- child: _choice(option, textStyle, detailStyle, height),
- ),
- if (hasMore)
- Semantics(
- label: widget.moreLabel,
- button: true,
- child: Tooltip(
- message: widget.moreLabel,
- child: AppSelectField<T>(
- key: widget.moreKey,
- value: widget.value,
- options: widget.options,
- onChanged: _choose,
- width: moreWidth,
- height: height,
- trigger: Icon(
- Icons.more_horiz,
- size: 20,
- color: AppPalette.textSecondary,
- ),
+ final children = <Widget>[
+ for (final option in visible)
+ SizedBox(
+ width: buttonWidth,
+ child: _choice(option, textStyle, detailStyle, controlHeight),
+ ),
+ if (hasMore)
+ Semantics(
+ label: widget.moreLabel,
+ button: true,
+ child: Tooltip(
+ message: widget.moreLabel,
+ child: AppSelectField<T>(
+ key: widget.moreKey,
+ value: widget.value,
+ options: widget.options,
+ onChanged: _choose,
+ width: moreWidth,
+ height: controlHeight,
+ trigger: Icon(
+ Icons.more_horiz,
+ size: 20,
+ color: AppPalette.textSecondary,
),
),
),
- ],
- );
+ ),
+ ];
+ return widget.wrap
+ ? Wrap(spacing: gap, runSpacing: gap, children: children)
+ : Row(
+ children: [
+ for (var i = 0; i < children.length; i++) ...[
+ if (i > 0) const SizedBox(width: gap),
+ children[i],
+ ],
+ ],
+ );
},
);
}
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index 5637ed50e..5d44c04b5 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';
import '../logging/debug_surface.dart';
/// Harness uses Command as a direct prefix for frequent workspace actions.
-/// T opens a tab, N adds an existing or new harness, S changes layout,
+/// T opens a tab, N adds an existing or new agent, S changes layout,
/// H/J/K/L and arrows focus panes, B routes a task, D splits down and R splits
/// right. The same definitions feed live keys, help and search.
///
@@ -284,7 +284,7 @@ const List<AppShortcut> kAppShortcuts = [
meta: true,
shift: true,
),
- label: 'New Harness',
+ label: 'New Agent',
group: ShortcutGroup.actions,
),
AppShortcut(
@@ -296,7 +296,7 @@ const List<AppShortcut> kAppShortcuts = [
AppShortcut(
action: ShortcutAction.reload,
activator: SingleActivator(LogicalKeyboardKey.keyR, meta: true),
- label: 'Reload machines and harnesses',
+ label: 'Reload machines and agents',
group: ShortcutGroup.actions,
),
AppShortcut(
@@ -346,7 +346,7 @@ const kSwarmShortcuts = [
AppShortcut(
action: ShortcutAction.addAgent,
activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),
- label: 'Add Harness',
+ label: 'Add Agent',
group: ShortcutGroup.actions,
),
AppShortcut(
@@ -368,7 +368,7 @@ const kSwarmShortcuts = [
meta: true,
shift: true,
),
- label: 'Reopen last closed harness',
+ label: 'Reopen last closed agent',
group: ShortcutGroup.navigate,
),
AppShortcut(
@@ -394,7 +394,7 @@ const kSwarmShortcuts = [
meta: true,
shift: true,
),
- label: 'Next Harness',
+ label: 'Next Tab',
group: ShortcutGroup.navigate,
),
AppShortcut(
@@ -404,13 +404,13 @@ const kSwarmShortcuts = [
meta: true,
shift: true,
),
- label: 'Previous Harness',
+ label: 'Previous Tab',
group: ShortcutGroup.navigate,
),
AppShortcut(
action: ShortcutAction.nextSwarm,
activator: SingleActivator(LogicalKeyboardKey.tab, control: true),
- label: 'Next Harness',
+ label: 'Next Tab',
group: ShortcutGroup.navigate,
),
AppShortcut(
@@ -420,7 +420,7 @@ const kSwarmShortcuts = [
control: true,
shift: true,
),
- label: 'Previous Harness',
+ label: 'Previous Tab',
group: ShortcutGroup.navigate,
),
AppShortcut(
@@ -430,7 +430,7 @@ const kSwarmShortcuts = [
meta: true,
shift: true,
),
- label: 'Show harnesses needing input',
+ label: 'Show agents needing input',
group: ShortcutGroup.navigate,
),
AppShortcut(
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index 9d689b0d6..d4e0cc828 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -70,14 +70,14 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'swarm.reopen',
- 'Reopen last closed harness',
+ 'Reopen last closed agent',
ShortcutGroup.navigate,
action: ShortcutAction.reopenClosedSwarm,
nativeAction: 'reopen',
),
const HarnessCommand(
'swarm.next',
- 'Next Harness',
+ 'Next Tab',
ShortcutGroup.navigate,
action: ShortcutAction.nextSwarm,
nativeAction: 'next',
@@ -85,7 +85,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'swarm.previous',
- 'Previous Harness',
+ 'Previous Tab',
ShortcutGroup.navigate,
action: ShortcutAction.previousSwarm,
nativeAction: 'previous',
@@ -123,7 +123,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'navigation.needs_input',
- 'Show harnesses needing input',
+ 'Show agents needing input',
ShortcutGroup.navigate,
action: ShortcutAction.showAttention,
nativeAction: 'notifications',
@@ -272,14 +272,14 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'agent.add',
- 'Add Harness',
+ 'Add Agent',
ShortcutGroup.actions,
action: ShortcutAction.addAgent,
nativeAction: 'addAgent',
),
const HarnessCommand(
'agent.new',
- 'New Harness',
+ 'New Agent',
ShortcutGroup.actions,
action: ShortcutAction.newAgent,
nativeAction: 'newAgent',
@@ -304,7 +304,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'machines.refresh',
- 'Refresh machines and harnesses',
+ 'Refresh machines and agents',
ShortcutGroup.actions,
action: ShortcutAction.reload,
nativeAction: 'reload',
@@ -383,7 +383,7 @@ final harnessCommands = <HarnessCommand>[
),
const HarnessCommand(
'picker.add_here',
- 'Add the selected harness',
+ 'Add the selected agent',
ShortcutGroup.actions,
extraKeys: ['cmd+enter'],
context: KeymapContext.picker,
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index f2b8ed9ba..c8dceda64 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -20,6 +20,8 @@ import '../core/local_hostname.dart';
import '../core/local_git_projects.dart';
import '../core/test_run.dart';
import '../core/models.dart';
+import '../core/project_folder.dart';
+import '../core/repository_clone.dart';
import '../core/retry.dart';
import '../settings/config_store.dart';
import '../stats/harness_stats.dart';
@@ -84,9 +86,14 @@ class AgentCreationAttempt {
Future<String?>? _inFlight;
bool _awaitingConfirmation = false, _finished = false;
String? _outcome;
+ String? _preparedFolder;
bool get awaitingConfirmation => _awaitingConfirmation;
+ /// A completed folder survives a refused agent launch, so correcting the
+ /// agent choice does not clone or create the same project again.
+ String? get preparedFolder => _preparedFolder;
+
String? _complete(String? error) {
_finished = true;
_awaitingConfirmation = false;
@@ -500,7 +507,7 @@ class AppNotifier extends ChangeNotifier {
bool get canOpenNewTab =>
swarms.length < maxSwarms || swarms.any((swarm) => swarm.isEmptyStarter);
- // A New Harness remains temporary until it has content or a custom name.
+ // A New Agent remains temporary until it has content or a custom name.
// The return destination is session-local; abandoned drafts are never saved.
final _draftSwarmReturns = <String, String>{};
@@ -560,7 +567,7 @@ class AppNotifier extends ChangeNotifier {
notifyListeners();
}
- /// Cancel an untouched New Harness without closing a session or recording
+ /// Cancel an untouched New Agent without closing a session or recording
/// Recently Closed. A sole workspace remains the app's starting screen.
bool cancelSwarmDraft(String id) {
final returnId = _draftSwarmReturns[id];
@@ -3226,7 +3233,7 @@ class AppNotifier extends ChangeNotifier {
unawaited(connection.forceReconnect());
}
} else {
- machine.agentsLoadError = 'Could not load harnesses: $error';
+ machine.agentsLoadError = 'Could not load agents: $error';
}
// A NO_PEER_LINK close already set needsLink (via onLocalFailure) perhaps a microtask before
// this catch runs — don't downgrade that specific, actionable state back to a generic error.
@@ -3763,9 +3770,9 @@ class AppNotifier extends ChangeNotifier {
'MEDIA_CHANGED' => 'The file changed while downloading. Wait for it to finish generating and try again.',
'MEDIA_UNSUPPORTED' => 'This file is not a supported image or video.',
'MEDIA_INVALID_REQUEST' =>
- 'Use a full path or a path inside this harness’s working folder.',
+ 'Use a full path or a path inside this agent’s working folder.',
'AGENT_NOT_FOUND' =>
- 'This harness is no longer available. Reconnect and try again.',
+ 'This agent is no longer available. Reconnect and try again.',
'NOT_TEXT' || 'FILE_TOO_LARGE' => 'Update the Harness CLI on this remote machine to open media previews.',
_ => 'The remote machine could not read this file. Check that it is accessible and try again.',
});
@@ -3837,10 +3844,14 @@ class AppNotifier extends ChangeNotifier {
/// Starts an agent, or recovers this form's earlier request after a lost reply.
/// Returns null on success, or an inline message; [attempt] tells the form
/// whether to offer Check status instead of inviting another creation.
+ Future<String> prepareLocalProjectFolder(ProjectFolderRequest request) =>
+ request.prepareLocal();
+
Future<String?> createAgent(
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
@@ -3850,7 +3861,8 @@ class AppNotifier extends ChangeNotifier {
final creation = attempt ?? AgentCreationAttempt();
final choices = <String, dynamic>{
'engine': engine,
- 'cwd': folder,
+ if (projectFolder == null) 'cwd': folder,
+ ...?projectFolder?.payload,
'bypassPermission': bypassPermission,
'codexHome': ?codexHome,
};
@@ -3881,22 +3893,30 @@ class AppNotifier extends ChangeNotifier {
final target = swarms.where((s) => s.id == targetId).firstOrNull;
if (target == null) return 'This tab was closed';
if (target.panes.length >= maxPanes) {
- return 'This tab is full. Open a new tab to create a harness.';
+ return 'This tab is full. Open a new tab to create an agent.';
}
return null;
}
String _creationFailureMessage(String code, String? detail, String machine) =>
switch (code) {
+ 'INVALID_PROJECT_SOURCE' ||
+ 'INVALID_REPOSITORY' ||
+ 'PROJECT_PREPARATION_FAILED' ||
+ 'PROJECT_EXISTS' ||
+ 'CLONE_FAILED' ||
+ 'CLONE_TIMEOUT' ||
+ 'GIT_UNAVAILABLE' =>
+ detail ?? 'Could not prepare the project folder on $machine.',
'CWD_NOT_FOUND' || 'INVALID_CWD' =>
'The project folder is unavailable on $machine. '
'Choose another folder and try again.',
'TMUX_UNAVAILABLE' =>
- 'Harness needs tmux to start harnesses on $machine. '
+ 'Harness needs tmux to start agents on $machine. '
'Install tmux there, then try again.',
'UNSUPPORTED_ON_REMOTE' || 'UNSUPPORTED' =>
- 'Update the harness CLI on this machine to create a harness',
- _ => 'Create harness failed: ${detail ?? code}',
+ 'Update the harness CLI on this machine to create an agent',
+ _ => 'Create agent failed: ${detail ?? code}',
};
Future<String?> _createAgentWithReceipt(AgentCreationAttempt creation) async {
@@ -3922,11 +3942,44 @@ class AppNotifier extends ChangeNotifier {
}
}
final connection = _conn(machineId);
+ var launchChoices = choices;
+ if (!creation.awaitingConfirmation &&
+ choices['projectSource'] != null &&
+ machine.isLocalMachine) {
+ try {
+ final repository = choices['repositoryUrl'];
+ final project = repository is String
+ ? ProjectFolderRequest.remote(GitHubRepository.parse(repository)!)
+ : const ProjectFolderRequest.newProject();
+ creation._preparedFolder ??= await prepareLocalProjectFolder(project);
+ } on RepositoryCloneException catch (error) {
+ return creation._complete(error.message);
+ } catch (_) {
+ return creation._complete(
+ 'Could not prepare the project folder. Choose Local to select an existing folder.',
+ );
+ }
+ // Preparation may be slow. Revalidate before starting a process, using
+ // the original machine and split rather than the current selection.
+ final placementError = _creationPlacementError(targetId, split);
+ if (placementError != null) return creation._complete(placementError);
+ if (_disposed ||
+ machineStates[machineId] != machine ||
+ !machine.isLocalMachine) {
+ return creation._complete(
+ 'The selected machine changed. Choose the machine again.',
+ );
+ }
+ launchChoices = Map.of(choices)
+ ..remove('projectSource')
+ ..remove('repositoryUrl')
+ ..['cwd'] = creation._preparedFolder;
+ }
final operation = creation.awaitingConfirmation
? 'agent_create_status'
: 'agent_create';
final unconfirmed =
- '$machineName has not confirmed the new harness yet. '
+ '$machineName has not confirmed the new agent yet. '
'Check status before creating another.';
Map<String, dynamic> result;
creation._awaitingConfirmation = true;
@@ -3941,7 +3994,7 @@ class AppNotifier extends ChangeNotifier {
} else {
result = await connection.request(
operation,
- payload: {...choices, 'creationId': creation._id},
+ payload: {...launchChoices, 'creationId': creation._id},
timeout: const Duration(seconds: 20),
);
}
@@ -3951,13 +4004,15 @@ class AppNotifier extends ChangeNotifier {
failure.code == 'UNSUPPORTED_ON_REMOTE' ||
failure.code == 'E2EE_REQUIRED') {
return '$machineName cannot check this creation. '
- 'Use Find a harness to look for it before creating another.';
+ 'Use Find an agent to look for it before creating another.';
}
return unconfirmed;
}
// Refusals that happen before a launch are safe to correct. INTERNAL,
// spawn timeouts and connection failures cannot prove nothing started.
const refusedBeforeLaunch = {
+ 'INVALID_PROJECT_SOURCE',
+ 'INVALID_REPOSITORY',
'CWD_NOT_FOUND',
'INVALID_CWD',
'INVALID_ENGINE',
@@ -3970,6 +4025,11 @@ class AppNotifier extends ChangeNotifier {
'UNSUPPORTED',
};
if (refusedBeforeLaunch.contains(failure.code)) {
+ if (failure.code == 'INVALID_CWD' && choices['projectSource'] != null) {
+ return creation._complete(
+ 'Update Harness CLI on $machineName to create or clone project folders. Local can open an existing folder.',
+ );
+ }
return creation._complete(
_creationFailureMessage(failure.code, failure.detail, machineName),
);
@@ -3990,20 +4050,24 @@ class AppNotifier extends ChangeNotifier {
// receipt-aware version. Missing is not proof that nothing started.
// Check status stays read-only, even across upgrades and reconnects.
return '$machineName has no record of this request. '
- 'Use Find a harness to look for it before creating another.';
+ 'Use Find an agent to look for it before creating another.';
case 'pending':
- return '$machineName is still starting your harness. Check again in a moment.';
+ return '$machineName is still starting your agent. Check again in a moment.';
case 'unconfirmed':
- return '$machineName could not confirm whether this harness started. '
- 'Use Open Harness to look for it before creating another.';
+ return '$machineName could not confirm whether this agent started. '
+ 'Use Open Agent to look for it before creating another.';
case 'unavailable':
return creation._complete(
- 'This harness was created but is no longer available. '
+ 'This agent was created but is no longer available. '
'You can create a new one.',
);
case 'failed':
final failure = result['failure'];
if (failure is! Map || failure['code'] is! String) return unconfirmed;
+ if (result['preparedFolder'] case final String folder
+ when folder.isNotEmpty) {
+ creation._preparedFolder = folder;
+ }
return creation._complete(
_creationFailureMessage(
failure['code'] as String,
@@ -4035,8 +4099,8 @@ class AppNotifier extends ChangeNotifier {
notifyListeners();
if (_creationPlacementError(targetId, split) != null) {
_lastError =
- 'The harness was created, but its original tab or layout changed. '
- 'Use Open Harness to find it.';
+ 'The agent was created, but its original tab or layout changed. '
+ 'Use Open Agent to find it.';
_lastErrorRetryable = false;
notifyListeners();
return null;
@@ -4473,7 +4537,7 @@ class AppNotifier extends ChangeNotifier {
existing == null &&
targetPanes.length >= maxPanes) {
_lastError =
- 'This tab holds $maxPanes harnesses. Open another tab to add more.';
+ 'This tab holds $maxPanes agents. Open another tab to add more.';
_lastErrorRetryable = false;
notifyListeners();
return;
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index 571cbe774..360e18185 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -691,7 +691,7 @@ Swarm? _matchingGroupSwarm(AppNotifier app, SwarmDestination destination) {
String _agentCountLabel(Iterable<String?> ids) {
final count = ids.whereType<String>().length;
- return '$count ${count == 1 ? 'harness' : 'harnesses'}';
+ return '$count ${count == 1 ? 'agent' : 'agents'}';
}
String _swarmMachineLabel(AppNotifier app, Iterable<String> machineIds) {
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index 62a520054..8d8998d9c 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -101,7 +101,7 @@ class SwarmSearchController extends ChangeNotifier {
? 'Search commands…'
: history != null
? 'Search history…'
- : 'Find a harness';
+ : 'Find an agent';
bool get canCreate =>
history == null &&
@@ -117,7 +117,7 @@ class SwarmSearchController extends ChangeNotifier {
String get primaryAction => switch (split?.axis) {
PaneResizeAxis.x => 'Split right',
PaneResizeAxis.y => 'Split down',
- null => 'Open Harness',
+ null => 'Open Agent',
};
String actionLabel(SwarmDestination? row) => row?.isCommand == true
@@ -127,7 +127,7 @@ class SwarmSearchController extends ChangeNotifier {
row.agentId == null &&
split == null &&
_missingIds(row).length > 1
- ? 'Open ${_missingIds(row).length} Harnesses'
+ ? 'Open ${_missingIds(row).length} Agents'
: primaryAction
: row == null
? 'Go to'
@@ -137,8 +137,8 @@ class SwarmSearchController extends ChangeNotifier {
split != null && !app.isPaneSplitCurrent(split!)
? 'The layout changed. Split the pane again.'
: selected != null && alreadyHere(selected!)
- ? 'This harness is already open here.'
- : 'No room for another harness.';
+ ? 'This agent is already open here.'
+ : 'No room for another agent.';
void _refresh() {
final next = navigating
@@ -317,7 +317,7 @@ class SwarmSearchController extends ChangeNotifier {
? 'Run command'
: row.closedId != null
? 'Reopen'
- : 'Open Harness';
+ : 'Open Agent';
@override
void dispose() {
diff --git a/desktop/lib/terminal/terminal_session.dart b/desktop/lib/terminal/terminal_session.dart
index 12b7c5618..834a6d052 100644
--- a/desktop/lib/terminal/terminal_session.dart
+++ b/desktop/lib/terminal/terminal_session.dart
@@ -1359,7 +1359,7 @@ class TerminalSession extends ChangeNotifier {
}
void transportLost([
- String message = 'Connection lost. Select the harness to reconnect.',
+ String message = 'Connection lost. Select the agent to reconnect.',
]) {
// `takenOver` is a deliberate dead end (see `_paneNeedsAttach`): only the user's own retry
// may reopen a stream someone else claimed. A WS hiccup must not quietly overwrite that into
diff --git a/desktop/lib/widgets/agent_switcher.dart b/desktop/lib/widgets/agent_switcher.dart
index 4a28322be..aaa4ba8a5 100644
--- a/desktop/lib/widgets/agent_switcher.dart
+++ b/desktop/lib/widgets/agent_switcher.dart
@@ -252,7 +252,7 @@ class _AgentSwitcherState extends State<_AgentSwitcher> {
decoration: InputDecoration(
border: InputBorder.none,
isDense: true,
- hintText: 'Find a harness',
+ hintText: 'Find an agent',
hintStyle: TextStyle(
fontSize: 17,
color: grid.AppPalette.textFaint,
@@ -270,7 +270,7 @@ class _AgentSwitcherState extends State<_AgentSwitcher> {
Padding(
padding: const EdgeInsets.fromLTRB(16, 18, 16, 20),
child: Text(
- 'No harness matches that.',
+ 'No agent matches that.',
style: TextStyle(
fontSize: 13,
color: grid.AppPalette.textFaint,
diff --git a/desktop/lib/widgets/delete_agent_dialog.dart b/desktop/lib/widgets/delete_agent_dialog.dart
index ee6aa4b1e..bfbe49384 100644
--- a/desktop/lib/widgets/delete_agent_dialog.dart
+++ b/desktop/lib/widgets/delete_agent_dialog.dart
@@ -4,7 +4,7 @@ import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
-/// Shared Stop Harness confirmation. The legacy agent_delete request stops the
+/// Shared Stop Agent confirmation. The legacy agent_delete request stops the
/// engine and removes its active entry, preserving files and saved history.
Future<void> confirmDeleteAgent(
BuildContext context,
@@ -16,12 +16,12 @@ Future<void> confirmDeleteAgent(
final confirmed = await showAppDialog<bool>(
context: context,
builder: (dialogContext) => AlertDialog(
- title: const Text('Stop Harness'),
+ title: const Text('Stop Agent'),
content: SizedBox(
width: 360,
child: Text(
'Stop “$name”? This ends the running agent and removes it from your '
- 'active harnesses. Project files and saved conversation history are kept.',
+ 'active agents. Project files and saved conversation history are kept.',
style: TextStyle(fontFamily: grid.AppFont.sans, fontSize: 13.5),
),
),
@@ -35,7 +35,7 @@ Future<void> confirmDeleteAgent(
backgroundColor: grid.AppPalette.dangerFill,
),
onPressed: () => Navigator.of(dialogContext).pop(true),
- child: const Text('Stop Harness'),
+ child: const Text('Stop Agent'),
),
],
),
diff --git a/desktop/lib/widgets/environment_setup_screen.dart b/desktop/lib/widgets/environment_setup_screen.dart
index c599f41cd..57fd590e8 100644
--- a/desktop/lib/widgets/environment_setup_screen.dart
+++ b/desktop/lib/widgets/environment_setup_screen.dart
@@ -162,7 +162,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
_heading(
'Getting started',
'Checking this computer',
- 'Checking the tools Harness needs to run your harnesses.',
+ 'Checking the tools Harness needs to run your agents.',
),
_checkList(state, checking: true),
],
@@ -183,8 +183,8 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
count == 0
? 'Your tools are ready. Verify them to continue.'
: count == 1
- ? 'Install this tool, then sign in to start your first harness.'
- : 'Install these $countLabel, then sign in to start your first harness.',
+ ? 'Install this tool, then sign in to start your first agent.'
+ : 'Install these $countLabel, then sign in to start your first agent.',
),
Row(
children: [
@@ -608,7 +608,7 @@ class _EnvironmentSetupScreenState extends State<EnvironmentSetupScreen> {
],
);
final next = Text(
- 'Next: sign in and start a harness.',
+ 'Next: sign in and start an agent.',
style: TextStyle(color: AppColors.textSoft, fontSize: 11),
);
return Container(
diff --git a/desktop/lib/widgets/harness_entry_actions.dart b/desktop/lib/widgets/harness_entry_actions.dart
index 2198825d5..9af101c8e 100644
--- a/desktop/lib/widgets/harness_entry_actions.dart
+++ b/desktop/lib/widgets/harness_entry_actions.dart
@@ -6,7 +6,7 @@ import '../shared/theme/app_theme.dart' as grid;
import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
-/// The same search-or-create choice on New Tab and in the Add Harness picker.
+/// The same search-or-create choice on New Tab and in the Add Agent picker.
class HarnessEntryActions extends StatelessWidget {
const HarnessEntryActions({
super.key,
@@ -70,7 +70,7 @@ class HarnessEntryActions extends StatelessWidget {
side: const BorderSide(color: Colors.white24),
shape: const StadiumBorder(),
),
- child: const Text('Open Harness'),
+ child: const Text('Open Agent'),
),
),
_keyboardAction(
@@ -80,7 +80,7 @@ class HarnessEntryActions extends StatelessWidget {
key: newKey,
onPressed: onNew,
icon: const Icon(LucideIcons.plus300, size: 18),
- label: const Text('New Harness'),
+ label: const Text('New Agent'),
style: FilledButton.styleFrom(
enabledMouseCursor: SystemMouseCursors.click,
minimumSize: size,
diff --git a/desktop/lib/widgets/harness_join_guide_screen.dart b/desktop/lib/widgets/harness_join_guide_screen.dart
index ebc29fbc4..8ea660241 100644
--- a/desktop/lib/widgets/harness_join_guide_screen.dart
+++ b/desktop/lib/widgets/harness_join_guide_screen.dart
@@ -77,8 +77,8 @@ class _HarnessJoinGuideScreenState extends State<HarnessJoinGuideScreen> {
const SizedBox(height: 14),
Text(
isLocal
- ? 'The Harness daemon on this machine isn\'t running. Start it — it reuses the SSO session already saved here. The selected harness will attach automatically when it comes online.'
- : 'The Harness CLI on ${widget.machineState.machine.displayName} appears to be offline. Start it there, then this harness will attach automatically when it comes back online.',
+ ? 'The Harness daemon on this machine isn\'t running. Start it — it reuses the SSO session already saved here. The selected agent will attach automatically when it comes online.'
+ : 'The Harness CLI on ${widget.machineState.machine.displayName} appears to be offline. Start it there, then this agent will attach automatically when it comes back online.',
style: TextStyle(color: AppColors.textSoft, height: 1.45),
),
const SizedBox(height: 18),
diff --git a/desktop/lib/widgets/harness_start_page.dart b/desktop/lib/widgets/harness_start_page.dart
index 9d4b3ffa3..1eb234bf1 100644
--- a/desktop/lib/widgets/harness_start_page.dart
+++ b/desktop/lib/widgets/harness_start_page.dart
@@ -8,7 +8,7 @@ import 'harness_entry_actions.dart';
import 'swarm_search_input.dart';
import 'swarm_switcher.dart';
-/// The Open Harness input, results and navigation, revealed on the start page
+/// The Open Agent input, results and navigation, revealed on the start page
/// only when the user chooses to search.
class HarnessStartPage extends StatefulWidget {
const HarnessStartPage({
@@ -101,7 +101,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
mainAxisSize: MainAxisSize.min,
children: [
Semantics(
- label: 'Find a harness',
+ label: 'Find an agent',
child: SwarmSearchInput(
inputKey: const ValueKey('harness-start-search'),
controller: _query,
@@ -114,7 +114,7 @@ class _HarnessStartPageState extends State<HarnessStartPage> {
groupId: _searchGroup,
autofocus: true,
showClose: _showResults,
- hintText: 'Find a harness',
+ hintText: 'Find an agent',
rounded: true,
prominent: true,
),
diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dart
index dcb5b783b..3e2bbd770 100644
--- a/desktop/lib/widgets/link_machine_screen.dart
+++ b/desktop/lib/widgets/link_machine_screen.dart
@@ -216,7 +216,7 @@ class _LinkMachineScreenState extends State<LinkMachineScreen> {
),
const SizedBox(height: 8),
Text(
- 'Your previous harness will reconnect automatically after linking.',
+ 'Your previous agent will reconnect automatically after linking.',
style: TextStyle(
fontFamily: AppFonts.sans,
fontSize: 11.2,
diff --git a/desktop/lib/widgets/machine_rail.dart b/desktop/lib/widgets/machine_rail.dart
index f83531d82..ce293f39b 100644
--- a/desktop/lib/widgets/machine_rail.dart
+++ b/desktop/lib/widgets/machine_rail.dart
@@ -400,7 +400,7 @@ class _CaptionActions extends StatelessWidget {
AppIconButton(
icon: LucideIcons.plus300,
size: 16,
- tooltip: 'Create Harness here…',
+ tooltip: 'Create Agent here…',
onPressed: onNewAgent,
),
],
@@ -410,7 +410,7 @@ class _CaptionActions extends StatelessWidget {
class _MachineNode extends StatefulWidget {
/// Whether the guide line arrives from a row above. False on the first
- /// machine, where a line dangling up towards the Create Harness button would point
+ /// machine, where a line dangling up towards the Create Agent button would point
/// at nothing.
final bool isFirst;
@@ -450,7 +450,7 @@ class _MachineNodeState extends State<_MachineNode> {
content: SizedBox(
width: 360,
child: Text(
- 'Delete "${machine.displayName}"? All its harnesses will be disconnected and '
+ 'Delete "${machine.displayName}"? All its agents will be disconnected and '
"it'll need to be linked again. This can't be undone.",
style: TextStyle(fontFamily: grid.AppFont.sans, fontSize: 13.5),
),
@@ -685,7 +685,7 @@ class _MachineNodeState extends State<_MachineNode> {
),
),
// Both of this machine's actions, on this machine's own
- // row. The `+` is what the rail's big Create Harness button
+ // row. The `+` is what the rail's big Create Agent button
// used to be: that button had to guess which machine you
// meant, and this one cannot be wrong about it.
_CaptionActions(
@@ -707,7 +707,7 @@ class _MachineNodeState extends State<_MachineNode> {
// it. A per-machine action belongs with the machine's other ones.
AppMenuItem(
icon: LucideIcons.refreshCw300,
- label: 'Reload harnesses',
+ label: 'Reload agents',
onPressed: () {
_machineMenu.close();
notifier.reloadMachineData(machine.machineId);
@@ -812,7 +812,7 @@ class _AgentTree extends StatelessWidget {
return _AgentStatusRow(
icon: Icons.sync,
label: state.connectionStatus == ConnectionStatus.connected
- ? 'preparing harness list…'
+ ? 'preparing agent list…'
: 'connecting…',
);
case AgentLoadStatus.needsLink:
@@ -1203,7 +1203,7 @@ class _AgentRowState extends State<_AgentRow> {
const AppMenuDivider(),
AppMenuItem(
icon: LucideIcons.refreshCw300,
- label: 'Restart Harness',
+ label: 'Restart Agent',
onPressed: () {
_agentMenu.close();
_restartAgent();
@@ -1212,7 +1212,7 @@ class _AgentRowState extends State<_AgentRow> {
const AppMenuDivider(),
AppMenuItem(
icon: Icons.stop_rounded,
- label: 'Stop Harness',
+ label: 'Stop Agent',
danger: true,
onPressed: () {
_agentMenu.close();
@@ -1385,7 +1385,7 @@ class _AgentRowsSkeleton extends StatelessWidget {
Widget build(BuildContext context) => SkeletonList(
rows: _rows,
fadeDepth: skeletonFadeLight,
- semanticsLabel: 'Loading harnesses',
+ semanticsLabel: 'Loading agents',
itemBuilder: (context, i) => SidebarTimeline(
role: SidebarTimelineRole.branch,
below: i < _rows - 1,
@@ -1570,7 +1570,7 @@ class _AgentLoadError extends StatelessWidget {
const SizedBox(width: 7),
Expanded(
child: Text(
- state.agentsLoadError ?? 'Could not load harnesses',
+ state.agentsLoadError ?? 'Could not load agents',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@@ -1583,7 +1583,7 @@ class _AgentLoadError extends StatelessWidget {
IconButton(
icon: const Icon(Icons.refresh, size: 14),
color: grid.AppPalette.textSecondary,
- tooltip: 'Retry harnesses',
+ tooltip: 'Retry agents',
onPressed: () =>
notifier.reloadMachineData(state.machine.machineId),
),
@@ -1593,7 +1593,7 @@ class _AgentLoadError extends StatelessWidget {
}
}
-/// "Create Harness…", drawn as the row it would create.
+/// "Create Agent…", drawn as the row it would create.
///
/// The rail is a LIST, and every framed control put in it has read as a foreign object — there is
/// nothing else in this column with a border or a fill of its own. So this is not a button placed in a
@@ -1634,11 +1634,11 @@ class _NewAgentRow extends StatelessWidget {
// one. A different indent here would bend the trunk at the last branch.
padding: const EdgeInsets.only(left: 28),
child: SidebarItem(
- label: 'Create Harness…',
+ label: 'Create Agent…',
// Dimmed rather than a colour of its own: this row is a placeholder until it is reached for, and
// the hover state SidebarItem already owns is what says it is live.
dimmed: true,
- tooltip: 'Start a harness on this machine',
+ tooltip: 'Start an agent on this machine',
onTap: () =>
showNewAgentDialog(context, notifier, machineId, source: source),
// The agent row's well, in dashes. Same 24px box and same 7px radius, so the column of marks
@@ -1689,7 +1689,7 @@ class _LinkMachineRow extends StatelessWidget {
label: 'Link this machine…',
dimmed: true,
tooltip:
- 'Link ${state.machine.displayName} so its harnesses show up here',
+ 'Link ${state.machine.displayName} so its agents show up here',
onTap: () => notifier.selectMachineForSetup(state.machine.machineId),
leading: CustomPaint(
painter: _DashedWellPainter(color: grid.AppPalette.textFaint),
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index a38f5c7b2..093e591cf 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -8,6 +8,8 @@ import '../analytics/analytics.dart';
import '../state/pane_arrangement.dart';
import '../core/engine_availability.dart';
import '../core/codex_profiles.dart';
+import '../core/project_folder.dart';
+import '../core/repository_clone.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_checkbox.dart';
import '../shared/widgets/app_choice_picker.dart';
@@ -17,7 +19,6 @@ import '../shared/widgets/labeled_field.dart';
import '../state/app_state.dart';
import 'engine_identity.dart';
import 'codex_profile_field.dart';
-import 'clone_repository_dialog.dart';
import 'agent_picker.dart';
import 'remote_folder_picker.dart';
@@ -34,7 +35,9 @@ const Map<String, String> kEngineBypassPermissionFlag = {
enum NewAgentDialogResult { created, findExisting, backToSearch }
-/// Opens the Create Harness dialog for [machineId].
+enum _FolderSource { newProject, local, remote }
+
+/// Opens the Create Agent dialog for [machineId].
///
/// [source] names the door it was opened by — `machine_row`, `rail_empty`,
/// `pane_empty` or `shortcut` — and is required rather than defaulted, so a
@@ -104,6 +107,10 @@ class _NewAgentDialog extends StatefulWidget {
class _NewAgentDialogState extends State<_NewAgentDialog> {
final _folderFocus = FocusNode(debugLabel: 'Working folder');
final _actionFocus = FocusNode(debugLabel: 'Create or check agent');
+ final _repositoryFocus = FocusNode(debugLabel: 'Repository URL');
+ final _repository = TextEditingController();
+ _FolderSource _folderSource = _FolderSource.local;
+ String? _preparedFolder;
AgentCreationAttempt? _creation;
bool _checkingCreation = false;
bool get _confirmationPending => _creation?.awaitingConfirmation == true;
@@ -127,6 +134,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
void dispose() {
_folderFocus.dispose();
_actionFocus.dispose();
+ _repositoryFocus.dispose();
+ _repository.dispose();
super.dispose();
}
@@ -328,7 +337,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_codexProfilesBusy;
/// [Machine.displayName], not `name` — the latter is nullable and a machine
- /// that never got one would title the dialog "Create Harness on null".
+ /// that never got one would title the dialog "Create Agent on null".
String get _machineName =>
widget.notifier.stateOf(_machineId)?.machine.displayName ??
'this machine';
@@ -413,8 +422,11 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
}
Future<void> _submit() async {
- final folder = _folder;
- if (folder == null ||
+ final project = _preparedFolder == null ? _projectFolder : null;
+ final folder =
+ _preparedFolder ??
+ (_folderSource == _FolderSource.local ? _folder : null);
+ if ((folder == null && project == null) ||
_submitting ||
(!_confirmationPending && _waitingForCodexProfile)) {
return;
@@ -432,7 +444,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
final error = await widget.notifier.createAgent(
_machineId,
engine: engine,
- folder: folder,
+ folder: folder ?? '',
+ projectFolder: project,
swarmId: widget.swarmId,
split: widget.split,
bypassPermission: bypassPermission,
@@ -444,6 +457,9 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
if (!mounted) return;
if (error != null) {
setState(() {
+ if (!_confirmationPending) {
+ _preparedFolder = _creation?.preparedFolder;
+ }
_submitting = false;
_error = error;
});
@@ -456,20 +472,31 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
Navigator.of(context).pop(NewAgentDialogResult.created);
}
- Future<void> _cloneRepository() async {
- if (_picking || _choicesLocked || !_machineIsThisComputer) return;
- final revision = _machineRevision;
- setState(() => _picking = true);
- final folder = await showCloneRepositoryDialog(
- context,
- initialFolder: _folder,
- );
- if (!mounted) return;
+ ProjectFolderRequest? get _projectFolder => switch (_folderSource) {
+ _FolderSource.newProject => const ProjectFolderRequest.newProject(),
+ _FolderSource.local => null,
+ _FolderSource.remote => switch (GitHubRepository.parse(_repository.text)) {
+ final repository? => ProjectFolderRequest.remote(repository),
+ null => null,
+ },
+ };
+
+ void _selectFolderSource(_FolderSource source) {
+ if (_folderSource == source || _choicesLocked || _picking) return;
setState(() {
- _picking = false;
- if (folder != null && !_choicesLocked && revision == _machineRevision) {
- _folder = folder;
- _error = null;
+ _folderSource = source;
+ _preparedFolder = null;
+ _error = null;
+ });
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted) return;
+ switch (source) {
+ case _FolderSource.local:
+ _folderFocus.requestFocus();
+ case _FolderSource.remote:
+ _repositoryFocus.requestFocus();
+ case _FolderSource.newProject:
+ if (!_waitingForCodexProfile) _actionFocus.requestFocus();
}
});
}
@@ -494,16 +521,19 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
Widget _buildDialog(BuildContext context) {
final bypassFlag = kEngineBypassPermissionFlag[_engine];
final canCreate =
- _folder != null &&
+ (_preparedFolder != null ||
+ (_folderSource == _FolderSource.local
+ ? _folder != null
+ : _projectFolder != null)) &&
!_picking &&
!_submitting &&
(_confirmationPending || !_waitingForCodexProfile);
return AlertDialog(
title: Text(switch (widget.split?.axis) {
- PaneResizeAxis.x => 'New Harness to the right',
- PaneResizeAxis.y => 'New Harness below',
- null => 'New Harness',
+ PaneResizeAxis.x => 'New Agent to the right',
+ PaneResizeAxis.y => 'New Agent below',
+ null => 'New Agent',
}),
titleTextStyle: Theme.of(context).textTheme.titleMedium,
content: SizedBox(
@@ -513,20 +543,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- // ONE COLUMN, and no summary card beside it.
- //
- // The card held three facts and every one of them was already on
- // screen: the folder a field above it, the machine in the title,
- // and the command a restatement of the engine that had just been
- // picked. Only the bypass FLAG was its own — and that has moved to
- // the Advanced row, which is the one thing still reporting what is
- // folded away.
- //
- // Dropping it takes the dialog from 712px to 520. The old width
- // was not chosen for the content: it was measured against
- // `--dangerously-bypass-approvals-and-sandbox`, so the rarest
- // thing on the screen was setting the size of the window for
- // everybody who never turns it on.
AbsorbPointer(
absorbing: _choicesLocked,
child: ExcludeFocus(
@@ -577,13 +593,14 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
Navigator.of(context)
.pop(NewAgentDialogResult.findExisting),
icon: const Icon(LucideIcons.search, size: 16),
- label: const Text('Find a harness'),
+ label: const Text('Find an agent'),
),
FilledButton(
key: const ValueKey('create-agent-submit'),
focusNode: _actionFocus,
onPressed: canCreate ? _submit : null,
style: FilledButton.styleFrom(
+ shape: const StadiumBorder(),
disabledForegroundColor: _submitting
? grid.AppPalette.textPrimary
: null,
@@ -603,12 +620,15 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
Text(
_checkingCreation
? 'Checking status…'
- : 'Creating harness…',
+ : _folderSource == _FolderSource.remote &&
+ _preparedFolder == null
+ ? 'Cloning and starting…'
+ : 'Creating agent…',
),
],
),
)
- : Text(_confirmationPending ? 'Check status' : 'New Harness'),
+ : Text(_confirmationPending ? 'Check status' : 'New Agent'),
),
],
);
@@ -632,6 +652,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
moreLabel: 'More machines',
optionKey: (id) => ValueKey('new-agent-machine-$id'),
showDetails: true,
+ wrap: false,
preferredValues: [
for (final machine in widget.notifier.machineStates.values)
if (machine.isLocalMachine) machine.machine.machineId,
@@ -656,6 +677,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_machineRevision++;
_machineId = id;
_folder = null;
+ _preparedFolder = null;
_codexProfile = null;
_codexProfilesBusy = true;
_error = null;
@@ -665,34 +687,71 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
),
const SizedBox(height: _gapField),
],
- Row(
- children: [
- const Expanded(child: FieldLabel('Working folder')),
- if (_machineIsThisComputer)
- TextButton(
- onPressed: _picking ? null : _cloneRepository,
- style: TextButton.styleFrom(
- foregroundColor: grid.AppPalette.textSecondary,
- padding: const EdgeInsets.only(bottom: 6),
- minimumSize: Size.zero,
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- child: const Text('Clone repository'),
- ),
+ const FieldLabel('Working folder'),
+ AppChoicePicker<_FolderSource>(
+ value: _folderSource,
+ moreLabel: 'Folder sources',
+ optionKey: (source) => ValueKey('new-agent-folder-${source.name}'),
+ options: [
+ SelectOption(
+ value: _FolderSource.newProject,
+ label: 'New',
+ leading: () => const Icon(LucideIcons.folderPlus, size: 18),
+ ),
+ SelectOption(
+ value: _FolderSource.local,
+ label: 'Local',
+ leading: () => const Icon(LucideIcons.folderOpen, size: 18),
+ ),
+ SelectOption(
+ value: _FolderSource.remote,
+ label: 'Remote',
+ leading: () => const Icon(LucideIcons.gitBranch, size: 18),
+ ),
],
+ onChanged: _selectFolderSource,
),
- _FolderControl(
- folder: _folder,
- machineName: _machineName,
- machineIsThisComputer: _machineIsThisComputer,
- picking: _picking,
- focusNode: _folderFocus,
- hovered: _folderHovered,
- focused: _folderFocused,
- onHover: (value) => setState(() => _folderHovered = value),
- onFocusChange: (value) => setState(() => _folderFocused = value),
- onPressed: _browse,
- ),
+ const SizedBox(height: 10),
+ if (_folderSource == _FolderSource.local)
+ _FolderControl(
+ folder: _folder,
+ machineName: _machineName,
+ machineIsThisComputer: _machineIsThisComputer,
+ picking: _picking,
+ focusNode: _folderFocus,
+ hovered: _folderHovered,
+ focused: _folderFocused,
+ onHover: (value) => setState(() => _folderHovered = value),
+ onFocusChange: (value) => setState(() => _folderFocused = value),
+ onPressed: _browse,
+ ),
+ if (_folderSource == _FolderSource.newProject)
+ Text(
+ 'Start in a new folder in ~/Harness Projects on $_machineName.',
+ style: Theme.of(context).textTheme.bodySmall
+ ?.copyWith(color: grid.AppPalette.textSecondary),
+ ),
+ if (_folderSource == _FolderSource.remote) ...[
+ TextField(
+ key: const ValueKey('new-agent-repository'),
+ controller: _repository,
+ focusNode: _repositoryFocus,
+ decoration: const InputDecoration(
+ hintText: 'GitHub URL or owner/repository',
+ ),
+ onChanged: (_) => setState(() {
+ _preparedFolder = null;
+ _error = null;
+ }),
+ onSubmitted: (_) => _submit(),
+ ),
+ const SizedBox(height: 6),
+ Text(
+ 'Clone into ~/Harness Projects on $_machineName.',
+ style: Theme.of(context).textTheme.bodySmall
+ ?.copyWith(color: grid.AppPalette.textSecondary),
+ ),
+ ],
const SizedBox(height: _gapField),
const FieldLabel('Agent'),
AgentPicker(
@@ -746,7 +805,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_willInstall
? 'Harness will install ${engineIdentity(_engine).label} before starting.'
: 'Couldn’t check whether ${engineIdentity(_engine).label} is installed. '
- 'You can still try creating a harness.',
+ 'You can still try creating an agent.',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: _willInstall
? grid.AppPalette.accentOnSurface
@@ -849,24 +908,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
}
}
-/// Wide enough for two columns that both hold a path without wrapping every
-/// line; the summary takes [_summaryWidth] and the choices take the rest.
-///
-/// The summary is the wider of the two, and deliberately: the choices column
-/// holds controls that ellipsize cleanly, while the summary holds three strings
-/// that must be read whole — a flag as long as
-/// `--dangerously-bypass-approvals-and-sandbox`, a hostname, and a path. At an
-/// even split the longest flag broke across two lines mid-word.
-///
-/// ⚠️ THAT REASONING IS GONE WITH THE SUMMARY, and it is worth keeping the
-/// record of it: 712 was 360 for the controls plus 352 for a card, and the 352
-/// was measured against `--dangerously-bypass-approvals-and-sandbox` — 42
-/// characters of a flag most people never turn on. The width of the dialog was
-/// being set by the rarest thing that could appear in it.
-///
-/// 520 is what two fields and a fold need. A path still ellipsizes from its
-/// HEAD (see `_ellipsizeHead`), which is what keeps the leaf readable.
-const double _dialogWidth = 520;
+/// Room for three readable machine choices and the overflow control in one row.
+const double _dialogWidth = 760;
/// A path shortened from its HEAD, so the leaf survives.
///
@@ -1198,7 +1241,7 @@ class _FolderControl extends StatelessWidget {
if (!machineIsThisComputer) ...[
const SizedBox(height: _gapTight),
Text(
- 'This harness will run on $machineName. Its folders are browsed '
+ 'This agent will run on $machineName. Its folders are browsed '
'through the remote CLI.',
style: theme.textTheme.bodySmall,
),
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 2cfaa92a3..936028161 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -1298,7 +1298,7 @@ class _PaneContent extends StatelessWidget {
icon: Icons.terminal,
detail:
agent?.terminalUnavailableReason ??
- 'This harness is unavailable on ${machine.machine.displayName}. Retained output is read only.',
+ 'This agent is unavailable on ${machine.machine.displayName}. Retained output is read only.',
);
} else if (agent.launchState == 'failed') {
notice = (
@@ -1399,7 +1399,7 @@ class _PaneContent extends StatelessWidget {
full: HarnessJoinGuideScreen(
notifier: notifier,
machineState: machine,
- agentName: agentName ?? 'selected harness',
+ agentName: agentName ?? 'selected agent',
),
);
}
@@ -1407,7 +1407,7 @@ class _PaneContent extends StatelessWidget {
return _PaneStatus(
title: machine.machine.displayName,
icon: Icons.check_circle_outline,
- message: 'This machine is ready. Drag a harness here to open it.',
+ message: 'This machine is ready. Drag an agent here to open it.',
onClose: close,
);
}
@@ -1415,7 +1415,7 @@ class _PaneContent extends StatelessWidget {
return _PaneStatus(
title: wantedAgentId,
icon: Icons.help_outline,
- message: 'This harness is no longer on ${machine.machine.displayName}.',
+ message: 'This agent is no longer on ${machine.machine.displayName}.',
onClose: close,
);
}
@@ -1425,7 +1425,7 @@ class _PaneContent extends StatelessWidget {
icon: Icons.terminal,
message:
agent.terminalUnavailableReason ??
- 'This harness has no available terminal.',
+ 'This agent has no available terminal.',
onClose: close,
);
}
@@ -1953,8 +1953,8 @@ class _DropZone extends StatelessWidget {
),
child: Text(
paneId == null
- ? 'Open ${candidate.first?.name ?? 'harness'} here'
- : 'Show ${candidate.first?.name ?? 'harness'} in this pane',
+ ? 'Open ${candidate.first?.name ?? 'agent'} here'
+ : 'Show ${candidate.first?.name ?? 'agent'} in this pane',
style: TextStyle(
color: AppColors.text,
fontFamily: AppFonts.sans,
@@ -2054,7 +2054,7 @@ class _EmptyGrid extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
- 'Select a harness, or drag one in from the left.',
+ 'Select an agent, or drag one in from the left.',
style: TextStyle(
color: AppColors.mutedStrong,
fontFamily: AppFonts.sans,
@@ -2069,7 +2069,7 @@ class _EmptyGrid extends StatelessWidget {
FilledButton.icon(
key: const ValueKey('empty-grid-new-agent'),
icon: const Icon(Icons.add, size: 16),
- label: const Text('Create Harness'),
+ label: const Text('Create Agent'),
onPressed: () => showNewAgentDialog(
context,
notifier,
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index e6938a2b1..5edd3033e 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -85,9 +85,9 @@ class PaneHeaderActions extends StatelessWidget {
onZoom,
),
const SizedBox(width: 2),
- action('Restart Harness', LucideIcons.refreshCw, onRestart),
+ action('Restart Agent', LucideIcons.refreshCw, onRestart),
const SizedBox(width: 2),
- action('Stop Harness', Icons.stop_rounded, onDelete),
+ action('Stop Agent', Icons.stop_rounded, onDelete),
const SizedBox(width: 2),
action('Close Pane', LucideIcons.x, onClose),
],
diff --git a/desktop/lib/widgets/rename_agent_dialog.dart b/desktop/lib/widgets/rename_agent_dialog.dart
index 4ac8bb194..15ed9f0fd 100644
--- a/desktop/lib/widgets/rename_agent_dialog.dart
+++ b/desktop/lib/widgets/rename_agent_dialog.dart
@@ -88,7 +88,7 @@ class _RenameAgentDialogState extends State<_RenameAgentDialog> {
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
return AlertDialog(
- title: const Text('Rename Harness'),
+ title: const Text('Rename Agent'),
content: SizedBox(
width: 360,
child: Column(
diff --git a/desktop/lib/widgets/status_rail/key_hints.dart b/desktop/lib/widgets/status_rail/key_hints.dart
index 95aa6c443..efbb46e2d 100644
--- a/desktop/lib/widgets/status_rail/key_hints.dart
+++ b/desktop/lib/widgets/status_rail/key_hints.dart
@@ -69,7 +69,7 @@ class KeyHints extends StatelessWidget {
/// match what it is about to do is worse than no label.
static List<(String, String)> _gridHints(AppNotifier notifier) => [
('⌘hjkl', 'panes'),
- ('⌘O', 'find a harness'),
+ ('⌘N', 'add an agent'),
('⌘⏎', notifier.zoomedPaneId != null ? 'unzoom' : 'zoom'),
('⌘;', 'last'),
('⌘N', 'new'),
diff --git a/desktop/lib/widgets/swarm_attention.dart b/desktop/lib/widgets/swarm_attention.dart
index 60a4ce15b..3ed25af76 100644
--- a/desktop/lib/widgets/swarm_attention.dart
+++ b/desktop/lib/widgets/swarm_attention.dart
@@ -147,7 +147,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
const SizedBox(height: 8),
SwarmSearchField(
autofocus: true,
- hintText: 'Find a question, harness, or project',
+ hintText: 'Find a question, agent, or project',
onChanged: (value) => setState(() {
_query = value;
_cursor = 0;
@@ -163,7 +163,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
? Center(
child: Text(
_catalog.isEmpty
- ? 'No harnesses need your input'
+ ? 'No agents need your input'
: 'No matching questions',
style: const TextStyle(
fontSize: 13,
@@ -237,7 +237,7 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
? 'Unavailable'
: destination.hasView
? 'Jump'
- : 'Open Harness',
+ : 'Open Agent',
style: const TextStyle(
fontSize: 11,
color: Colors.white54,
@@ -255,9 +255,9 @@ class _SwarmAttentionState extends State<_SwarmAttention> {
alignment: Alignment.centerLeft,
child: Text(
selected != null && !selected.available
- ? 'This harness’s terminal is unavailable · Esc to close'
+ ? 'This agent’s terminal is unavailable · Esc to close'
: selected != null && !selected.destination.hasView
- ? '↵ Open Harness in $_targetName · Esc to close'
+ ? '↵ Open Agent in $_targetName · Esc to close'
: '↑↓ or ⌃N ⌃P to choose · Return to jump · Esc to close',
maxLines: 1,
overflow: TextOverflow.ellipsis,
diff --git a/desktop/lib/widgets/swarm_project_agents.dart b/desktop/lib/widgets/swarm_project_agents.dart
index a10258beb..cefbe5a8e 100644
--- a/desktop/lib/widgets/swarm_project_agents.dart
+++ b/desktop/lib/widgets/swarm_project_agents.dart
@@ -67,13 +67,13 @@ class _ProjectAgentsState extends State<_ProjectAgents> {
),
const SizedBox(height: 8),
const Text(
- 'Include harnesses from any machine. Matching repositories are included automatically.',
+ 'Include agents from any machine. Matching repositories are included automatically.',
style: TextStyle(fontSize: 12),
),
const SizedBox(height: 16),
SwarmSearchField(
autofocus: true,
- hintText: 'Find a harness or machine',
+ hintText: 'Find an agent or machine',
onChanged: (value) => setState(() => _query = value),
),
const SizedBox(height: 12),
@@ -83,7 +83,7 @@ class _ProjectAgentsState extends State<_ProjectAgents> {
builder: (context, _) {
final rows = swarmAgents(widget.app, _query);
if (rows.isEmpty) {
- return const Center(child: Text('No matching harnesses'));
+ return const Center(child: Text('No matching agents'));
}
return ListView.builder(
itemCount: rows.length,
diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dart
index 5caf97cd3..ab1af0f8e 100644
--- a/desktop/lib/widgets/swarm_search_field.dart
+++ b/desktop/lib/widgets/swarm_search_field.dart
@@ -8,7 +8,7 @@ class SwarmSearchField extends StatefulWidget {
this.onSubmitted,
this.onMove,
this.autofocus = false,
- this.hintText = 'Find a harness',
+ this.hintText = 'Find an agent',
this.controller,
this.focusNode,
});
@@ -27,7 +27,7 @@ class _SwarmSearchFieldState extends State<SwarmSearchField> {
FocusNode? _ownedFocus;
FocusNode get _focus =>
widget.focusNode ??
- (_ownedFocus ??= FocusNode(debugLabel: 'Find harness'));
+ (_ownedFocus ??= FocusNode(debugLabel: 'Find agent'));
@override
void initState() {
diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dart
index 64c5c7f5d..5f81ee920 100644
--- a/desktop/lib/widgets/swarm_search_input.dart
+++ b/desktop/lib/widgets/swarm_search_input.dart
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../state/swarm_search.dart';
-/// The shared input for the start page, Open Harness and split searches.
+/// The shared input for the start page, Open Agent and split searches.
/// Flutter owns the caret and result navigation; native chrome only opens it.
class SwarmSearchInput extends StatelessWidget {
const SwarmSearchInput({
@@ -77,7 +77,7 @@ class SwarmSearchInput extends StatelessWidget {
decoration: InputDecoration(
hintText: search?.isCommandMode == true
? search!.hint
- : hintText ?? search?.hint ?? 'Find a harness',
+ : hintText ?? search?.hint ?? 'Find an agent',
hintStyle: const TextStyle(fontSize: 16, color: Colors.white60),
prefixIcon: const Icon(Icons.search, size: 20, color: Colors.white60),
prefixIconConstraints: BoxConstraints(
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 71ca8c8f6..cc9bde752 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -165,7 +165,7 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
final agents = _agents(app, row);
return Semantics(
container: true,
- label: 'Harness preview',
+ label: 'Agent preview',
child: ColoredBox(
color: Colors.black.withValues(alpha: .10),
child: Scrollbar(
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 104309243..28d1575e1 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -409,9 +409,9 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
search.isCommandMode
? 'No matching commands'
: search.adding && search.query.isEmpty
- ? 'Create a new harness to start fresh.'
+ ? 'Create a new agent to start fresh.'
: search.adding
- ? 'No matching harnesses'
+ ? 'No matching agents'
: 'No matching results',
style: const TextStyle(
fontSize: 14,
@@ -584,8 +584,8 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
: selected!.isGroup &&
selected.members.length >
AppNotifier.maxPanes
- ? 'Open up to ${AppNotifier.maxPanes} harnesses at once'
- : 'No room to open this ${selected.isSwarm || selected.isGroup ? 'group' : 'harness'}',
+ ? 'Open up to ${AppNotifier.maxPanes} agents at once'
+ : 'No room to open this ${selected.isSwarm || selected.isGroup ? 'group' : 'agent'}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index 839298cd9..ca62888f0 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -59,7 +59,7 @@ class TerminalPanel extends StatefulWidget {
final bool visible;
final Size? viewportSize;
- /// A shared terminal can move to another harness without being remounted.
+ /// A shared terminal can move to another agent without being remounted.
final (String, int)? paneLocation;
final (int, int, int?)? layoutRequest;
final bool compactHeader;
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 2e0d32f09..bc8089cd2 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -96,7 +96,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func sendTabAction(_ method: String, arguments: Any?) {
- guard ["select", "close", "new", "rename", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "manageMachines"].contains(method) else {
+ guard ["select", "close", "new", "rename", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines"].contains(method) else {
channel.invokeMethod(method, arguments: arguments)
return
}
@@ -232,7 +232,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
if let file = main.item(withTitle: "File") { main.removeItem(file) }
let file = NSMenu(title: "File")
add(file, "New Tab", "t", "new")
- add(file, "Add Harness…", "n", "addAgent")
+ add(file, "Add Agent…", "n", "addAgent")
add(file, "Rename Tab…", "r", "renameActive", [.command, .shift])
add(file, "Close Tab", "w", "closeActive")
file.addItem(.separator())
@@ -252,7 +252,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
if let view = main.item(withTitle: "View")?.submenu {
view.addItem(.separator())
- add(view, "Harnesses Needing Input…", "i", "notifications", [.command, .shift])
+ add(view, "Agents Needing Input…", "i", "notifications", [.command, .shift])
}
modelsMenu.autoenablesItems = false
modelsMenu.delegate = self
@@ -291,9 +291,32 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
item.target = self
item.representedObject = machine.id
let label = NSMutableAttributedString(string: machine.name)
- label.append(NSAttributedString(string: " " + machine.status, attributes: [.foregroundColor: NSColor.secondaryLabelColor]))
+ let count = machine.agentCount.map { "\($0) \($0 == 1 ? "agent" : "agents")" }
+ let detail = [machine.status, count].compactMap { $0 }.filter { !$0.isEmpty }.joined(separator: " · ")
+ label.append(NSAttributedString(string: " " + detail, attributes: [.foregroundColor: NSColor.secondaryLabelColor]))
item.attributedTitle = label
item.image = NSImage(systemSymbolName: machine.local ? "laptopcomputer" : "desktopcomputer", accessibilityDescription: nil)
+ let submenu = NSMenu(title: machine.name)
+ for agent in machine.agents {
+ let child = NSMenuItem(title: agent.title, action: #selector(machineAgentAction(_:)), keyEquivalent: "")
+ child.target = self
+ child.representedObject = ["machineId": machine.id, "agentId": agent.id]
+ child.image = historyIcons.image(engine: agent.engine, asset: agent.iconAsset)
+ submenu.addItem(child)
+ }
+ if machine.agents.isEmpty {
+ let title = machine.agentCount == 0 ? "No agents yet" :
+ machine.status == "Online" || machine.status == "Connecting…" ? "Loading agents…" : machine.status
+ let empty = NSMenuItem(title: title, action: nil, keyEquivalent: "")
+ empty.isEnabled = false
+ submenu.addItem(empty)
+ }
+ submenu.addItem(.separator())
+ let find = NSMenuItem(title: "Find Agents…", action: #selector(machineAction(_:)), keyEquivalent: "")
+ find.target = self
+ find.representedObject = machine.id
+ submenu.addItem(find)
+ item.submenu = submenu
machinesMenu.addItem(item)
}
if machines.isEmpty {
@@ -414,7 +437,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
historyMenu.addItem(item)
}
if entries.isEmpty {
- let item = NSMenuItem(title: closed ? "No Recently Closed Harnesses" : "No Recent Visits", action: nil, keyEquivalent: "")
+ let item = NSMenuItem(title: closed ? "No Recently Closed Agents" : "No Recent Visits", action: nil, keyEquivalent: "")
item.isEnabled = false
historyMenu.addItem(item)
}
@@ -442,6 +465,11 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
+ if menuItem.action == #selector(machineAgentAction(_:)) {
+ guard actionsEnabled, let target = menuItem.representedObject as? [String: String],
+ let machine = machines.first(where: { $0.id == target["machineId"] }) else { return false }
+ return machine.agents.contains(where: { $0.id == target["agentId"] && $0.canOpen })
+ }
let action = menuItem.representedObject as? String ?? ""
if menuItem.action == #selector(machineAction(_:)) {
return actionsEnabled && machines.contains(where: { $0.id == action })
@@ -468,6 +496,11 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
sendTabAction("machineDestination", arguments: ["id": id])
}
+ @objc private func machineAgentAction(_ sender: NSMenuItem) {
+ guard validateMenuItem(sender), let target = sender.representedObject as? [String: String] else { return }
+ sendTabAction("machineAgent", arguments: target)
+ }
+
@objc private func historyAction(_ sender: NSMenuItem) {
guard validateMenuItem(sender), let id = sender.representedObject as? String else { return }
channel.invokeMethod("historyDestination", arguments: ["id": id])
@@ -489,6 +522,8 @@ private struct SwarmMachineEntry: Equatable {
let name: String
let status: String
let local: Bool
+ let agentCount: Int?
+ let agents: [SwarmMachineAgent]
init?(_ row: [String: Any]) {
guard let id = row["id"] as? String, !id.isEmpty,
let name = row["name"] as? String, !name.isEmpty else { return nil }
@@ -496,6 +531,25 @@ private struct SwarmMachineEntry: Equatable {
self.name = String(name.prefix(128))
status = String((row["status"] as? String ?? "").prefix(80))
local = row["local"] as? Bool == true
+ agentCount = (row["agentCount"] as? Int).map { max(0, $0) }
+ agents = (row["agents"] as? [[String: Any]] ?? []).prefix(512).compactMap(SwarmMachineAgent.init)
+ }
+}
+
+private struct SwarmMachineAgent: Equatable {
+ let id: String
+ let title: String
+ let engine: String?
+ let iconAsset: String?
+ let canOpen: Bool
+ init?(_ row: [String: Any]) {
+ guard let id = row["id"] as? String, !id.isEmpty,
+ let title = row["title"] as? String, !title.isEmpty else { return nil }
+ self.id = id
+ self.title = String(title.prefix(160)).replacingOccurrences(of: "\n", with: " ")
+ engine = row["engine"] as? String
+ iconAsset = row["iconAsset"] as? String
+ canOpen = row["canOpen"] as? Bool == true
}
}
@@ -849,7 +903,7 @@ private final class SwarmTabStrip: NSView {
button.isEnabled = false
addSubview(button)
}
- textButton(openButton, "Add Harness", #selector(openHarness))
+ textButton(openButton, "Add Agent", #selector(openHarness))
updateActionColors()
setAccessibilityChildren([notificationButton, scroll, newButton, openButton])
registerForDraggedTypes([swarmPasteboardType])
@@ -917,7 +971,7 @@ private final class SwarmTabStrip: NSView {
openButton.isEnabled = actionsEnabled
let attention = state["attention"] as? Int ?? 0
notificationButton.hasAttention = attention > 0
- notificationButton.setAccessibilityLabel(attention > 0 ? "\(attention) harnesses need input" : "Notifications")
+ notificationButton.setAccessibilityLabel(attention > 0 ? "\(attention) agents need input" : "Notifications")
needsLayout = true
layoutSubtreeIfNeeded()
if ids != previousOrder {
@@ -1167,7 +1221,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
setAccessibilityLabel(name)
selectButton.setAccessibilityLabel("Select \(name)")
selectButton.setAccessibilityValue(selected ? "Selected" : "")
- selectButton.setAccessibilityHelp(attention ? "Contains harnesses needing input" : nil)
+ selectButton.setAccessibilityHelp(attention ? "Contains agents needing input" : nil)
closeButton.setAccessibilityLabel("Close \(name)")
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { actionsEnabled }
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 6124adc6b..9b28aa276 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -208,16 +208,16 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
}
- expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('harness-picker-new')));
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.byType(SwarmSearchResults), findsNothing);
expect(
find.text(switch (entry) {
- 'Split right' => 'New Harness to the right',
- 'Split down' => 'New Harness below',
- _ => 'New Harness',
+ 'Split right' => 'New Agent to the right',
+ 'Split down' => 'New Agent below',
+ _ => 'New Agent',
}),
findsWidgets,
);
@@ -280,7 +280,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Close'), findsOneWidget);
expect(find.text('Back to Search'), findsNothing);
- expect(find.widgetWithText(TextButton, 'Find a harness'), findsNothing);
+ expect(find.widgetWithText(TextButton, 'Find an agent'), findsNothing);
if (change == 'switch' || change == 'closed') app.newSwarm();
if (change == 'closed') await app.closeSwarm(original.id);
if (change == 'stale split') {
@@ -317,7 +317,7 @@ void main() {
expect(app.activeSwarmId, current);
if (change == 'closed' || change == 'stale split') {
expect(app.allPanes.any((p) => p.agentId == 'created'), isFalse);
- expect(app.lastError, contains('Open Harness'));
+ expect(app.lastError, contains('Open Agent'));
} else {
expect(original.panes.first, same(originalPane));
expect(original.panes.last.agentId, 'created');
@@ -371,7 +371,7 @@ void main() {
await tester.pump();
expect(input.single.bytes, [27, 91, 66]);
await chord(tester, LogicalKeyboardKey.keyN);
- expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
expect(connection.calls, hasLength(1));
await tester.pumpWidget(const SizedBox());
@@ -590,7 +590,7 @@ void main() {
app.stateOf('m')!.agents.any((agent) => agent.id == 'created'),
isTrue,
);
- expect(app.lastError, contains('Open Harness'));
+ expect(app.lastError, contains('Open Agent'));
});
testWidgets(
@@ -629,7 +629,7 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.text('/work'), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'New Harness'), findsNothing);
+ expect(find.widgetWithText(FilledButton, 'New Agent'), findsNothing);
final action = tester.widget<FilledButton>(
find.widgetWithText(FilledButton, 'Check status'),
);
diff --git a/desktop/test/agent_events_test.dart b/desktop/test/agent_events_test.dart
index 99fbe4ee6..ee42067a8 100644
--- a/desktop/test/agent_events_test.dart
+++ b/desktop/test/agent_events_test.dart
@@ -15,6 +15,7 @@ import 'package:harness/auth/auth_session.dart';
import 'package:harness/core/config.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/widgets/new_agent_dialog.dart';
@@ -59,6 +60,7 @@ class FakeCreateAgentNotifier extends AppNotifier {
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
@@ -165,12 +167,12 @@ void main() {
await tester.pumpAndSettle();
// Create stays dead until a folder is chosen. This machine is not
// `thisComputer`, so Browse… opens the in-app remote picker rather than
- // a native panel this harness has no plugin for.
+ // a native panel this agent has no plugin for.
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
await tester.tap(find.widgetWithText(FilledButton, 'Select this folder'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
}
diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dart
index de71525d3..2a083be56 100644
--- a/desktop/test/boot_flow_widget_test.dart
+++ b/desktop/test/boot_flow_widget_test.dart
@@ -502,7 +502,7 @@ void main() {
// The card leads with what the app does for you, not with its own name —
// the wordmark left when the screen stopped being a logo over a button.
- expect(find.text('All your harnesses, on one screen'), findsOneWidget);
+ expect(find.text('All your agents, on one screen'), findsOneWidget);
expect(find.text('Sign in'), findsOneWidget);
expect(find.byIcon(Icons.login), findsOneWidget);
});
@@ -836,7 +836,7 @@ void main() {
),
);
await tester.pumpAndSettle();
- expect(find.text('New Harness'), findsWidgets);
+ expect(find.text('New Agent'), findsWidgets);
expect(
tester
.widget<TextField>(
@@ -944,7 +944,7 @@ void main() {
});
testWidgets(
- 'offline selected harness retains its Swarm view with an offline message',
+ 'offline selected agent retains its Swarm view with an offline message',
(tester) async {
final app = makeNotifier(AppStatus.authenticated);
const machine = Machine(
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 9c0aeac42..071a55ed6 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -11,6 +11,7 @@ import 'package:harness/core/models.dart';
import 'package:harness/shared/widgets/app_choice_picker.dart';
import 'package:harness/shared/widgets/app_select_field.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/state/swarm_catalog.dart';
import 'package:harness/terminal/terminal_binary.dart';
@@ -63,6 +64,7 @@ class _FirstUseApp extends AppNotifier {
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
@@ -392,7 +394,7 @@ void main() {
await tester.tapAt(const Offset(8, 100));
await tester.pump();
expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.text('Creating harness…'), findsOneWidget);
+ expect(find.text('Creating agent…'), findsOneWidget);
expect(app.launches, hasLength(1));
expect(app.panes, isEmpty);
final folder = find.byKey(const Key('new-agent-folder'));
@@ -436,7 +438,7 @@ void main() {
for (final native in [false, true]) {
testWidgets(
- 'New Harness ${native ? 'native menu' : 'header'} defaults to this computer',
+ 'New Agent ${native ? 'native menu' : 'header'} defaults to this computer',
(tester) async {
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
const MethodChannel('harness/swarm_tabs'),
@@ -560,7 +562,7 @@ void main() {
}
testWidgets(
- 'new harness supports immediate keyboard creation',
+ 'new agent supports immediate keyboard creation',
(tester) async {
final app = _FirstUseApp();
app.machineStates['m']!.engines.replace(const [
@@ -674,7 +676,7 @@ void main() {
addTearDown(() => FileSelectorPlatform.instance = oldPicker);
await mount(tester, app);
- expect(find.text('New Harness'), findsWidgets);
+ expect(find.text('New Agent'), findsWidgets);
expect(find.text('Machines'), findsNothing);
expect(find.text('Projects'), findsNothing);
expect(app.launches, isEmpty);
diff --git a/desktop/test/harness_join_guide_widget_test.dart b/desktop/test/harness_join_guide_widget_test.dart
index 88778422d..5e553eddb 100644
--- a/desktop/test/harness_join_guide_widget_test.dart
+++ b/desktop/test/harness_join_guide_widget_test.dart
@@ -35,7 +35,7 @@ void main() {
return state;
}
- testWidgets('renders a harness start command for this computer', (
+ testWidgets('renders an agent start command for this computer', (
tester,
) async {
final notifier = AppNotifier(
@@ -68,7 +68,7 @@ void main() {
notifier.dispose();
});
- testWidgets('renders a harness start command for a remote machine', (
+ testWidgets('renders an agent start command for a remote machine', (
tester,
) async {
final notifier = AppNotifier(
diff --git a/desktop/test/harness_picker_entry_test.dart b/desktop/test/harness_picker_entry_test.dart
index a0b7d96d9..0f7915839 100644
--- a/desktop/test/harness_picker_entry_test.dart
+++ b/desktop/test/harness_picker_entry_test.dart
@@ -35,7 +35,7 @@ void main() {
(const Size(760, 760), 1.0),
(const Size(600, 680), 2.0),
]) {
- testWidgets('compact Add Harness keeps its editor stable at $size, $scale', (
+ testWidgets('Add Agent opens results and preview at $size, $scale', (
tester,
) async {
tester.view.devicePixelRatio = 1;
@@ -69,7 +69,11 @@ void main() {
expect(field, findsNothing);
await chord(tester, LogicalKeyboardKey.keyN);
expect(field, findsOneWidget);
- expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('swarm-search-preview')),
+ findsOneWidget,
+ );
expect(find.byKey(const ValueKey('harness-picker-open')), findsOneWidget);
expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
final before = tester.getRect(field);
@@ -93,16 +97,12 @@ void main() {
});
}
- await capture('compact');
- // Return reveals choices, never opens a result the user has not seen.
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- await tester.pump();
- expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await capture('initial');
expect(app.focusedPane, same(pane));
- expect(tester.getRect(field), before);
- expect(tester.widget<TextField>(field).controller, same(controller));
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');
// Creation remains reachable after a query, including with the keyboard.
@@ -110,7 +110,7 @@ void main() {
tester.element(
find.descendant(
of: find.byKey(const ValueKey('harness-picker-new')),
- matching: find.text('New Harness'),
+ matching: find.text('New Agent'),
),
),
).requestFocus();
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index 5110d5864..9bf183d0e 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -358,7 +358,7 @@ void main() {
for (final inline in [false, true]) {
testWidgets(
- 'configured picker actions and hints stay in ${inline ? 'start-page' : 'Open Harness'} search',
+ 'configured picker actions and hints stay in ${inline ? 'start-page' : 'Open Agent'} search',
(tester) async {
final map = MemoryKeymap()
..apply('''{"bindings":[
diff --git a/desktop/test/link_machine_widget_test.dart b/desktop/test/link_machine_widget_test.dart
index 8bdccd17c..444bbb4d5 100644
--- a/desktop/test/link_machine_widget_test.dart
+++ b/desktop/test/link_machine_widget_test.dart
@@ -94,7 +94,7 @@ void main() {
expect(find.text('Link machine'), findsOneWidget);
expect(
find.text(
- 'Your previous harness will reconnect automatically after linking.',
+ 'Your previous agent will reconnect automatically after linking.',
),
findsOneWidget,
);
diff --git a/desktop/test/login_screen_test.dart b/desktop/test/login_screen_test.dart
index e4a7a00e6..f07d0cce5 100644
--- a/desktop/test/login_screen_test.dart
+++ b/desktop/test/login_screen_test.dart
@@ -78,7 +78,7 @@ void main() {
await tester.pumpWidget(_host(app));
await tester.pump(const Duration(milliseconds: 100));
- expect(find.text('All your harnesses, on one screen'), findsOneWidget);
+ expect(find.text('All your agents, on one screen'), findsOneWidget);
expect(find.text('Sign in'), findsOneWidget);
expect(find.byType(WelcomeWorkspacePreview), findsOneWidget);
// The real mark, from the bundle — `Icons.memory` used to stand here and
@@ -95,7 +95,7 @@ void main() {
// The promise the screen exists to make, in words with no jargon in them.
expect(
find.textContaining(
- 'Start with one harness and add panes as your work grows',
+ 'Start with one agent and add panes as your work grows',
),
findsOneWidget,
);
diff --git a/desktop/test/machine_tree_widget_test.dart b/desktop/test/machine_tree_widget_test.dart
index 04faff68c..eee682d68 100644
--- a/desktop/test/machine_tree_widget_test.dart
+++ b/desktop/test/machine_tree_widget_test.dart
@@ -174,11 +174,11 @@ void main() {
);
await tester.pump();
- expect(find.text('Create Harness…'), findsOneWidget);
+ expect(find.text('Create Agent…'), findsOneWidget);
expect(find.text('no running agents'), findsNothing);
// The old button read "New agent" flat, and it is the ellipsis that promises a dialog rather than an
// agent appearing on the spot.
- expect(find.text('Create Harness'), findsNothing);
+ expect(find.text('Create Agent'), findsNothing);
});
testWidgets('a machine that HAS agents is offered the same row, last', (
@@ -198,9 +198,9 @@ void main() {
await tester.pump();
expect(find.text('backend-api'), findsOneWidget);
- expect(find.text('Create Harness…'), findsOneWidget);
+ expect(find.text('Create Agent…'), findsOneWidget);
// …and LAST, because a row that would create the next agent has to stand where the next agent would.
- final rowY = tester.getTopLeft(find.text('Create Harness…')).dy;
+ final rowY = tester.getTopLeft(find.text('Create Agent…')).dy;
for (final name in ['backend-api', 'future-worker', 'herdr-session']) {
expect(
tester.getTopLeft(find.text(name)).dy,
@@ -942,7 +942,7 @@ void main() {
notifier = notifierWithLoadState(
AgentLoadStatus.error,
- error: 'Could not load harnesses: disconnected',
+ error: 'Could not load agents: disconnected',
);
await tester.pumpWidget(
MaterialApp(
@@ -951,8 +951,8 @@ void main() {
),
),
);
- expect(find.textContaining('Could not load harnesses'), findsOneWidget);
- expect(find.byTooltip('Retry harnesses'), findsOneWidget);
+ expect(find.textContaining('Could not load agents'), findsOneWidget);
+ expect(find.byTooltip('Retry agents'), findsOneWidget);
notifier.dispose();
},
);
diff --git a/desktop/test/machines_menu_test.dart b/desktop/test/machines_menu_test.dart
new file mode 100644
index 000000000..7b91a3774
--- /dev/null
+++ b/desktop/test/machines_menu_test.dart
@@ -0,0 +1,50 @@
+import 'dart:async';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/state/swarm_catalog.dart';
+import 'package:harness/terminal/terminal_binary.dart';
+import 'swarm_state_test.dart' show createApp;
+import 'swarm_screen_test.dart' show terminal;
+
+void main() {
+ testWidgets('machine submenu lists cached agents and opens an exact existing view', (tester) async {
+ const channel = MethodChannel('harness/swarm_tabs');
+ final messenger = tester.binding.defaultBinaryMessenger;
+ final messages = <MethodCall>[];
+ messenger.setMockMethodCallHandler(channel, (call) async { messages.add(call); return true; });
+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));
+ final app = createApp();
+ final input = <TerminalBinaryFrame>[];
+ final original = app.activeSwarmId;
+ final pane = app.adoptSessionForTest(terminal('a0', input));
+ app.newSwarm(name: 'Second');
+ final projects = SwarmProjectStore();
+ await tester.pumpWidget(MaterialApp(home: SwarmScreen(notifier: app, nativeTabs: true, projectStore: projects)));
+ await tester.pump();
+ final snapshot = messages.lastWhere((c) => c.method == 'update').arguments as Map;
+ final machine = (snapshot['machines'] as List).single as Map;
+ expect(machine['agentCount'], 70);
+ final rows = machine['agents'] as List;
+ expect(rows.first['id'], 'a0');
+ expect(rows.first['title'], 'Agent 0');
+ expect(rows.first['canOpen'], isTrue);
+ final reply = Completer<void>();
+ messenger.handlePlatformMessage(channel.name, const StandardMethodCodec().encodeMethodCall(const MethodCall('machineAgent', {'machineId': 'm', 'agentId': 'a0'})), (_) => reply.complete());
+ await tester.pumpAndSettle();
+ await reply.future;
+ expect(app.activeSwarmId, original);
+ expect(app.focusedPane, same(pane));
+ expect(input, isEmpty);
+ final stale = Completer<void>();
+ messenger.handlePlatformMessage(channel.name, const StandardMethodCodec().encodeMethodCall(const MethodCall('machineAgent', {'machineId': 'm', 'agentId': 'removed'})), (_) => stale.complete());
+ await tester.pumpAndSettle();
+ await stale.future;
+ expect(app.focusedPane, same(pane));
+ expect(app.swarms, hasLength(2));
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ projects.dispose();
+ });
+}
diff --git a/desktop/test/new_agent_choices_layout_test.dart b/desktop/test/new_agent_choices_layout_test.dart
index df8ed7404..b1490bebc 100644
--- a/desktop/test/new_agent_choices_layout_test.dart
+++ b/desktop/test/new_agent_choices_layout_test.dart
@@ -18,9 +18,9 @@ import 'support/real_fonts.dart';
class _ChoicesApp extends AppNotifier {
_ChoicesApp() : super(config: AppConfig.dev, authSession: AuthSession()) {
for (final (id, name) in [
- ('local', 'M2'),
- ('office', 'iMac - Office'),
- ('home', 'iMac - Home'),
+ ('local', 'iMac - Office'),
+ ('office', 'M2'),
+ ('home', 'T480 - Omarchy'),
('studio', 'Studio'),
]) {
final machine = Machine(
@@ -30,7 +30,7 @@ class _ChoicesApp extends AppNotifier {
);
machineStates[id] = MachineState(machine)
..localOnly = id == 'local'
- ..nodeOnline = true
+ ..nodeOnline = id != 'home'
..engines.replace(const [
EngineAvailability(
engine: 'codex',
@@ -143,9 +143,8 @@ void main() {
await capture('initial');
for (final label in [
- 'M2',
'iMac - Office',
- 'iMac - Home',
+ if (scale == 1) ...['M2', 'T480 - Omarchy'],
'Codex',
'Claude Code',
'Cursor',
@@ -178,6 +177,17 @@ void main() {
agentTop,
);
}
+ final visibleMachines = ['local', 'office', 'home']
+ .map((id) => find.byKey(ValueKey('new-agent-machine-$id')))
+ .where((finder) => finder.evaluate().isNotEmpty);
+ final top = tester.getTopLeft(visibleMachines.first).dy;
+ for (final choice in visibleMachines) {
+ expect(tester.getTopLeft(choice).dy, top);
+ }
+ expect(
+ tester.getTopLeft(find.byKey(const Key('new-agent-machine-more'))).dy,
+ top,
+ );
await tester.tap(find.byKey(const Key('new-agent-machine-more')));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('Studio'));
diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dart
index afdfaa162..91ac6514c 100644
--- a/desktop/test/new_agent_codex_profile_test.dart
+++ b/desktop/test/new_agent_codex_profile_test.dart
@@ -9,6 +9,7 @@ import 'package:harness/core/config.dart';
import 'package:harness/core/engine_availability.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/widgets/new_agent_dialog.dart';
import 'package:harness/shared/widgets/app_choice_picker.dart';
@@ -97,6 +98,7 @@ class _Notifier extends AppNotifier {
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
@@ -199,7 +201,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, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -220,7 +222,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, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/custom/work-login');
expect(tester.takeException(), isNull);
@@ -239,10 +241,10 @@ void main() {
);
expect(machineField.options.single.label, 'This Mac');
expect(machineField.options.single.detail, 'Remote');
- expect(find.widgetWithText(FilledButton, 'New Harness'), findsOneWidget);
+ expect(find.widgetWithText(FilledButton, 'New Agent'), findsOneWidget);
expect(
find.text(
- 'This harness will run on This Mac. Its folders are browsed through '
+ 'This agent will run on This Mac. Its folders are browsed through '
'the remote CLI.',
),
findsOneWidget,
@@ -299,7 +301,7 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
- final createButton = find.widgetWithText(FilledButton, 'New Harness');
+ final createButton = find.widgetWithText(FilledButton, 'New Agent');
expect(tester.widget<FilledButton>(createButton).onPressed, isNull);
expect(folderFocus.hasPrimaryFocus, isTrue);
expect(notifier.calls, isEmpty);
@@ -337,7 +339,7 @@ void main() {
expectProfile(tester, 'codex1');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/accounts/codex1');
});
@@ -361,7 +363,7 @@ void main() {
expectProfile(tester, 'Default profile');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -374,7 +376,7 @@ void main() {
expectProfile(tester, 'codex2');
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls, [
{'engine': 'codex', 'codexHome': '/accounts/codex2', 'folder': '/work'},
@@ -454,7 +456,7 @@ void main() {
);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
expect(notifier.calls.single['engine'], 'claude');
@@ -474,7 +476,7 @@ void main() {
);
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
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 7cd0dc836..0a6d762b9 100644
--- a/desktop/test/new_agent_engine_check_test.dart
+++ b/desktop/test/new_agent_engine_check_test.dart
@@ -18,6 +18,7 @@ import 'package:harness/core/config.dart';
import 'package:harness/core/engine_availability.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/shared/widgets/app_choice_picker.dart';
import 'package:harness/shared/widgets/app_select_field.dart';
@@ -91,7 +92,7 @@ void main() {
// be attempted and troubleshooting stays in the optional details.
expect(find.textContaining('Couldn’t check whether'), findsOneWidget);
expect(
- find.textContaining('You can still try creating a harness.'),
+ find.textContaining('You can still try creating an agent.'),
findsOneWidget,
);
expect(find.textContaining('uses an older Harness CLI'), findsNothing);
@@ -185,7 +186,7 @@ void main() {
findsOneWidget,
);
expect(app.launches, isEmpty);
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pump();
expect(app.launches.single, {
'machine': 'machine-1',
@@ -294,6 +295,7 @@ class _RetryNotifier extends AppNotifier {
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
diff --git a/desktop/test/new_agent_project_folder_test.dart b/desktop/test/new_agent_project_folder_test.dart
new file mode 100644
index 000000000..b7d14269a
--- /dev/null
+++ b/desktop/test/new_agent_project_folder_test.dart
@@ -0,0 +1,193 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/core/config.dart';
+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/widgets/new_agent_dialog.dart';
+import 'package:harness/ws/ws_conn.dart';
+
+class _Connection extends WsConn {
+ _Connection()
+ : super(
+ wsBaseUrl: 'ws://fixture.invalid',
+ autonomousEnv: 'test',
+ machineId: 'm',
+ accessTokenProvider: (_, _) async => '',
+ onAuthFailure: (_) {},
+ onEvent: (_) {},
+ onStatus: (_) {},
+ );
+ final calls =
+ <(String, Map<String, dynamic>, Completer<Map<String, dynamic>>)>[];
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) {
+ final result = Completer<Map<String, dynamic>>();
+ calls.add((type, payload, result));
+ return result.future;
+ }
+
+ void fail({String? folder}) {
+ final (_, payload, result) = calls.last;
+ result.complete({
+ 'creationId': payload['creationId'],
+ 'state': 'failed',
+ 'preparedFolder': ?folder,
+ 'failure': {'code': 'TMUX_UNAVAILABLE'},
+ });
+ }
+}
+
+class _App extends AppNotifier {
+ _App(_Connection connection, {required bool local})
+ : super(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ connectionForTest: (_) => connection,
+ ) {
+ const machine = Machine(
+ machineId: 'm',
+ name: 'Studio',
+ authMode: MachineAuthMode.remote,
+ );
+ machineStates['m'] = MachineState(machine)..localOnly = local;
+ }
+ final prepared = <ProjectFolderRequest>[];
+ @override
+ Future<void> probeEngines(String machineId, {bool force = false}) async {}
+ @override
+ Future<String> prepareLocalProjectFolder(ProjectFolderRequest request) async {
+ prepared.add(request);
+ return '/local/Harness Projects/project-test';
+ }
+}
+
+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: Builder(
+ builder: (context) => TextButton(
+ onPressed: () =>
+ showNewAgentDialog(context, app, 'm', source: 'test'),
+ child: const Text('Open'),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.text('Open'));
+ await tester.pumpAndSettle();
+}
+
+void main() {
+ 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')),
+ );
+ 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();
+ });
+ }
+
+ 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/pane_restart_test.dart b/desktop/test/pane_restart_test.dart
index 913232d19..3edfc05c9 100644
--- a/desktop/test/pane_restart_test.dart
+++ b/desktop/test/pane_restart_test.dart
@@ -62,7 +62,7 @@ void main() {
await tester.tap(
find.descendant(
of: controls,
- matching: find.byTooltip('Restart Harness'),
+ matching: find.byTooltip('Restart Agent'),
),
);
await tester.pump();
@@ -85,7 +85,7 @@ void main() {
of: controls,
matching: find.byWidgetPredicate(
(widget) =>
- widget is IconButton && widget.tooltip == 'Restart Harness',
+ widget is IconButton && widget.tooltip == 'Restart Agent',
),
),
);
diff --git a/desktop/test/project_folder_test.dart b/desktop/test/project_folder_test.dart
new file mode 100644
index 000000000..1c60fa3a1
--- /dev/null
+++ b/desktop/test/project_folder_test.dart
@@ -0,0 +1,65 @@
+import 'dart:io';
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/project_folder.dart';
+import 'package:harness/core/repository_clone.dart';
+import 'package:path/path.dart' as p;
+
+void main() {
+ test(
+ 'new projects use unique folders and preserve existing projects',
+ () async {
+ final root = await Directory.systemTemp.createTemp(
+ 'harness-new-project-test-',
+ );
+ addTearDown(() => root.delete(recursive: true));
+ final existing = File(p.join(root.path, 'keep.txt'));
+ await existing.writeAsString('keep');
+ const request = ProjectFolderRequest.newProject();
+ final folders = await Future.wait([
+ request.prepareLocal(projectHome: root.path),
+ request.prepareLocal(projectHome: root.path),
+ ]);
+ expect(folders.toSet(), hasLength(2));
+ expect(folders.every((folder) => p.isWithin(root.path, folder)), isTrue);
+ expect(await existing.readAsString(), 'keep');
+ expect(request.payload, {'projectSource': 'new'});
+ },
+ );
+ test(
+ 'remote repository uses the existing safe clone on this computer',
+ () async {
+ final root = await Directory.systemTemp.createTemp(
+ 'harness-remote-project-test-',
+ );
+ addTearDown(() => root.delete(recursive: true));
+ final source = p.join(root.path, 'source.git');
+ expect(
+ (await Process.run('git', ['init', '--bare', source])).exitCode,
+ 0,
+ );
+ final request = ProjectFolderRequest.remote(
+ GitHubRepository.parse('owner/repo')!,
+ );
+ final folder = await request.prepareLocal(
+ projectHome: p.join(root.path, 'projects'),
+ createClone: () => RepositoryClone(
+ startProcess: (args, environment) {
+ expect(args[2], 'https://github.com/owner/repo.git');
+ return Process.start('git', [
+ 'clone',
+ '--',
+ source,
+ args.last,
+ ], environment: environment);
+ },
+ ),
+ );
+ expect(await Directory(p.join(folder, '.git')).exists(), isTrue);
+ expect(request.payload, {
+ 'projectSource': 'remote',
+ 'repositoryUrl': 'https://github.com/owner/repo.git',
+ });
+ },
+ );
+}
diff --git a/desktop/test/rail_agents_first_test.dart b/desktop/test/rail_agents_first_test.dart
index 5e6175d09..53371e62c 100644
--- a/desktop/test/rail_agents_first_test.dart
+++ b/desktop/test/rail_agents_first_test.dart
@@ -107,7 +107,7 @@ void main() {
// by accident. Measured on the clip box, not on a button — each button
// keeps its own 24px inside it either way.
final menu = find.byTooltip('Machine options');
- final plus = find.byTooltip('Create Harness here…');
+ final plus = find.byTooltip('Create Agent here…');
expect(menu, findsOneWidget);
expect(plus, findsOneWidget);
Size actionsBox() => tester.getSize(
diff --git a/desktop/test/remote_folder_picker_test.dart b/desktop/test/remote_folder_picker_test.dart
index 2e487af55..b6672c6cf 100644
--- a/desktop/test/remote_folder_picker_test.dart
+++ b/desktop/test/remote_folder_picker_test.dart
@@ -7,6 +7,7 @@ import 'package:harness/auth/auth_session.dart';
import 'package:harness/core/config.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/widgets/new_agent_dialog.dart';
@@ -43,6 +44,7 @@ class _Folders extends AppNotifier {
String machineId, {
required String engine,
required String folder,
+ ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
String? swarmId,
@@ -359,7 +361,7 @@ void main() {
);
testWidgets(
- 'remote selection returns to New Harness without launching or losing choices',
+ 'remote selection returns to New Agent without launching or losing choices',
(tester) async {
final app = _Folders();
addTearDown(app.dispose);
@@ -414,7 +416,7 @@ void main() {
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('/home/dev/target'), findsOneWidget);
expect(app.launches, isEmpty);
- await tester.tap(find.widgetWithText(FilledButton, 'New Harness'));
+ await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
await tester.pumpAndSettle();
expect(app.launches, [
(machine: 'remote', engine: 'codex', folder: '/home/dev/target'),
diff --git a/desktop/test/rename_agent_dialog_test.dart b/desktop/test/rename_agent_dialog_test.dart
index 03378df09..5a12416aa 100644
--- a/desktop/test/rename_agent_dialog_test.dart
+++ b/desktop/test/rename_agent_dialog_test.dart
@@ -52,14 +52,14 @@ void main() {
);
await tester.tap(find.text('rename'));
await tester.pumpAndSettle();
- expect(find.text('Rename Harness'), findsOneWidget);
+ expect(find.text('Rename Agent'), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
// Pumped through the WHOLE exit transition, which is the window the bug
// lived in: one pump would settle before the rebuild that threw.
await tester.pumpAndSettle();
- expect(find.text('Rename Harness'), findsNothing);
+ expect(find.text('Rename Agent'), findsNothing);
expect(
tester.takeException(),
isNull,
diff --git a/desktop/test/shortcuts_test.dart b/desktop/test/shortcuts_test.dart
index 21d3c7910..605bc89da 100644
--- a/desktop/test/shortcuts_test.dart
+++ b/desktop/test/shortcuts_test.dart
@@ -299,7 +299,7 @@ void main() {
['⌘', '→'],
]);
- final next = rows.firstWhere((row) => row.label == 'Next Harness');
+ final next = rows.firstWhere((row) => row.label == 'Next Tab');
expect(next.chords, [
['⇧', '⌘', ']'],
['⌃', '⇥'],
diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dart
index 0d0e4c01e..c5e98847e 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(
- 'Open Harness in the header reuses the chosen session in this workspace',
+ 'Open Agent in the header reuses the chosen session in this workspace',
(tester) async {
final app = createApp();
final input = <TerminalBinaryFrame>[];
@@ -44,7 +44,7 @@ void main() {
expect(
find.descendant(
of: find.byKey(const ValueKey('swarm-row-action')),
- matching: find.text('Open Harness'),
+ matching: find.text('Open Agent'),
),
findsOneWidget,
);
diff --git a/desktop/test/swarm_async_test.dart b/desktop/test/swarm_async_test.dart
index e371f8fc0..55521b980 100644
--- a/desktop/test/swarm_async_test.dart
+++ b/desktop/test/swarm_async_test.dart
@@ -92,17 +92,17 @@ void main() {
(
'TMUX_UNAVAILABLE',
null,
- 'Harness needs tmux to start harnesses on Test host. Install tmux there, then try again.',
+ 'Harness needs tmux to start agents on Test host. Install tmux there, then try again.',
),
(
'UNSUPPORTED',
null,
- 'Update the harness CLI on this machine to create a harness',
+ 'Update the harness CLI on this machine to create an agent',
),
(
'SPAWN_FAILED',
'The machine could not allocate an agent process.',
- 'Test host has not confirmed the new harness yet. Check status before creating another.',
+ 'Test host has not confirmed the new agent yet. Check status before creating another.',
),
]) {
test(
@@ -140,7 +140,7 @@ void main() {
connection.reply.completeError(const WsRequestTimeout('agent_create'));
expect(
await creation,
- 'Test host has not confirmed the new harness yet. Check status before creating another.',
+ 'Test host has not confirmed the new agent yet. Check status before creating another.',
);
expect(connection.calls, ['agent_create']);
expect(app.panes, isEmpty);
diff --git a/desktop/test/swarm_attention_picker_test.dart b/desktop/test/swarm_attention_picker_test.dart
index 840398a07..dd74f1286 100644
--- a/desktop/test/swarm_attention_picker_test.dart
+++ b/desktop/test/swarm_attention_picker_test.dart
@@ -14,7 +14,7 @@ import 'swarm_switcher_test.dart' show selectedRow;
Finder get attentionField => find.byWidgetPredicate(
(w) =>
w is TextField &&
- w.decoration?.hintText == 'Find a question, harness, or project',
+ w.decoration?.hintText == 'Find a question, agent, or project',
);
void main() {
@@ -223,7 +223,7 @@ void main() {
machine.blockedAgents.clear();
app.dismissError();
await tester.pump();
- expect(find.text('No harnesses need your input'), findsOneWidget);
+ expect(find.text('No agents need your input'), findsOneWidget);
await tester.tap(find.byTooltip('Close notifications'));
await tester.pump();
expect(app.panes, isEmpty);
diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dart
index 149c1090b..226de897e 100644
--- a/desktop/test/swarm_commands_test.dart
+++ b/desktop/test/swarm_commands_test.dart
@@ -18,7 +18,7 @@ void main() {
addTearDown(app.dispose);
final command = SwarmDestination(
id: 'command:swarm.new',
- title: 'New Harness',
+ title: 'New Agent',
detail: 'Navigate',
swarmId: null,
current: false,
@@ -32,7 +32,7 @@ void main() {
commands: () => available ? [command] : [],
);
addTearDown(search.dispose);
- search.setQuery('New Harness');
+ search.setQuery('New Agent');
expect(search.rows.any((row) => row.isCommand), isFalse);
search.setQuery('> new');
expect(search.selected, same(command));
@@ -77,7 +77,7 @@ void main() {
expect(
find.descendant(
of: find.byKey(const ValueKey('swarm-search-results')),
- matching: find.text('Open Harness'),
+ matching: find.text('Open Agent'),
),
findsNothing,
);
@@ -112,7 +112,7 @@ void main() {
);
testWidgets(
- 'New Harness commands use the shared picker and hand focus to the chosen dialog',
+ 'New Agent commands use the shared picker and hand focus to the chosen dialog',
(tester) async {
final app = createApp();
await mount(tester, app);
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index e561cca31..1b510a5a2 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -70,7 +70,7 @@ void main() {
findsOneWidget,
);
expect(
- find.descendant(of: selected, matching: find.text('Open Harness')),
+ find.descendant(of: selected, matching: find.text('Open Agent')),
findsOneWidget,
);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
@@ -82,7 +82,7 @@ void main() {
});
for (final native in [false, true]) {
- testWidgets('start page separates Open and New Harness (native=$native)', (
+ testWidgets('start page separates Open and New Agent (native=$native)', (
tester,
) async {
const channel = MethodChannel('harness/swarm_tabs');
@@ -110,7 +110,7 @@ void main() {
);
expect(
tester.widget<TextField>(_startInput).decoration!.hintText,
- 'Find a harness',
+ 'Find an agent',
);
expect(tester.widget<TextField>(_startInput).focusNode!.hasFocus, isTrue);
expect(find.byKey(const ValueKey('harness-device-link')), findsOneWidget);
@@ -155,7 +155,7 @@ void main() {
expect(
find.descendant(
of: find.byType(AlertDialog),
- matching: find.widgetWithText(FilledButton, 'New Harness'),
+ matching: find.widgetWithText(FilledButton, 'New Agent'),
),
findsOneWidget,
);
diff --git a/desktop/test/swarm_history_test.dart b/desktop/test/swarm_history_test.dart
index 87c3c3c18..88bbc2778 100644
--- a/desktop/test/swarm_history_test.dart
+++ b/desktop/test/swarm_history_test.dart
@@ -52,7 +52,7 @@ void main() {
for (final count in [1, 2]) {
test(
- 'History keeps the engine identity of $count-agent harnesses',
+ 'History keeps the engine identity of $count-agent agents',
() async {
final app = createApp();
addTearDown(app.dispose);
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index bfa866c8f..ffc94029e 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -240,7 +240,7 @@ void main() {
find.descendant(of: controls, matching: find.byType(IconButton)),
findsNWidgets(5),
);
- expect(find.byTooltip('Stop Harness').first.hitTestable(), findsNothing);
+ expect(find.byTooltip('Stop Agent').first.hitTestable(), findsNothing);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: const Offset(1, 1));
Future<void> hover() async {
@@ -267,10 +267,10 @@ void main() {
await hover();
await tester.tap(
- find.descendant(of: controls, matching: find.byTooltip('Stop Harness')),
+ find.descendant(of: controls, matching: find.byTooltip('Stop Agent')),
);
await tester.pumpAndSettle();
- expect(find.text('Stop Harness'), findsNWidgets(2));
+ expect(find.text('Stop Agent'), findsNWidgets(2));
expect(app.panes, contains(pane));
expect(original.panes.single.session, same(session));
await tester.tap(find.text('Cancel'));
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
index 7f891bbb2..32a37bc5b 100644
--- a/desktop/test/swarm_picker_activation_test.dart
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -25,7 +25,7 @@ void main() {
expect(tester.getRect(field).width, tester.getRect(results).width);
await chord(tester, LogicalKeyboardKey.keyN, shift: true);
expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'New Harness'), findsOneWidget);
+ expect(find.widgetWithText(FilledButton, 'New Agent'), findsOneWidget);
expect(results, findsNothing);
expect(find.text('Back to Search'), findsNothing);
expect(app.panes, [pane]);
@@ -55,7 +55,9 @@ void main() {
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyN);
final field = find.byKey(const ValueKey('swarm-search-input'));
- await tester.enterText(field, 'Agent 0');
+ if (activate == 'click') {
+ await tester.enterText(field, 'Agent 0');
+ }
await tester.pump();
expect(find.byType(Checkbox), findsNothing);
expect(app.panes, isEmpty);
@@ -63,7 +65,7 @@ void main() {
expect(
find.descendant(
of: find.byKey(const ValueKey('swarm-row-action')),
- matching: find.text('Open Harness'),
+ matching: find.text('Open Agent'),
),
findsOneWidget,
);
diff --git a/desktop/test/swarm_project_members_test.dart b/desktop/test/swarm_project_members_test.dart
index 2ccb66960..51a10d0b8 100644
--- a/desktop/test/swarm_project_members_test.dart
+++ b/desktop/test/swarm_project_members_test.dart
@@ -71,7 +71,7 @@ void main() {
find.byWidgetPredicate(
(w) =>
w is TextField &&
- w.decoration?.hintText == 'Find a harness or machine',
+ w.decoration?.hintText == 'Find an agent or machine',
),
'Chess Set',
);
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 9af5bfcc7..40878f72d 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -458,7 +458,7 @@ void main() {
});
await chord(tester, LogicalKeyboardKey.keyI, shift: true);
await tester.pump(const Duration(milliseconds: 300));
- expect(find.text('No harnesses need your input'), findsOneWidget);
+ expect(find.text('No agents need your input'), findsOneWidget);
await tester.pumpWidget(const SizedBox());
app.dispose();
},
diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dart
index d02b07e0c..0c6c4245a 100644
--- a/desktop/test/swarm_search_test.dart
+++ b/desktop/test/swarm_search_test.dart
@@ -174,7 +174,7 @@ void main() {
search.setQuery('Test host');
final choice = search.submit();
expect(choice?.destination.isMachine, isTrue);
- expect(SwarmSearchController.action(choice!.destination), 'Open Harness');
+ expect(SwarmSearchController.action(choice!.destination), 'Open Agent');
expect(
await activateSwarmSearchSelection(
app,
@@ -312,7 +312,7 @@ void main() {
expect(
find.descendant(
of: find.byKey(const ValueKey('swarm-row-action')),
- matching: find.text('Open Harness'),
+ matching: find.text('Open Agent'),
),
findsOneWidget,
);
@@ -338,7 +338,7 @@ void main() {
for (final adding in [false, true]) {
testWidgets(
- 'Return waits for composing text in ${adding ? 'Add' : 'New Harness'}',
+ 'Return waits for composing text in ${adding ? 'Add' : 'New Agent'}',
(tester) async {
final app = createApp();
app.adoptSessionForTest(terminal('a0', []));
diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dart
index ade671d17..1618df9cf 100644
--- a/desktop/test/swarm_split_test.dart
+++ b/desktop/test/swarm_split_test.dart
@@ -341,7 +341,7 @@ void main() {
isTrue,
);
if (change != 'switch') {
- expect(app.lastError, contains('harness was created'));
+ expect(app.lastError, contains('agent was created'));
}
expect(connection.calls, isNot(contains('agent_delete')));
await tester.pumpWidget(const SizedBox());
@@ -377,11 +377,11 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
expect(find.byKey(const ValueKey('harness-picker-new')), findsOneWidget);
- expect(find.byKey(const ValueKey('swarm-row-action')), findsNothing);
+ expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);
expect(find.byType(AlertDialog), findsNothing);
await chord(tester, LogicalKeyboardKey.keyN, shift: true);
await tester.pump();
- expect(find.text('New Harness to the right'), findsOneWidget);
+ expect(find.text('New Agent 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 8f31cc2ce..e2d51ea7c 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 Tab offers Open Harness and preserves the selected runtime (native=$nativeTabs)',
+ 'New Tab offers Open Agent and preserves the selected runtime (native=$nativeTabs)',
(tester) async {
const channel = MethodChannel('harness/swarm_tabs');
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
@@ -104,7 +104,7 @@ void main() {
);
expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);
}
- expect(harnessCommandById['agent.new']!.label, 'New Harness');
+ expect(harnessCommandById['agent.new']!.label, 'New Agent');
await tester.tap(find.byKey(const ValueKey('command:swarm.new')));
await tester.pump();
expect(app.activeSwarm.name, 'New Tab');
diff --git a/desktop/test/terminal_initial_output_test.dart b/desktop/test/terminal_initial_output_test.dart
index ae2181e3b..16de77f98 100644
--- a/desktop/test/terminal_initial_output_test.dart
+++ b/desktop/test/terminal_initial_output_test.dart
@@ -135,7 +135,7 @@ void main() {
expect(scroll.position.maxScrollExtent, greaterThan(0));
expect(scroll.offset, scroll.position.maxScrollExtent);
}
- // Reopening a harness reveals current output in each retained view.
+ // Reopening an agent reveals current output in each retained view.
final first = terminalView(tester, sessions.first);
final scroll = first.widget.scrollController!;
scroll.jumpTo(100);
diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dart
index 59aaf4f9c..8e598c6b2 100644
--- a/desktop/test/terminal_panel_presentation_test.dart
+++ b/desktop/test/terminal_panel_presentation_test.dart
@@ -54,8 +54,8 @@ void main() {
await tester.pump(const Duration(milliseconds: 120));
await tester.tap(find.byTooltip('Show message composer'));
await tester.tap(find.byTooltip('Zoom Pane'));
- await tester.tap(find.byTooltip('Restart Harness'));
- await tester.tap(find.byTooltip('Stop Harness'));
+ await tester.tap(find.byTooltip('Restart Agent'));
+ await tester.tap(find.byTooltip('Stop Agent'));
await tester.tap(find.byTooltip('Close Pane'));
await tester.pump();
expect(closed, [1]);
@@ -161,7 +161,7 @@ void main() {
tester.getRect(find.text('Test host')).left,
greaterThan(tester.getRect(find.text('main')).right),
);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsNothing);
+ expect(find.byTooltip('Stop Agent').hitTestable(), findsNothing);
expect(
find.descendant(of: controls, matching: find.byType(IconButton)),
findsNWidgets(local ? 4 : 5),
@@ -170,7 +170,7 @@ void main() {
await mouse.addPointer(location: tester.getCenter(title));
await tester.pump(const Duration(milliseconds: 120));
expect(tester.widget<AnimatedOpacity>(details).opacity, 0);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
+ expect(find.byTooltip('Stop Agent').hitTestable(), findsOneWidget);
expect(tester.getRect(title), titleBounds);
expect(
tester.widget<TerminalView>(find.byType(TerminalView)),
@@ -179,11 +179,11 @@ void main() {
await mouse.moveTo(const Offset(300, 200));
await tester.pump(const Duration(milliseconds: 120));
expect(tester.widget<AnimatedOpacity>(details).opacity, 1);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsNothing);
+ expect(find.byTooltip('Stop Agent').hitTestable(), findsNothing);
// Keyboard users can reveal and reach the same actions without a mouse.
- Focus.of(tester.element(find.byTooltip('Stop Harness'))).nextFocus();
+ Focus.of(tester.element(find.byTooltip('Stop Agent'))).nextFocus();
await tester.pump(const Duration(milliseconds: 120));
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
+ expect(find.byTooltip('Stop Agent').hitTestable(), findsOneWidget);
await mouse.removePointer();
await tester.pumpWidget(const SizedBox());
session.dispose();
diff --git a/desktop/test/terminal_tail_lifecycle_test.dart b/desktop/test/terminal_tail_lifecycle_test.dart
index cc8c05f03..d157c75dc 100644
--- a/desktop/test/terminal_tail_lifecycle_test.dart
+++ b/desktop/test/terminal_tail_lifecycle_test.dart
@@ -246,7 +246,7 @@ void main() {
}
testWidgets(
- 'adding a retained pane to a new harness reveals the latest output',
+ 'adding a retained pane to a new agent reveals the latest output',
(tester) async {
final app = createApp();
final session = terminal('a0', []);
@@ -268,7 +268,7 @@ void main() {
expect(terminalView(tester, session), same(view));
atBottom(tester, session);
// Shared panes can remain visible with exactly the same geometry while
- // switching harnesses, so visibility/size alone cannot detect a reveal.
+ // switching agents, so visibility/size alone cannot detect a reveal.
view.widget.scrollController!.jumpTo(100);
await tester.pump();
app.selectSwarm(app.swarms.first.id);
diff --git a/desktop/test/welcome_entry_layout_test.dart b/desktop/test/welcome_entry_layout_test.dart
index 6509ece7f..d4955ef5b 100644
--- a/desktop/test/welcome_entry_layout_test.dart
+++ b/desktop/test/welcome_entry_layout_test.dart
@@ -106,7 +106,7 @@ void main() {
expect(find.text('Harness'), findsNothing);
expect(
tester.widget<TextField>(field).decoration!.hintText,
- 'Find a harness',
+ 'Find an agent',
);
expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
expect(find.byType(ListTile), findsNothing);
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index f816c56d7..6ccc6a72b 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -180,7 +180,7 @@ private extension SwarmTabStrip {
try checkTitlebar(tabs[0].showsDivider && tabs[1].showsDivider, "Separators return when the pointer leaves")
try checkTitlebar(!tabs[10].showsDivider && !tabs[11].showsDivider, "Selected tab remains joined without neighboring separators")
try checkTitlebar(tabs.count == 24, "All overflow tabs exist")
- try checkTitlebar(!newButton.isEnabled, "New Harness is disabled at capacity")
+ try checkTitlebar(!newButton.isEnabled, "New Agent is disabled at capacity")
for (index, tab) in tabs.enumerated() {
try tab.checkAccessibility(expectedName: "Swarm \(index)", active: index == 11)
}
@@ -218,7 +218,7 @@ private extension SwarmTabStrip {
update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0"))
try checkTitlebar(tabs.count == 1 && tabs[0] === original, "Closing tabs retains the surviving control")
try original.checkAccessibility(expectedName: "Renamed tab", active: true)
- try checkTitlebar(newButton.isEnabled, "New Harness returns below capacity")
+ try checkTitlebar(newButton.isEnabled, "New Agent returns below capacity")
var fullWithStarter = state(rows, active: "swarm-0")
fullWithStarter["canOpenNewTab"] = true
update(fullWithStarter)
@@ -234,16 +234,16 @@ private extension SwarmTabStrip {
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 Harness has its own target on the right")
- try checkTitlebar(openButton.title == "Add Harness",
- "The titlebar has one Add Harness entry point")
+ "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(!subviews.contains(where: { $0 is NSTextField }), "The titlebar has no competing text editor")
events.removeAll()
newButton.performClick(nil)
notificationButton.performClick(nil)
openButton.performClick(nil)
try checkTitlebar(events == ["new", "notifications", "addAgent"],
- "The new tab, notification and Add Harness buttons dispatch once")
+ "The new tab, notification and Add Agent 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")
@@ -264,7 +264,7 @@ private extension SwarmTabStrip {
try original.checkEnabled(false)
try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled && !openButton.isEnabled, "Titlebar actions disable with a modal")
try checkTitlebar(actionPixels == [openButton.renderedPixels()],
- "Add Harness keeps its rendered colors when a workspace modal opens")
+ "Add Agent keeps its rendered colors when a workspace modal opens")
original.clickBothActions()
newButton.performClick(nil)
notificationButton.performClick(nil)
@@ -477,7 +477,7 @@ private extension SwarmTitlebar {
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 Harness on Command-N")
+ "The exported keymap keeps Add Agent on Command-N")
setKeymap(changed)
try checkTitlebar(NSApp.mainMenu === main && newSwarm.keyEquivalent == "o",
"Hot reload updates the existing menu to the remapped key")
@@ -573,8 +573,8 @@ 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 Harness…" && addHarness.keyEquivalent == "n" && addHarness.keyEquivalentModifierMask == [.command],
- "The single Add Harness menu entry advertises Command-N")
+ try checkTitlebar(addHarness.title == "Add Agent…" && addHarness.keyEquivalent == "n" && addHarness.keyEquivalentModifierMask == [.command],
+ "The single Add Agent menu entry advertises Command-N")
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.filter { !$0.isSeparatorItem }.allSatisfy { $0.image != nil && $0.toolTip == nil },
@@ -602,8 +602,10 @@ private extension SwarmTitlebar {
canCreateSwarm = true
try checkTitlebar(validateMenuItem(create), "Native New Swarm returns below capacity")
let machineRows: [[String: Any]] = [
- ["id": "office", "name": "iMac – Office", "status": "Online", "local": true],
- ["id": "home", "name": "iMac – Home", "status": "Offline", "local": false],
+ ["id": "office", "name": "iMac – Office", "status": "Online", "local": true, "agentCount": 2,
+ "agents": [["id": "one", "title": "App work", "engine": "codex", "canOpen": true],
+ ["id": "two", "title": "Unavailable session", "canOpen": false]]],
+ ["id": "home", "name": "iMac – Home", "status": "Offline", "local": false, "agentCount": 0],
]
updateMachines(machineRows)
let machineMenu = main.item(withTitle: "Machines")!.submenu!
@@ -619,6 +621,20 @@ private extension SwarmTitlebar {
try checkTitlebar(destinations[0].attributedTitle?.string.contains("Online") == true &&
destinations[1].attributedTitle?.string.contains("Offline") == true,
"Machine availability is visible before opening its agent search")
+ try checkTitlebar(destinations[0].attributedTitle?.string.contains("2 agents") == true && destinations[1].attributedTitle?.string.contains("0 agents") == true,
+ "Machine labels include their cached agent count")
+ let agentItems = destinations[0].submenu!.items.filter { $0.action == #selector(machineAgentAction(_:)) }
+ try checkTitlebar(agentItems.map(\.title) == ["App work", "Unavailable session"] && agentItems[0].image != nil,
+ "Machines expand into named agents with engine icons")
+ try checkTitlebar(validateMenuItem(agentItems[0]) && !validateMenuItem(agentItems[1]),
+ "Unavailable agents cannot be activated")
+ machineAgentAction(agentItems[0])
+ try checkTitlebar(messenger.calls.last?.method == "machineAgent" &&
+ (messenger.calls.last?.arguments as? [String: String]) == ["machineId": "office", "agentId": "one"],
+ "Agent selection sends both stable identities to Flutter")
+ try checkTitlebar(destinations[1].submenu?.item(withTitle: "No agents yet")?.isEnabled == false &&
+ destinations[1].submenu?.item(withTitle: "Find Agents…") != nil,
+ "Empty machines explain the empty list and keep search available")
try checkTitlebar(machineMenu.items.compactMap { $0.representedObject as? String }.suffix(2) == ["linkMachine", "refreshMachines"],
"Machines exposes Link and Refresh after the computer list")
let machineCallCount = messenger.calls.count
@@ -629,6 +645,7 @@ private extension SwarmTitlebar {
"A computer sends its stable id to the shared agent search")
actionsEnabled = false
machineAction(destinations[1])
+ machineAgentAction(agentItems[0])
try checkTitlebar(!validateMenuItem(destinations[1]) && messenger.calls.count == machineCallCount + 1,
"A modal blocks machine destinations")
actionsEnabled = true
@@ -636,7 +653,7 @@ private extension SwarmTitlebar {
try checkTitlebar(machineMenu.items.contains(where: { $0 === destinations[0] }),
"Unchanged machine data retains menu controls")
updateMachines([])
- try checkTitlebar(!validateMenuItem(destinations[0]) &&
+ try checkTitlebar(!validateMenuItem(destinations[0]) && !validateMenuItem(agentItems[0]) &&
machineMenu.item(withTitle: "No Machines Linked")?.isEnabled == false,
"Unlinking computers clears destinations and invalidates stale actions")
let recentRows: [[String: Any]] = (0..<20).map { index -> [String: Any] in
@@ -693,19 +710,19 @@ private extension SwarmTitlebar {
let groupItems = historyMenu.items.filter { $0.representedObject as? String == "group-harness" }
try checkTitlebar(singleItems.count == 2 && singleItems.allSatisfy {
$0.image === historyIcons.image(engine: "claude", asset: nil)
- }, "Recently visited and closed single-agent harnesses show their agent icon")
+ }, "Recently visited and closed single-agent agents show their agent icon")
try checkTitlebar(groupItems.count == 2 && groupItems.allSatisfy {
$0.image === SwarmIdentity.menuIcon
- }, "Multiple-agent harnesses retain the group icon")
+ }, "Multiple-agent agents retain the group icon")
updateHistory([])
try checkTitlebar(!validateMenuItem(recent), "A stale recent menu item cannot dispatch after its view disappears")
try checkTitlebar(!validateMenuItem(closed), "A stale closed entry cannot restore another Swarm")
try checkTitlebar(historyMenu.items.first(where: { $0.title == "No Recent Visits" })?.isEnabled == false, "An empty history is an inert placeholder")
guard let menu = main.items.first(where: { $0.title == "View" })?.submenu,
let attention = menu.items.first(where: { $0.representedObject as? String == "notifications" }) else {
- throw TitlebarCheckFailure(message: "View menu exposes harnesses needing input")
+ throw TitlebarCheckFailure(message: "View menu exposes agents needing input")
}
- try checkTitlebar(attention.title == "Harnesses Needing Input…", "Native command names its destination")
+ try checkTitlebar(attention.title == "Agents Needing Input…", "Native command names its destination")
try checkTitlebar(attention.keyEquivalent == "i" && attention.keyEquivalentModifierMask == [.command, .shift], "Native attention shortcut matches Flutter")
try checkTitlebar(attention.target === self && attention.action == #selector(menuAction(_:)), "Native attention command uses the guarded channel handler")
actionsEnabled = false
diff --git a/docs/harness-agent-creation.md b/docs/harness-agent-creation.md
index a95a67b3d..32e4a6be4 100644
--- a/docs/harness-agent-creation.md
+++ b/docs/harness-agent-creation.md
@@ -39,6 +39,29 @@ separate from the proposed Archive/Resume lifecycle; it stops no existing agent.
## Compatibility and verification
+### New / Local / Remote folders
+
+Local keeps the existing absolute `cwd` request. On this computer, New and Remote
+prepare the folder before sending that same protocol: a unique OS-reserved
+`~/Harness Projects/project-*` folder, or the existing staged GitHub clone.
+The selected remote machine receives `projectSource: new|remote`, optional
+`repositoryUrl`, and a required `creationId`, with `cwd` omitted. Its CLI validates
+the source and prepares the folder **inside** the same creation receipt before
+launching. Source/URL participate in the fingerprint. A slow clone does not
+block `agent_create_status`, and retries do not create another folder or agent.
+
+A known launch refusal after folder preparation returns `preparedFolder` beside
+the failure. The form retains it for the next deliberate, corrected launch using
+ordinary `cwd`. Existing destinations are never intentionally reused or removed
+by cloning. Git runs without shell interpolation or interactive credential
+prompts; failed private staging is cleaned up. Credentials/diagnostics are not
+shown in the UI. The accepted repository formats match the existing GitHub flow.
+
+An older remote CLI refuses the missing `cwd`; the desktop explains that its CLI
+needs updating or Local can select an existing folder. No new RPC type or E2EE
+classification is introduced. The user's running daemon has not been replaced
+or restarted as part of this change.
+
Legacy callers without `creationId` keep the existing create response. An older
CLI can also handle a new desktop's first create, ignoring the additional field.
The desktop keeps an uncertain request on **Check status**. On old CLIs where
@@ -60,7 +83,7 @@ to that action. Closing an uncertain request is labeled **Close**, not Cancel.
A confirmed refusal unlocks the choices for correction; the next deliberate
submission uses a new intent. Opening New agent also starts a fresh intent.
-In a swarm, the uncertain form also offers **Find a harness**. It closes
+In a swarm, the uncertain form also offers **Find an agent**. It closes
the form and opens the shared Add picker, with its input focused and the query
retained when creation began from search. This only searches the catalog; it
does not infer the created agent from a matching name/folder or start another.
@@ -74,7 +97,7 @@ When creation starts from centered Add or a split, clicking outside or pressing
**Escape** dismisses the entire flow and restores the original terminal's keyboard
input. **Back to Search** explicitly returns to the picker with its query, text
selection, highlighted result and split target intact. Direct creation retains
-**Cancel**. **Find a harness** on an uncertain request also restores that search
+**Cancel**. **Find an agent** on an uncertain request also restores that search
draft. Successful creation keeps the picker closed. Returning to search never
silently redirects a stale split; a changed target gets an explanation.
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index 13e4e64f8..e087cd2df 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -1,17 +1,22 @@
# Harness entry and pane controls
-Users start with one harness immediately and add panes when useful. A tab holds
-one or several harnesses without a selection basket or a separate group-creation step.
+Users start with one agent immediately and add panes when useful. A tab holds
+one or several agents without a selection basket or a separate group-creation step.
This is the latest product direction; it supersedes earlier swarm and multi-select
proposals in the progress log.
-## Open and New Harness
+**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
+remains the application, CLI and device brand. Existing saved names and protocol
+identifiers are unchanged.
+
+## Open and New Agent
**Cmd-T / New Tab** and the tab-bar plus open the Harness start page over its
restored lake-at-dusk wallpaper. A long search field, capped at 1120 logical pixels,
-has a prominent 64-pixel minimum height and shows **Find a harness** in place of
-a large heading. **Open Harness** and accented
-**+ New Harness** sit underneath, aligned with the field's left edge. The pill
+has a prominent 64-pixel minimum height and shows **Find an agent** in place of
+a large heading. **Open Agent** and accented
+**+ New Agent** sit underneath, aligned with the field's left edge. The pill
buttons retain their smaller 48-pixel height and wrap at narrow widths or large
text sizes. The device image and its caption share that same left edge in a footer
32 pixels above the window bottom. The footer stays put when search opens or
@@ -23,7 +28,7 @@ searching. Results fit the available space above the footer and scroll independe
Escape restores both actions and retains the query.
The field starts empty and focused so typing works immediately. Typing, clicking
-it or Open Harness, or pressing an arrow reveals the same input, results,
+it or Open Agent, 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 Tab refocuses an existing unused
page too. Typing filters immediately; arrows select and Enter opens. Escape or clicking
@@ -40,18 +45,18 @@ device image from https://cdn.autonomous.ai/production/ecm/260731/2.webp,
cropped in the viewport so the device is larger and centered. The caption is
“Meet the Harness device”.
The start-page actions use the same pill shape as the titlebar. The device link
-and both pairs of New/Open buttons show a hand cursor. Open Harness on the start
+and both pairs of New/Open buttons show a hand cursor. Open Agent on the start
page is transparent with a subtle border; New
Harness retains its accent fill.
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 Harness** button sits on the right. It and
-**Cmd-N** open the same compact chooser: a focused **Find a harness** field,
-with outlined **Open Harness** and accented **+ New Harness** beneath it.
-Typing, clicking the field, Open Harness, or the first navigation/Enter key
-reveals results without opening an unseen session. The field keeps its width
-and position. Both buttons remain available after results open; Open activates
+plus. A single accented **Add Agent** button sits on the right. It and
+**Cmd-N** open the results and preview immediately beneath a focused
+**Find an agent** field, with outlined **Open Agent** and accented
+**+ New Agent** below the panel. Enter immediately opens the highlighted result.
+This supersedes the compact-first modal; the New Tab page remains compact until
+search is activated. Both buttons remain available; Open activates
the selected result and New replaces search with creation. There is no stacked
picker behind creation. Escape dismisses the chooser and restores terminal focus.
The titlebar button is a 34-point-high pill with generous padding and a 12-point
@@ -59,7 +64,7 @@ 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 creation dialog title and CTA are **New Harness**. Cancel is removed; Escape
+The creation dialog title and CTA are **New Agent**. Cancel is removed; Escape
and clicking outside dismiss it. Launch-in-progress and uncertain-outcome states
retain their existing safeguards and recovery actions.
Machine and Agent use the same direct-choice layout: up to three buttons, with
@@ -68,22 +73,34 @@ local/remote and offline/link status below their names. The first two agent slot
are Codex and Claude Code; the third begins as Cursor. Choosing from **…** replaces
the third slot, and that option stays available while switching between the first
two. All options remain in **…**. Selection uses an accent-tinted fill and check;
-a separate outline shows keyboard focus. Names wrap into additional button rows
-at larger text sizes; long custom names have their full text in a tooltip.
+a separate outline shows keyboard focus. The form is 760 logical pixels wide.
+Machine choices stay on one row; narrow windows and larger text move excess
+choices into **…**, keeping the selected machine visible. Agent choices can wrap.
+Long custom names have their full text in a tooltip.
Selecting the current machine again preserves the chosen folder. One healthy
local machine still needs no machine selector.
The folder control receives initial keyboard focus, so Enter opens its chooser.
-A successful keyboard folder choice focuses the enabled New Harness action;
+A successful keyboard folder choice focuses the enabled New Agent action;
cancellation or failure returns focus to the folder control. If a required Codex
account lookup is still pending, focus stays on the folder instead of a disabled
submit action. Completing that lookup does not steal focus.
+Working folder has three visible choices: **New / Local / Remote**. Local is
+initially selected and browses the selected machine. 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 inline and clones under
+the same root on the selected machine. Nothing is created until New Agent is
+submitted. A prepared folder is reused after a refused launch. An uncertain
+launch keeps the original receipt and offers Check status instead of cloning or
+starting again. Remote folder preparation requires the accompanying CLI change;
+this computer prepares folders locally and keeps the existing create protocol.
+
The **…** menus support typing a name to highlight a choice. Enter
selects it; Escape returns to the field without changing the value. These keys
also work immediately after opening the menu, before its first frame.
-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**,
+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 Harnesses**, 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
@@ -110,14 +127,14 @@ 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 visible New Harness action or Shift-Cmd-N while choosing a split replaces
+The visible New Agent action or Shift-Cmd-N while choosing a split replaces
search with creation in that split position; dismissing creation still returns directly 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 entire surface, so dismissing New Harness cannot restore a caret.
-Native New Harness and Search Commands actions use the focused picker's
+focus from the entire surface, so dismissing New Agent cannot restore a caret.
+Native New Agent and Search Commands actions use the focused picker's
actions too. Command search stays in its field, and creation closes its dropdown
before opening the form. Native actions wait for the destination focus tree before
handing keyboard ownership back to Flutter and preserve in-progress search composition.
@@ -131,7 +148,7 @@ not also trigger the window's titlebar zoom behavior.
## Tabs and menus
-One harness shows its engine mark; multiple harnesses use four separate outlined
+One harness shows its engine mark; multiple agents use four separate outlined
tiles, matching the native square.grid.2x2 symbol. An empty tab uses a plain plus.
Only one unused **New Tab** is kept. New Tab from the plus, File menu,
Cmd-T or command search selects that existing page, even at the tab limit.
@@ -146,17 +163,23 @@ 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, Add Harness…, Rename Tab, Close Tab**;
+Window, Help**. File groups **New Tab, Add Agent…, Rename Tab, Close Tab**;
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
-linked computers with their status, followed by Link Machine and Refresh Machines.
+linked computers with their status and cached agent count, followed by Link
+Machine and Refresh Machines. Each computer is a submenu of named agents with
+engine icons. Selecting an agent opens its exact machine/agent identity, reusing
+an existing pane when present. The submenu retains Find Agents for the full
+search. Empty/unavailable lists are explicit; unknown counts are not shown as
+zero. Menus use existing cached discovery, with no fetch on opening. A stale
+agent or unlinked machine cannot redirect a menu action.
The manager has a visible **Rename** action on each computer and uses the existing
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 the start page and **Cmd-N** opens Add Harness.
+**Cmd-T** opens the start page and **Cmd-N** opens Add Agent.
**Shift-Cmd-N** remains a direct creation shortcut; Cmd-O is unbound by default. **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,
@@ -202,7 +225,7 @@ shows **folder • branch • machine**, omitting unavailable folder/branch data
Long details truncate, with full context in the session-name tooltip.
Hovering anywhere on the header replaces the details with small, muted controls:
-**Zoom Pane, Restart Harness, Stop Harness, Close Pane**, with **Keyboard** first for remote sessions. Keyboard
+**Zoom Pane, Restart Agent, Stop Agent, Close Pane**, with **Keyboard** first for remote sessions. Keyboard
focus also reveals the controls. The title keeps the same space during the swap,
and hovering retains the terminal renderer. Stop uses a plain filled square
and an explicit confirmation: it ends the engine process and removes the active
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index 2c9179ea0..cdf33126b 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -34,14 +34,44 @@ user for a benchmark window.
## Current product contract
+### September 15 continuation checkpoint
+
+- 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
+ menus. Harness remains the app/device/CLI brand; saved names and wire IDs stay.
+- Cmd-N now opens results and preview immediately, with Open Agent / New Agent
+ below. This supersedes every earlier compact-first modal instruction. New Tab
+ remains compact until search activation.
+- New Agent is 760 logical pixels wide. Machines stay in one row; narrow/large
+ text moves excess machines into the overflow while preserving the selection.
+- Working folder now offers **New / Local / Remote**. New creates a unique
+ project under `~/Harness Projects`; Local browses the selected machine;
+ Remote clones a GitHub repository onto that machine. Folder preparation begins
+ only on submit. A known refused launch retains its prepared folder for retry.
+ Local works with the existing daemon protocol. Remote preparation needs this
+ checkout's accompanying CLI change; no real daemon was updated or restarted.
+- Machines is a native submenu tree with cached counts, names and engine icons.
+ Selection uses both machine and agent IDs. Existing views are revealed, stale
+ destinations are refused, and opening menus does no network work.
+- Verification: 339 affected Flutter tests, 57 CLI tests, TypeScript checking,
+ 96 native keymap checks and 403 AppKit checks pass. No real agents were launched
+ or used for input tests, and no native latency benchmark was run. Captures:
+ `/private/tmp/harness-agent-folder-captures` and
+ `/private/tmp/harness-agent-picker-captures`.
+
+The preview below is still the earlier installed source until a later build
+checkpoint records the new bundle. The d22b338 native focus correction is installed;
+CUA-sent Command-N remains inconclusive, although native callback and exported
+shortcut checks pass.
+
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 Harness unifies search and creation.** A single titlebar button and
- File → Add Harness… open the compact chooser: search plus Open/New actions.
- Typing or explicit search activation reveals results and preview without
- moving the field. New remains visible after searching and preserves split
+ File → Add Harness… open results and preview immediately, with the search
+ field focused and Open/New actions below. This supersedes compact-first modal
+ entry; the New Tab page stays compact until activated. New preserves split
placement. The bell stays beside the traffic lights.
- **Cmd-T: New Tab; Cmd-N: Add Harness; Shift-Cmd-N: direct New Harness; Cmd-S: Layout.**
Cmd-O is unbound by default.
@@ -257,12 +287,10 @@ The approved visible-choice refinement is implemented in **620a868**. This remov
the primary machine dropdown and the detached selected-agent line. It preserves
engine discovery, profile checks, folder targeting and uncertain-launch recovery.
-The **larger project-creation workflow is not implemented**. The discussed
-shape is New Project / Existing Folder / Clone Repository, remembered agent,
-and compact This Machine / linked-machine choices in a spacious form. A new
-project would create its own folder, requiring no picker or typing. Do not infer
-the project from the current pane in a multiproject workspace. The visible-choice
-refinement is separate from that larger workflow.
+The **New / Local / Remote project-folder workflow is now implemented**; see the
+continuation checkpoint above and [creation recovery](harness-agent-creation.md).
+It preserves remembered agents, selected-machine targeting and the original split.
+Do not infer a project from the current pane in a multiproject workspace.
Command-held tab number hints were discussed as a discoverability improvement:
brief hold, subtle hints in each tab's right edge, no label movement. They have