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
Merge branch 'main' into feat/models-picker-ux
Tim7f174f9aa177
diff --cc desktop/lib/state/swarm_search.dartindex d1a51b259,103fff323..a4aeab93c--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@@ -1184,22 -1250,16 +1278,28 @@@ class SwarmSearchController extends Cha).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 (isModelMode && matchQuery.trim().isEmpty) {+ candidates = candidates.where((row) {+ final entry = models?.entries[row.modelId];+ return entry?.apiModel == null || expandedApis.contains(entry!.api!.id);+ }).toList();+ }if (scopedBranch case final branch?) {candidates = candidates.where((row) {final machine = app.stateOf(row.machineId ?? '');@@@ -1392,12 -1468,19 +1508,21 @@@if (section != 0) return section;if (modelSection(a) != ModelSearchSection.local) {final create = (a.isCreate ? 1 : 0).compareTo(b.isCreate ? 1 : 0);- return create != 0 ? create : order[a.id]!.compareTo(order[b.id]!);+ if (create != 0) return create;+ if (modelSection(a) == ModelSearchSection.apis && !a.isCreate) {+ final group = apiGroup(a).compareTo(apiGroup(b));+ if (group != 0) return group;+ final heading = (isApiRow(a) ? 0 : 1).compareTo(+ isApiRow(b) ? 0 : 1,+ );+ if (heading != 0) return heading;+ }+ return 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 --cc desktop/lib/widgets/swarm_resource_preview.dartindex 2bea3ec2a,ed44f9d14..75b3974b4--- a/desktop/lib/widgets/swarm_resource_preview.dart+++ b/desktop/lib/widgets/swarm_resource_preview.dart@@@ -1030,173 -1047,131 +1052,234 @@@ class _SwarmResourcePreviewState extendfinal 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';+ final opActive = operation?.active == true;++ // API entries have their own dedicated preview; keep main's dispatch.+ if (entry.api != null) return _apiPreview(entry);- 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.subscription case final subscription?) ...[- ...((subscription['details'] as List?) ?? const [])- .map((detail) => '$detail')- .where((detail) => detail != entry.status),++ 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);+ );}+ static const _kDetailLabelColumns = 9;++ /// A saved API, or one of its models: a summary line, then labelled facts, then what it is for.+ Widget _apiPreview(ModelSearchEntry entry) {+ final api = entry.api!;+ final listed = widget.search.models!.manager.apis.models[api.id];+ final model = entry.apiModel;+ if (model != null) {+ final reason = widget.search.modelUseReason(row);+ return _details([+ entry.name,+ [+ api.name,+ if (model.contextWindow case final window?)+ '${contextWindowLabel(window)} context',+ ].join(' · '),+ '',+ if (model.name case final name?) ('Name', name),+ ('Via', '${api.name} · ${api.host}'),+ '',+ if (reason == null)+ 'Use runs this harness on it, with the key saved on '+ '${widget.search.models!.manager.apis.hostLabel}.'+ else if (reason == 'Other machine')+ 'Its key is saved on ${widget.search.models!.manager.apis.hostLabel}, '+ 'so only the harnesses there can run on it.'+ else+ reason,+ ], controls: true);+ }+ final count = listed?.models.length ?? 0;+ // One line for what the API is for: a harness runs on its models (Use), or harness agents call+ // it (Tools) — fal.ai, Replicate, and any API that lists no models a coding agent can run on.+ final summary = !api.servesModels || count > 0+ ? null+ : switch (listed) {+ ApiModels(loading: true) => 'Loading models…',+ ApiModels(error: _?) => 'Models unavailable',+ _ => null,+ };+ return _details([+ entry.name,+ ['API', ?summary].join(' · '),+ '',+ ('URL', api.baseUrl),+ if (count > 0)+ (+ 'Use',+ 'pick one of its $count ${count == 1 ? 'model' : 'models'} to run a harness on it',+ )+ else if (summary == null)+ (+ 'Tools',+ 'harness agents on this computer can call it with the saved key',+ ),+ if (listed?.error case final error?) ...['', error],+ ], controls: true);+ }+Widget _machinePreview() {final machine = app.stateOf(row!.machineId!);if (machine == null) return _details([row!.title, 'Unavailable']);diff --cc desktop/lib/widgets/swarm_switcher.dartindex 5089dda14,470c3c715..29b22545e--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@@ -1404,16 -1432,23 +1432,24 @@@ class _SearchRowContentState extends Ststyle: style,),),- if (widget.search.modelRowStatus(row) case final status?) ...[+ if (apiRow != null) ...[+ SizedBox(width: cell.width * 2),+ Text(+ apiRow.hint,+ key: ValueKey('api-row-hint:${row.id}'),+ maxLines: 1,+ style: terminalContentStyle(color: muted),+ ),- ] else if (modelAction != null) ...[++ ] else 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,),),