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.

desktop: ask each machine which harnesses it has

deefa0f8fcd1071
diff --git a/desktop/lib/core/dsh_catalog.dart b/desktop/lib/core/dsh_catalog.dart
new file mode 100644
index 000000000..834277f74
--- /dev/null
+++ b/desktop/lib/core/dsh_catalog.dart
@@ -0,0 +1,153 @@
+/// Which domain-specific harnesses one machine has, or could install, as that
+/// machine answered it (`dsh_list` in the CLI's backendSocket).
+///
+/// A harness is installed PER MACHINE — it is a clone under `~/.harness/dsh`
+/// on the box the agent will run on, with that box's toolchain set up beside
+/// it — so, exactly like [MachineEngines], the answer is asked of the machine
+/// and rendered, never computed here. The catalog the daemon merges in (the
+/// registry bundled into the CLI) is what lets the Create dialog offer Circuit
+/// on a machine that has never heard of it and say "Harness will install".
+library;
+
+class DshEntry {
+ const DshEntry({
+ required this.id,
+ required this.name,
+ required this.engine,
+ this.description,
+ this.installed = false,
+ this.viewer = false,
+ this.tier = 0,
+ });
+
+ /// `owner/name` — the install directory on the machine and the wire id.
+ final String id;
+
+ /// The tile's name, as the manifest or the registry spells it.
+ final String name;
+
+ /// The base engine the harness runs on: what `agent_create` must be sent.
+ final String engine;
+ final String? description;
+ final bool installed;
+
+ /// Whether it ships a viewer, i.e. whether a web pane will open beside it.
+ final bool viewer;
+ final int tier;
+
+ static DshEntry? fromJson(Object? raw) {
+ if (raw is! Map) return null;
+ final id = raw['id'];
+ final engine = raw['engine'];
+ if (id is! String || !_validId(id)) return null;
+ if (engine is! String || engine.isEmpty || engine.length > 64) return null;
+ final name = raw['name'];
+ final description = raw['description'];
+ final tier = raw['tier'];
+ return DshEntry(
+ id: id,
+ name: name is String && name.trim().isNotEmpty
+ ? name.trim().substring(0, name.trim().length.clamp(0, 40))
+ : id.substring(id.indexOf('/') + 1),
+ engine: engine,
+ description: description is String && description.trim().isNotEmpty
+ ? description.trim().substring(
+ 0,
+ description.trim().length.clamp(0, 300),
+ )
+ : null,
+ installed: raw['installed'] == true,
+ viewer: raw['viewer'] == true,
+ tier: tier is num && tier >= 0 && tier <= 9 ? tier.toInt() : 0,
+ );
+ }
+
+ static bool _validId(String id) =>
+ id.length <= 129 &&
+ RegExp(r'^[a-z0-9][a-z0-9-]{0,63}/[a-z0-9][a-z0-9-]{0,63}$').hasMatch(id);
+}
+
+/// Where an install the user asked for stands, as the machine reports it
+/// (`dsh_install_status` pushes: clone → setup → doctor → done, or failed).
+class DshInstallProgress {
+ const DshInstallProgress({
+ required this.id,
+ required this.phase,
+ this.detail,
+ });
+
+ final String id;
+ final String phase;
+ final String? detail;
+
+ bool get done => phase == 'done';
+ bool get failed => phase == 'failed';
+ bool get inProgress => !done && !failed;
+
+ /// A sentence for the dialog's status line.
+ String get label => switch (phase) {
+ 'clone' => 'Fetching…',
+ 'setup' => 'Setting up the toolchain…',
+ 'doctor' => 'Checking the machine…',
+ 'done' => 'Installed',
+ 'failed' => detail?.isNotEmpty == true ? detail! : 'Install failed',
+ _ => 'Installing…',
+ };
+
+ static DshInstallProgress? fromJson(Object? raw) {
+ if (raw is! Map) return null;
+ final id = raw['id'];
+ final phase = raw['phase'];
+ if (id is! String || id.isEmpty || phase is! String || phase.isEmpty) {
+ return null;
+ }
+ final detail = raw['detail'];
+ return DshInstallProgress(
+ id: id,
+ phase: phase,
+ detail: detail is String && detail.trim().isNotEmpty
+ ? detail
+ .replaceAll(RegExp(r'[\x00-\x1f\x7f]'), ' ')
+ .trim()
+ .substring(0, detail.trim().length.clamp(0, 500))
+ : null,
+ );
+ }
+}
+
+/// One machine's answers, with the same "still asking" versus "asked, and it
+/// has nothing" distinction [MachineEngines] keeps — a tile must not read as
+/// "not installed" on the strength of a request that has not come back.
+class MachineDsh {
+ MachineDsh();
+
+ final Map<String, DshEntry> byId = {};
+
+ /// True once `dsh_list` has answered at least once. Never reset by a
+ /// refresh, so the rows already on screen stay put while a new answer lands.
+ bool loaded = false;
+
+ /// A request is in flight. Held so a dialog opening twice does not start two.
+ Future<void>? inFlight;
+
+ /// Set when the machine could not answer — an older CLI that does not know
+ /// the request, or a transport failure. The dialog still offers the harnesses
+ /// this build ships a face for; the machine decides at create time.
+ String? error;
+
+ /// Installs the user asked for, by harness id, at their latest reported phase.
+ final Map<String, DshInstallProgress> installs = {};
+
+ DshEntry? operator [](String id) => byId[id];
+
+ /// Every harness the machine named, installed or not, in the order it gave.
+ List<DshEntry> get entries => byId.values.toList(growable: false);
+
+ void replace(Iterable<DshEntry> found) {
+ byId
+ ..clear()
+ ..addEntries(found.map((entry) => MapEntry(entry.id, entry)));
+ loaded = true;
+ error = null;
+ }
+}
diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dart
index 084621b84..dce9b715d 100644
--- a/desktop/lib/core/models.dart
+++ b/desktop/lib/core/models.dart
@@ -257,7 +257,8 @@ class Agent {
/// id names an install directory on the far machine and a picker tile here.
static String? _safeDsh(Object? raw) {
if (raw is! String || raw.isEmpty || raw.length > 129) return null;
- return RegExp(r'^[a-z0-9][a-z0-9-]{0,63}/[a-z0-9][a-z0-9-]{0,63}$').hasMatch(raw)
+ return RegExp(r'^[a-z0-9][a-z0-9-]{0,63}/[a-z0-9][a-z0-9-]{0,63}$')
+ .hasMatch(raw)
? raw
: null;
}
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 84925f856..f9f03cfeb 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -18,6 +18,7 @@ import '../auth/cli_login.dart';
import '../bootstrap/environment_provisioner.dart';
import '../core/config.dart';
import '../core/agent_preference.dart';
+import '../core/dsh_catalog.dart';
import '../core/engine_availability.dart';
import '../core/local_hostname.dart';
import '../core/local_git_projects.dart';
@@ -187,6 +188,10 @@ class MachineState {
// machines on one account hold different engines, and the Docker rig holds
// exactly one. See `engines_probe` in the CLI's backendSocket.
final MachineEngines engines = MachineEngines();
+ // Which domain-specific harnesses this machine has or could install, as it
+ // answered `dsh_list`. Per machine for the same reason `engines` is: an
+ // install is a clone and a toolchain on ONE box.
+ final MachineDsh dsh = MachineDsh();
// Adapter/manager presence for this machine, from `node_status` pushes —
// distinct from `connectionStatus`, which only reflects OUR websocket to
// the backend. null = not seen yet (initial connect).
@@ -3525,6 +3530,112 @@ class AppNotifier extends ChangeNotifier {
/// reopening it mid-probe, does not start a second sweep. Never throws — a
/// machine that cannot answer leaves every engine unknown, and unknown is
/// rendered as the dialog behaved before this existed.
+ /// Which domain-specific harnesses [machineId] has or could install — the
+ /// `dsh_list` answer, cached per machine and deduplicated on
+ /// [MachineDsh.inFlight] exactly like [probeEngines]. The Create dialog asks
+ /// with [force] on every open, since an install it started itself is what
+ /// most often makes the stored answer stale.
+ Future<void> probeDsh(String machineId, {bool force = false}) {
+ final machine = machineStates[machineId];
+ if (machine == null) return Future.value();
+ final existing = machine.dsh.inFlight;
+ if (existing != null) return existing;
+ if (machine.dsh.loaded && !force) return Future.value();
+ final work = _probeDsh(machine);
+ machine.dsh.inFlight = work;
+ notifyListeners();
+ return work;
+ }
+
+ Future<void> _probeDsh(MachineState machine) async {
+ try {
+ final result = await _conn(machine.machine.machineId).request(
+ 'dsh_list',
+ timeout: const Duration(seconds: 30),
+ );
+ final raw = result['dsh'];
+ if (raw is! List) throw const FormatException('dsh_list: no list');
+ machine.dsh.replace(raw.map(DshEntry.fromJson).whereType<DshEntry>());
+ } catch (error) {
+ // A CLI that predates `dsh_list` refuses it by code, and the dialog then
+ // offers only the harnesses this build ships a face for; the machine
+ // has the final say at create time (`INVALID_DSH`).
+ machine.dsh.error = error is WsRequestFailure
+ ? (error.detail?.isNotEmpty == true ? error.detail : error.code)
+ : 'This machine could not report its harnesses';
+ } finally {
+ machine.dsh.inFlight = null;
+ notifyListeners();
+ }
+ }
+
+ /// Install the harness [id] on [machineId]: clone, set up its toolchain, run
+ /// its doctor. Minutes, not seconds — the Circuit toolchain alone is an
+ /// `npm ci` — so the request carries its own long budget and the machine
+ /// narrates progress through `dsh_install_status` pushes, which land in
+ /// [MachineDsh.installs] for the dialog's status line. Null on success, else
+ /// a sentence for the person who clicked.
+ Future<String?> installDsh(String machineId, String id) async {
+ final machine = machineStates[machineId];
+ if (machine == null) return 'Machine not found';
+ final machineName = machine.machine.displayName;
+ machine.dsh.installs[id] = DshInstallProgress(id: id, phase: 'clone');
+ notifyListeners();
+ try {
+ final result = await _conn(machineId).request(
+ 'dsh_install',
+ payload: {'id': id},
+ timeout: const Duration(minutes: 10),
+ );
+ if (result['ok'] != true) {
+ final detail = result['detail'];
+ return _finishInstall(
+ machine,
+ id,
+ detail is String && detail.isNotEmpty
+ ? detail
+ : 'Install failed on $machineName',
+ );
+ }
+ } on WsRequestFailure catch (failure) {
+ return _finishInstall(
+ machine,
+ id,
+ switch (failure.code) {
+ 'UNSUPPORTED' ||
+ 'UNSUPPORTED_ON_REMOTE' =>
+ 'Update the harness CLI on $machineName to install harnesses',
+ _ => failure.detail?.isNotEmpty == true
+ ? failure.detail!
+ : 'Install failed on $machineName (${failure.code})',
+ },
+ );
+ } on WsRequestTimeout {
+ return _finishInstall(
+ machine,
+ id,
+ '$machineName is still installing. Try again in a few minutes.',
+ );
+ } catch (_) {
+ return _finishInstall(machine, id, 'Install failed on $machineName');
+ }
+ machine.dsh.installs[id] = DshInstallProgress(id: id, phase: 'done');
+ notifyListeners();
+ // The stored answer just became stale by the dialog's own hand.
+ await probeDsh(machineId, force: true);
+ return null;
+ }
+
+ String _finishInstall(MachineState machine, String id, String error) {
+ machine.dsh.installs[id] = DshInstallProgress(
+ id: id,
+ phase: 'failed',
+ detail: error,
+ );
+ notifyListeners();
+ return error;
+ }
+
Future<void> probeEngines(String machineId, {bool force = false}) {
final machine = machineStates[machineId];
if (machine == null) return Future.value();
@@ -4111,6 +4222,7 @@ class AppNotifier extends ChangeNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
@@ -4122,6 +4234,9 @@ class AppNotifier extends ChangeNotifier {
...?projectFolder?.payload,
'bypassPermission': bypassPermission,
'codexHome': ?codexHome,
+ // The harness this agent is created from. `engine` above is its BASE —
+ // the machine refuses the pair when they disagree (`INVALID_DSH`).
+ 'dsh': ?dsh,
};
if (creation._choices != null &&
(creation._machineId != machineId ||
@@ -4173,6 +4288,9 @@ class AppNotifier extends ChangeNotifier {
'Install tmux there, then try again.',
'UNSUPPORTED_ON_REMOTE' || 'UNSUPPORTED' =>
'Update the harness CLI on this machine to create an agent',
+ 'INVALID_DSH' =>
+ 'This harness is not installed on $machine. '
+ '${detail ?? 'Install it there, then try again.'}',
_ => 'Create agent failed: ${detail ?? code}',
};
@@ -4275,6 +4393,7 @@ class AppNotifier extends ChangeNotifier {
'INVALID_ENGINE',
'INVALID_GRID',
'INVALID_CODEX_HOME',
+ 'INVALID_DSH',
'TMUX_UNAVAILABLE',
'TMUX_TOO_OLD_FOR_GRID',
'GRID_CONFIG_FAILED',
@@ -5802,6 +5921,13 @@ class AppNotifier extends ChangeNotifier {
// until now, even though the daemon had already shaped the question for
// the dial — `sendCommander` is device-only, so it never came down this
// wire at all.
+ case 'dsh_install_status':
+ // The machine narrating an install this window (or another) asked for.
+ // Only ever advances a known install: a phase for an id nobody here
+ // asked about is still worth showing, so it is recorded either way.
+ final progress = DshInstallProgress.fromJson(payload);
+ if (progress != null) machine.dsh.installs[progress.id] = progress;
+ break;
case 'commander_question':
final agentId = _eventAgentId(machine, event, payload);
if (agentId != null) {
diff --git a/desktop/test/agent_events_test.dart b/desktop/test/agent_events_test.dart
index 7c002ff95..0405c4c38 100644
--- a/desktop/test/agent_events_test.dart
+++ b/desktop/test/agent_events_test.dart
@@ -63,6 +63,7 @@ class FakeCreateAgentNotifier extends AppNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
diff --git a/desktop/test/agent_model_test.dart b/desktop/test/agent_model_test.dart
index 5a75fadda..d0bb64895 100644
--- a/desktop/test/agent_model_test.dart
+++ b/desktop/test/agent_model_test.dart
@@ -111,37 +111,48 @@ void _dshTests() {
expect(agent.identityEngine, 'codex');
});
- test('refuses a harness id, viewer URL or verdict outside the spec shape', () {
- Agent parse(Map<String, dynamic> extra) =>
- Agent.fromJson({'id': 'agent-1', 'name': 'a', ...extra});
- // The id is owner/name; a bare word, a deeper path, or an upper-case one is not.
- expect(parse({'dsh': 'circuit'}).dsh, isNull);
- expect(parse({'dsh': 'a/b/c'}).dsh, isNull);
- expect(parse({'dsh': 'Autonomous/Circuit'}).dsh, isNull);
- expect(parse({'dsh': 'autonomous/../etc'}).dsh, isNull);
- // The viewer URL lands in a webview: http(s) with a host, no whitespace, no control bytes.
- expect(parse({'viewerUrl': 'file:///etc/passwd'}).viewerUrl, isNull);
- expect(parse({'viewerUrl': 'javascript:alert(1)'}).viewerUrl, isNull);
- expect(parse({'viewerUrl': 'http://127.0.0.1:4179/a b'}).viewerUrl, isNull);
- expect(parse({'viewerUrl': 'http://\n127.0.0.1/'}).viewerUrl, isNull);
- expect(
- parse({'viewerUrl': 'https://viewer.local/x'}).viewerUrl,
- 'https://viewer.local/x',
- );
- // A verdict without the one required fact is no verdict; counts never go negative or absurd.
- expect(parse({'verdict': {'summary': 'x'}}).verdict, isNull);
- expect(parse({'verdict': 'ready'}).verdict, isNull);
- final odd = parse({
- 'verdict': {
- 'ready': true,
- 'errors': -3,
- 'warnings': 1e9,
- 'summary': 'ok\u0000\u0001',
- },
- }).verdict!;
- expect(odd.errors, 0);
- expect(odd.warnings, 9999);
- expect(odd.summary, 'ok');
- expect(odd.updatedAt, isNull);
- });
+ test(
+ 'refuses a harness id, viewer URL or verdict outside the spec shape',
+ () {
+ Agent parse(Map<String, dynamic> extra) =>
+ Agent.fromJson({'id': 'agent-1', 'name': 'a', ...extra});
+ // The id is owner/name; a bare word, a deeper path, or an upper-case one is not.
+ expect(parse({'dsh': 'circuit'}).dsh, isNull);
+ expect(parse({'dsh': 'a/b/c'}).dsh, isNull);
+ expect(parse({'dsh': 'Autonomous/Circuit'}).dsh, isNull);
+ expect(parse({'dsh': 'autonomous/../etc'}).dsh, isNull);
+ // The viewer URL lands in a webview: http(s) with a host, no whitespace, no control bytes.
+ expect(parse({'viewerUrl': 'file:///etc/passwd'}).viewerUrl, isNull);
+ expect(parse({'viewerUrl': 'javascript:alert(1)'}).viewerUrl, isNull);
+ expect(
+ parse({'viewerUrl': 'http://127.0.0.1:4179/a b'}).viewerUrl,
+ isNull,
+ );
+ expect(parse({'viewerUrl': 'http://\n127.0.0.1/'}).viewerUrl, isNull);
+ expect(
+ parse({'viewerUrl': 'https://viewer.local/x'}).viewerUrl,
+ 'https://viewer.local/x',
+ );
+ // A verdict without the one required fact is no verdict; counts never go negative or absurd.
+ expect(
+ parse({
+ 'verdict': {'summary': 'x'},
+ }).verdict,
+ isNull,
+ );
+ expect(parse({'verdict': 'ready'}).verdict, isNull);
+ final odd = parse({
+ 'verdict': {
+ 'ready': true,
+ 'errors': -3,
+ 'warnings': 1e9,
+ 'summary': 'ok\u0000\u0001',
+ },
+ }).verdict!;
+ expect(odd.errors, 0);
+ expect(odd.warnings, 9999);
+ expect(odd.summary, 'ok');
+ expect(odd.updatedAt, isNull);
+ },
+ );
}
diff --git a/desktop/test/dsh_catalog_test.dart b/desktop/test/dsh_catalog_test.dart
new file mode 100644
index 000000000..301363444
--- /dev/null
+++ b/desktop/test/dsh_catalog_test.dart
@@ -0,0 +1,174 @@
+// The per-machine harness catalog: what `dsh_list` says a machine has or could
+// install, and how an install the dialog asked for is narrated back.
+import 'dart:async';
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/ws/ws_conn.dart';
+
+import 'swarm_state_test.dart' show createApp;
+
+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>)>[];
+ Future<Map<String, dynamic>> Function(String type, Map<String, dynamic>)?
+ answer;
+
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) {
+ calls.add((type, Map.of(payload)));
+ return answer?.call(type, payload) ?? Future.value({});
+ }
+}
+
+const _circuit = {
+ 'id': 'autonomous/circuit',
+ 'name': 'Circuit',
+ 'description': 'Chat with AI → a board you can order',
+ 'engine': 'claude',
+ 'installed': false,
+ 'viewer': true,
+ 'tier': 2,
+};
+
+void main() {
+ test('an entry is read off the wire and refuses ids outside owner/name', () {
+ final entry = DshEntry.fromJson(_circuit)!;
+ expect(entry.id, 'autonomous/circuit');
+ expect(entry.name, 'Circuit');
+ expect(entry.engine, 'claude');
+ expect(entry.installed, isFalse);
+ expect(entry.viewer, isTrue);
+ expect(entry.tier, 2);
+ // A name the machine left out falls back to the id's own name half.
+ expect(
+ DshEntry.fromJson({'id': 'someone/robot-arm', 'engine': 'codex'})!.name,
+ 'robot-arm',
+ );
+ expect(DshEntry.fromJson({'id': 'circuit', 'engine': 'claude'}), isNull);
+ expect(DshEntry.fromJson({'id': 'a/b', 'engine': ''}), isNull);
+ expect(DshEntry.fromJson('autonomous/circuit'), isNull);
+ });
+
+ test(
+ 'install progress reads as a sentence, and a failure keeps its detail',
+ () {
+ expect(
+ DshInstallProgress.fromJson({'id': 'a/b', 'phase': 'setup'})!.label,
+ 'Setting up the toolchain…',
+ );
+ final failed = DshInstallProgress.fromJson({
+ 'id': 'a/b',
+ 'phase': 'failed',
+ 'detail': 'kicad-cli\u0000 not found',
+ })!;
+ expect(failed.failed, isTrue);
+ expect(failed.inProgress, isFalse);
+ expect(failed.label, 'kicad-cli not found');
+ expect(DshInstallProgress.fromJson({'id': 'a/b'}), isNull);
+ },
+ );
+
+ test(
+ 'probeDsh records the answer, and an older CLI leaves it unknown',
+ () async {
+ final connection = _Connection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ connection.answer = (type, _) async => {
+ 'dsh': [
+ _circuit,
+ 'junk',
+ {'id': 'bad', 'engine': 'claude'},
+ ],
+ };
+ await app.probeDsh('m');
+ final catalog = app.stateOf('m')!.dsh;
+ expect(catalog.loaded, isTrue);
+ expect(catalog.error, isNull);
+ expect(catalog.entries.map((e) => e.id), ['autonomous/circuit']);
+ expect(connection.calls.map((c) => c.$1), ['dsh_list']);
+ // A second ask is answered from memory unless forced.
+ await app.probeDsh('m');
+ expect(connection.calls.length, 1);
+ await app.probeDsh('m', force: true);
+ expect(connection.calls.length, 2);
+
+ final older = _Connection()
+ ..answer = (_, _) => Future.error(
+ const WsRequestFailure(responseType: 'dsh_list', code: 'UNSUPPORTED'),
+ );
+ final legacy = createApp(connectionForTest: (_) => older);
+ addTearDown(legacy.dispose);
+ await legacy.probeDsh('m');
+ expect(legacy.stateOf('m')!.dsh.loaded, isFalse);
+ expect(legacy.stateOf('m')!.dsh.error, 'UNSUPPORTED');
+ },
+ );
+
+ test(
+ 'installDsh narrates its phases and re-asks the catalog when done',
+ () async {
+ final connection = _Connection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ final install = Completer<Map<String, dynamic>>();
+ connection.answer = (type, _) => type == 'dsh_install'
+ ? install.future
+ : Future.value({
+ 'dsh': [
+ {..._circuit, 'installed': true},
+ ],
+ });
+ final result = app.installDsh('m', 'autonomous/circuit');
+ final catalog = app.stateOf('m')!.dsh;
+ expect(catalog.installs['autonomous/circuit']!.phase, 'clone');
+ await app.handleEventForTest('m', {
+ 'type': 'dsh_install_status',
+ 'payload': {'id': 'autonomous/circuit', 'phase': 'setup'},
+ });
+ expect(
+ catalog.installs['autonomous/circuit']!.label,
+ 'Setting up the toolchain…',
+ );
+ install.complete({'ok': true});
+ expect(await result, isNull);
+ expect(catalog.installs['autonomous/circuit']!.done, isTrue);
+ expect(catalog['autonomous/circuit']!.installed, isTrue);
+ expect(connection.calls.map((c) => c.$1), ['dsh_install', 'dsh_list']);
+ expect(connection.calls.first.$2, {'id': 'autonomous/circuit'});
+ },
+ );
+
+ test('a refused install says so and stays retryable', () async {
+ final connection = _Connection()
+ ..answer = (type, _) => Future.error(
+ const WsRequestFailure(
+ responseType: 'dsh_install',
+ code: 'UNSUPPORTED',
+ ),
+ );
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ final error = await app.installDsh('m', 'autonomous/circuit');
+ expect(error, 'Update the harness CLI on Test host to install harnesses');
+ expect(
+ app.stateOf('m')!.dsh.installs['autonomous/circuit']!.failed,
+ isTrue,
+ );
+ });
+}
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 741f2b461..d6cde358d 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -67,6 +67,7 @@ class _FirstUseApp extends AppNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dart
index d5c5c6203..05dc1775c 100644
--- a/desktop/test/new_agent_codex_profile_test.dart
+++ b/desktop/test/new_agent_codex_profile_test.dart
@@ -128,6 +128,7 @@ class _Notifier extends AppNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
diff --git a/desktop/test/new_agent_engine_check_test.dart b/desktop/test/new_agent_engine_check_test.dart
index 55e0552c2..6b9bb59c8 100644
--- a/desktop/test/new_agent_engine_check_test.dart
+++ b/desktop/test/new_agent_engine_check_test.dart
@@ -311,6 +311,7 @@ class _RetryNotifier extends AppNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,
diff --git a/desktop/test/remote_folder_picker_test.dart b/desktop/test/remote_folder_picker_test.dart
index ee0e00aaa..65823231b 100644
--- a/desktop/test/remote_folder_picker_test.dart
+++ b/desktop/test/remote_folder_picker_test.dart
@@ -47,6 +47,7 @@ class _Folders extends AppNotifier {
ProjectFolderRequest? projectFolder,
bool bypassPermission = false,
String? codexHome,
+ String? dsh,
String? swarmId,
PaneSplitRequest? split,
AgentCreationAttempt? attempt,