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.

fix: reconcile model picker with main (short status word, top-5, design-system colors)

Time8664414a86b
diff --git a/desktop/lib/models/model_search_catalog.dart b/desktop/lib/models/model_search_catalog.dart
index c1a8dc5b8..c73684bb5 100644
--- a/desktop/lib/models/model_search_catalog.dart
+++ b/desktop/lib/models/model_search_catalog.dart
@@ -372,6 +372,28 @@ class ModelSearchCatalog extends ChangeNotifier {
: 'Suggested';
}
+ /// The inline status word for a list row: a short word with no progress
+ /// percentage (the percentage lives in the pane/detail). Operation and pending
+ /// states map to their bare label so the row never repeats the "42%".
+ String localStatusWord(LocalModel model, {ModelManagerController? controller}) {
+ final owner = controller ?? manager;
+ final operation = owner.operationFor(model);
+ if (operation?.active == true) return operation!.label;
+ if (owner.pendingId == model.id) {
+ return owner.pendingDownload
+ ? 'Downloading'
+ : owner.pendingStart
+ ? 'Starting'
+ : 'Stopping';
+ }
+ if (operation?.failed == true) return 'Failed';
+ return model.running
+ ? 'Running'
+ : model.downloaded
+ ? 'Downloaded'
+ : 'Suggested';
+ }
+
@override
void dispose() {
manager.app.removeListener(_machinesChanged);
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index a4aeab93c..491447085 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -214,7 +214,7 @@ class SwarmSearchController extends ChangeNotifier {
final local = entry.local;
final owner = entry.controller ?? catalog.manager;
return local != null
- ? catalog.localStatus(local, controller: owner)
+ ? catalog.localStatusWord(local, controller: owner)
: entry.status;
}
diff --git a/desktop/lib/widgets/resting_model_words.dart b/desktop/lib/widgets/resting_model_words.dart
index ad9f57341..6b8a77d01 100644
--- a/desktop/lib/widgets/resting_model_words.dart
+++ b/desktop/lib/widgets/resting_model_words.dart
@@ -52,9 +52,9 @@ const kRestingUntilNextMessage = 'Running · resting until your next message';
/// minutes, hours and days — rounded down, so a list is never called younger than it is.
String listAge(int seconds) {
if (seconds < 60) return 'just now';
- if (seconds < 3600) return '${seconds ~/ 60} min ago';
- if (seconds < 86400) return '${seconds ~/ 3600} h ago';
- return '${seconds ~/ 86400} d ago';
+ if (seconds < 3600) return '${seconds ~/ 60}min ago';
+ if (seconds < 86400) return '${seconds ~/ 3600}h ago';
+ return '${seconds ~/ 86400}d ago';
}
/// The asleep section's subtitle. The age is left off when the daemon did not send one — a list
@@ -62,7 +62,7 @@ String listAge(int seconds) {
String restingSubtitle(int? lastKnownAge) => [
'Asleep',
if (lastKnownAge != null) listAge(lastKnownAge),
-].join(' · ');
+].join(' ');
/// A wake that could not start [section]. The account's own section is "your models" — its name is
/// an internal id nobody chose — and a shared one goes by the name it is listed under.
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index 75b3974b4..1492e724a 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -1142,12 +1142,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
SizedBox(height: cell.height),
Text(
statusWord,
- style: terminalContentStyle(
- color:
- local?.running == true || opActive || statusWord == 'Suggested'
- ? const Color(0xFF86E6A3)
- : theme.foreground,
- ),
+ style: terminalContentStyle(color: theme.foreground),
),
if (widget.search.modelUseErrorId == entry.id &&
widget.search.modelUseError != null)
diff --git a/desktop/test/model_search_catalog_test.dart b/desktop/test/model_search_catalog_test.dart
index 10ab0dd0d..0f9a4b43f 100644
--- a/desktop/test/model_search_catalog_test.dart
+++ b/desktop/test/model_search_catalog_test.dart
@@ -121,6 +121,7 @@ void main() {
'Custom API',
'[ Add ]',
'ZZZ installed',
+ 'AAA catalog',
'[ Get models ]',
'Shared Qwen · team.lan',
]);
@@ -130,6 +131,7 @@ void main() {
ModelSearchSection.apis,
ModelSearchSection.local,
ModelSearchSection.local,
+ ModelSearchSection.local,
ModelSearchSection.shared,
]);
search.move(
@@ -142,8 +144,8 @@ void main() {
'Custom API',
'[ Add ]',
'ZZZ installed',
- '[ Hide catalog ]',
'AAA catalog',
+ '[ Hide catalog ]',
'Shared Qwen · team.lan',
]);
expect(search.selected!.title, 'AAA catalog');
@@ -153,7 +155,8 @@ void main() {
);
search.submit();
expect(search.modelDownloadsVisible, isFalse);
- expect(search.rows.any((row) => row.title == 'AAA catalog'), isFalse);
+ // The top-5 catalog model stays visible even after hiding the catalog.
+ expect(search.rows.any((row) => row.title == 'AAA catalog'), isTrue);
search.setQuery(':Local AI');
expect(
search.rows.where((row) => !row.isCreate).map((row) => row.title),
diff --git a/desktop/test/models_panel_test.dart b/desktop/test/models_panel_test.dart
index c38c9b2a2..ed1e5c8b7 100644
--- a/desktop/test/models_panel_test.dart
+++ b/desktop/test/models_panel_test.dart
@@ -735,10 +735,11 @@ void main() {
expect(panel.width, greaterThan(1000));
expect(find.byType(Dialog), findsNothing);
expect(resourceSearch(tester).isModelMode, isTrue);
+ // The top-5 catalog model stays visible without pressing "Get models".
expect(
resourceSearch(tester).rows
.any((row) => row.modelId == 'model:local:qwen'),
- isFalse,
+ isTrue,
);
expect(
resourceSearch(tester).rows
diff --git a/desktop/test/resource_picker_test.dart b/desktop/test/resource_picker_test.dart
index 22a10d708..456a535a6 100644
--- a/desktop/test/resource_picker_test.dart
+++ b/desktop/test/resource_picker_test.dart
@@ -748,9 +748,10 @@ void main() {
await key(tester, LogicalKeyboardKey.keyI, cmd: true);
expect(search(tester).modelSelectionEngine, 'codex');
expect(search(tester).selected!.title, 'OpenAI');
+ // The top-5 catalog models are surfaced without pressing "Get models".
expect(
search(tester).rows.any((row) => row.modelId == 'model:local:qwen'),
- isFalse,
+ isTrue,
);
for (final heading in [
'Subscriptions',
diff --git a/desktop/test/resting_model_picker_test.dart b/desktop/test/resting_model_picker_test.dart
index 20e6d60dd..6faca5ea9 100644
--- a/desktop/test/resting_model_picker_test.dart
+++ b/desktop/test/resting_model_picker_test.dart
@@ -125,8 +125,7 @@ void main() {
),
]);
await open(tester);
- const subtitle =
- 'Asleep · starts when you send a message (about 10–30 s) · list from 9 h ago';
+ const subtitle = 'Asleep 9h ago';
expect(find.text(subtitle), findsOneWidget);
expect(
find.byTooltip(
diff --git a/desktop/test/resting_models_panel_test.dart b/desktop/test/resting_models_panel_test.dart
index 87f283b8d..d65991de3 100644
--- a/desktop/test/resting_models_panel_test.dart
+++ b/desktop/test/resting_models_panel_test.dart
@@ -164,8 +164,7 @@ void main() {
section('loft', state: 'awake', wakeOutcome: 'nobody_serving'),
]);
- const subtitle =
- 'Asleep · starts when you send a message (about 10–30 s) · list from 2 h ago';
+ const subtitle = 'Asleep 2h ago';
expect(find.text(subtitle), findsOneWidget);
expect(
find.byTooltip(
diff --git a/desktop/test/resting_models_test.dart b/desktop/test/resting_models_test.dart
index 073adaa85..15b699be1 100644
--- a/desktop/test/resting_models_test.dart
+++ b/desktop/test/resting_models_test.dart
@@ -142,11 +142,11 @@ void main() {
test('a list age reads in minutes, hours and days, rounded down', () {
expect(listAge(0), 'just now');
expect(listAge(59), 'just now');
- expect(listAge(60), '1 min ago');
- expect(listAge(3599), '59 min ago');
- expect(listAge(9 * 3600 + 1800), '9 h ago');
- expect(listAge(86399), '23 h ago');
- expect(listAge(3 * 86400), '3 d ago');
+ expect(listAge(60), '1min ago');
+ expect(listAge(3599), '59min ago');
+ expect(listAge(9 * 3600 + 1800), '9h ago');
+ expect(listAge(86399), '23h ago');
+ expect(listAge(3 * 86400), '3d ago');
});
test('each state of the contract table reads as the table says', () {
@@ -163,7 +163,7 @@ void main() {
);
expect(
asleep.subtitle,
- 'Asleep · starts when you send a message (about 10–30 s) · list from 9 h ago',
+ 'Asleep 9h ago',
);
expect(
asleep.tooltip,