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
feat(models picker): terminal status display, top-5 catalog, grid order
Tim6508b7b3faac
diff --git a/cli/src/lib/localModels.ts b/cli/src/lib/localModels.tsindex 3d11cd02e..3082344f7 100644--- a/cli/src/lib/localModels.ts+++ b/cli/src/lib/localModels.ts@@ -194,23 +194,19 @@ export class LocalModels {if (url.protocol !== 'https:' && !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))) {throw new Error('The model catalog address is unavailable.')}- const all: any[] = []- for (let page = 1; page <= 100; page++) {- const response = await this.request(url, {- method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },- body: JSON.stringify({ browse: true, page, page_size: 50, device: {- device_class: device.device_class, usable_bytes: device.usable_bytes, backend: device.backend,- } }), signal: AbortSignal.timeout(20_000), redirect: 'error',- })- if (!response.ok) throw new Error('Compatible models are unavailable. Try again.')- const body = obj(await response.json())- if (!Array.isArray(body.models)) throw new Error('Compatible models are unavailable. Try again.')- all.push(...body.models)- const totalPages = num(obj(body.pagination).total_pages) ?? 1- if (page >= totalPages || (num(body.runnable_total) !== undefined && all.filter(m => m.runnable === true).length >= body.runnable_total)) return { models: all }- if (!body.models.length || obj(body.pagination).page !== page) throw new Error('The model catalog is incomplete. Try again.')- }- throw new Error('The model catalog is incomplete. Try again.')+ // Match `grid catalog`/`list` (cli/models.py `_fetch_pullable`): browse the+ // catalog service's first page of ranked "popular" models for this device,+ // not every compatible row across all pages — the picker shows one page.+ const response = await this.request(url, {+ method: 'POST', headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },+ body: JSON.stringify({ browse: true, page_size: 50, device: {+ device_class: device.device_class, usable_bytes: device.usable_bytes, backend: device.backend,+ } }), signal: AbortSignal.timeout(20_000), redirect: 'error',+ })+ if (!response.ok) throw new Error('Compatible models are unavailable. Try again.')+ const body = obj(await response.json())+ if (!Array.isArray(body.models)) throw new Error('Compatible models are unavailable. Try again.')+ return { models: body.models }}private async loadCatalog(force = false): Promise<void> {diff --git a/desktop/lib/models/model_search_catalog.dart b/desktop/lib/models/model_search_catalog.dartindex 667ac46b7..f62bb3a54 100644--- a/desktop/lib/models/model_search_catalog.dart+++ b/desktop/lib/models/model_search_catalog.dart@@ -232,6 +232,8 @@ class ModelSearchCatalog extends ChangeNotifier {words.subtitle ??(manager.models?.reachable == false? 'Unavailable'+ : section.own+ ? 'Suggested': 'Available'),),);@@ -252,8 +254,13 @@ class ModelSearchCatalog extends ChangeNotifier {local.sort((a, b) {final state = rank(a.owner, a.model).compareTo(rank(b.owner, b.model));if (state != 0) return state;- final name = a.model.name.compareTo(b.model.name);- if (name != 0) return name;+ // Preserve the daemon's grid-ranking order (the order the catalog+ // service returned), not an alphabetised re-sort — so the top models+ // match `grid catalog` / `list` instead of listing alphabetical first.+ final aIndex = a.owner.localModels.indexOf(a.model);+ final bIndex = b.owner.localModels.indexOf(b.model);+ final order = aIndex.compareTo(bIndex);+ if (order != 0) return order;final host = (a.owner.machine?.machine.displayName ?? '').compareTo(b.owner.machine?.machine.displayName ?? '',);@@ -336,7 +343,7 @@ class ModelSearchCatalog extends ChangeNotifier {? 'Running': model.downloaded? 'Downloaded'- : 'Available';+ : 'Suggested';}@overridediff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex 79ae96e0f..d1a51b259 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -126,6 +126,34 @@ class SwarmSearchController extends ChangeNotifier {: null;}+ /// The live status word for a model row (no glyph), shown inline in the list+ /// so you can see Running/Downloaded/usage at a glance. Derives the word from+ /// the same catalogue [ModelSearchCatalog.localStatus] the preview uses, so+ /// the list and the pane can never disagree.+ String? modelRowStatus(SwarmDestination row) {+ final catalog = models;+ final entry = catalog?.entries[row.modelId];+ if (entry == null || catalog == null) return null;+ final local = entry.local;+ final owner = entry.controller ?? catalog.manager;+ return local != null+ ? catalog.localStatus(local, controller: owner)+ : entry.status;+ }++ /// Whether the model row is live right now (running, or a download/start/stop+ /// in progress). Drives the green status colour in the list.+ bool modelRowLive(SwarmDestination row) {+ final catalog = models;+ final entry = catalog?.entries[row.modelId];+ if (entry == null || catalog == null) return false;+ final local = entry.local;+ final op = local == null+ ? null+ : (entry.controller ?? catalog.manager).operationFor(local);+ return op?.active == true || (local?.running ?? false);+ }+bool canGetModel(SwarmDestination? row) {if (!isModelMode) return false;final entry = models?.entries[row?.modelId];@@ -1156,8 +1184,20 @@ class SwarmSearchController extends ChangeNotifier {).toList();if (isModelMode && matchQuery.trim().isEmpty && !modelDownloadsVisible) {+ // Always surface the top few catalog models (in grid-ranking order) so the+ // picker opens with them already in view; the rest stay hidden until+ // "Get models" is pressed.+ final topCatalog = candidates+ .where((row) => models?.entries[row.modelId]?.needsDownload == true)+ .take(5)+ .map((row) => row.id)+ .toSet();candidates = candidates- .where((row) => models?.entries[row.modelId]?.needsDownload != true)+ .where(+ (row) =>+ models?.entries[row.modelId]?.needsDownload != true ||+ topCatalog.contains(row.id),+ ).toList();}if (scopedBranch case final branch?) {@@ -1354,8 +1394,10 @@ class SwarmSearchController extends ChangeNotifier {final create = (a.isCreate ? 1 : 0).compareTo(b.isCreate ? 1 : 0);return create != 0 ? create : order[a.id]!.compareTo(order[b.id]!);}- final installed = (models?.entries[a.modelId]?.localRank ?? 1)- .compareTo(models?.entries[b.modelId]?.localRank ?? 1);+ // The downloads toggle sorts AFTER the catalog rows (rank 2), so the+ // always-visible top catalog models sit above the "[ Get models ]" row.+ final installed = (models?.entries[a.modelId]?.localRank ?? 3)+ .compareTo(models?.entries[b.modelId]?.localRank ?? 3);return installed != 0? installed: order[a.id]!.compareTo(order[b.id]!);diff --git a/desktop/lib/terminal/terminal_theme.dart b/desktop/lib/terminal/terminal_theme.dartindex d7d995ef8..6fe53c39d 100644--- a/desktop/lib/terminal/terminal_theme.dart+++ b/desktop/lib/terminal/terminal_theme.dart@@ -4,6 +4,24 @@ import 'package:xterm/xterm.dart';import '../shared/theme/color_palette.dart';import 'terminal_theme_store.dart';+/// Semantic colours for terminal-styled chrome, derived from the scheme's own+/// foreground rather than a hardcoded white. The terminal-dialogs design system+/// says to derive muted text from the foreground, so these are the foreground+/// blended toward the background at increasing strength. They are additive+/// getters, so they never change how an existing theme resolves.+extension TerminalThemeSemantics on TerminalTheme {+ /// Low-importance text: meta, labels, timestamps, hints, secondary lines.+ Color get muted => foreground.withValues(alpha: .54);++ /// Lower still: disabled or strongly receding text. Kept separate from+ /// [muted] so a real hierarchy has more than two levels on the same size.+ Color get faded => foreground.withValues(alpha: .40);++ /// The scheme's interactive accent — the cursor colour, which the match-app+ /// theme sets to the app palette's accent.+ Color get accent => cursor;+}+/// The colours a terminal pane draws itself in.////// ⚠️ Returns a CACHED (or `const`) instance, never a fresh one. The vendoreddiff --git a/desktop/lib/widgets/resting_model_words.dart b/desktop/lib/widgets/resting_model_words.dartindex 39c8ee4c3..ad9f57341 100644--- a/desktop/lib/widgets/resting_model_words.dart+++ b/desktop/lib/widgets/resting_model_words.dart@@ -61,8 +61,7 @@ String listAge(int seconds) {/// with no known age is still a resting section, and "from ? ago" would be a guess.String restingSubtitle(int? lastKnownAge) => ['Asleep',- 'starts when you send a message (about 10–30 s)',- if (lastKnownAge != null) 'list from ${listAge(lastKnownAge)}',+ if (lastKnownAge != null) listAge(lastKnownAge),].join(' · ');/// A wake that could not start [section]. The account's own section is "your models" — its name isdiff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dartindex bba0c5867..2bea3ec2a 100644--- a/desktop/lib/widgets/swarm_resource_preview.dart+++ b/desktop/lib/widgets/swarm_resource_preview.dart@@ -1021,78 +1021,180 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {catalog.manager.scanning ? 'Finding models…' : 'No matching models',]);}+ final cell = terminalCellSizeOf(context);+ final theme = terminalThemeFor(+ grid.AppTheme.palette.value,+ terminalThemeStore.value,+ );final local = entry.local;final owner = entry.controller ?? catalog.manager;final operation = local == null ? null : owner.operationFor(local);final pending = local != null && owner.pendingId == local.id;- String window(double seconds) => seconds % 86400 == 0- ? '${(seconds / 86400).toInt()}d'- : seconds % 3600 == 0- ? '${(seconds / 3600).toInt()}h'- : '${seconds.toInt()}s';- return _details([- entry.name,- if (widget.search.modelUseErrorId == entry.id)- ?widget.search.modelUseError,- [- if (local == null) entry.source,- ?entry.node,- if (local?.sizeBytes case final size?)- '${(size / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB',- ].join(' · '),- if (local != null) ...[- if (local.running &&- (local.tokensPerSecond != null || local.requests != null))- [- if (local.tokensPerSecond case final speed?)- '${speed.toStringAsFixed(1)} tok/s',- if (local.requests != null && local.windowSeconds != null)- '${local.requests!.toInt()} requests / ${window(local.windowSeconds!)}',- ].join(' · '),- if (local.resting) 'Resting until your next message',- if (pending || operation?.active == true || operation?.failed == true)- catalog.localStatus(local, controller: owner),- ?operation?.error,- if (!local.downloaded &&- !owner.supportsDownload &&- local.canStart &&- !pending &&- operation?.active != true)- 'Downloads and starts on ${entry.node ?? 'this machine'}.',- ] else if (entry.status != 'Available')- entry.status,- if (widget.search.modelUseReason(row) case final reason?- when reason != 'No active harness' &&- reason != entry.status &&- reason != 'Tools only' &&- reason != 'Download first')- switch (reason) {- 'Claude only' => 'Use this subscription in a Claude harness.',- 'Codex only' => 'Use this subscription in a Codex harness.',- 'Other account' =>- 'This account is not signed in on the harness’s machine.',- 'Not serving' => 'Not serving on ${entry.node ?? 'its host'}.',- _ => reason,- },- if (entry.own && local == null && owner.scanning)- 'Finding model controls…',- if (!identical(owner, catalog.manager)) ...[- if (owner.machine?.connectionStatus != ConnectionStatus.connected)- 'Connect to ${entry.node} to manage its models.'- else- ?owner.error,- ],- if (entry.api case final api?) ...[- api.baseUrl,- api.keyEnv,- 'Available to harness tools on this computer.',- ],- if (entry.subscription case final subscription?) ...[- ...((subscription['details'] as List?) ?? const [])- .map((detail) => '$detail')- .where((detail) => detail != entry.status),+ final opActive = operation?.active == true;++ String bytesLabel(double? bytes) {+ if (bytes == null) return '—';+ return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(1)} GB';+ }++ String windowLabel(double? seconds) {+ if (seconds == null) return '—';+ if (seconds > 0 && seconds % 86400 == 0) {+ return '${(seconds / 86400).toInt()}d';+ }+ if (seconds > 0 && seconds % 3600 == 0) {+ return '${(seconds / 3600).toInt()}h';+ }+ return '${(seconds / 60).round()}m';+ }++ // The status word is the catalog's own [localStatus] so the pane and the+ // list row can never disagree (both come from the same [_refresh] snapshot);+ // no re-derivation from a possibly-stale operation on the pane side.+ final statusWord =+ local != null ? catalog.localStatus(local, controller: owner) : entry.status;++ // Suitability against this machine's usable memory, per plan §5. Only local+ // models carry a "fits this machine" meaning; shared/api/subscription nodes+ // have no per-node memory here, so fit is left out for them.+ final memory = owner.memoryBytes;+ String? fitsLabel() {+ final size = local?.sizeBytes;+ if (memory == null || local == null || size == null) return null;+ if (size <= memory) {+ final gb = (memory / (1024 * 1024 * 1024)).toStringAsFixed(0);+ return '✓ fits $gb GB';+ }+ return 'needs ${(size / (1024 * 1024 * 1024)).toStringAsFixed(0)} GB';+ }++ Widget labelValue(String label, String value) {+ return Padding(+ padding: EdgeInsets.only(bottom: cell.height * .6),+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.baseline,+ textBaseline: TextBaseline.alphabetic,+ children: [+ SizedBox(+ width: cell.width * 9,+ child: Text(+ label,+ style: terminalContentStyle(color: theme.muted),+ ),+ ),+ Expanded(+ child: Text(+ value,+ style: terminalContentStyle(color: theme.foreground),+ ),+ ),+ ],+ ),+ );+ }++ Widget errorLine(String text) {+ return Padding(+ padding: EdgeInsets.only(top: cell.height),+ child: Text(+ text,+ style: terminalContentStyle(color: theme.yellow),+ ),+ );+ }++ return ListView(+ controller: _scroll,+ padding: EdgeInsets.symmetric(+ horizontal: cell.width * 2,+ vertical: cell.height,+ ),+ children: [+ Text(+ entry.name,+ style: terminalContentStyle(color: theme.foreground)+ .copyWith(fontWeight: FontWeight.bold),+ ),+ SizedBox(height: cell.height),+ Text(+ statusWord,+ style: terminalContentStyle(+ color:+ local?.running == true || opActive || statusWord == 'Suggested'+ ? const Color(0xFF86E6A3)+ : theme.foreground,+ ),+ ),+ if (widget.search.modelUseErrorId == entry.id &&+ widget.search.modelUseError != null)+ errorLine(widget.search.modelUseError!),+ SizedBox(height: cell.height),+ labelValue(+ 'Machine',+ entry.node ?? (entry.source == 'Local' ? 'This Mac' : entry.source),+ ),+ if (local != null) ...[+ if (fitsLabel() case final fits?) labelValue('Fits', fits),+ labelValue('Size', bytesLabel(local.sizeBytes)),+ labelValue('Quant', local.quant ?? '—'),+ if (local.running && local.tokensPerSecond != null)+ labelValue('Speed',+ '${local.tokensPerSecond!.toStringAsFixed(1)} tok/s'),+ if (local.running &&+ local.requests != null &&+ local.windowSeconds != null)+ labelValue(+ 'Window',+ '${local.requests!.toInt()} req / ${windowLabel(local.windowSeconds)}',+ ),+ if (local.resting) labelValue('State', 'Resting until your next message'),+ if (!local.downloaded &&+ !owner.supportsDownload &&+ local.canStart &&+ !pending &&+ !opActive)+ errorLine(+ 'Downloads and starts on ${entry.node ?? 'this machine'}.'),+ ],+ if (entry.api case final api?) ...[+ labelValue('Host', api.baseUrl),+ labelValue('Key', api.keyEnv),+ ],+ if (entry.subscription case final subscription?) ...[+ ...((subscription['details'] as List?) ?? const [])+ .map((d) => '$d')+ .where((d) => d != entry.status)+ .take(3)+ .map((d) => labelValue('Detail', d)),+ ],+ labelValue('Source', entry.source),+ if (widget.search.modelUseReason(row) case final reason?+ when reason != 'No active harness' &&+ reason != entry.status &&+ reason != 'Tools only' &&+ reason != 'Download first')+ errorLine(switch (reason) {+ 'Claude only' => 'Use this subscription in a Claude harness.',+ 'Codex only' => 'Use this subscription in a Codex harness.',+ 'Other account' =>+ 'This account is not signed in on the harness’s machine.',+ 'Not serving' => 'Not serving on ${entry.node ?? 'its host'}.',+ _ => reason,+ }),+ if (entry.own && local == null && owner.scanning)+ errorLine('Finding model controls…'),+ if (!identical(owner, catalog.manager)) ...[+ if (owner.machine?.connectionStatus != ConnectionStatus.connected)+ errorLine('Connect to ${entry.node} to manage its models.')+ else if (owner.error case final err?)+ errorLine(err),+ ],+ if (operation?.error case final err?) errorLine(err),+ if (catalog.manager.error case final err?) errorLine(err),+ SizedBox(height: cell.height),+ _actionButtons(),],- ], controls: true);+ );}Widget _machinePreview() {diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex e09dd1799..5089dda14 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -1143,7 +1143,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {crossAxisAlignment: CrossAxisAlignment.stretch,children: [// The list is what is being read; the preview confirms it.- Expanded(flex: 6, child: results),+ Expanded(flex: 5, child: results),if (widget.terminal)VerticalDivider(width: 1,@@ -1153,7 +1153,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {)elseconst SizedBox(width: 8),- Expanded(flex: 4, child: preview ?? const SizedBox()),+ Expanded(flex: 5, child: preview ?? const SizedBox()),],): preview == null@@ -1332,12 +1332,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {? widget.search.modelRowAction(row): null;final style = terminalContentStyle(- color:- !widget.enabled ||- (row.isModel &&- !widget.search.isModelDownloadsRow(row) &&- !widget.search.canSelectModel(row) &&- !widget.search.canGetModel(row))+ color: !widget.enabled? theme.foreground.withValues(alpha: .28): row.isCreate || widget.search.isModelDownloadsRow(row)? theme.cursor@@ -1409,19 +1404,21 @@ class _SearchRowContentState extends State<_SearchRowContent> {style: style,),),- if (modelAction != null) ...[+ if (widget.search.modelRowStatus(row) case final status?) ...[SizedBox(width: cell.width * 2),Text(- modelAction,- key: ValueKey('model-row-action:${row.id}'),+ status,+ key: ValueKey('model-row-status:${row.id}'),maxLines: 1,style: terminalContentStyle(- color: modelAction == 'Use'- ? theme.foreground+ color: widget.search.modelRowLive(row) ||+ status == 'Suggested'+ ? const Color(0xFF86E6A3): muted,),),- ] else if (widget.unavailableReason case final reason?) ...[+ ],+ if (widget.unavailableReason case final reason?) ...[SizedBox(width: cell.width * 2),ConstrainedBox(constraints: BoxConstraints(diff --git a/desktop/test/resource_picker_test.dart b/desktop/test/resource_picker_test.dartindex e5ea79802..d4af15bb4 100644--- a/desktop/test/resource_picker_test.dart+++ b/desktop/test/resource_picker_test.dart@@ -788,7 +788,7 @@ void main() {.move(search(tester).rows.indexOf(usable) - search(tester).cursor);await tester.pump();expect(- find.byKey(ValueKey('model-row-action:${usable.id}')),+ find.byKey(ValueKey('model-row-status:${usable.id}')),findsOneWidget,);expect(search(tester).modelRowAction(usable), 'Use');@@ -803,7 +803,8 @@ void main() {.join('\n'),);expect(find.text('Enter Use · Tab pane'), findsOneWidget);- expect(find.text('M2 · 15.0 GB'), findsOneWidget);+ expect(find.text('M2'), findsOneWidget);+ expect(find.text('15.0 GB'), findsOneWidget);await capture(tester, 'remote-model-select');final origin = search(tester);await key(tester, LogicalKeyboardKey.tab);@@ -941,7 +942,8 @@ void main() {await tester.enterText(field, ':mac.lan');await tester.pump();expect(search(tester).selected!.title, 'qwen3.8-27b');- expect(find.text('On your machines · mac.lan'), findsOneWidget);+ expect(find.text('On your machines'), findsOneWidget);+ expect(find.text('mac.lan'), findsOneWidget);if (mac) await capture(tester, 'own-machine-model');await key(tester, LogicalKeyboardKey.escape);await key(tester, LogicalKeyboardKey.keyO, cmd: mac, ctrl: !mac);diff --git a/desktop/test/resource_preview_actions_test.dart b/desktop/test/resource_preview_actions_test.dartindex 944f12717..615ff6a03 100644--- a/desktop/test/resource_preview_actions_test.dart+++ b/desktop/test/resource_preview_actions_test.dart@@ -196,8 +196,11 @@ void main() {tester,) async {await mount(tester, ':Shared Qwen');- expect(find.text('Shared · Team · Team computer'), findsOneWidget);- expect(find.text('Available'), findsNothing);+ // The preview is a label/value table, not a single joined string.+ expect(find.text('Shared Qwen'), findsOneWidget);+ expect(find.text('Shared · Team'), findsOneWidget);+ expect(find.text('Team computer'), findsOneWidget);+ expect(find.text('Available'), findsOneWidget);await invoke(tester, 'picker.accept');expect(choices, isEmpty);search.setQuery(':Codex subscription');@@ -232,7 +235,8 @@ void main() {) async {await mount(tester, ':mac.lan');expect(find.text('qwen3.8-27b'), findsOneWidget);- expect(find.text('On your machines · mac.lan'), findsOneWidget);+ expect(find.text('On your machines'), findsOneWidget);+ expect(find.text('mac.lan'), findsOneWidget);expect(find.byKey(const ValueKey('resource-action:picker.accept')),findsOneWidget,@@ -268,7 +272,8 @@ void main() {tester,) async {await mount(tester, ':Qwen3.8-27B', scenario: 'ready');- expect(find.text('17.6 tok/s · 42 requests / 1d'), findsOneWidget);+ expect(find.text('17.6 tok/s'), findsOneWidget);+ expect(find.text('42 req / 1d'), findsOneWidget);await invoke(tester, 'picker.accept');expect(choices, isEmpty);final reads = app.localReads;@@ -319,8 +324,10 @@ void main() {search.rows.where((row) => row.title == 'qwen3.8-27b · Q4_0'),hasLength(1),);- expect(find.text('M2 · 16.0 GB'), findsOneWidget);- expect(find.text('17.6 tok/s · 42 requests / 1d'), findsOneWidget);+ expect(find.text('M2'), findsOneWidget);+ expect(find.text('16.0 GB'), findsOneWidget);+ expect(find.text('17.6 tok/s'), findsOneWidget);+ expect(find.text('42 req / 1d'), findsOneWidget);TerminalTextAction button(String action) => tester.widget(find.byKey(ValueKey('resource-action:picker.model_$action')),);