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.

Fit the harness choices to the redesigned New Agent dialog

dee77ed261ed163
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index 2ed090c9e..1ec29913e 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -19,12 +19,13 @@ class AgentPicker extends StatelessWidget {
final ValueChanged<String> onChanged;
final bool compact;
final Size? tileSize;
- /// The one-click choices: the two engines most people run, then the two
- /// first-party domain harnesses. In the tile layout the third tile follows
- /// the selection, so a harness is one tap away without crowding the row.
+ /// The preferred order: the three engines the tiles show, then the two
+ /// first-party domain harnesses, first in More; a chosen one is what the
+ /// More tile then shows.
static const quickAgents = [
'codex',
'claude',
+ 'opencode',
'autonomous/circuit',
'autonomous/workshop',
];
diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dart
index 68a312dda..62b6deb4f 100644
--- a/desktop/lib/widgets/new_agent_dialog.dart
+++ b/desktop/lib/widgets/new_agent_dialog.dart
@@ -177,7 +177,6 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
// actionable control once the route and its focus tree are mounted.
_folderFocus.requestFocus();
unawaited(_probeEngines(initialProbe: widget.initialEngineProbe));
- unawaited(_probeHarnesses());
unawaited(_loadAgentPreference());
}
});
@@ -191,9 +190,11 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
knownHarnesses.any((identity) => identity.id == id) ||
_harness(id) != null);
- /// Which harnesses this machine has or could install — asked on every open,
- /// for the reason `_probeEngines` gives: an install this very dialog starts
- /// is what makes the stored answer stale.
+ /// Which harnesses this machine has or could install — asked when a harness
+ /// is chosen, not on open: most creates never involve one, and the answer
+ /// costs the machine a request. Forced, for the reason `_probeEngines`
+ /// gives: an install this very dialog starts is what makes a stored answer
+ /// stale.
Future<void> _probeHarnesses() =>
widget.notifier.probeDsh(_machineId, force: true);
@@ -408,7 +409,12 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
});
// A harness the machine does not have yet is installed FIRST, as its own
// step with its own words: minutes of clone and toolchain under a button
- // that said "Creating agent…" would read as a create that hung.
+ // that said "Creating agent…" would read as a create that hung. The
+ // machine's catalog decides "has it"; wait for its answer if it is out.
+ if (harness != null && !_confirmationPending && _harness(harness) == null) {
+ await _probeHarnesses();
+ if (!mounted) return;
+ }
if (harness != null &&
!_confirmationPending &&
_willInstallHarness(harness)) {
@@ -768,6 +774,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_bypassPermission = false;
}
});
+ if (isHarnessId(value)) unawaited(_probeHarnesses());
},
),
if (!_confirmationPending && _installStatus != null) ...[
@@ -1010,7 +1017,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {
_error = null;
});
unawaited(_probeEngines());
- unawaited(_probeHarnesses());
+ if (_engineIsHarness) unawaited(_probeHarnesses());
},
);
}
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 4396f6a95..d274943ef 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -16,7 +16,6 @@ import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/state/swarm_catalog.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/terminal/terminal_session.dart';
-import 'package:harness/widgets/agent_picker.dart';
import 'package:xterm/xterm.dart';
import 'swarm_screen_test.dart' show mount, terminal;
diff --git a/desktop/test/new_agent_dsh_test.dart b/desktop/test/new_agent_dsh_test.dart
index 8bc78c1c5..44d6bd865 100644
--- a/desktop/test/new_agent_dsh_test.dart
+++ b/desktop/test/new_agent_dsh_test.dart
@@ -11,6 +11,7 @@ import 'package:harness/core/config.dart';
import 'package:harness/core/dsh_catalog.dart';
import 'package:harness/core/engine_availability.dart';
import 'package:harness/core/models.dart';
+import 'package:harness/core/project_folder.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/shared/widgets/app_select_field.dart';
@@ -92,6 +93,7 @@ class _Notifier extends AppNotifier {
bool bypassPermission = false,
String? codexHome,
String? dsh,
+ ProjectFolderRequest? projectFolder,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
@@ -161,11 +163,31 @@ void main() {
);
await tester.tap(find.text('open'));
await tester.pumpAndSettle();
- await tester.tap(find.text('Browse…'));
+ // A new project needs no folder: the daemon prepares one. That keeps the
+ // native folder panel out of these tests, which are about the harness.
+ await tester.tap(find.byKey(const ValueKey('new-agent-folder-newProject')));
await tester.pumpAndSettle();
return notifier;
}
+ /// The harnesses live in More, first after the three engines the tiles
+ /// show; a chosen one is what the More tile then shows.
+ Future<void> pick(WidgetTester tester, String label) async {
+ 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(label).last);
+ await tester.pumpAndSettle();
+ await tester.tap(find.text(label).last);
+ await tester.pumpAndSettle();
+ }
+
+ Future<void> create(WidgetTester tester) async {
+ await tester.ensureVisible(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));
+ await tester.pump();
+ }
+
String engineField(WidgetTester tester) => tester
.widget<AppSelectField<String>>(
find.byKey(const Key('new-agent-engine-field')),
@@ -180,36 +202,39 @@ void main() {
seed: (state) =>
state.dsh.replace([_circuit.copyWith(installed: true)]),
);
- expect(app.harnessProbes, 1, reason: 'asked on open, like the engines');
- await tester.tap(
- find.byKey(const ValueKey('new-agent-quick-autonomous/circuit')),
- );
- await tester.pumpAndSettle();
+ expect(app.harnessProbes, 0, reason: 'not asked until a harness is chosen');
+ await pick(tester, 'Circuit');
+ expect(app.harnessProbes, 1);
expect(engineField(tester), 'autonomous/circuit');
- expect(find.text('Runs on Claude Code'), findsOneWidget);
- // Installed, so nothing to announce.
- expect(find.textContaining('Harness will install'), findsNothing);
+ // Chosen, it is what the More tile shows.
+ expect(
+ find.descendant(
+ of: find.byKey(const Key('new-agent-engine-field')),
+ matching: find.text('Circuit'),
+ ),
+ findsOneWidget,
+ );
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
await tester.tap(find.byKey(const Key('new-agent-advanced')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('new-agent-runs-on')), findsOneWidget);
expect(
- find.textContaining('Runs on Claude Code. The harness brings'),
+ find.textContaining('Runs on Claude Code.'),
findsOneWidget,
);
// Its base engine's bypass flag is the one offered: a harness has no
// flag of its own, and without the base's it would say "Managed by".
- await tester.ensureVisible(find.text('Bypass permission prompts'));
- expect(find.text('Bypass permission prompts'), findsOneWidget);
+ await tester.ensureVisible(find.text('Bypass approvals'));
+ expect(find.text('Bypass approvals'), findsOneWidget);
expect(find.textContaining('Managed by'), findsNothing);
- await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
- await tester.pump();
+ await create(tester);
expect(app.installs, isEmpty);
expect(app.launches.single, {
'machine': 'machine-1',
'engine': 'claude',
'dsh': 'autonomous/circuit',
- 'folder': _folder,
+ 'folder': '',
'bypass': false,
});
expect(tester.takeException(), isNull);
@@ -224,18 +249,10 @@ void main() {
seed: (state) => state.dsh.replace([_circuit]),
);
app.pendingInstall = Completer<String?>();
- await tester.tap(
- find.byKey(const ValueKey('new-agent-quick-autonomous/circuit')),
- );
- await tester.pumpAndSettle();
- expect(
- find.text(
- 'Harness will install Circuit on harness-remote-box before starting.',
- ),
- findsOneWidget,
- );
- await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
- await tester.pump();
+ await pick(tester, 'Circuit');
+ // Quiet until Create: the install is a step of the create, not a warning.
+ expect(find.textContaining('Installing'), findsNothing);
+ await create(tester);
expect(app.installs, ['autonomous/circuit']);
expect(
app.launches,
@@ -263,19 +280,15 @@ void main() {
seed: (state) => state.dsh.replace([_circuit]),
);
app.pendingInstall = Completer<String?>();
- await tester.tap(
- find.byKey(const ValueKey('new-agent-quick-autonomous/circuit')),
- );
- await tester.pumpAndSettle();
- await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
- await tester.pump();
+ await pick(tester, 'Circuit');
+ await create(tester);
app.pendingInstall!.complete('kicad-cli is not on harness-remote-box');
await tester.pump();
await tester.pump();
expect(app.launches, isEmpty);
expect(find.text('kicad-cli is not on harness-remote-box'), findsOneWidget);
// Retryable: the button is back.
- expect(find.widgetWithText(FilledButton, 'Create Agent'), findsOneWidget);
+ expect(find.widgetWithText(FilledButton, 'Create'), findsOneWidget);
expect(tester.takeException(), isNull);
});
@@ -283,15 +296,14 @@ void main() {
'a machine that has not answered offers the tiles without a verdict',
(tester) async {
final app = await open(tester, seed: (_) {});
- await tester.tap(
- find.byKey(const ValueKey('new-agent-quick-autonomous/workshop')),
- );
- await tester.pumpAndSettle();
+ await pick(tester, 'Workshop');
expect(engineField(tester), 'autonomous/workshop');
- expect(find.text('Runs on Codex'), findsOneWidget);
- expect(find.textContaining('Harness will install'), findsNothing);
- await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));
- await tester.pump();
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
+ await tester.tap(find.byKey(const Key('new-agent-advanced')));
+ await tester.pumpAndSettle();
+ expect(find.textContaining('Runs on Codex.'), findsOneWidget);
+ await create(tester);
+ // The machine never answered, so nothing can be called missing.
expect(app.installs, isEmpty);
expect(app.launches.single['engine'], 'codex');
expect(app.launches.single['dsh'], 'autonomous/workshop');
@@ -313,24 +325,22 @@ void main() {
),
]),
);
- await tester.tap(find.byTooltip('More agents'));
+ 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();
// Far down a list of fourteen engines: scrolled into view first, or the
// tap lands on the menu's edge and quietly selects nothing.
- await tester.ensureVisible(find.text('Robot Arm'));
+ await tester.ensureVisible(find.text('Robot Arm').last);
await tester.pumpAndSettle();
- expect(find.text('Robot Arm'), findsOneWidget);
+ expect(find.text('Robot Arm'), findsWidgets);
expect(find.text('on Codex'), findsOneWidget);
- await tester.tap(find.text('Robot Arm'));
+ await tester.tap(find.text('Robot Arm').last);
await tester.pumpAndSettle();
expect(engineField(tester), 'someone/robot-arm');
- expect(find.text('Runs on Codex'), findsOneWidget);
- expect(
- find.text(
- 'Harness will install Robot Arm on harness-remote-box before starting.',
- ),
- findsOneWidget,
- );
+ await tester.ensureVisible(find.byKey(const Key('new-agent-advanced')));
+ await tester.tap(find.byKey(const Key('new-agent-advanced')));
+ await tester.pumpAndSettle();
+ expect(find.textContaining('Runs on Codex.'), findsOneWidget);
expect(tester.takeException(), isNull);
});
}
diff --git a/desktop/test/new_agent_project_picker_test.dart b/desktop/test/new_agent_project_picker_test.dart
index 2f02ac0bc..869af0d91 100644
--- a/desktop/test/new_agent_project_picker_test.dart
+++ b/desktop/test/new_agent_project_picker_test.dart
@@ -66,6 +66,7 @@ class _App extends AppNotifier {
String? codexHome,
String? swarmId,
PaneSplitRequest? split,
+ String? dsh,
AgentCreationAttempt? attempt,
}) async {
calls.add({
diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dart
index fc31bac71..3444f80e0 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -139,7 +139,7 @@ void main() {
// Its own close control, and no way to end an agent from it.
expect(find.byTooltip('Close viewer'), findsOneWidget);
expect(
- find.byTooltip('Delete agent'),
+ find.byTooltip('Stop Agent'),
findsOneWidget,
reason: 'the terminal keeps its own',
);