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(super-tabs): indent the Swarm sidebar as a tree
bitcoinbuilderbb741fa62fc1
diff --git a/desktop/integration_test/super_tab_native_test.dart b/desktop/integration_test/super_tab_native_test.dartindex 92f9502d9..c9ee6d54f 100644--- a/desktop/integration_test/super_tab_native_test.dart+++ b/desktop/integration_test/super_tab_native_test.dart@@ -90,6 +90,12 @@ void main() {...conversationFixture('design-lead', 'Lead'),'projectId': 'design',});+ // A workgroup under Lamp OS, so the sidebar's tree shows a second level.+ (server.state['conversations'] as List).add({+ ...conversationFixture('polish', 'Sidebar polish'),+ 'projectId': 'lead',+ 'number': 20,+ });server.state['machines'] = [{'machineId': 'm',@@ -270,11 +276,38 @@ void main() {expect(find.byKey(const ValueKey('super-machine-m-old')), findsNothing);expect(find.textContaining('CPU'), findsNothing);await shot('sidebar-groups');- debugPrint('Swarm fixture: open the offline machines');+ debugPrint(+ 'Swarm fixture: open the tree: a workgroup and the offline machines',+ );+ final leadWasOpen = c!.expandedProjects.contains('lead');+ if (!leadWasOpen) {+ await tester.tap(+ find.byKey(const ValueKey('super-project-expand-lead')),+ );+ }await tester.tap(find.byKey(const ValueKey('super-machines-offline')));await tester.pumpAndSettle();+ expect(find.text('#20 Sidebar polish'), findsOneWidget);expect(find.byKey(const ValueKey('super-machine-m-old')), findsOneWidget);- await shot('sidebar-offline-open');+ // Each level one step further in than the one above it.+ double textX(String row, String label) => tester+ .getTopLeft(+ find.descendant(+ of: find.byKey(ValueKey(row)),+ matching: find.text(label),+ ),+ )+ .dx;+ expect(+ textX('super-group-polish', '#20 Sidebar polish'),+ greaterThan(textX('super-group-lead', 'Lamp OS')),+ );+ await shot('sidebar-tree');+ if (!leadWasOpen) {+ await tester.tap(+ find.byKey(const ValueKey('super-project-expand-lead')),+ );+ }await tester.tap(find.byKey(const ValueKey('super-machines-offline')));await tester.pumpAndSettle();debugPrint('Swarm fixture: empty project disclosure');@@ -282,7 +315,7 @@ void main() {find.byKey(const ValueKey('super-project-expand-design')),);await tester.pumpAndSettle();- expect(c!.selectedId, 'lead');+ expect(c.selectedId, 'lead');expect(c.expandedProjects.contains('design'), isTrue);expect(find.text('No workgroups yet'), findsOneWidget);await tester.tap(find.byKey(const ValueKey('super-group-lead')));diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex 802c07b1d..dce5eb178 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -874,7 +874,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {/// One machine on one line: its state's dot in the icon column, its name on the text column, its agents at/// the end. Everything else is in its tooltip and its details.- Widget _machine(_MachineView v, {String? owner}) {+ Widget _machine(_MachineView v, {String? owner, int level = 1}) {final tipKey = _tips.putIfAbsent(v.id, GlobalKey<TooltipState>.new);final name = superTabMachineName(v.name);final row = Padding(@@ -899,7 +899,12 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {Tooltip.dismissAllToolTips();}},- child: _MachineLine(view: v, owner: owner, anchor: _anchor),+ child: _MachineLine(+ view: v,+ owner: owner,+ anchor: _anchor,+ level: level,+ ),),),);@@ -947,6 +952,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {excludeSemantics: true,child: Row(children: [+ SizedBox(width: SuperTabSectionHeading.indentFor(1)),SizedBox(width: _MachineLine.iconColumn,child: Icon(@@ -960,7 +966,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {constraints: const BoxConstraints(minHeight: 36),child: Padding(padding: EdgeInsets.fromLTRB(- _MachineLine.textGap,+ 0,8,_anchor - _MachineLine.dotHalf,8,@@ -1020,7 +1026,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {if (offline.isNotEmpty) ...[_offlineToggle(offline.length),if (c.offlineMachinesOpen)- for (final v in offline) _machine(v, owner: owner(v)),+ for (final v in offline) _machine(v, owner: owner(v), level: 2),],];}@@ -1130,6 +1136,7 @@ class _MachineLine extends StatelessWidget {required this.view,required this.owner,required this.anchor,+ required this.level,});final _MachineView view;@@ -1140,8 +1147,10 @@ class _MachineLine extends StatelessWidget {/// From the row's right edge to the center of its last mark.final double anchor;- static const iconColumn = 32.0;- static const textGap = 4.0;+ /// 1 under the Machines heading, 2 under "Offline · N".+ final int level;++ static const iconColumn = SuperTabSectionHeading.actionWidth;/// Half the project rows' dot, so that a row with nothing at its end stops where theirs do.static const dotHalf = 3.0;@@ -1182,6 +1191,7 @@ class _MachineLine extends StatelessWidget {return Row(children: [+ SizedBox(width: SuperTabSectionHeading.indentFor(level)),SizedBox(width: iconColumn,child: Center(@@ -1199,7 +1209,7 @@ class _MachineLine extends StatelessWidget {child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 36),child: Padding(- padding: const EdgeInsets.only(left: textGap, top: 8, bottom: 8),+ padding: const EdgeInsets.symmetric(vertical: 8),child: LayoutBuilder(builder: (context, constraints) {final warning = v.low.isNotEmpty;diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex 4056cf094..730c124b3 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -43,9 +43,8 @@ class ProjectSidebar extends StatelessWidget {@visibleForTestingfinal DateTime Function() now;- // Actions, project names and workgroup names share one text column.- static const _iconColumn = 32.0;- static const _textGap = 4.0;+ /// A row's chevron (or the room for one), at its level's indent; its name starts right after.+ static const _iconColumn = SuperTabSectionHeading.actionWidth;static const _dotSize = 6.0;/// The space after a row's trailing unread dot: it centers the dot on the@@ -53,7 +52,9 @@ class ProjectSidebar extends StatelessWidget {static const markerInset =SuperTabSectionHeading.actionWidth / 2 - _dotSize / 2;+ /// A project's lead row (level 1, under the heading) or a workgroup (level 2, under its project).Widget _row(SuperTabConversation group, {SuperTabProject? project}) {+ final level = project == null ? 2 : 1;final selected = controller.selectedId == group.id;final groups = project == null? [group]@@ -78,6 +79,7 @@ class ProjectSidebar extends StatelessWidget {borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),child: Row(children: [+ SizedBox(width: SuperTabSectionHeading.indentFor(level)),if (project != null)IconButton(key: ValueKey('super-project-expand-${project.id}'),@@ -112,7 +114,7 @@ class ProjectSidebar extends StatelessWidget {constraints: const BoxConstraints(minHeight: 36),child: Padding(padding: const EdgeInsets.fromLTRB(- _textGap,+ 0,8,markerInset,8,@@ -193,8 +195,8 @@ class ProjectSidebar extends StatelessWidget {return groups.isEmpty? [Padding(- padding: const EdgeInsets.fromLTRB(- _iconColumn + _textGap,+ padding: EdgeInsets.fromLTRB(+ SuperTabSectionHeading.indentFor(2) + _iconColumn,8,12,10,diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dartindex 4d3725f14..0eb4ac920 100644--- a/desktop/lib/super_tabs/section_heading.dart+++ b/desktop/lib/super_tabs/section_heading.dart@@ -46,6 +46,18 @@ class SuperTabSectionHeading extends StatelessWidget {/// before the actions is 4 px; the title always keeps at least this/// much room, even when the trailing pill is at its widest.static const actionWidth = 32.0;++ /// One step of the sidebar's tree: a group's rows sit one step in from its heading, and the rows under one+ /// of those (a project's workgroups, the offline machines) two.+ static const indentStep = 16.0;++ /// Where a collapsible heading's chevron column starts.+ static const _leadingInset = 4.0;++ /// Where the icon column of a row at [level] starts, from the row's leading edge; its text starts right+ /// after that 32 px column, as the heading's does. Level 0 is the heading's own.+ static double indentFor(int level) => _leadingInset + level * indentStep;+static const _trailingGap = 4.0;static const _minTitleWidth = 40.0;@@ -53,7 +65,12 @@ class SuperTabSectionHeading extends StatelessWidget {Widget build(BuildContext context) {final collapsible = onToggleCollapsed != null;return Padding(- padding: EdgeInsets.fromLTRB(collapsible ? 4 : 16, 0, endInset, 4),+ padding: EdgeInsets.fromLTRB(+ collapsible ? _leadingInset : 16,+ 0,+ endInset,+ 4,+ ),child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 32),child: LayoutBuilder(diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dartindex 2c737792d..a0bb08521 100644--- a/desktop/test/super_tab_machines_test.dart+++ b/desktop/test/super_tab_machines_test.dart@@ -12,6 +12,7 @@ import 'package:harness/super_tabs/machines.dart';import 'package:harness/super_tabs/machine_details.dart';import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/model.dart';+import 'package:harness/super_tabs/section_heading.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/widgets/desktop_chrome.dart';import 'package:harness/widgets/engine_identity.dart';@@ -656,7 +657,9 @@ void main() {matching: find.byType(SuperTabMachineDot),),);- expect(dot.center.dx, closeTo(rowRect.left + 16, .01));+ // Level 1, one indent step in from the heading's columns.+ final indent = SuperTabSectionHeading.indentFor(1);+ expect(dot.center.dx, closeTo(rowRect.left + indent + 16, .01));expect(dot.center.dy, closeTo(rowRect.center.dy, .5));expect(tester@@ -666,7 +669,7 @@ void main() {.first,).dx,- rowRect.left + 36,+ rowRect.left + indent + 32,);// Left to right, as they read: the first agent is drawn last, on top.final avatars =diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dartindex 102608e06..112ad6574 100644--- a/desktop/test/super_tab_sidebar_test.dart+++ b/desktop/test/super_tab_sidebar_test.dart@@ -6,6 +6,7 @@ import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/machine_status.dart';import 'package:harness/super_tabs/machines.dart';import 'package:harness/super_tabs/project_sidebar.dart';@@ -100,10 +101,17 @@ void main() {expect(c.selectedId, 'empty-lead');final work = find.byKey(const ValueKey('super-group-offline'));expect(work, findsOneWidget);+ // Projects share a column; their workgroups sit one step further in.final projectX = tester.getTopLeft(inside(find.text('web-project'))).dx;- for (final label in ['sample-project', '#12 Offline editing']) {- expect(tester.getTopLeft(inside(find.text(label))).dx, projectX);- }+ const step = SuperTabSectionHeading.indentStep;+ expect(+ tester.getTopLeft(inside(find.text('sample-project'))).dx,+ projectX,+ );+ expect(+ tester.getTopLeft(inside(find.text('#12 Offline editing'))).dx,+ projectX + step,+ );// Your devices is a heading action beside Add machine, not a row.expect(inside(find.text('Your devices')), findsNothing);final yourDevices = find.byKey(const ValueKey('super-your-devices'));@@ -135,7 +143,7 @@ void main() {expect(inside(find.text('No workgroups yet')), findsOneWidget);expect(tester.getTopLeft(inside(find.text('No workgroups yet'))).dx,- projectX,+ projectX + step,);expect(find.byTooltip('Collapse sample-project'), findsOneWidget);expect(@@ -460,6 +468,174 @@ void main() {},);+ testWidgets(+ 'one indent step makes a tree: headings, then projects, machines and '+ '"Offline · N", then workgroups and offline machines; the trailing column stays',+ (tester) async {+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final app = createApp(connected: true);+ addTearDown(app.dispose);+ final server = ConversationServer();+ server.state['projects'] = [+ projectFixture('lead', 'web-project', 'lead'),+ projectFixture('empty', 'sample-project', 'empty-lead'),+ ];+ (server.state['conversations'] as List)[1]+ ..['projectId'] = 'lead'+ ..['number'] = 12+ ..['lastMessageSequence'] = 5;+ (server.state['conversations'] as List).add({+ ...conversationFixture('empty-lead', 'Lead'),+ 'projectId': 'empty',+ });+ final at = DateTime.now().millisecondsSinceEpoch;+ server.state['machines'] = [+ for (final (id, name, age) in [+ ('on', 'Studio Mac', 0),+ ('off', 'Old Mini', 600000),+ ])+ {+ 'machineId': id,+ 'name': name,+ 'contributorId': 'owner',+ 'observation': {'receivedAt': at - age},+ },+ ];+ server.state['agents'] = [+ {+ 'id': 'agent-0',+ 'name': 'Lead',+ 'displayName': 'Atlas',+ 'machineId': 'on',+ 'harnessId': 'a0',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude'},+ },+ ];+ final c = server.controller();+ await c.refresh();+ c.expandedProjects.addAll(['lead', 'empty']);+ c.offlineMachinesOpen = true;+ const step = SuperTabSectionHeading.indentStep;+ for (final width in [180.0, 280.0]) {+ for (final scale in [1.0, 2.0]) {+ await pumpSidebar(tester, c, app, width: width, scale: scale);+ final reason = 'at width $width, scale $scale';+ expect(tester.takeException(), isNull, reason: reason);+ double centerX(Finder f) => tester.getCenter(f).dx;+ double leftX(Finder f) => tester.getTopLeft(f).dx;+ Finder inRow(String key, Finder f) =>+ find.descendant(of: find.byKey(ValueKey(key)), matching: f);+ Finder nameOf(String id) =>+ inRow('super-machine-$id', find.byType(RichText)).first;++ // Level 0: both headings share one chevron column and one text column.+ final icon = centerX(find.byTooltip('Collapse Projects'));+ final text = leftX(find.text('Projects'));+ expect(+ centerX(find.byTooltip('Collapse Machines')),+ icon,+ reason: reason,+ );+ expect(leftX(find.text('Machines')), text, reason: reason);++ // Level 1: one step in.+ for (final (what, mark, name) in [+ (+ 'project',+ find.byKey(const ValueKey('super-project-expand-lead')),+ find.text('web-project'),+ ),+ (+ 'machine',+ inRow('super-machine-on', find.byType(SuperTabMachineDot)),+ nameOf('on'),+ ),+ (+ 'offline disclosure',+ inRow('super-machines-offline', find.byType(Icon)),+ find.text('Offline · 1'),+ ),+ ]) {+ expect(+ centerX(mark),+ closeTo(icon + step, .01),+ reason: '$what $reason',+ );+ expect(+ leftX(name),+ closeTo(text + step, .01),+ reason: '$what $reason',+ );+ }++ // Level 2: two steps in.+ expect(+ leftX(find.text('#12 Offline editing')),+ closeTo(text + 2 * step, .01),+ reason: reason,+ );+ expect(+ leftX(find.text('No workgroups yet')),+ closeTo(text + 2 * step, .01),+ reason: reason,+ );+ expect(+ centerX(+ inRow('super-machine-off', find.byType(SuperTabMachineDot)),+ ),+ closeTo(icon + 2 * step, .01),+ reason: reason,+ );+ expect(+ leftX(nameOf('off')),+ closeTo(text + 2 * step, .01),+ reason: reason,+ );++ // The trailing column does not move with the level: a workgroup's+ // unread dot and a machine's last avatar center on the heading +.+ final add = centerX(find.byTooltip('New project'));+ expect(centerX(find.byTooltip('Add machine')), add, reason: reason);+ expect(+ centerX(+ inRow(+ 'super-group-offline',+ find.byWidgetPredicate(+ (w) =>+ w is Semantics && w.properties.label == 'Unread messages',+ ),+ ),+ ),+ closeTo(add, .01),+ reason: reason,+ );+ expect(+ centerX(inRow('super-machine-on', find.byType(SuperTabAvatar))),+ closeTo(add, .5),+ reason: reason,+ );++ // Every row's fill spans the full row, whatever its level.+ final rows = [+ 'super-group-lead',+ 'super-group-offline',+ 'super-machine-on',+ 'super-machines-offline',+ 'super-machine-off',+ ].map((k) => tester.getRect(find.byKey(ValueKey(k))));+ for (final r in rows) {+ expect(r.left, rows.first.left, reason: reason);+ expect(r.right, rows.first.right, reason: reason);+ }+ }+ }+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );+testWidgets('the left Machines group repaints on a live app change alone', (tester,) async {diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dartindex 65affc883..cabb71c4b 100644--- a/desktop/test/swarm_projects_test.dart+++ b/desktop/test/swarm_projects_test.dart@@ -5,6 +5,7 @@ import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/super_tabs/view.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/project_visibility.dart';+import 'package:harness/super_tabs/section_heading.dart';import 'support/super_tab_fixture.dart';@@ -125,10 +126,11 @@ void main() {of: project,matching: find.text('Lamp OS'),);+ // A workgroup sits one indent step in from its project.expect(tester.getTopLeft(find.text('#12 Offline editing')).dx -tester.getTopLeft(projectName).dx,- 0,+ SuperTabSectionHeading.indentStep,);// A child row's formerly empty inset is part of its one click target.