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(desktop): a quieter models list, and an API form that reads in order
bitcoinbuilder35372a2163bd
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex ed18e1a32..69cbaa562 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -276,9 +276,10 @@ class SwarmSearchController extends ChangeNotifier {// Its entry's status is only the API's name, which the row it sits under already shows.if (entry.apiModel != null) return modelRowAction(row);final local = entry.local;- if (local == null) {- return entry.own ? modelRowAction(row) ?? entry.status : entry.status;- }+ // A subscription says how much of it is left — the one figure worth a glance; Enter on it is+ // the preview's to say. Other rows with no weights here say what Enter does.+ if (entry.subscription != null) return entry.status;+ if (local == null) return modelRowAction(row) ?? entry.status;final owner = entry.controller ?? catalog.manager;final operation = owner.operationFor(local);if (operation?.active == true ||@@ -296,6 +297,18 @@ class SwarmSearchController extends ChangeNotifier {static const inUseWord = '● In use';+ /// A model row's title on the desktop list: the two action rows named for what they do, without+ /// the terminal list's brackets; every other row as it is.+ String modelRowTitle(SwarmDestination row) {+ if (isGridSetupRow(row)) return 'Set up local & shared models';+ if (isModelDownloadsRow(row)) {+ return modelDownloadsVisible+ ? 'Show fewer'+ : 'More models (${_downloadCount - shownDownloads})';+ }+ return row.title;+ }+/// Whether the harness this picker chooses for is on [row]'s model now: the grid model the/// daemon read off its process, or a saved API's model at that API's address.bool modelRowInUse(SwarmDestination row) {diff --git a/desktop/lib/widgets/api_picker_form.dart b/desktop/lib/widgets/api_picker_form.dartindex ea24cea0c..6504d5760 100644--- a/desktop/lib/widgets/api_picker_form.dart+++ b/desktop/lib/widgets/api_picker_form.dart@@ -204,25 +204,23 @@ class ApiPickerFormState extends State<ApiPickerForm> {List<FocusNode> get _nodes => [for (final id in _visibleFields) _inputs[id]!,- for (final action in [- for (final action in _actions)- if (!_fixedAction(action.id)) action,- ..._fixedActions,- ])+ for (final action in _shownActions)if (action.run != null && _buttons[action.id] != null)_buttons[action.id]!,];- bool _fixedAction(String id) =>- _desktop &&- _editing != null &&- const {'save', 'delete', 'cancel'}.contains(id);-- List<({String id, String label, VoidCallback? run})> get _fixedActions => [- for (final id in ['cancel', 'save', 'delete'])- for (final action in _actions)- if (_fixedAction(action.id) && action.id == id) action,- ];+ /// The actions in the order they are shown, and walked: on the desktop, the one that does the job+ /// (Save, Delete) first, then Cancel, then the quieter ones — all in one row right under the fields.+ /// A footer of its own below a divider put Save out of sight of the fields it saves.+ List<({String id, String label, VoidCallback? run})> get _shownActions {+ final actions = _actions;+ if (!_desktop || _editing == null) return actions;+ const first = ['save', 'delete', 'cancel'];+ return [+ for (final id in first) ...actions.where((action) => action.id == id),+ ...actions.where((action) => !first.contains(action.id)),+ ];+ }FocusNode get _focusTarget =>(widget.removing ? _buttons['cancel'] : _nodes.firstOrNull) ?? _scope;@@ -460,6 +458,18 @@ class ApiPickerFormState extends State<ApiPickerForm> {);}+ /// What a field takes, shown in it while it is empty.+ String? _example(String id) => switch (id) {+ 'name' => 'e.g. DeepSeek',+ 'url' => 'https://api.example.com/v1',+ 'key' =>+ _existing ? 'Leave blank to keep the saved key' : 'Paste the API key',+ 'environment' => 'e.g. DEEPSEEK_API_KEY',+ 'header' => 'Authorization',+ 'prefix' => 'Bearer',+ _ => null,+ };+Widget _actionButton(({String id, String label, VoidCallback? run}) action) {final node = _buttons.putIfAbsent(action.id,@@ -533,6 +543,8 @@ class ApiPickerFormState extends State<ApiPickerForm> {? _advanced? 'Hide options': 'More options'+ : action.id == 'back'+ ? 'Change provider': action.label,selected: action.id == 'options' ? _advanced : null,compact: true,@@ -598,9 +610,21 @@ class ApiPickerFormState extends State<ApiPickerForm> {Text(widget.removing? 'Delete ${_editing?.name ?? 'API'}?'+ : desktop && _editing != null && !_existing+ ? 'Add ${_editing!.name}': _editing?.name ?? 'Add API connection',style: desktop ? DesktopChrome.heading() : style,),+ if (desktop &&+ _editing?.provider == 'custom' &&+ !_existing &&+ !widget.removing) ...[+ const SizedBox(height: 4),+ Text(+ 'Any OpenAI-compatible API. Harnesses can run on its models.',+ style: muted,+ ),+ ],if (controller.app.viewer != null)Text('Saved on ${controller.hostLabel}', style: muted),SizedBox(height: cell.height),@@ -685,6 +709,15 @@ class ApiPickerFormState extends State<ApiPickerForm> {filled: true,fillColor: DesktopChrome.field,isDense: true,+ hintText: _example(id),+ hintStyle: DesktopChrome.text(+ size: 13,+ color: DesktopChrome.muted,+ ),+ helperText: id == 'key'+ ? 'Stored only on ${controller.hostLabel}.'+ : null,+ helperStyle: muted,contentPadding:const EdgeInsets.symmetric(horizontal: 10,@@ -720,7 +753,7 @@ class ApiPickerFormState extends State<ApiPickerForm> {],),),- if (_editing != null && !widget.removing) ...[+ if (!desktop && _editing != null && !widget.removing) ...[Text('Stored on ${controller.hostLabel}.',style: muted,@@ -756,9 +789,8 @@ class ApiPickerFormState extends State<ApiPickerForm> {spacing: desktop ? 8 : cell.width * 2,runSpacing: desktop ? 8 : cell.height,children: [- for (final action in _actions)- if (!_fixedAction(action.id))- _actionButton(action),+ for (final action in _shownActions)+ _actionButton(action),],),buttons: true,@@ -767,24 +799,6 @@ class ApiPickerFormState extends State<ApiPickerForm> {),),),- if (_fixedActions.isNotEmpty) ...[- Divider(height: 1, color: DesktopChrome.rim),- Padding(- padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),- child: _keys(- Wrap(- alignment: WrapAlignment.end,- spacing: 8,- runSpacing: 8,- children: [- for (final action in _fixedActions)- _actionButton(action),- ],- ),- buttons: true,- ),- ),- ],Padding(padding: EdgeInsets.symmetric(horizontal: cell.width * 2,diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex 3e17e706e..e7c6cf1ce 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -812,8 +812,15 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {_rowHeight = cell.height * (singleLine ? 1 : 3);}if (desktop) {- _rowHeight =- scale.scale(14) * (search.isCommandMode ? 1.5 : 2.8) + 16;+ // Commands and models are one line a row; everything else carries a second. A model row+ // is still a resource row, and keeps the 44-point target every one of those has — the+ // slot is 4 points taller than the row it holds.+ final oneLine = scale.scale(14) * 1.5 + 16;+ _rowHeight = search.isCommandMode+ ? oneLine+ : search.isModelMode+ ? oneLine.clamp(48, double.infinity)+ : scale.scale(14) * 2.8 + 16;}_desktopRows = desktop;_modelHeadingHeight = scale.scale(12) * 1.45 + 12;@@ -953,7 +960,11 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {),// The dock uses its full-row highlight for// selection; prefixes only appear in the input.- leading: widget.terminal && !desktop+ // The models list has no icons: its section headings already say what each row+ // is, and one mark per kind added nothing the text did not.+ leading:+ (widget.terminal && !desktop) ||+ (desktop && search.isModelMode)? null: desktop? row.isStore@@ -1585,6 +1596,10 @@ class _SearchRowContent extends StatefulWidget {}class _SearchRowContentState extends State<_SearchRowContent> {+ /// The arrow before an API's name, and the gap after it.+ static const _apiMarkerSize = 16.0;+ static const _apiMarkerGap = 4.0;+/// The widest word a model row of yours ends with (`Downloading`): the column is that wide, so/// the size and speed columns ahead of it line up whatever each row says.static const _modelWordColumns = 11;@@ -1688,10 +1703,8 @@ class _SearchRowContentState extends State<_SearchRowContent> {: DesktopChrome.muted;final title = widget.search.isModelMode && row.isCreate? 'Add API connection'- : widget.search.isModelDownloadsRow(row)- ? widget.search.modelDownloadsVisible- ? 'Hide catalog'- : 'Get models'+ : row.isModel+ ? widget.search.modelRowTitle(row): row.title;final unavailable = widget.search.sessionUnavailable(row);final api = row.isModel ? widget.search.apiRowState(row) : null;@@ -1700,12 +1713,24 @@ class _SearchRowContentState extends State<_SearchRowContent> {? widget.search.modelRowStatus(row): null;final status = unavailable ?? api?.hint ?? modelStatus;- final modelFacts = row.isModel+ // One line a model: a local model's size and speed sit muted before its word at the right.+ final facts = row.isModel? widget.search.modelRowFacts(row)?.trim().replaceAll(RegExp(r' {2,}'), ' · '): null;+ final modelFacts = facts?.isNotEmpty == true ? facts : null;+ final subscription = row.isModel+ ? widget.search.models?.entries[row.modelId]?.subscription+ : null;+ final account = '${subscription?['account'] ?? ''}'.trim();+ final subscriptionAccount = subscription != null && account.isNotEmpty+ ? (+ provider: '${subscription['title'] ?? 'Subscription'}',+ account: account,+ )+ : null;final activity = widget.search.activityOf(row);final age = activity == null? null@@ -1752,20 +1777,58 @@ class _SearchRowContentState extends State<_SearchRowContent> {Icon(key: ValueKey('api-row-marker:${row.id}'),api.open ? AppIcons.chevronDown : AppIcons.chevronRight,- size: 16,+ size: _apiMarkerSize,color: muted,),- const SizedBox(width: 4),+ const SizedBox(width: _apiMarkerGap),],Expanded(- child: SearchResultText(- title,- matches: matches.where((match) => match.title),- style: DesktopChrome.text(- color: unavailable == null ? ink : muted,+ child: subscriptionAccount != null+ // A subscription names its provider, and the account after it in the quieter+ // colour: "Anthropic 315df1", not one run of text where the account reads+ // as part of the name.+ ? Row(+ children: [+ Flexible(+ child: SearchResultText(+ subscriptionAccount.provider,+ matches: matches.where((match) => match.title),+ style: DesktopChrome.text(+ color: unavailable == null ? ink : muted,+ ),+ ),+ ),+ const SizedBox(width: 8),+ SearchResultText(+ subscriptionAccount.account,+ key: ValueKey('model-row-account:${row.id}'),+ matches: matches.where((match) => match.title),+ style: DesktopChrome.text(color: muted),+ ),+ ],+ )+ : SearchResultText(+ title,+ matches: matches.where((match) => match.title),+ style: DesktopChrome.text(+ color: unavailable == null ? ink : muted,+ ),+ ),+ ),+ if (modelFacts != null) ...[+ const SizedBox(width: 12),+ // A fixed column, so size and speed start at the same place on every row.+ SizedBox(+ width: MediaQuery.textScalerOf(context).scale(120),+ child: Text(+ modelFacts,+ key: ValueKey('model-row-facts:${row.id}'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(color: muted),),),- ),+ ],if (status ?? age case final trailing?) ...[const SizedBox(width: 12),if (status == null && activity != null)@@ -1783,16 +1846,8 @@ class _SearchRowContentState extends State<_SearchRowContent> {],],),- if (modelFacts != null) ...[- const SizedBox(height: 2),- Text(- modelFacts,- key: ValueKey('model-row-facts:${row.id}'),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.metadata(color: muted),- ),- ] else if (!row.isCommand &&+ if (!widget.search.isModelMode &&+ !row.isCommand &&!underApi &&(detail.isNotEmpty || snippet != null)) ...[const SizedBox(height: 2),diff --git a/desktop/test/desktop_resource_forms_edge_test.dart b/desktop/test/desktop_resource_forms_edge_test.dartindex 02e4dc497..e99ddaa0b 100644--- a/desktop/test/desktop_resource_forms_edge_test.dart+++ b/desktop/test/desktop_resource_forms_edge_test.dart@@ -192,7 +192,8 @@ void main() {brightness: switchPane ? Brightness.light : Brightness.dark,);await tester.enterText(_apiInput('key'), 'fixture-only-secret');- for (final id in ['visibility', 'options', 'cancel', 'save']) {+ // One row under the fields, the job first: Save, Cancel, then the quieter ones.+ for (final id in ['save', 'cancel', 'visibility', 'options']) {await key(tester, LogicalKeyboardKey.tab);expect(_buttonFocused(tester, _api(id)), isTrue);}@@ -207,7 +208,7 @@ void main() {await tester.pump();await key(tester, LogicalKeyboardKey.tab, shift: true);expect(- switchPane ? query.hasFocus : _buttonFocused(tester, _api('save')),+ switchPane ? query.hasFocus : _buttonFocused(tester, _api('options')),isTrue,);form.currentState!.focus();diff --git a/desktop/test/desktop_search_edges_test.dart b/desktop/test/desktop_search_edges_test.dartindex a854f3b36..8a259b832 100644--- a/desktop/test/desktop_search_edges_test.dart+++ b/desktop/test/desktop_search_edges_test.dart@@ -42,11 +42,12 @@ class _EdgeApp extends ModelManagerTestApp {Future<Map<String, dynamic>> localModels(String machineId, {bool refresh = false,+ bool setup = false,}) {if (failingModelHosts.contains(machineId)) {throw StateError('Fixture model host unavailable');}- return super.localModels(machineId, refresh: refresh);+ return super.localModels(machineId, refresh: refresh, setup: setup);}@overridediff --git a/desktop/test/model_search_catalog_test.dart b/desktop/test/model_search_catalog_test.dartindex d2da24ff7..06e11d255 100644--- a/desktop/test/model_search_catalog_test.dart+++ b/desktop/test/model_search_catalog_test.dart@@ -2,6 +2,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/models/model_search_catalog.dart';import 'package:harness/models/api_connections_controller.dart';+import 'package:harness/state/swarm_navigation.dart';import 'package:harness/state/swarm_search.dart';import 'package:harness/usage/models_menu_controller.dart';import 'package:harness/widgets/resting_model_words.dart';@@ -189,6 +190,103 @@ void main() {}});+ test('the desktop list names its action rows for what they do, and keeps who shares a model on its line', () async {+ final usage = _WithSubscriptions();+ final grouped = ModelSearchCatalog(+ app.modelManager,+ usage,+ pollHosts: false,+ );+ final search = SwarmSearchController(+ app,+ const [],+ models: grouped,+ offersCreate: true,+ adding: true,+ )..setQuery(':');+ try {+ app.localInventory = {+ 'models': [+ for (final letter in ['A', 'B', 'C', 'D', 'E', 'F', 'G'])+ {'id': 'catalog-$letter', 'name': '${letter * 3} catalog'},+ ],+ };+ app.inventory = const GridModels(+ gridName: 'home',+ models: [],+ grids: [+ GridSection(+ name: 'Team',+ own: false,+ models: [GridModel(id: 'Shared Qwen', node: 'team.lan')],+ ),+ ],+ );+ app.modelManager.apis.connections = [+ const ApiConnection({+ 'id': 'custom',+ 'name': 'Custom API',+ 'baseUrl': 'https://relay.example.test/v1',+ }),+ ];+ await app.modelManager.refresh();+ SwarmDestination row(bool Function(SwarmDestination) test) =>+ search.rows.singleWhere(test);+ final subscription = row((r) => r.title == 'OpenAI');+ final api = row((r) => r.title == 'Custom API');+ final shared = row((r) => r.title == 'Shared Qwen · team.lan');+ final more = row(search.isModelDownloadsRow);++ // One line a row: every other row keeps its own title, who shares a model included.+ expect(search.modelRowTitle(subscription), 'OpenAI');+ expect(search.modelRowTitle(api), 'Custom API');+ expect(search.modelRowTitle(shared), 'Shared Qwen · team.lan');+ // The fold is named for what Enter does, with how many it holds.+ expect(search.modelRowTitle(more), 'More models (2)');+ search.move(search.rows.indexOf(more) - search.cursor);+ search.submit();+ expect(search.modelRowTitle(more), 'Show fewer');+ } finally {+ search.dispose();+ grouped.dispose();+ usage.dispose();+ }+ });++ test('a subscription the harness can use still shows how much of it is left, not Use', () async {+ final usage = _MachineSubscriptions();+ final grouped = ModelSearchCatalog(+ app.modelManager,+ usage,+ pollHosts: false,+ );+ final search = SwarmSearchController(+ app,+ const [],+ models: grouped,+ offersCreate: true,+ adding: true,+ )..setQuery(':');+ try {+ await app.modelManager.refresh();+ // A Codex harness on this computer: its own OpenAI account is one it can switch to.+ search.setModelSelection(+ 'codex',+ const GridModels(gridName: 'home', models: []),+ machineId: 'm',+ );+ final own = search.rows.singleWhere(+ (row) => row.title == 'OpenAI · local-account',+ );+ expect(search.canSelectModel(own), isTrue);+ expect(search.modelRowStatus(own), '50% remaining');+ } finally {+ search.dispose();+ grouped.dispose();+ usage.dispose();+ }+ });+test('own models precede shared models even without local inventory',() async {