Skip to content

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

Refine New Agent into a focused creation form

dee2cdfa88de250
diff --git a/desktop/lib/shared/widgets/app_choice_picker.dart b/desktop/lib/shared/widgets/app_choice_picker.dart
index db8a3dc08..13b02b183 100644
--- a/desktop/lib/shared/widgets/app_choice_picker.dart
+++ b/desktop/lib/shared/widgets/app_choice_picker.dart
@@ -19,6 +19,7 @@ class AppChoicePicker<T> extends StatefulWidget {
this.preferredValues = const [],
this.showDetails = false,
this.wrap = true,
+ this.compact = false,
});
final T value;
@@ -30,6 +31,7 @@ class AppChoicePicker<T> extends StatefulWidget {
final List<T> preferredValues;
final bool showDetails;
final bool wrap;
+ final bool compact;
@override
State<AppChoicePicker<T>> createState() => _AppChoicePickerState<T>();
@@ -97,7 +99,9 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
fontSize: 12,
fontWeight: FontWeight.w400,
);
- final height = widget.showDetails ? 58.0 : 44.0;
+ final height = widget.showDetails
+ ? (widget.compact ? 52.0 : 58.0)
+ : (widget.compact ? 40.0 : 44.0);
return LayoutBuilder(
builder: (context, constraints) {
@@ -119,18 +123,21 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
labelWidth = math.max(labelWidth, painter.width);
textHeight += painter.height + 2;
}
- controlHeight = math.max(controlHeight, textHeight + 20);
+ controlHeight = math.max(
+ controlHeight,
+ textHeight + (widget.compact ? 16 : 20),
+ );
// Long custom names truncate with their full text in the tooltip.
// Larger system text gets wider choices and additional rows.
final width =
math.min(labelWidth, scaler.scale(13) * 9) +
(option.leading == null ? 0 : 26) +
- 42;
+ (widget.compact ? 34 : 42);
minimumWidth = math.max(minimumWidth, width);
}
painter.dispose();
const gap = 8.0;
- const moreWidth = 44.0;
+ final moreWidth = widget.compact ? 40.0 : 44.0;
var visible = candidates;
if (!widget.wrap) {
var count = candidates.length;
@@ -213,7 +220,9 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
double height,
) {
final selected = widget.value == option.value;
- final foreground = selected
+ final foreground = widget.compact
+ ? AppPalette.textPrimary
+ : selected
? AppPalette.accentOnSurface
: AppPalette.textPrimary;
return Semantics(
@@ -227,13 +236,15 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
style:
TextButton.styleFrom(
foregroundColor: foreground,
- backgroundColor: selected
+ backgroundColor: widget.compact
+ ? (selected ? AppSurface.recess : Colors.transparent)
+ : selected
? AppPalette.accentOnSurface.withValues(alpha: .16)
: AppSurface.recess,
minimumSize: Size(0, height),
- padding: const EdgeInsets.symmetric(
+ padding: EdgeInsets.symmetric(
horizontal: 10,
- vertical: 10,
+ vertical: widget.compact ? 8 : 10,
),
textStyle: textStyle,
shape: RoundedRectangleBorder(
@@ -244,6 +255,10 @@ class _AppChoicePickerState<T> extends State<AppChoicePicker<T>> {
(states) => BorderSide(
color: states.contains(WidgetState.focused)
? AppPalette.accentOnSurface
+ : widget.compact
+ ? (selected
+ ? AppPalette.accentOnSurface.withValues(alpha: .6)
+ : AppGlass.hair)
: Colors.transparent,
),
),
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index e867ab7e9..bb274a0a2 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -10,15 +10,18 @@ class AgentPicker extends StatelessWidget {
required this.value,
required this.options,
required this.onChanged,
+ this.compact = false,
});
final String value;
final List<SelectOption<String>> options;
final ValueChanged<String> onChanged;
+ final bool compact;
static const quickAgents = ['codex', 'claude', 'cursor'];
@override
Widget build(BuildContext context) => AppChoicePicker<String>(
value: value,
+ compact: compact,
options: [
for (final option in options)
SelectOption(
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index a17035d5d..2a4e9bbd4 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -109,6 +109,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
final _actionFocus = FocusNode(debugLabel: 'Create or check agent');
final _repositoryFocus = FocusNode(debugLabel: 'Repository URL');
final _repository = TextEditingController();
+ final _advancedKey = GlobalKey();
+ final _choicesScroll = ScrollController();
_FolderSource _folderSource = _FolderSource.local;
String? _preparedFolder;
AgentCreationAttempt? _creation;
@@ -128,6 +130,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
/// it is shut for the case it exists to serve, and a drawer that remembers
/// being open is a drawer that is open for somebody who never asked.
bool _advancedOpen = false;
+ bool _machineChoicesOpen = false;
bool _submitting = false;
@override
@@ -136,6 +139,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_actionFocus.dispose();
_repositoryFocus.dispose();
_repository.dispose();
+ _choicesScroll.dispose();
super.dispose();
}
@@ -295,21 +299,8 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
/// older CLI has no recipe. Stated rather than silently offered, because the
/// create WILL fail and the person needs to fix that machine first.
- /// What the fold says about itself while it is shut.
- ///
- /// Two facts in the order they matter: which Codex home, and whether the
- /// prompts are on. It is the ONLY thing on screen reporting either once the
- /// drawer is closed, which is why it is built here rather than left to a
- /// string in the widget — the two have to stay in step.
- String _advancedState() {
- // THE PROFILE ONLY. It also carried "prompts on" / "prompts OFF", and that
- // was cut on the owner's call for the reason that decides most copy here:
- // it did not say what it meant. "Prompts" names a thing the sentence inside
- // the fold explains and the row outside it does not, so the row was asking
- // people to already know.
- if (_engine != 'codex') return '';
- return _codexProfile?.label ?? 'default profile';
- }
+ /// Surface a changed permission setting without repeating the default profile.
+ String _advancedState() => _bypassPermission ? 'Approvals off' : '';
/// This engine is absent and Harness would install it before launching.
bool get _willInstall {
@@ -503,6 +494,25 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
});
}
+ void _toggleAdvanced() {
+ setState(() => _advancedOpen = !_advancedOpen);
+ if (!_advancedOpen) return;
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted || !_advancedOpen) return;
+ final anchor = _advancedKey.currentContext;
+ if (anchor == null) return;
+ unawaited(
+ Scrollable.ensureVisible(
+ anchor,
+ duration: MediaQuery.disableAnimationsOf(context)
+ ? Duration.zero
+ : const Duration(milliseconds: 160),
+ curve: Curves.easeOut,
+ ),
+ );
+ });
+ }
+
@override
Widget build(BuildContext context) {
// Reads colour tokens, and lives in an Overlay — a top-down rebuild never
@@ -537,40 +547,63 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
PaneResizeAxis.y => 'New Agent below',
null => 'New Agent',
}),
- titleTextStyle: Theme.of(context).textTheme.titleMedium,
+ titleTextStyle: Theme.of(context).textTheme.headlineSmall?.copyWith(
+ fontSize: 24,
+ fontWeight: grid.AppFont.semibold,
+ color: grid.AppPalette.textPrimary,
+ ),
+ titlePadding: const EdgeInsets.fromLTRB(28, 28, 28, 0),
+ contentPadding: const EdgeInsets.fromLTRB(28, 24, 28, 16),
+ actionsPadding: const EdgeInsets.fromLTRB(28, 0, 28, 24),
+ actionsOverflowButtonSpacing: 8,
content: SizedBox(
width: _dialogWidth,
- child: SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- AbsorbPointer(
- absorbing: _choicesLocked,
- child: ExcludeFocus(
- excluding: _choicesLocked,
- child: _choices(bypassFlag),
+ child: Scrollbar(
+ controller: _choicesScroll,
+ thumbVisibility: true,
+ thickness: 4,
+ radius: const Radius.circular(2),
+ child: SingleChildScrollView(
+ controller: _choicesScroll,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ AbsorbPointer(
+ absorbing: _choicesLocked,
+ child: ExcludeFocus(
+ excluding: _choicesLocked,
+ child: _choices(bypassFlag),
+ ),
),
- ),
- if (_error != null) ...[
- const SizedBox(height: _gapBlock),
- Semantics(
- liveRegion: true,
- child: Text(
- _error!,
- style: Theme.of(context).textTheme.bodySmall?.copyWith(
- color: _confirmationPending
- ? grid.AppPalette.textSecondary
- : Theme.of(context).colorScheme.error,
+ if (_error != null) ...[
+ const SizedBox(height: _gapBlock),
+ Semantics(
+ liveRegion: true,
+ child: Text(
+ _error!,
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(
+ color: _confirmationPending
+ ? grid.AppPalette.textSecondary
+ : Theme.of(context).colorScheme.error,
+ ),
),
),
- ),
+ ],
],
- ],
+ ),
),
),
),
actions: [
+ if (!_confirmationPending && !widget.offerBackToSearch)
+ TextButton(
+ onPressed: _submitting ? null : () => Navigator.of(context).pop(),
+ style: TextButton.styleFrom(
+ foregroundColor: grid.AppPalette.textSecondary,
+ ),
+ child: const Text('Cancel'),
+ ),
if (_confirmationPending || widget.offerBackToSearch)
TextButton(
onPressed: _submitting
@@ -602,6 +635,10 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
focusNode: _actionFocus,
onPressed: canCreate ? _submit : null,
style: FilledButton.styleFrom(
+ minimumSize: const Size(136, 42),
+ padding: const EdgeInsets.symmetric(horizontal: 22, vertical: 12),
+ backgroundColor: grid.AppPalette.swarmAccent,
+ foregroundColor: grid.AppPalette.swarmTabBar,
shape: const StadiumBorder(),
disabledForegroundColor: _submitting
? grid.AppPalette.textPrimary
@@ -630,133 +667,20 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
],
),
)
- : Text(_confirmationPending ? 'Check status' : 'New Agent'),
+ : Text(_confirmationPending ? 'Check status' : 'Create Agent'),
),
],
);
}
- /// The left column: what the user actually decides.
Widget _choices(String? bypassFlag) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- if (widget.notifier.machineStates.length != 1 ||
- !_machineIsThisComputer ||
- widget.notifier.machineStates[_machineId]?.nodeOnline == false ||
- widget.notifier.machineStates[_machineId]?.needsLink == true) ...[
- const FieldLabel('Machine'),
- AppChoicePicker<String>(
- key: const Key('new-agent-machine-field'),
- value: _machineId,
- moreKey: const Key('new-agent-machine-more'),
- 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,
- ],
- options: [
- for (final machine in widget.notifier.machineStates.values)
- SelectOption(
- value: machine.machine.machineId,
- label: machine.machine.displayName,
- detail: _machineDetail(machine),
- leading: () => Icon(
- machine.isLocalMachine
- ? LucideIcons.laptop
- : LucideIcons.monitor,
- size: 18,
- ),
- ),
- ],
- onChanged: (id) {
- if (id == _machineId || _choicesLocked) return;
- setState(() {
- _machineRevision++;
- _machineId = id;
- _folder = null;
- _preparedFolder = null;
- _codexProfile = null;
- _codexProfilesBusy = true;
- _error = null;
- });
- unawaited(_probeEngines());
- },
- ),
- const SizedBox(height: _gapField),
- ],
- 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,
- ),
- 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(
+ compact: true,
value: _engine,
options: [
for (final identity in allEngines)
@@ -826,19 +750,78 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
],
),
],
- // THE FOLD. What is behind it is what most people never touch: a Codex
- // home to run under, and the flag that turns the approvals off. Leaving
- // them in the main column made this a four-question dialog to do a
- // two-question job.
- //
- // The row REPORTS ITS OWN STATE on the right, and that is what makes
- // folding them away safe rather than merely tidy. A drawer that hides
- // what it is set to is a drawer people open every time to check.
+ const SizedBox(height: _gapField),
+ _projectHeader(),
+ 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)
+ ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 52),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ 'Creates a new folder in ~/Harness Projects.',
+ 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: InputDecoration(
+ hintText: 'GitHub URL or owner/repository',
+ filled: true,
+ fillColor: grid.AppSurface.recess,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 14,
+ vertical: 16,
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ borderSide: BorderSide.none,
+ ),
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(grid.AppControl.radius),
+ borderSide: BorderSide(color: grid.AppPalette.accentOnSurface),
+ ),
+ ),
+ 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),
+ _machineSelector(),
+ // Profiles keep loading while collapsed; creation still waits for them.
const SizedBox(height: _gapBlock),
_Advanced(
+ key: _advancedKey,
open: _advancedOpen,
state: _advancedState(),
- onToggle: () => setState(() => _advancedOpen = !_advancedOpen),
+ onToggle: _toggleAdvanced,
children: [
if (_engineCheckFailed) ...[
Text(
@@ -908,10 +891,191 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
],
);
}
+
+ Widget _projectHeader() => SizedBox(
+ width: double.infinity,
+ child: Wrap(
+ alignment: WrapAlignment.spaceBetween,
+ crossAxisAlignment: WrapCrossAlignment.center,
+ runSpacing: 8,
+ children: [
+ Text(
+ 'Project',
+ style: Theme.of(context).textTheme.labelMedium
+ ?.copyWith(color: grid.AppPalette.textSecondary),
+ ),
+ DecoratedBox(
+ decoration: BoxDecoration(
+ color: grid.AppSurface.recess,
+ borderRadius: BorderRadius.circular(10),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(3),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ for (final (source, label) in [
+ (_FolderSource.newProject, 'New'),
+ (_FolderSource.local, 'Local'),
+ (_FolderSource.remote, 'Remote'),
+ ])
+ Semantics(
+ selected: _folderSource == source,
+ inMutuallyExclusiveGroup: true,
+ child: TextButton(
+ key: ValueKey('new-agent-folder-${source.name}'),
+ onPressed: () => _selectFolderSource(source),
+ style: TextButton.styleFrom(
+ minimumSize: const Size(60, 30),
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 7,
+ ),
+ foregroundColor: _folderSource == source
+ ? grid.AppPalette.textPrimary
+ : grid.AppPalette.textSecondary,
+ backgroundColor: _folderSource == source
+ ? grid.AppSurface.recessHover
+ : Colors.transparent,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(7),
+ ),
+ ),
+ child: Text(label),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+
+ Widget _machineSelector() {
+ final machine = widget.notifier.stateOf(_machineId);
+ final status = machine?.nodeOnline == false
+ ? 'Offline'
+ : machine?.needsLink == true
+ ? 'Link required'
+ : null;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ 'Run on',
+ style: Theme.of(context).textTheme.bodySmall
+ ?.copyWith(color: grid.AppPalette.textSecondary),
+ ),
+ const SizedBox(width: 10),
+ Flexible(
+ child: Tooltip(
+ message: 'Choose machine',
+ child: TextButton(
+ key: const Key('new-agent-machine-toggle'),
+ onPressed: () => setState(
+ () => _machineChoicesOpen = !_machineChoicesOpen,
+ ),
+ style: TextButton.styleFrom(
+ foregroundColor: grid.AppPalette.textPrimary,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8,
+ vertical: 6,
+ ),
+ minimumSize: const Size(0, 32),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ _machineIsThisComputer
+ ? LucideIcons.laptop
+ : LucideIcons.monitor,
+ size: 16,
+ ),
+ const SizedBox(width: 8),
+ Flexible(
+ child: Text(
+ _machineName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ ),
+ if (status != null) ...[
+ const SizedBox(width: 8),
+ Text(
+ status,
+ style: Theme.of(context).textTheme.bodySmall
+ ?.copyWith(color: grid.AppPalette.textSecondary),
+ ),
+ ],
+ const SizedBox(width: 6),
+ Icon(
+ _machineChoicesOpen
+ ? Icons.expand_less
+ : Icons.expand_more,
+ size: 16,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ if (_machineChoicesOpen) ...[
+ const SizedBox(height: 8),
+ _machineOptions(),
+ ],
+ ],
+ );
+ }
+
+ Widget _machineOptions() => AppChoicePicker<String>(
+ key: const Key('new-agent-machine-field'),
+ value: _machineId,
+ moreKey: const Key('new-agent-machine-more'),
+ moreLabel: 'More machines',
+ optionKey: (id) => ValueKey('new-agent-machine-$id'),
+ showDetails: true,
+ compact: true,
+ wrap: false,
+ preferredValues: [
+ for (final machine in widget.notifier.machineStates.values)
+ if (machine.isLocalMachine) machine.machine.machineId,
+ ],
+ options: [
+ for (final machine in widget.notifier.machineStates.values)
+ SelectOption(
+ value: machine.machine.machineId,
+ label: machine.machine.displayName,
+ detail: _machineDetail(machine),
+ leading: () => Icon(
+ machine.isLocalMachine ? LucideIcons.laptop : LucideIcons.monitor,
+ size: 18,
+ ),
+ ),
+ ],
+ onChanged: (id) {
+ if (id == _machineId || _choicesLocked) return;
+ setState(() {
+ _machineRevision++;
+ _machineId = id;
+ _folder = null;
+ _preparedFolder = null;
+ _codexProfile = null;
+ _codexProfilesBusy = true;
+ _error = null;
+ });
+ unawaited(_probeEngines());
+ },
+ );
}
-/// Room for three readable machine choices and the overflow control in one row.
-const double _dialogWidth = 760;
+/// A focused creation form; machine details expand only when requested.
+const double _dialogWidth = 600;
/// A path shortened from its HEAD, so the leaf survives.
///
@@ -981,7 +1145,7 @@ const double _gapTight = 4;
const double _gapBlock = 12;
/// One field and the next, down the choices column.
-const double _gapField = 16;
+const double _gapField = 24;
/// The folder control: one target, not a text box with a button beside it.
///
@@ -1003,6 +1167,7 @@ const double _gapField = 16;
/// already what this app gives that flag wherever else it appears.
class _Advanced extends StatelessWidget {
const _Advanced({
+ super.key,
required this.open,
required this.state,
required this.onToggle,
@@ -1024,7 +1189,6 @@ class _Advanced extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
- Divider(height: 1, color: grid.AppGlass.hair),
InkWell(
key: const Key('new-agent-advanced'),
onTap: onToggle,
@@ -1160,11 +1324,14 @@ class _FolderControl extends StatelessWidget {
duration: grid.AppMotion.hover,
curve: grid.AppMotion.curve,
constraints: BoxConstraints(
- minHeight: grid.AppControl.heightFieldScaled,
+ minHeight: grid.AppControl.heightFieldScaled.clamp(
+ 52.0,
+ double.infinity,
+ ),
),
// The select field's own padding, so the two controls stacked in
// this column share one left edge and one right edge.
- padding: const EdgeInsets.only(left: 10, right: 8),
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
decoration: BoxDecoration(
color: (hovered || focused) && !picking
? grid.AppSurface.recessHover
@@ -1180,8 +1347,8 @@ class _FolderControl extends StatelessWidget {
children: [
Icon(
Icons.folder_outlined,
- size: grid.AppControl.iconSize,
- color: grid.AppPalette.textFaint,
+ size: 20,
+ color: grid.AppPalette.textSecondary,
),
const SizedBox(width: 8),
Expanded(
@@ -1216,7 +1383,7 @@ class _FolderControl extends StatelessWidget {
style: chosen != null && !picking
? _mono(color: grid.AppPalette.textPrimary)
: theme.textTheme.labelMedium?.copyWith(
- color: grid.AppPalette.textFaint,
+ color: grid.AppPalette.textSecondary,
),
),
),
@@ -1243,8 +1410,7 @@ class _FolderControl extends StatelessWidget {
if (!machineIsThisComputer) ...[
const SizedBox(height: _gapTight),
Text(
- 'This agent will run on $machineName. Its folders are browsed '
- 'through the remote CLI.',
+ 'Choose a folder on $machineName.',
style: theme.textTheme.bodySmall,
),
],
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index c0966c8ef..92041dcfb 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -120,7 +120,7 @@ void main() {
}
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.text('Cancel'), findsNothing);
+ expect(find.text('Cancel'), findsOneWidget);
expect(find.text('Back to Search'), findsNothing);
if (dismissal == 'outside') {
await tester.tapAt(const Offset(12, 72));
@@ -627,7 +627,7 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.text('/work'), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'New Agent'), findsNothing);
+ expect(find.widgetWithText(FilledButton, 'Create 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 ee42067a8..cd8c39475 100644
--- a/desktop/test/agent_events_test.dart
+++ b/desktop/test/agent_events_test.dart
@@ -172,7 +172,7 @@ void main() {
await tester.pumpAndSettle();
await tester.tap(find.widgetWithText(FilledButton, 'Select this folder'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
}
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 8f309c821..741f2b461 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -160,10 +160,12 @@ void main() {
expect(node.hasPrimaryFocus, isTrue);
}
- await tabTo(
- Focus.of(tester.element(find.text('Workshop machine'))),
- back: true,
- );
+ final machineToggle = find.byKey(const Key('new-agent-machine-toggle'));
+ await tabTo(Focus.of(tester.element(find.text('My computer').last)));
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pumpAndSettle();
+ expect(machineToggle, findsOneWidget);
+ await tabTo(Focus.of(tester.element(find.text('Workshop machine'))));
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
expect(
@@ -343,6 +345,8 @@ void main() {
await tester.pump();
expect(picker.opened, 1);
expect(find.text('/work/my-project'), findsOneWidget);
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pump();
await tester.tap(find.byKey(const ValueKey('new-agent-machine-m')));
await tester.pump();
expect(find.text('/work/my-project'), findsOneWidget);
@@ -516,6 +520,8 @@ void main() {
expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('/work/existing'), findsNothing);
expect(find.text('Choose a folder…'), findsOneWidget);
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pump();
final machineField = tester.widget<AppChoicePicker<String>>(
find.byKey(const Key('new-agent-machine-field')),
);
@@ -539,7 +545,7 @@ void main() {
expect(app.panes, [pane]);
expect(app.launches, isEmpty);
expect(app.input, isEmpty);
- expect(find.text('Cancel'), findsNothing);
+ expect(find.text('Cancel'), findsOneWidget);
expect(find.text('Back to Search'), findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
@@ -593,7 +599,7 @@ void main() {
);
expect(submit.focusNode!.hasPrimaryFocus, isTrue);
expect(app.launches, isEmpty);
- expect(find.text('Cancel'), findsNothing);
+ expect(find.text('Cancel'), findsOneWidget);
expect(find.text('Back to Search'), findsNothing);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
@@ -689,8 +695,8 @@ void main() {
expect(engine.value, 'codex');
expect(find.byKey(const Key('new-agent-machine-field')), findsNothing);
expect(
- tester.getTopLeft(find.text('Working folder')).dy,
- lessThan(tester.getTopLeft(find.text('Agent')).dy),
+ tester.getTopLeft(find.text('Agent')).dy,
+ lessThan(tester.getTopLeft(find.text('Project')).dy),
);
expect(picker.opened, 0);
await tester.tap(find.byKey(const Key('new-agent-folder')));
diff --git a/desktop/test/new_agent_choices_layout_test.dart b/desktop/test/new_agent_choices_layout_test.dart
index b1490bebc..bc6b9a5a7 100644
--- a/desktop/test/new_agent_choices_layout_test.dart
+++ b/desktop/test/new_agent_choices_layout_test.dart
@@ -142,6 +142,20 @@ void main() {
}
await capture('initial');
+ await tester.tap(
+ find.byKey(const ValueKey('new-agent-folder-newProject')),
+ );
+ await tester.pumpAndSettle();
+ await capture('new-project');
+ await tester.tap(find.byKey(const ValueKey('new-agent-folder-remote')));
+ await tester.pumpAndSettle();
+ await capture('repository');
+ await tester.tap(find.byKey(const ValueKey('new-agent-folder-local')));
+ await tester.pumpAndSettle();
+ expect(find.byKey(const Key('new-agent-machine-field')), findsNothing);
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pumpAndSettle();
+ await capture('machines');
for (final label in [
'iMac - Office',
if (scale == 1) ...['M2', 'T480 - Omarchy'],
@@ -151,7 +165,7 @@ void main() {
]) {
expect(
tester
- .renderObject<RenderParagraph>(find.text(label))
+ .renderObject<RenderParagraph>(find.text(label).last)
.didExceedMaxLines,
isFalse,
reason: label,
diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dart
index bdf7ff172..4e8b0e81e 100644
--- a/desktop/test/new_agent_codex_profile_test.dart
+++ b/desktop/test/new_agent_codex_profile_test.dart
@@ -189,6 +189,7 @@ void main() {
await tester.tap(find.text('open'));
await tester.pumpAndSettle();
if (!revealOptions) return n;
+ await tester.ensureVisible(find.byKey(const Key('new-agent-engine-field')));
await tester.tap(find.byKey(const Key('new-agent-engine-field')));
await tester.pumpAndSettle();
await tester.tap(find.text('Codex').last);
@@ -249,9 +250,10 @@ void main() {
);
expect(find.text('Codex profile'), findsOneWidget);
expect(find.text('Link a profile folder…'), findsOneWidget);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -270,9 +272,10 @@ void main() {
expect(find.text('Codex profile'), findsOneWidget);
expectProfile(tester, 'work-login');
expect(find.text('Link a profile folder…'), findsOneWidget);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/custom/work-login');
expect(tester.takeException(), isNull);
@@ -286,19 +289,15 @@ void main() {
local: false,
initialPaths: const ['/custom/work-login'],
);
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pump();
final machineField = tester.widget<AppChoicePicker<String>>(
find.byKey(const Key('new-agent-machine-field')),
);
expect(machineField.options.single.label, 'This Mac');
expect(machineField.options.single.detail, 'Remote');
- expect(find.widgetWithText(FilledButton, 'New Agent'), findsOneWidget);
- expect(
- find.text(
- 'This agent will run on This Mac. Its folders are browsed through '
- 'the remote CLI.',
- ),
- findsOneWidget,
- );
+ expect(find.widgetWithText(FilledButton, 'Create Agent'), findsOneWidget);
+ expect(find.text('Choose a folder on This Mac.'), findsOneWidget);
expect(
find.byKey(const Key('new-agent-codex-profile-field')),
findsOneWidget,
@@ -351,7 +350,7 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
- final createButton = find.widgetWithText(FilledButton, 'New Agent');
+ final createButton = find.widgetWithText(FilledButton, 'Create Agent');
expect(tester.widget<FilledButton>(createButton).onPressed, isNull);
expect(folderFocus.hasPrimaryFocus, isTrue);
expect(notifier.calls, isEmpty);
@@ -387,9 +386,10 @@ void main() {
await tester.tap(find.text('codex1').last);
await tester.pumpAndSettle();
expectProfile(tester, 'codex1');
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], '/accounts/codex1');
});
@@ -411,9 +411,10 @@ void main() {
findsOneWidget,
);
expectProfile(tester, 'Default profile');
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
});
@@ -424,9 +425,10 @@ void main() {
final notifier = await open(tester);
await selectSecond(tester);
expectProfile(tester, 'codex2');
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls, [
{'engine': 'codex', 'codexHome': '/accounts/codex2', 'folder': '/work'},
@@ -494,6 +496,7 @@ void main() {
testWidgets('changing engines clears the selected account', (tester) async {
final notifier = await open(tester);
await selectSecond(tester);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-engine-field')));
await tester.tap(find.byKey(const Key('new-agent-engine-field')));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('Claude Code').last);
@@ -504,9 +507,10 @@ void main() {
find.byKey(const Key('new-agent-codex-profile-field')),
findsNothing,
);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(notifier.calls.single['codexHome'], isNull);
expect(notifier.calls.single['engine'], 'claude');
@@ -524,9 +528,10 @@ void main() {
find.text('Update Harness CLI on This Mac to choose a Codex profile.'),
findsOneWidget,
);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-folder')));
await tester.tap(find.text('Browse…'));
await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create 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 0a6d762b9..2b3ac0239 100644
--- a/desktop/test/new_agent_engine_check_test.dart
+++ b/desktop/test/new_agent_engine_check_test.dart
@@ -96,6 +96,7 @@ void main() {
findsOneWidget,
);
expect(find.textContaining('uses an older Harness CLI'), findsNothing);
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
await tester.tap(find.byKey(const Key('new-agent-advanced')));
await tester.pump();
expect(
@@ -135,6 +136,7 @@ void main() {
app: app,
);
await tester.tap(find.byKey(const ValueKey('new-agent-quick-codex')));
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
await tester.tap(find.byKey(const Key('new-agent-advanced')));
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('Bypass permission prompts'));
@@ -186,7 +188,7 @@ void main() {
findsOneWidget,
);
expect(app.launches, isEmpty);
- await tester.tap(find.widgetWithText(FilledButton, 'New Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pump();
expect(app.launches.single, {
'machine': 'machine-1',
@@ -216,9 +218,12 @@ void main() {
final pending = app.pending['machine-1'] = Completer<void>();
await tester.tap(find.byKey(const Key('new-agent-retry-check')));
await tester.pump();
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pump();
await tester.tap(find.byKey(const ValueKey('new-agent-machine-machine-2')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('new-agent-quick-codex')));
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
await tester.tap(find.byKey(const Key('new-agent-advanced')));
await tester.pumpAndSettle();
expect(
diff --git a/desktop/test/remote_folder_picker_test.dart b/desktop/test/remote_folder_picker_test.dart
index b6672c6cf..6709172ae 100644
--- a/desktop/test/remote_folder_picker_test.dart
+++ b/desktop/test/remote_folder_picker_test.dart
@@ -416,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 Agent'));
+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
await tester.pumpAndSettle();
expect(app.launches, [
(machine: 'remote', engine: 'codex', folder: '/home/dev/target'),
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index 95e38c685..06bbb07f3 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -155,12 +155,12 @@ void main() {
expect(
find.descendant(
of: find.byType(AlertDialog),
- matching: find.widgetWithText(FilledButton, 'New Agent'),
+ matching: find.widgetWithText(FilledButton, 'Create Agent'),
),
findsOneWidget,
);
expect(find.text('Back to Search'), findsNothing);
- expect(find.text('Cancel'), findsNothing);
+ expect(find.text('Cancel'), findsOneWidget);
expect(_results, findsNothing);
await tester.tapAt(const Offset(20, 200));
await tester.pump(const Duration(milliseconds: 200));
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index f65578fad..144ff57c1 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -595,6 +595,8 @@ void main() {
await tester.pump(const Duration(milliseconds: 300));
await tester.tap(find.text('Browse…'));
await tester.pump();
+ await tester.tap(find.byKey(const Key('new-agent-machine-toggle')));
+ await tester.pump();
final field = find.byKey(const Key('new-agent-machine-field'));
tester.widget<AppChoicePicker<String>>(field).onChanged('b');
await tester.pump();
diff --git a/desktop/test/swarm_picker_activation_test.dart b/desktop/test/swarm_picker_activation_test.dart
index a6304c7a9..b5ddb7853 100644
--- a/desktop/test/swarm_picker_activation_test.dart
+++ b/desktop/test/swarm_picker_activation_test.dart
@@ -28,7 +28,7 @@ void main() {
expect(fieldRect.right, panelRect.right - 28);
await chord(tester, LogicalKeyboardKey.keyN);
expect(find.byType(AlertDialog), findsOneWidget);
- expect(find.widgetWithText(FilledButton, 'New Agent'), findsOneWidget);
+ expect(find.widgetWithText(FilledButton, 'Create Agent'), findsOneWidget);
expect(results, findsNothing);
expect(find.text('Back to Search'), findsNothing);
expect(app.panes, [pane]);
diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.md
index d962994df..c0c7c7eaf 100644
--- a/docs/harness-agent-first-tabs.md
+++ b/docs/harness-agent-first-tabs.md
@@ -72,13 +72,18 @@ the preview without taking typing focus. Page Up/Down scrolls the preview while
retaining the query and selection. Native menus and the titlebar retain normal
colors while modal actions are blocked.
-New Agent uses the wide direct-choice dialog: Machine, Working folder and Agent,
-with up to three machine/engine choices and an overflow control. A selected
-overflow choice replaces the third visible choice. **New / Local / Remote** mean
+New Agent uses a focused 600-pixel form: compact **Agent** choices first,
+**Project** in the center, then a quiet **Run on** machine disclosure. The
+machine row expands to direct choices when requested. Machine and agent pickers
+show up to three choices and an overflow control; a selected overflow choice
+replaces the third visible choice. **New / Local / Remote** are small project
+tabs and mean
create a folder, choose an existing folder and clone a GitHub repository onto
the selected machine. Local is initially selected. New and Remote prepare a
-unique folder under `~/Harness Projects` only on submission. Advanced retains
-profiles and permissions. A late saved preference equal to the selected engine
+unique folder under `~/Harness Projects` only on submission. The footer keeps
+**Cancel / Create Agent** accessible while tall content scrolls. Advanced retains
+profiles and permissions, hides the default profile summary, and scrolls its
+controls into view when opened. A late saved preference equal to the selected engine
preserves loaded profile readiness. Failure keeps the choices and prepared folder;
an uncertain launch retains its receipt and offers **Check status** and **Close**
without cloning or starting again. Success focuses the new agent.
diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.md
index dabfd39f2..8fc3aac27 100644
--- a/docs/harness-v2-handoff.md
+++ b/docs/harness-v2-handoff.md
@@ -34,7 +34,19 @@ user for a benchmark window.
## Current product contract
-### Latest: compact customization button on wallpapers
+### Latest: focused New Agent form
+
+The creation dialog is now 600 pixels wide with compact Agent choices, Project
+tabs, a prominent folder/repository control, and a quiet Run on machine row.
+Machine choices expand on demand. Advanced hides the default profile summary;
+opening it scrolls its controls into view. Cancel and Create Agent remain in
+the footer, with existing local/remote folder selection, profile readiness,
+creation recovery and split targeting preserved. Final checks and captures are
+in `/private/tmp/harness-new-agent-refined-final-tests.log` and
+`/private/tmp/harness-new-agent-refined-final-captures`; palette/large-text
+captures are in `/private/tmp/harness-new-agent-refined-palettes`.
+
+### Compact customization button — pushed 98e8056
Default retains the **Customize Harness** pill. Any wallpaper switches it to a
40-pixel circular pencil button, keeping the tooltip and accessible label.
@@ -312,8 +324,8 @@ are:
both actions participate in the configurable Search keymap.
- The Harness application menu includes **Check for Updates…**, using the
existing manual update-check dialog, directly above Flash Firmware.
-- The dedicated **New Agent** form keeps Machine, Working folder, Agent and
- Advanced choices. Pending creation cannot be dismissed accidentally; uncertain
+- The dedicated **New Agent** form shows Agent, Project, Run on and Advanced.
+ Machine details expand on request. Pending creation cannot be dismissed accidentally; uncertain
results retain Close and Check status without creating again. Folder choosers
preserve the form, and successful creation focuses the new pane.
- A single-agent tab/search/history entry uses that agent's engine icon;