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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Store: the catalog and what is installed are this computer's, not every machine's
deehw819cc95c9e51
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dartindex 85804f2b1..6d7108bac 100644--- a/desktop/lib/store/store_screen.dart+++ b/desktop/lib/store/store_screen.dart@@ -30,10 +30,10 @@ const String kStoreMarkAsset = 'assets/app_icon.png';/// with Get, Open and Remove. A tab, not a screen over the window, so the/// strip stays where it is and browsing never blocks switching.///-/// The catalogue is what the machines answered `dsh_list` with, so the same-/// screen is honest about the one fact an app store usually hides: a harness-/// is installed PER MACHINE. The page lists your machines and lets you put it-/// on any of them. Ratings and reviews come from the control plane through+/// The catalogue and installation state come from this computer's daemon.+/// Browsing, Get, Open and Remove all refer to this computer; remote machines+/// do not contribute packages or installation state to the Store.+/// Ratings and reviews come from the control plane through/// [StoreApi]; the screen works without them (a page simply has no stars).class StoreTab extends StatefulWidget {const StoreTab({@@ -148,22 +148,18 @@ class _StoreTabState extends State<StoreTab> {WidgetsBinding.instance.addPostFrameCallback((_) {if (!mounted) return;unawaited(_store.loadRatings());- // Every machine is asked again: what the store shows as installed is a- // per-machine fact, and an install started from a terminal is exactly- // what a stored answer misses.- for (final machine in widget.notifier.machineStates.values) {- _ask(machine);- }+ // Refresh installs made from a local terminal while the Store was closed.+ final local = widget.notifier.localMachineState;+ if (local != null) _ask(local);widget.notifier.addListener(_onAppChanged);// A Store left open picks up new publications; engines do not need reprobes.// The daemon caches catalog HTTP requests for five minutes._catalogRefresh = Timer.periodic(const Duration(minutes: 1), (_) {- for (final machine in widget.notifier.machineStates.values) {- if (machine.connectionStatus == ConnectionStatus.connected) {- unawaited(- widget.notifier.probeDsh(machine.machine.machineId, force: true),- );- }+ final local = widget.notifier.localMachineState;+ if (local?.connectionStatus == ConnectionStatus.connected) {+ unawaited(+ widget.notifier.probeDsh(local!.machine.machineId, force: true),+ );}});});@@ -190,7 +186,7 @@ class _StoreTabState extends State<StoreTab> {void _onAppChanged() {final connecting = <MachineState>[];- for (final machine in widget.notifier.machineStates.values) {+ for (final machine in [?widget.notifier.localMachineState]) {final id = machine.machine.machineId;if (machine.connectionStatus != ConnectionStatus.connected) {_askedWhileConnected.remove(id);@@ -204,6 +200,7 @@ class _StoreTabState extends State<StoreTab> {if (!mounted) return;for (final machine in connecting) {if (machine.connectionStatus == ConnectionStatus.connected &&+ identical(machine, widget.notifier.localMachineState) &&!_askedWhileConnected.contains(machine.machine.machineId)) {_ask(machine);}@@ -220,19 +217,12 @@ class _StoreTabState extends State<StoreTab> {super.dispose();}- /// One row per harness id across every machine, the local machine's row- /// winning (its catalog carries the whole registry) — and one row per+ /// The local daemon's catalog carries the registry, plus one row per/// built-in engine, because a person looking for "Claude Code" in a store/// should find it beside Marp, not learn that it is a different kind of thing.Map<String, DshEntry> get _catalog {final rows = <String, DshEntry>{};final local = widget.notifier.localMachineState;- final states = [- ?local,- ...widget.notifier.machineStates.values.where(- (s) => !identical(s, local),- ),- ];for (final identity in allEngines) {rows[identity.id] = DshEntry(id: identity.id,@@ -243,25 +233,19 @@ class _StoreTabState extends State<StoreTab> {author: identity.creator,description: identity.blurb,homepage: identity.homepage,- installed: states.any((s) => s.engines[identity.id]?.installed == true),+ installed: _installedOnMachine(local, identity.id),);}- for (final state in states) {- for (final entry in state.dsh.entries) {- rows.putIfAbsent(entry.id, () => entry);- }+ for (final entry in local?.dsh.entries ?? const <DshEntry>[]) {+ rows.putIfAbsent(entry.id, () => entry);}return rows;}- /// The machines that have [id] installed — a harness from their catalog, an- /// engine from their probe.+ /// Store installation facts are local, including shared viewer packages.List<MachineState> _installedOn(String id) => [- for (final state in widget.notifier.machineStates.values)- if (isHarnessId(id)- ? state.dsh[id]?.installed == true- : state.engines[id]?.installed == true)- state,+ for (final state in [?widget.notifier.localMachineState])+ if (_installedOnMachine(state, id)) state,];List<String> get _categories {@@ -311,24 +295,13 @@ class _StoreTabState extends State<StoreTab> {});void _takeAction(DshEntry entry) {- final installed = _installedOn(entry.id);final local = widget.notifier.localMachineState;- final target =- installed.where((s) => identical(s, local)).firstOrNull ??- installed- .where((s) => s.nodeOnline == true && !s.needsLink)- .firstOrNull;- if (target == null) {+ if (local == null || !_installedOnMachine(local, entry.id)) {_openPage(entry.id);return;}unawaited(- _openStoreAgent(- context,- widget.notifier,- entry,- target.machine.machineId,- ),+ _openStoreAgent(context, widget.notifier, entry, local.machine.machineId),);}@@ -364,17 +337,18 @@ class _StoreTabState extends State<StoreTab> {entry: selected,notifier: widget.notifier,store: _store,- installedOn: _installedOn(selected.id),onBack: () => setState(() => _selected = null),): _shelf is _Viewers? StoreViewers(viewers: _shelved(const _Viewers()),- agents: [- for (final machine- in widget.notifier.machineStates.values)- ...machine.dsh.entries,- ],+ agents:+ widget+ .notifier+ .localMachineState+ ?.dsh+ .entries ??+ const [],installedOn: (id) => _installedOn(id).map((machine) => machine.machine.displayName).toList(),@@ -626,7 +600,7 @@ class _Shelf$View extends StatelessWidget {? 'No matching harnesses. Try a name or something you want to make.': loaded? 'Nothing here yet.'- : 'Asking your machines…',+ : 'Asking this computer…',style: TextStyle(fontSize: 14,height: 1.5,@@ -687,6 +661,21 @@ class _Stars extends StatelessWidget {// ─── the page ────────────────────────────────────────────────────────────────+bool _installedOnMachine(MachineState? machine, String id) => isHarnessId(id)+ ? machine?.dsh[id]?.installed == true+ : machine?.engines[id]?.installed == true;++bool _canGetOnMachine(MachineState machine, DshEntry entry) {+ if (machine.needsLink || machine.nodeOnline == false) return false;+ if (entry.isEngine) {+ return machine.engines.loaded &&+ machine.engines[entry.id]?.installable == true;+ }+ return machine.dsh.loaded &&+ machine.dsh[entry.id] != null &&+ machine.dsh.runs[entry.id]?.inProgress != true;+}+Future<void> _openStoreAgent(BuildContext context,AppNotifier notifier,@@ -721,14 +710,12 @@ class _ProductPage extends StatefulWidget {required this.entry,required this.notifier,required this.store,- required this.installedOn,required this.onBack,});final DshEntry entry;final AppNotifier notifier;final StoreController store;- final List<MachineState> installedOn;final VoidCallback onBack;@override@@ -757,6 +744,12 @@ class _ProductPageState extends State<_ProductPage> {}Future<void> _get(String machineId) async {+ final local = widget.notifier.localMachineState;+ if (local == null ||+ local.machine.machineId != machineId ||+ !_canGetOnMachine(local, widget.entry)) {+ return;+ }// An engine is installed by the daemon on the way to the first harness// that needs it (`installIfMissing` on create), so Get is Open.if (widget.entry.isEngine) return _open(machineId);@@ -772,6 +765,9 @@ class _ProductPageState extends State<_ProductPage> {}Future<void> _remove(String machineId, String machineName) async {+ if (widget.notifier.localMachineState?.machine.machineId != machineId) {+ return;+ }final ok = await showAppDialog<bool>(context: context,builder: (context) => _ConfirmCard(@@ -797,6 +793,9 @@ class _ProductPageState extends State<_ProductPage> {/// a pane never lands in the store tab. A draft tab is opened for it and/// abandoned — back to the store — if the dialog is dismissed.Future<void> _open(String machineId) async {+ if (widget.notifier.localMachineState?.machine.machineId != machineId) {+ return;+ }await _openStoreAgent(context, widget.notifier, widget.entry, machineId);}@@ -828,19 +827,8 @@ class _ProductPageState extends State<_ProductPage> {final rating = widget.store.ratingOf(_key);final page = widget.store.reviews[_key];final local = widget.notifier.localMachineState;- final localInstalled =- local != null &&- (entry.isEngine- ? local.engines[entry.id]?.installed == true- : local.dsh[entry.id]?.installed == true);- final machines = widget.notifier.machineStates.values.toList()- ..sort((a, b) {- if (identical(a, local)) return -1;- if (identical(b, local)) return 1;- return a.machine.displayName.toLowerCase().compareTo(- b.machine.displayName.toLowerCase(),- );- });+ final localInstalled = _installedOnMachine(local, entry.id);+ final machines = [?local];final base = entry.engine.isNotEmpty? entry.engine: (knownHarnessBase[entry.id] ?? '');@@ -931,7 +919,11 @@ class _ProductPageState extends State<_ProductPage> {if (!entry.isViewerPackage && local != null)FilledButton(key: const ValueKey('store-primary-action'),- onPressed: _busy.contains(local.machine.machineId)+ onPressed:+ _busy.contains(local.machine.machineId) ||+ local.dsh.runs[entry.id]?.inProgress == true ||+ (!localInstalled &&+ !_canGetOnMachine(local, entry))? null: () => localInstalled? _open(local.machine.machineId)@@ -981,7 +973,7 @@ class _ProductPageState extends State<_ProductPage> {),],const SizedBox(height: 28),- _SectionTitle('On your machines'),+ _SectionTitle('On this computer'),const SizedBox(height: 8),Container(decoration: BoxDecoration(@@ -1016,7 +1008,7 @@ class _ProductPageState extends State<_ProductPage> {Padding(padding: const EdgeInsets.all(16),child: Text(- 'No machines yet.',+ 'Connecting to this computer…',style: TextStyle(fontSize: 13,color: grid.AppPalette.textFaint,@@ -1252,7 +1244,7 @@ class _MachineRow extends StatelessWidget {] elseFilledButton.tonal(key: ValueKey('store-get:${state.machine.machineId}'),- onPressed: state.dsh.loaded && unavailable == null ? onGet : null,+ onPressed: _canGetOnMachine(state, entry) ? onGet : null,style: FilledButton.styleFrom(minimumSize: const Size(72, 32),shape: const StadiumBorder(),@@ -1328,10 +1320,7 @@ extension on _MachineRow {onPressed: onOpen,child: const Text('Open'),)- else if (loaded &&- probe?.installable == true &&- !state.needsLink &&- state.nodeOnline != false)+ else if (_canGetOnMachine(state, entry))FilledButton.tonal(key: ValueKey('store-get:${state.machine.machineId}'),onPressed: onGet,diff --git a/desktop/lib/store/store_viewers.dart b/desktop/lib/store/store_viewers.dartindex 0dd5cf158..da95e66cd 100644--- a/desktop/lib/store/store_viewers.dart+++ b/desktop/lib/store/store_viewers.dart@@ -43,8 +43,8 @@ class StoreViewers extends StatelessWidget {if (viewers.isEmpty)Text(loaded- ? 'No viewers reported by your machines.'- : 'Asking your machines…',+ ? 'No viewers reported by this computer.'+ : 'Asking this computer…',style: TextStyle(color: grid.AppPalette.textSecondary),),for (final viewer in viewers) _viewer(context, viewer),diff --git a/desktop/test/store_page_test.dart b/desktop/test/store_page_test.dartindex 2755a5800..b0c8ddea0 100644--- a/desktop/test/store_page_test.dart+++ b/desktop/test/store_page_test.dart@@ -1,5 +1,5 @@// A harness's page in the Harness Store, past the happy path the screen test-// pins: every machine's row and what its install is doing, Get/Open/Remove+// pins: this computer's install state, Get/Open/Remove// under double clicks and pages that vanish mid-dialog, engines as the probes// saw them, viewer packages, links, pictures, reviews, the shelves around the// page, and a store whose control plane has no ratings routes at all (404).@@ -16,6 +16,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/shared/widgets/app_choice_picker.dart';import 'package:harness/state/app_state.dart';import 'package:harness/store/store_controller.dart';import 'package:harness/store/store_models.dart';@@ -242,6 +243,65 @@ void main() {setUpAll(loadRealFonts);group('Get, Open and Remove', () {+ testWidgets('the primary Get respects this computer’s availability', (+ tester,+ ) async {+ final (app, _) = await _open(+ tester,+ initialHarness: _typst.id,+ seed: (app) {+ app.machine(+ 'machine-1',+ local: true,+ online: false,+ dsh: const [_typst],+ );+ app.machine('remote', online: true, dsh: const [_typst]);+ },+ );+ final local = app.machineStates['machine-1']!;+ void expectEnabled(bool enabled) {+ for (final key in ['store-primary-action', 'store-get:machine-1']) {+ expect(+ tester.widget<FilledButton>(_key(key)).onPressed != null,+ enabled,+ reason: key,+ );+ }+ }++ expectEnabled(false);+ expect(+ _in('store-machine:machine-1', find.text('Offline')),+ findsOneWidget,+ );+ local.nodeOnline = true;+ local.needsLink = true;+ app.changed();+ await tester.pumpAndSettle();+ expectEnabled(false);+ local.needsLink = false;+ app.changed();+ await tester.pumpAndSettle();+ expectEnabled(true);++ // An install started elsewhere also disables the page’s main action.+ local.dsh.runs[_typst.id] = DshInstallRun(_typst.id);+ app.changed();+ await tester.pump();+ expect(+ tester.widget<FilledButton>(_key('store-primary-action')).onPressed,+ isNull,+ );+ local.dsh.runs[_typst.id]!.apply(+ DshInstallProgress(id: _typst.id, phase: 'failed'),+ );+ app.changed();+ await tester.pumpAndSettle();+ expectEnabled(true);+ expect(app.installs, isEmpty);+ });+testWidgets('Get installs on this machine once however fast the clicks, and a failure is said',(tester) async {@@ -413,151 +473,136 @@ void main() {});testWidgets(- 'every machine has a row — this computer first, then by name — saying where its install stands',+ 'only this computer has an install row, through progress, failure and recovery',(tester) async {- DshInstallRun run(String phase, {String? line}) => DshInstallRun(- _typst.id,- )..apply(DshInstallProgress(id: _typst.id, phase: phase, line: line));final (app, _) = await _open(tester,- initialHarness: 'autonomous/typst',- settle: false,+ initialHarness: _typst.id,seed: (app) {- app.machine('juliet', dsh: const [_typst]);- app.machine('india').dsh.error =- 'This machine could not report its harnesses';- app.machine('hotel');- app.machine('golf').dsh.error = 'UNSUPPORTED';+ app.machine('remote', dsh: const [_marp, _typst]);app.machine(- 'foxtrot',- dsh: const [- DshEntry(- id: 'autonomous/typst',- name: 'Typst',- engine: 'claude',- installed: true,- linked: true,- ),- ],- );- app- .machine('echo', dsh: const [_typst])- .dsh- .runs[_typst.id] = DshInstallRun(_typst.id)- ..apply(DshInstallProgress(id: _typst.id, phase: 'clone'))- ..apply(- DshInstallProgress(- id: _typst.id,- phase: 'failed',- detail: 'no space left',- ),- );- app.machine('delta', dsh: const [_typst]).dsh.runs[_typst.id] = run(- 'doctor',- line: 'miss typst-cli (cargo install typst-cli)',- )..apply(DshInstallProgress(id: _typst.id, phase: 'failed'));- app.machine('charlie', dsh: const [_typst]).dsh.runs[_typst.id] = run(- 'queued',- );- app.machine('Beta', dsh: const [_typst]).dsh.runs[_typst.id] = run(- 'doctor',- );- app.machine('alpha', dsh: const [_typst]).dsh.runs[_typst.id] = run(- 'setup',- );- app- .machine(- 'machine-1',- name: 'zulu-mac',- local: true,- dsh: const [_typst],- )- .dsh- .runs[_typst.id] = run(- 'clone',+ 'machine-1',+ name: 'studio-mac',+ local: true,+ dsh: const [_typst],);},);- final order = [- 'machine-1',- 'alpha',- 'Beta',- 'charlie',- 'delta',- 'echo',- 'foxtrot',- 'golf',- 'hotel',- 'india',- 'juliet',- ];- final tops = [- for (final id in order) tester.getTopLeft(_key('store-machine:$id')).dy,- ];- expect(tops, [...tops]..sort(), reason: 'this computer, then by name');-- void says(String id, String status) => expect(- _in('store-machine:$id', find.text(status)),+ final local = app.machineStates['machine-1']!;+ void says(String status) => expect(+ _in('store-machine:machine-1', find.text(status)),findsOneWidget,- reason: id,);- says('machine-1', 'zulu-mac · this computer');- says('machine-1', 'Fetching…');- says('alpha', 'alpha');- says('alpha', 'Setting up the toolchain…');- says('Beta', 'Checking…');- says('charlie', 'Installing…');- for (final id in ['machine-1', 'alpha', 'Beta', 'charlie']) {+ expect(find.text('On this computer'), findsOneWidget);+ expect(_key('store-machine:remote'), findsNothing);+ says('studio-mac · this computer');+ says('Not installed');+ final quietColor = tester+ .widget<Text>(+ _in('store-machine:machine-1', find.text('Not installed')),+ )+ .style+ ?.color;++ for (final (phase, label) in [+ ('clone', 'Fetching…'),+ ('setup', 'Setting up the toolchain…'),+ ('doctor', 'Checking…'),+ ('queued', 'Installing…'),+ ]) {+ local.dsh.runs[_typst.id] = DshInstallRun(_typst.id)+ ..apply(DshInstallProgress(id: _typst.id, phase: phase));+ app.changed();+ await tester.pump();+ says(label);expect(- _in('store-machine:$id', find.byType(CircularProgressIndicator)),+ _in(+ 'store-machine:machine-1',+ find.byType(CircularProgressIndicator),+ ),findsOneWidget,- reason: id,+ );+ expect(+ tester.widget<FilledButton>(_key('store-primary-action')).onPressed,+ isNull,);}- says('delta', 'miss typst-cli (cargo install typst-cli)');- says('echo', 'Install failed');- final failed = tester.widget<Text>(- _in('store-machine:echo', find.text('Install failed')),+ local.dsh.runs[_typst.id]!.apply(+ DshInstallProgress(id: _typst.id, phase: 'failed'),);+ app.changed();+ await tester.pumpAndSettle();+ says('Install failed');expect(- failed.style?.color,- isNot(- tester- .widget<Text>(- _in('store-machine:juliet', find.text('Not installed')),- )- .style- ?.color,- ),- reason: 'a failure is not in the quiet colour',+ tester+ .widget<Text>(+ _in('store-machine:machine-1', find.text('Install failed')),+ )+ .style+ ?.color,+ isNot(quietColor),);- expect(_in('store-get:delta', find.text('Try again')), findsOneWidget);- says('foxtrot', 'Installed · linked to a checkout');- expect(_key('store-open:foxtrot'), findsOneWidget);- expect(_key('store-remove:foxtrot'), findsOneWidget);- says(- 'golf',- 'Update the harness CLI on this machine to install harnesses',+ expect(+ _in('store-get:machine-1', find.text('Try again')),+ findsOneWidget,);- says('hotel', 'Asking…');- says('india', 'This machine could not report its harnesses');- for (final id in ['golf', 'hotel', 'india']) {++ local.dsh.runs[_typst.id] = DshInstallRun(_typst.id)+ ..apply(+ DshInstallProgress(+ id: _typst.id,+ phase: 'doctor',+ line: 'miss typst-cli (cargo install typst-cli)',+ ),+ )+ ..apply(DshInstallProgress(id: _typst.id, phase: 'failed'));+ app.changed();+ await tester.pumpAndSettle();+ says('miss typst-cli (cargo install typst-cli)');+ await tester.tap(_key('store-get:machine-1'));+ await tester.pumpAndSettle();+ expect(app.installs, [('machine-1', _typst.id)]);++ local.dsh.runs.clear();+ local.dsh.loaded = false;+ for (final (error, label) in <(String?, String)>[+ (null, 'Asking…'),+ (+ 'UNSUPPORTED',+ 'Update the harness CLI on this machine to install harnesses',+ ),+ (+ 'This machine could not report its harnesses',+ 'This machine could not report its harnesses',+ ),+ ]) {+ local.dsh.error = error;+ app.changed();+ await tester.pumpAndSettle();+ says(label);expect(- tester.widget<FilledButton>(_key('store-get:$id')).onPressed,+ tester.widget<FilledButton>(_key('store-get:machine-1')).onPressed,+ isNull,+ );+ expect(+ tester.widget<FilledButton>(_key('store-primary-action')).onPressed,isNull,- reason: '$id has not said it can install',);}- says('juliet', 'Not installed');-- await tester.tap(_key('store-get:delta'));- await tester.pump();- await tester.tap(_key('store-get:juliet'));- await tester.pump();- expect(app.installs, [- ('delta', 'autonomous/typst'),- ('juliet', 'autonomous/typst'),+ local.dsh.replace(const [+ DshEntry(+ id: 'autonomous/typst',+ name: 'Typst',+ engine: 'claude',+ installed: true,+ linked: true,+ ),]);+ app.changed();+ await tester.pumpAndSettle();+ says('Installed · linked to a checkout');+ expect(_key('store-open:machine-1'), findsOneWidget);+ expect(_key('store-remove:machine-1'), findsOneWidget);},);@@ -617,19 +662,40 @@ void main() {_in('store-machine:machine-1', find.byType(TextButton)),findsNothing,);- expect(_in('store-machine:alpha', find.text('alpha')), findsOneWidget);- expect(_key('store-open:alpha'), findsOneWidget);+ for (final id in ['alpha', 'beta', 'gamma']) {+ expect(_key('store-machine:$id'), findsNothing);+ }+ final local = app.machineStates['machine-1']!;+ local.engines.replace(const [+ EngineAvailability(engine: 'claude', installed: false),+ ]);+ app.changed();+ await tester.pumpAndSettle();expect(- _in('store-machine:beta', find.text('Not installed')),+ _in('store-machine:machine-1', find.text('Not installed')),findsOneWidget,);- expect(_key('store-get:beta'), findsNothing, reason: 'nothing to offer');- expect(_key('store-get:gamma'), findsOneWidget);+ expect(_key('store-get:machine-1'), findsNothing);// A rating with no bars drawn still reads as its number.expect(find.text('5.0 · 1 rating'), findsOneWidget);expect(find.text('out of 5 · 1 rating'), findsOneWidget);final tabs = app.swarms.length;+ expect(+ tester.widget<FilledButton>(_key('store-primary-action')).onPressed,+ isNull,+ reason:+ 'wait for this computer’s engine probe, as the machine row does',+ );+ app.machineStates['machine-1']!.engines.replace(const [+ EngineAvailability(+ engine: 'claude',+ installed: false,+ installable: true,+ ),+ ]);+ app.changed();+ await tester.pumpAndSettle();// Get on an engine is Open: the daemon installs it on the way.expect(_in('store-primary-action', find.text('Get')), findsOneWidget);await tester.tap(_key('store-primary-action'));@@ -639,6 +705,13 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pumpAndSettle();expect(app.swarms.length, tabs);+ local.engines.replace(const [+ EngineAvailability(engine: 'claude', installed: true),+ ]);+ app.changed();+ await tester.pumpAndSettle();+ expect(_in('store-primary-action', find.text('Open')), findsOneWidget);+ expect(_key('store-open:machine-1'), findsOneWidget);},);@@ -669,7 +742,7 @@ void main() {tester,) async {await _open(tester, initialHarness: 'codex', seed: (_) {});- expect(find.text('No machines yet.'), findsOneWidget);+ expect(find.text('Connecting to this computer…'), findsOneWidget);expect(_key('store-primary-action'), findsNothing);});@@ -961,7 +1034,7 @@ void main() {app.machineStates.clear();app.changed();await tester.pumpAndSettle();- expect(find.text('Asking your machines…'), findsOneWidget);+ expect(find.text('Asking this computer…'), findsOneWidget);},);@@ -982,73 +1055,153 @@ void main() {);});- testWidgets(- 'a card\'s action opens where it is installed — here, else an online machine — else the page',- (tester) async {- final (app, _) = await _open(- tester,- seed: (app) {- app.machine(- 'machine-1',- name: 'studio-mac',- local: true,- dsh: const [_typst],- );- app.machine(- 'remote',- online: true,- dsh: const [- DshEntry(- id: 'autonomous/typst',- name: 'Typst',- engine: 'claude',- installed: true,- ),- DshEntry(- id: 'autonomous/marp',- name: 'Marp',- engine: 'claude',- installed: true,- ),- ],- );- app.machine(- 'offline',- online: false,- dsh: const [- DshEntry(- id: 'autonomous/manim',- name: 'Manim',- engine: 'claude',- category: 'Math animation',- installed: true,- ),- ],- );- },- );- await tester.tap(_key('store-shelf-category:Media'));- await tester.pumpAndSettle();- final tabs = app.swarms.length;+ testWidgets('cards and pages install and open only on this computer', (+ tester,+ ) async {+ final (app, _) = await _open(+ tester,+ seed: (app) {+ app.machine(+ 'machine-1',+ name: 'studio-mac',+ local: true,+ dsh: const [_typst],+ );+ app.machine(+ 'remote',+ online: true,+ dsh: const [+ DshEntry(+ id: 'autonomous/typst',+ name: 'Typst',+ category: 'Documents',+ engine: 'claude',+ installed: true,+ ),+ DshEntry(+ id: 'autonomous/marp',+ name: 'Marp',+ category: 'Slides',+ engine: 'claude',+ installed: true,+ ),+ ],+ );+ app.machine(+ 'offline',+ online: false,+ dsh: const [+ DshEntry(+ id: 'autonomous/manim',+ name: 'Manim',+ engine: 'claude',+ category: 'Math animation',+ installed: true,+ ),+ ],+ );+ },+ );+ await tester.tap(_key('store-shelf-category:Media'));+ await tester.pumpAndSettle();+ final tabs = app.swarms.length;- expect(- _in('store-action:autonomous/typst', find.text('Open')),- findsOneWidget,- );- await tester.tap(_key('store-action:autonomous/typst'));- await tester.pumpAndSettle();- expect(find.text('New Harness'), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pumpAndSettle();- expect(app.swarms.length, tabs);+ expect(+ _in('store-action:autonomous/typst', find.text('Get')),+ findsOneWidget,+ );+ await tester.tap(_key('store-action:autonomous/typst'));+ await tester.pumpAndSettle();+ expect(_key('store-page:autonomous/typst'), findsOneWidget);+ expect(_in('store-primary-action', find.text('Get')), findsOneWidget);+ expect(find.text('New Harness'), findsNothing);+ expect(app.swarms.length, tabs);+ expect(app.installs, isEmpty);- // Installed only on a machine that is offline: nowhere to open it.- await tester.tap(_key('store-action:autonomous/manim'));- await tester.pumpAndSettle();- expect(_key('store-page:autonomous/manim'), findsOneWidget);- expect(app.swarms.length, tabs);- },- );+ expect(_key('store-machine:remote'), findsNothing);+ expect(_key('store-machine:offline'), findsNothing);+ await tester.tap(_key('store-primary-action'));+ await tester.pumpAndSettle();+ expect(app.installs, [('machine-1', _typst.id)]);+ await tester.tap(_key('store-back'));+ await tester.pumpAndSettle();++ // Once installed locally, the same card becomes Open and stays local.+ app.machineStates['machine-1']!.dsh.replace(+ app.machineStates['remote']!.dsh.entries,+ );+ app.changed();+ await tester.pumpAndSettle();+ expect(+ _in('store-action:autonomous/typst', find.text('Open')),+ findsOneWidget,+ );+ await tester.tap(_key('store-action:autonomous/typst'));+ await tester.pumpAndSettle();+ expect(+ tester+ .widget<AppChoicePicker<String>>(_key('new-agent-machine-field'))+ .value,+ 'machine-1',+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();++ // Remote-only packages never leak into the local catalog.+ expect(_key('store-action:autonomous/manim'), findsNothing);+ expect(app.swarms.length, tabs);+ });++ for (final (id, name, category) in [+ ('autonomous/marp', 'Marp', 'Media'),+ ('claude', 'Claude Code', 'Code'),+ ]) {+ testWidgets(+ '$name uses local installation state in every store listing',+ (tester) async {+ final (app, _) = await _open(+ tester,+ seed: (app) {+ app.machine(+ 'machine-1',+ local: true,+ dsh: const [+ DshEntry(+ id: 'autonomous/marp',+ name: 'Marp',+ engine: 'claude',+ category: 'Slides',+ ),+ ],+ );+ app.machine(+ 'remote',+ online: true,+ dsh: const [_marp],+ engines: const [+ EngineAvailability(engine: 'claude', installed: true),+ ],+ );+ },+ );+ void expectGet() =>+ expect(_in('store-action:$id', find.text('Get')), findsOneWidget);+ expectGet(); // Discover.+ await tester.tap(_key('store-shelf-category:$category'));+ await tester.pumpAndSettle();+ expectGet();+ await tester.enterText(_key('store-search'), name);+ await tester.pumpAndSettle();+ expectGet();+ await tester.tap(_key('store-action:$id'));+ await tester.pumpAndSettle();+ expect(_key('store-page:$id'), findsOneWidget);+ expect(_in('store-primary-action', find.text('Get')), findsOneWidget);+ expect(find.text('New Harness'), findsNothing);+ expect(app.installs, isEmpty);+ },+ );+ }});testWidgets('without an injected API nothing is asked under test', (diff --git a/desktop/test/store_screen_test.dart b/desktop/test/store_screen_test.dartindex b255517de..f687aeafb 100644--- a/desktop/test/store_screen_test.dart+++ b/desktop/test/store_screen_test.dart@@ -1,5 +1,5 @@-// The Harness Store: the shelf is the machines' catalog as cards, a page is-// one harness with Get/Open/Remove per machine, and ratings and reviews come+// The Harness Store: the shelf is this computer's catalog as cards, a page is+// one harness with local Get/Open/Remove, and ratings and reviews come// from the store API. Pinned: viewers have a quiet dependency view, Get and// Remove reach the notifier for the right machine, Remove asks first, and a// posted review goes to the API with what was typed.@@ -63,15 +63,18 @@ class _Notifier extends AppNotifier {final removals = <(String, String)>[];int probes = 0;int engineProbes = 0;+ final probedMachines = <String>[];@overrideFuture<void> probeEngines(String machineId, {bool force = false}) async {engineProbes++;+ probedMachines.add(machineId);}@overrideFuture<void> probeDsh(String machineId, {bool force = false}) async {probes++;+ probedMachines.add(machineId);}@override@@ -301,75 +304,52 @@ void main() {);testWidgets(- 'a machine that is offline, unlinked or on an older CLI says so instead of offering Get',+ 'the Store never probes or shows remote machines, including reconnects and refreshes',(tester) async {final notifier = _Notifier();addTearDown(notifier.dispose);- // This computer knows Typst; a second machine runs an older CLI that does not.- notifier.machineStates['machine-1'] = MachineState(_machine)+ final local = MachineState(_machine)..localOnly = true+ ..connectionStatus = ConnectionStatus.connected..dsh.replace(const [_marp, _typst]);- final other = MachineState(+ notifier.machineStates['machine-1'] = local;+ final remote = MachineState(const Machine(machineId: 'machine-2',authMode: MachineAuthMode.remote,name: 'office-imac',),- )..dsh.replace(const [_marp]);- notifier.machineStates['machine-2'] = other;+ )..connectionStatus = ConnectionStatus.connected;+ notifier.machineStates['machine-2'] = remote;await tester.pumpWidget(MaterialApp(home: Scaffold(body: StoreTab(notifier: notifier,api: _FakeStore(),- source: 'test',- initialHarness: 'autonomous/typst',+ initialHarness: _typst.id,),),),);await tester.pumpAndSettle();- Finder status(String text) => find.descendant(- of: find.byKey(const ValueKey('store-machine:machine-2')),- matching: find.text(text),- );- FilledButton? get() => tester- .widgetList<FilledButton>(- find.byKey(const ValueKey('store-get:machine-2')),- )- .firstOrNull;-expect(- status('Update Harness CLI on this machine to get it'),+ find.byKey(const ValueKey('store-machine:machine-1')),findsOneWidget,);- expect(get()?.onPressed, isNull);-- // Offline: it cannot answer, so it is not "Asking…" forever.- other.nodeOnline = false;- notifier.notifyListeners();- await tester.pumpAndSettle();- expect(status('Offline'), findsOneWidget);- expect(status('Asking…'), findsNothing);- expect(get()?.onPressed, isNull);-- // Unlinked wins over offline.- other.needsLink = true;+ expect(+ find.byKey(const ValueKey('store-machine:machine-2')),+ findsNothing,+ );+ expect(notifier.probedMachines, ['machine-1', 'machine-1']);+ remote.connectionStatus = ConnectionStatus.reconnecting;notifier.notifyListeners();- await tester.pumpAndSettle();- expect(status('Link required'), findsOneWidget);- expect(get()?.onPressed, isNull);-- // Back online, linked, and knowing the package: Get again.- other- ..needsLink = false- ..nodeOnline = true- ..dsh.replace(const [_marp, _typst]);+ await tester.pump();+ remote.connectionStatus = ConnectionStatus.connected;notifier.notifyListeners();- await tester.pumpAndSettle();- expect(status('Not installed'), findsOneWidget);- expect(get()?.onPressed, isNotNull);+ await tester.pump();+ await tester.pump(const Duration(minutes: 1));+ expect(notifier.probedMachines, ['machine-1', 'machine-1', 'machine-1']);expect(tester.takeException(), isNull);},);@@ -422,7 +402,7 @@ void main() {tester,) async {final (notifier, store) = await open(tester);- expect(notifier.probes, 1, reason: 'every machine is asked again on open');+ expect(notifier.probes, 1, reason: 'this computer is asked again on open');expect(notifier.engineProbes,1,diff --git a/desktop/test/store_tab_state_test.dart b/desktop/test/store_tab_state_test.dartindex 8d59c407f..bfe19f651 100644--- a/desktop/test/store_tab_state_test.dart+++ b/desktop/test/store_tab_state_test.dart@@ -3,8 +3,8 @@// and survives a restart as the store (layouts from before the kind was saved// included). And the two requests its buttons send a machine, `dsh_install`// and `dsh_remove`, with every way a machine can say no turned into a sentence.-// Last, the store page against real per-machine answers: a current CLI, one-// that predates harnesses (UNSUPPORTED), and a relay that cannot install.+// Last, the Store page uses the local daemon only, even with older and+// relayed machines connected beside it.import 'dart:async';import 'package:flutter/material.dart';@@ -323,137 +323,113 @@ void main() {);});- testWidgets(- 'Get, Open and Remove per machine: a current CLI does each, an older one is told to update, a relay says it cannot',- (tester) async {- tester.view.devicePixelRatio = 1;- tester.view.physicalSize = const Size(1280, 1600);- addTearDown(tester.view.reset);+ testWidgets('Store Get, Open and Remove use only the local daemon', (+ tester,+ ) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1280, 1600);+ addTearDown(tester.view.reset);- final installed = <String>{};- final local = _Daemon('local')- ..answer = (type, payload) async => switch (type) {- 'engines_probe' => {'engines': <Object>[]},- 'dsh_install' => (() {- installed.add(payload['id'] as String);- return {'ok': true};- })(),- 'dsh_remove' => {'ok': installed.remove(payload['id'])},- _ => {- 'dsh': [- {..._typst, 'installed': installed.contains(_typst['id'])},- ],- },- };- final older = _Daemon('older')..answer = (_, _) => _refuse('UNSUPPORTED');- final relay = _Daemon('relay')- ..answer = (type, _) => switch (type) {- 'dsh_install' => _refuse('UNSUPPORTED_ON_REMOTE'),- 'engines_probe' => Future.value({'engines': <Object>[]}),- _ => Future.value({- 'dsh': [_typst],- }),- };- final daemons = {'local': local, 'older': older, 'relay': relay};- final app = AppNotifier(- config: AppConfig.dev,- authSession: AuthSession(),- configStore: null,- connectionForTest: (id) => daemons[id]!,+ final installed = <String>{};+ final local = _Daemon('local')+ ..answer = (type, payload) async => switch (type) {+ 'engines_probe' => {'engines': <Object>[]},+ 'dsh_install' => (() {+ installed.add(payload['id'] as String);+ return {'ok': true};+ })(),+ 'dsh_remove' => {'ok': installed.remove(payload['id'])},+ _ => {+ 'dsh': [+ {..._typst, 'installed': installed.contains(_typst['id'])},+ ],+ },+ };+ final older = _Daemon('older')..answer = (_, _) => _refuse('UNSUPPORTED');+ final relay = _Daemon('relay')+ ..answer = (type, _) => switch (type) {+ 'dsh_install' => _refuse('UNSUPPORTED_ON_REMOTE'),+ 'engines_probe' => Future.value({'engines': <Object>[]}),+ _ => Future.value({+ 'dsh': [_typst],+ }),+ };+ final daemons = {'local': local, 'older': older, 'relay': relay};+ final app = AppNotifier(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: null,+ connectionForTest: (id) => daemons[id]!,+ );+ addTearDown(app.dispose);+ for (final (id, name) in [+ ('local', 'studio-mac'),+ ('older', 'old-box'),+ ('relay', 'relay-box'),+ ]) {+ final machine = Machine(+ machineId: id,+ authMode: MachineAuthMode.remote,+ name: name,);- addTearDown(app.dispose);- for (final (id, name) in [- ('local', 'studio-mac'),- ('older', 'old-box'),- ('relay', 'relay-box'),- ]) {- final machine = Machine(- machineId: id,- authMode: MachineAuthMode.remote,- name: name,- );- app.machineStates[id] = MachineState(machine)- ..localOnly = id == 'local'- ..nodeOnline = true;- }- app.openStore();- await tester.pumpWidget(- MaterialApp(- home: Scaffold(- body: StoreTab(- notifier: app,- api: _NoRatings(),- initialHarness: 'autonomous/typst',- ),+ app.machineStates[id] = MachineState(machine)+ ..localOnly = id == 'local'+ ..nodeOnline = true;+ }+ app.openStore();+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: StoreTab(+ notifier: app,+ api: _NoRatings(),+ initialHarness: 'autonomous/typst',),),- );- await tester.pumpAndSettle();- Finder row(String id) => find.byKey(ValueKey('store-machine:$id'));- Finder says(String id, String text) =>- find.descendant(of: row(id), matching: find.text(text));+ ),+ );+ await tester.pumpAndSettle();+ Finder row(String id) => find.byKey(ValueKey('store-machine:$id'));+ Finder says(String id, String text) =>+ find.descendant(of: row(id), matching: find.text(text));- expect(says('local', 'Not installed'), findsOneWidget);- expect(- says(- 'older',- 'Update the harness CLI on this machine to install harnesses',- ),- findsOneWidget,- );- expect(- tester- .widget<FilledButton>(find.byKey(const ValueKey('store-get:older')))- .onPressed,- isNull,- );- expect(says('relay', 'Not installed'), findsOneWidget);+ expect(says('local', 'Not installed'), findsOneWidget);+ expect(row('older'), findsNothing);+ expect(row('relay'), findsNothing);+ expect(older.requests, isEmpty);+ expect(relay.requests, isEmpty);- await tester.tap(find.byKey(const ValueKey('store-get:local')));- await tester.pumpAndSettle();- expect(installed, {'autonomous/typst'});- expect(says('local', 'Installed'), findsOneWidget);- expect(find.byKey(const ValueKey('store-open:local')), findsOneWidget);- expect(- find.descendant(- of: find.byKey(const ValueKey('store-primary-action')),- matching: find.text('Open'),- ),- findsOneWidget,- );+ await tester.tap(find.byKey(const ValueKey('store-get:local')));+ await tester.pumpAndSettle();+ expect(installed, {'autonomous/typst'});+ expect(says('local', 'Installed'), findsOneWidget);+ expect(find.byKey(const ValueKey('store-open:local')), findsOneWidget);+ expect(+ find.descendant(+ of: find.byKey(const ValueKey('store-primary-action')),+ matching: find.text('Open'),+ ),+ findsOneWidget,+ );- await tester.tap(find.byKey(const ValueKey('store-remove:local')));- await tester.pumpAndSettle();- await tester.tap(find.byKey(const ValueKey('store-confirm')));- await tester.pumpAndSettle();- expect(installed, isEmpty);- expect(says('local', 'Not installed'), findsOneWidget);- expect(- local.requests.map((r) => r.$1).where((t) => t != 'engines_probe'),- ['dsh_list', 'dsh_install', 'dsh_list', 'dsh_remove', 'dsh_list'],- );+ await tester.tap(find.byKey(const ValueKey('store-remove:local')));+ await tester.pumpAndSettle();+ await tester.tap(find.byKey(const ValueKey('store-confirm')));+ await tester.pumpAndSettle();+ expect(installed, isEmpty);+ expect(says('local', 'Not installed'), findsOneWidget);+ expect(local.requests.map((r) => r.$1).where((t) => t != 'engines_probe'), [+ 'dsh_list',+ 'dsh_install',+ 'dsh_list',+ 'dsh_remove',+ 'dsh_list',+ ]);- await tester.tap(find.byKey(const ValueKey('store-get:relay')));- await tester.pumpAndSettle();- expect(- find.text('Update the harness CLI on relay-box to install harnesses'),- findsOneWidget,- );- expect(says('relay', 'Install failed'), findsOneWidget);- expect(- find.descendant(- of: find.byKey(const ValueKey('store-get:relay')),- matching: find.text('Try again'),- ),- findsOneWidget,- );- expect(older.requests.map((r) => r.$1).toSet(), {- 'dsh_list',- 'engines_probe',- });- expect(tester.takeException(), isNull);- },- );+ expect(older.requests, isEmpty);+ expect(relay.requests, isEmpty);+ expect(tester.takeException(), isNull);+ });}class _NoRatings implements StoreApi {diff --git a/desktop/test/store_viewers_test.dart b/desktop/test/store_viewers_test.dartindex 79cbebe6b..34abf69ae 100644--- a/desktop/test/store_viewers_test.dart+++ b/desktop/test/store_viewers_test.dart@@ -31,9 +31,9 @@ void main() {loaded: loaded,);await _show(tester, page(loaded: false));- expect(find.text('Asking your machines…'), findsOneWidget);+ expect(find.text('Asking this computer…'), findsOneWidget);await _show(tester, page(loaded: true));- expect(find.text('No viewers reported by your machines.'), findsOneWidget);+ expect(find.text('No viewers reported by this computer.'), findsOneWidget);});testWidgets(