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.

Store: machine rows say Offline, Link required, or that the CLI needs an update

dee32ba0df7372d
diff --git a/desktop/lib/store/store_screen.dart b/desktop/lib/store/store_screen.dart
index c879024f1..1b7086262 100644
--- a/desktop/lib/store/store_screen.dart
+++ b/desktop/lib/store/store_screen.dart
@@ -1096,6 +1096,17 @@ class _MachineRow extends StatelessWidget {
final run = state.dsh.runs[entry.id];
final installing = run != null && run.inProgress;
final installed = row?.installed == true;
+ // Why a machine cannot take this package right now, when it cannot. An
+ // offline or unlinked machine answers nothing, so without these the row
+ // said "Asking…" forever; a machine whose CLI predates the package lists
+ // no row for it, and a Get there would only fail.
+ final unavailable = state.needsLink
+ ? 'Link required'
+ : state.nodeOnline == false
+ ? 'Offline'
+ : state.dsh.loaded && state.dsh.error == null && row == null
+ ? 'Update Harness CLI on this machine to get it'
+ : null;
final String status;
if (installing) {
status = switch (run.phase) {
@@ -1112,6 +1123,8 @@ class _MachineRow extends StatelessWidget {
status = row?.linked == true
? 'Installed · linked to a checkout'
: 'Installed';
+ } else if (unavailable != null) {
+ status = unavailable;
} else if (!state.dsh.loaded) {
status = state.dsh.error ?? 'Asking…';
} else {
@@ -1180,7 +1193,7 @@ class _MachineRow extends StatelessWidget {
] else
FilledButton.tonal(
key: ValueKey('store-get:${state.machine.machineId}'),
- onPressed: state.dsh.loaded ? onGet : null,
+ onPressed: state.dsh.loaded && unavailable == null ? onGet : null,
style: FilledButton.styleFrom(
minimumSize: const Size(72, 32),
shape: const StadiumBorder(),
@@ -1202,7 +1215,11 @@ extension on _MachineRow {
final loaded = state.engines.loaded;
final installed = probe?.installed == true;
final String status;
- if (!loaded) {
+ if (!installed && state.needsLink) {
+ status = 'Link required';
+ } else if (!installed && state.nodeOnline == false) {
+ status = 'Offline';
+ } else if (!loaded) {
status = 'Asking…';
} else if (installed) {
status = 'Installed';
@@ -1252,7 +1269,10 @@ extension on _MachineRow {
onPressed: onOpen,
child: const Text('Open'),
)
- else if (loaded && probe?.installable == true)
+ else if (loaded &&
+ probe?.installable == true &&
+ !state.needsLink &&
+ state.nodeOnline != false)
FilledButton.tonal(
key: ValueKey('store-get:${state.machine.machineId}'),
onPressed: onGet,
diff --git a/desktop/test/store_screen_test.dart b/desktop/test/store_screen_test.dart
index cbf1b56b3..c41ea631b 100644
--- a/desktop/test/store_screen_test.dart
+++ b/desktop/test/store_screen_test.dart
@@ -250,7 +250,11 @@ void main() {
final (notifier, _) = await open(tester);
final state = notifier.machineStates['machine-1']!;
expect(state.connectionStatus, ConnectionStatus.disconnected);
- expect(notifier.probes, 1, reason: 'asked once on open, before it connected');
+ expect(
+ notifier.probes,
+ 1,
+ reason: 'asked once on open, before it connected',
+ );
// The launch race: the store tab was restored first, the machine connects later.
state.connectionStatus = ConnectionStatus.connected;
@@ -276,6 +280,80 @@ void main() {
},
);
+ testWidgets(
+ 'a machine that is offline, unlinked or on an older CLI says so instead of offering Get',
+ (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)
+ ..localOnly = true
+ ..dsh.replace(const [_marp, _typst]);
+ final other = MachineState(
+ const Machine(
+ machineId: 'machine-2',
+ authMode: MachineAuthMode.remote,
+ name: 'office-imac',
+ ),
+ )..dsh.replace(const [_marp]);
+ notifier.machineStates['machine-2'] = other;
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: StoreTab(
+ notifier: notifier,
+ api: _FakeStore(),
+ source: 'test',
+ initialHarness: 'autonomous/typst',
+ ),
+ ),
+ ),
+ );
+ 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'),
+ 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;
+ 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]);
+ notifier.notifyListeners();
+ await tester.pumpAndSettle();
+ expect(status('Not installed'), findsOneWidget);
+ expect(get()?.onPressed, isNotNull);
+ expect(tester.takeException(), isNull);
+ },
+ );
+
testWidgets('the catalog keeps real ratings and hides viewer dependencies', (
tester,
) async {