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.

feat(super-tabs): machine rows share fixed columns for Claude, Codex and agents

bitcoinbuilder3877cd953ea0
diff --git a/desktop/integration_test/super_tab_native_test.dart b/desktop/integration_test/super_tab_native_test.dart
index 23fd151d1..127f6b569 100644
--- a/desktop/integration_test/super_tab_native_test.dart
+++ b/desktop/integration_test/super_tab_native_test.dart
@@ -150,6 +150,24 @@ void main() {
'resources': {'cpuPercent': 40},
},
},
+ // A Codex-only machine: its Claude slot stays blank, so its Codex % lines up with the others'.
+ {
+ 'machineId': 'm-codex',
+ 'name': 'Build Box',
+ 'contributorId': 'person-1',
+ 'observation': {
+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,
+ 'quotas': [
+ {
+ 'engine': 'codex',
+ 'known': true,
+ 'windows': [
+ {'name': '5-hour', 'usedPercent': 30},
+ ],
+ },
+ ],
+ },
+ },
{
'machineId': 'm-old',
'name': 'Old Mini',
@@ -317,7 +335,16 @@ void main() {
.evaluate()
.isNotEmpty) {
expect(chip('codex', '88%'), findsOneWidget);
+ // The Codex-only machine's figure lines up with Studio Mac's.
+ double figureRight(String id) => tester
+ .getRect(find.byKey(ValueKey('super-machine-figure-$id-codex')))
+ .right;
+ expect(figureRight('m-codex'), closeTo(figureRight('m'), .01));
}
+ expect(
+ find.byKey(const ValueKey('super-machine-figure-m-codex-claude')),
+ findsNothing,
+ );
expect(find.text('Offline · 1'), findsOneWidget);
expect(find.byKey(const ValueKey('super-machine-m-old')), findsNothing);
expect(find.textContaining('CPU'), findsNothing);
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index 2728d45f6..803539036 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -900,7 +900,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, {int level = 1}) {
+ Widget _machine(_MachineView v, _Columns columns, {int level = 1}) {
final tipKey = _tips.putIfAbsent(v.id, GlobalKey<TooltipState>.new);
final name = superTabMachineName(v.name);
final row = Padding(
@@ -925,7 +925,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
Tooltip.dismissAllToolTips();
}
},
- child: _MachineLine(view: v, anchor: _anchor, level: level),
+ child: _MachineLine(view: v, columns: columns, level: level),
),
),
);
@@ -1014,8 +1014,103 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
);
}
+ /// The right side of every row, decided once for the whole list from its [width], so each column lines up:
+ /// Claude's allowance, Codex's, then the agents. A column no machine uses is left out. When the name would
+ /// have less than its minimum, the agents column becomes a count first, then the Codex column goes, then
+ /// Claude's, for every row at once.
+ _Columns _columns(
+ BuildContext context,
+ double width,
+ List<_MachineView> views,
+ ) {
+ final scaler = MediaQuery.textScalerOf(context);
+ final direction = Directionality.of(context);
+ double measure(String text, TextStyle style) {
+ final painter = TextPainter(
+ text: TextSpan(text: text, style: style),
+ textDirection: direction,
+ textScaler: scaler,
+ maxLines: 1,
+ )..layout();
+ final result = painter.width;
+ painter.dispose();
+ return result;
+ }
+
+ final count = _MachineLine.countStyle;
+ final chip =
+ _MachineLine.gap +
+ _MachineLine.mark +
+ _MachineLine.markGap +
+ measure('100%', count);
+ bool uses(String engine) =>
+ views.any((v) => v.allowances.any((a) => a.engine == engine));
+ final most = views.fold(0, (n, v) => math.max(n, v.agents.length));
+ final stacked = math.min(most, _MachineLine.maxAvatars);
+ final rest = most - stacked;
+ final ringed = _MachineLine.ringed;
+ final full = most == 0
+ ? 0.0
+ : _MachineLine.gap +
+ ringed +
+ (ringed - _MachineLine.overlap) * (stacked - 1) +
+ (rest > 0 ? 4 + measure('+$rest', count) : 0);
+ final counted = most == 0
+ ? 0.0
+ : _MachineLine.gap + measure('+$most', count);
+ // With agents, their last avatar centers on the heading +; without, the row ends where project dots do.
+ final end = most == 0
+ ? _anchor - _MachineLine.dotHalf
+ : (_anchor - ringed / 2).clamp(0.0, _anchor);
+ final style = DesktopChrome.control();
+ final wanted = math.min(
+ views.fold(
+ 0.0,
+ (w, v) => math.max(w, measure(superTabMachineName(v.name), style)),
+ ),
+ scaler.scale(_MachineLine.minName),
+ );
+ // Decided for the online rows, so opening "Offline · N" never moves a column; the offline rows' names,
+ // one step further in, give way a little sooner.
+ final text =
+ width -
+ SuperTabSectionHeading.indentFor(1) -
+ _MachineLine.iconColumn -
+ end;
+ final steps = [
+ (
+ agents: full,
+ counted: false,
+ claude: uses('claude'),
+ codex: uses('codex'),
+ ),
+ (
+ agents: counted,
+ counted: true,
+ claude: uses('claude'),
+ codex: uses('codex'),
+ ),
+ (agents: counted, counted: true, claude: uses('claude'), codex: false),
+ (agents: counted, counted: true, claude: false, codex: false),
+ ];
+ final pick = steps.firstWhere(
+ (s) =>
+ text - s.agents - (s.claude ? chip : 0) - (s.codex ? chip : 0) >=
+ wanted,
+ orElse: () => steps.last,
+ );
+ return _Columns(
+ claude: pick.claude,
+ codex: pick.codex,
+ chip: chip,
+ agents: pick.agents,
+ counted: pick.counted,
+ end: end,
+ );
+ }
+
/// Online machines first, then "Offline · N" with the offline ones under it; each part by name.
- List<Widget> _machines() {
+ List<Widget> _machines(BuildContext context, double width) {
final views = [for (final id in _ids) _view(id)];
String key(_MachineView v) => superTabMachineName(v.name).toLowerCase();
// A machine being refreshed keeps its place; one whose state cannot be read follows the ones that report.
@@ -1034,13 +1129,19 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
final offline = views
.where((v) => v.status == SuperTabMachineStatus.offline)
.toList();
+ final open = offline.isNotEmpty && c.offlineMachinesOpen;
+ final shown = [
+ for (final v in views)
+ if (v.status != SuperTabMachineStatus.offline || open) v,
+ ];
+ final columns = _columns(context, width, shown);
return [
for (final v in views)
- if (v.status != SuperTabMachineStatus.offline) _machine(v),
+ if (v.status != SuperTabMachineStatus.offline) _machine(v, columns),
if (offline.isNotEmpty) ...[
_offlineToggle(offline.length),
- if (c.offlineMachinesOpen)
- for (final v in offline) _machine(v, level: 2),
+ if (open)
+ for (final v in offline) _machine(v, columns, level: 2),
],
];
}
@@ -1086,7 +1187,14 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
),
)
else
- ..._machines(),
+ // The rows share their columns, which depend on the list's width.
+ LayoutBuilder(
+ builder: (context, constraints) => Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: _machines(context, constraints.maxWidth),
+ ),
+ ),
],
];
return widget.embedded
@@ -1168,42 +1276,72 @@ class _Allowance {
);
}
+/// The right side every machine row shares: which columns show, and how wide each one is.
+class _Columns {
+ const _Columns({
+ required this.claude,
+ required this.codex,
+ required this.chip,
+ required this.agents,
+ required this.counted,
+ required this.end,
+ });
+
+ /// Whether the Claude and Codex allowance columns show.
+ final bool claude, codex;
+
+ /// The width of an allowance column: a gap, the mark, and room for "100%".
+ final double chip;
+
+ /// The width of the agents column; 0 when no machine has an agent.
+ final double agents;
+
+ /// Whether the agents column only counts them ("+3") rather than stacking their avatars.
+ final bool counted;
+
+ /// The space after the last column, from the row's right edge.
+ final double end;
+}
+
/// A machine's line, at the height and on the columns of a project row: the dot centered in the icon column,
-/// the name on the text column, then each engine's allowance and up to three agents overlapping, then +N. The
-/// last agent mark centers on [anchor], the heading +'s column. When the line runs short, the name keeps
-/// [_minName]: the agents become +N first, then the Codex chip goes, then the Claude one.
+/// the name on the text column, then the list's shared [columns]: Claude's allowance, Codex's, and the agents.
+/// A machine without an allowance leaves its column blank, so every row's figures line up.
class _MachineLine extends StatelessWidget {
const _MachineLine({
required this.view,
- required this.anchor,
+ required this.columns,
required this.level,
});
final _MachineView view;
-
- /// From the row's right edge to the center of its last mark.
- final double anchor;
+ final _Columns columns;
/// 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 no agents stops where theirs do.
+ /// Half the project rows' dot, so that a list without agents stops where their rows do.
static const dotHalf = 3.0;
static const _avatar = 16.0;
static const _ring = 1.0;
- static const _overlap = 5.0;
- static const _maxAvatars = 3;
- static const _mark = 14.0;
- static const _markGap = 4.0;
- static const _chipGap = 8.0;
- static const _gap = 8.0;
+ static const overlap = 5.0;
+ static const maxAvatars = 3;
+ static const mark = 14.0;
+ static const markGap = 3.0;
+
+ /// Before each column, and between the name and the first.
+ static const gap = 6.0;
- /// What the name keeps, at the default text size, before anything at the end gives way.
- static const _minName = 56.0;
+ /// What the name keeps, at the default text size, before a column gives way: a readable start of it, small
+ /// enough that Claude's allowance still fits beside it in the default 204 px sidebar.
+ static const minName = 48.0;
- static double get _ringed => _avatar + 2 * _ring;
+ static double get ringed => _avatar + 2 * _ring;
+
+ static TextStyle get countStyle => DesktopChrome.metadata().copyWith(
+ fontFeatures: const [FontFeature.tabularFigures()],
+ );
@override
Widget build(BuildContext context) {
@@ -1214,19 +1352,46 @@ class _MachineLine extends StatelessWidget {
final style = DesktopChrome.control(
color: muted ? DesktopChrome.muted : DesktopChrome.foreground,
);
- final countStyle = DesktopChrome.metadata().copyWith(
- fontFeatures: const [FontFeature.tabularFigures()],
- );
- double measure(String text, [TextStyle? textStyle]) {
- final painter = TextPainter(
- text: TextSpan(text: text, style: textStyle ?? countStyle),
- textDirection: Directionality.of(context),
- textScaler: MediaQuery.textScalerOf(context),
- maxLines: 1,
- )..layout();
- final result = painter.width;
- painter.dispose();
- return result;
+ final count = countStyle;
+ final agents = v.agents.length;
+ final shown = columns.counted ? 0 : math.min(agents, maxAvatars);
+ final hidden = agents - shown;
+ final roles = v.agents.map((a) => '${a.name} — ${a.role}').join('\n');
+
+ Widget allowance(String engine) {
+ final a = v.allowances.where((a) => a.engine == engine).firstOrNull;
+ return SizedBox(
+ width: columns.chip,
+ child: a == null
+ ? null
+ : Tooltip(
+ message: a.detail,
+ child: Semantics(
+ label: '${a.name} ${a.figure} remaining',
+ excludeSemantics: true,
+ child: Row(
+ key: ValueKey('super-machine-allowance-${v.id}-$engine'),
+ children: [
+ const SizedBox(width: gap),
+ EngineMark(engine: engine, size: mark),
+ const SizedBox(width: markGap),
+ // Right-aligned in tabular figures, so every row's % sign lines up.
+ Expanded(
+ child: Text(
+ a.figure,
+ key: ValueKey('super-machine-figure-${v.id}-$engine'),
+ textAlign: TextAlign.right,
+ maxLines: 1,
+ softWrap: false,
+ overflow: TextOverflow.clip,
+ style: count.copyWith(color: a.ink),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
}
return Row(
@@ -1250,121 +1415,57 @@ class _MachineLine extends StatelessWidget {
constraints: const BoxConstraints(minHeight: 36),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
- child: LayoutBuilder(
- builder: (context, constraints) {
- final agents = v.agents.length;
- double chipWidth(_Allowance a) =>
- _mark + _markGap + measure(a.figure);
-
- /// How much the end takes with [shown] avatars and the first [chips] chips, and the space after
- /// it that puts its last mark on the anchor.
- ({double width, double end}) end(int shown, int chips) {
- final hidden = agents - shown;
- final more = hidden > 0 ? measure('+$hidden') : 0.0;
- final stack = shown > 0
- ? _ringed + (_ringed - _overlap) * (shown - 1)
- : 0.0;
- final double agentsWidth =
- stack + (hidden > 0 ? (shown > 0 ? 4 : 0) + more : 0);
- var chipsWidth = 0.0;
- for (var i = 0; i < chips; i++) {
- chipsWidth +=
- chipWidth(v.allowances[i]) + (i > 0 ? _chipGap : 0);
- }
- final double width =
- (chips > 0 ? _gap + chipsWidth : 0) +
- (agents > 0 ? _gap + agentsWidth : 0);
- final last = hidden > 0 ? more : _ringed;
- return (
- width: width,
- end: agents > 0
- ? (anchor - last / 2).clamp(0.0, anchor)
- : anchor - dotHalf,
- );
- }
-
- final name = superTabMachineName(v.name);
- final wanted = math.min(
- measure(name, style),
- MediaQuery.textScalerOf(context).scale(_minName),
- );
- // Agents to +N first, then chips from the end: Codex, then Claude.
- final steps = [
- for (var s = math.min(agents, _maxAvatars); s >= 0; s--)
- (s, v.allowances.length),
- for (var k = v.allowances.length - 1; k >= 0; k--) (0, k),
- ];
- var (shown, chips) = steps.last;
- for (final (s, k) in steps) {
- final e = end(s, k);
- if (constraints.maxWidth - e.width - e.end >= wanted) {
- (shown, chips) = (s, k);
- break;
- }
- }
- final hidden = agents - shown;
- final room =
- constraints.maxWidth -
- end(shown, chips).width -
- end(shown, chips).end;
- final roles = v.agents
- .map((a) => '${a.name} — ${a.role}')
- .join('\n');
- return Row(
- children: [
- Expanded(child: _name(context, name, style, room)),
- for (final (i, a)
- in v.allowances.take(chips).indexed) ...[
- SizedBox(width: i == 0 ? _gap : _chipGap),
- Tooltip(
- message: a.detail,
- child: Semantics(
- label: '${a.name} ${a.figure} remaining',
- excludeSemantics: true,
- child: Row(
- key: ValueKey(
- 'super-machine-allowance-${v.id}-${a.engine}',
- ),
- mainAxisSize: MainAxisSize.min,
- children: [
- EngineMark(engine: a.engine, size: _mark),
- const SizedBox(width: _markGap),
- Text(
- a.figure,
- style: countStyle.copyWith(color: a.ink),
- ),
- ],
- ),
- ),
+ child: Row(
+ children: [
+ Expanded(
+ child: LayoutBuilder(
+ builder: (context, constraints) => Align(
+ alignment: Alignment.centerLeft,
+ child: _name(
+ context,
+ superTabMachineName(v.name),
+ style,
+ constraints.maxWidth,
),
- ],
- if (agents > 0) ...[
- const SizedBox(width: _gap),
- Tooltip(
- message: roles,
- child: Semantics(
- label: v.agents
- .map((a) => '${a.name}, ${a.role}')
- .join('; '),
- excludeSemantics: true,
- child: Row(
- key: ValueKey('super-machine-agents-${v.id}'),
- mainAxisSize: MainAxisSize.min,
- children: [
- if (shown > 0) _stack(context, shown),
- if (hidden > 0) ...[
- if (shown > 0) const SizedBox(width: 4),
- Text('+$hidden', style: countStyle),
- ],
- ],
+ ),
+ ),
+ ),
+ if (columns.claude) allowance('claude'),
+ if (columns.codex) allowance('codex'),
+ if (columns.agents > 0)
+ SizedBox(
+ key: ValueKey('super-machine-agents-slot-${v.id}'),
+ width: columns.agents,
+ child: agents == 0
+ ? null
+ : Align(
+ alignment: Alignment.centerRight,
+ child: Tooltip(
+ message: roles,
+ child: Semantics(
+ label: v.agents
+ .map((a) => '${a.name}, ${a.role}')
+ .join('; '),
+ excludeSemantics: true,
+ child: Row(
+ key: ValueKey(
+ 'super-machine-agents-${v.id}',
+ ),
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ if (shown > 0) _stack(context, shown),
+ if (hidden > 0) ...[
+ if (shown > 0) const SizedBox(width: 4),
+ Text('+$hidden', style: count),
+ ],
+ ],
+ ),
+ ),
+ ),
),
- ),
- ),
- ],
- SizedBox(width: end(shown, chips).end),
- ],
- );
- },
+ ),
+ SizedBox(width: columns.end),
+ ],
),
),
),
@@ -1418,12 +1519,12 @@ class _MachineLine extends StatelessWidget {
/// The first [shown] agents, overlapping, each on a ring of the surface so the one behind reads as behind.
Widget _stack(BuildContext context, int shown) {
- final step = _ringed - _overlap;
+ final step = ringed - overlap;
return MediaQuery.withClampedTextScaling(
maxScaleFactor: 1,
child: SizedBox(
- width: _ringed + step * (shown - 1),
- height: _ringed,
+ width: ringed + step * (shown - 1),
+ height: ringed,
child: Stack(
children: [
// The first agent is drawn last, on top.
diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dart
index 5a857e682..f423f4ff8 100644
--- a/desktop/test/super_tab_machines_test.dart
+++ b/desktop/test/super_tab_machines_test.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'dart:math' as math;
import 'dart:ui' show PointerDeviceKind;
import 'package:flutter/material.dart';
@@ -428,10 +429,10 @@ void main() {
for (final a in five) {
expect(a.center.dy, closeTo(rowFive.center.dy, .5));
}
- // The last mark, +2, centers where the heading's + does (embedded: 16 from the edge).
+ // The agents column ends half an avatar past the heading's + (embedded: 16 from the edge), so +2 ends there.
expect(
- tester.getCenter(inRow('five', find.text('+2'))).dx,
- closeTo(rowFive.right - 16, .5),
+ tester.getRect(inRow('five', find.text('+2'))).right,
+ closeTo(rowFive.right - 16 + 9, .5),
);
expect(
find.descendant(
@@ -593,7 +594,10 @@ void main() {
find.bySemanticsLabel(RegExp('Claude Code 15% remaining')),
findsOneWidget,
);
- expect(find.bySemanticsLabel(RegExp('Codex 5% remaining')), findsOneWidget);
+ expect(
+ find.bySemanticsLabel(RegExp('Codex 5% remaining')),
+ findsOneWidget,
+ );
// No chip for an expired or unknown allowance, nor for an offline machine; no warning icon anywhere.
expect(find.byKey(const ValueKey('super-machine-gone')), findsOneWidget);
for (final id in ['expired', 'unknown', 'gone']) {
@@ -615,7 +619,151 @@ void main() {
);
testWidgets(
- 'as the line narrows the name keeps its minimum: agents become +N, then Codex goes, then Claude',
+ 'every row shares the Claude, Codex and agents columns: their right edges line up, an empty slot keeps '
+ 'its place, and a narrow list hides a column for every row at once',
+ (tester) async {
+ final server = ConversationServer();
+ final at = DateTime.now().millisecondsSinceEpoch;
+ Map<String, dynamic> quota(String engine, int used) => {
+ 'engine': engine,
+ 'known': true,
+ 'windows': [
+ {'name': '5-hour', 'usedPercent': used},
+ ],
+ };
+ // Quota sets: both, Claude only, Codex only, none; agents: 7, 3, 1, 0; and one offline.
+ final machines = [
+ ('both', [quota('claude', 0), quota('codex', 57)], 7, 0),
+ ('claude', [quota('claude', 91)], 3, 0),
+ ('codex', [quota('codex', 100)], 1, 0),
+ ('none', <Map<String, dynamic>>[], 0, 0),
+ ('gone', [quota('claude', 50)], 1, 600000),
+ ];
+ server.state['machines'] = [
+ for (final (id, quotas, _, age) in machines)
+ {
+ 'machineId': id,
+ 'name': '$id machine',
+ 'contributorId': 'owner',
+ 'observation': {'receivedAt': at - age, 'quotas': quotas},
+ },
+ ];
+ server.state['agents'] = [
+ for (final (id, _, agents, _) in machines)
+ for (var i = 0; i < agents; i++)
+ {
+ 'id': '$id-$i',
+ 'name': 'Harness $i',
+ 'displayName': 'Agent $i',
+ 'machineId': id,
+ 'harnessId': 'native-$id-$i',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ },
+ ];
+ final c = server.controller();
+ await c.refresh();
+ c.offlineMachinesOpen = true;
+ final ids = [for (final m in machines) m.$1];
+ Finder key(String k) => find.byKey(ValueKey(k));
+ bool has(String k) => key(k).evaluate().isNotEmpty;
+ double right(String k) => tester.getRect(key(k)).right;
+
+ // The sidebar's widths, less its 8 px padding on each side, and a wide one.
+ for (final width in [164.0, 188.0, 224.0, 264.0, 420.0]) {
+ for (final scale in [1.0, 2.0]) {
+ await tester.pumpWidget(
+ MaterialApp(
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context)
+ .copyWith(textScaler: TextScaler.linear(scale)),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: Align(
+ alignment: Alignment.topLeft,
+ child: SizedBox(
+ width: width,
+ child: SuperTabMachines(
+ controller: c,
+ embedded: true,
+ onAddAgent: (_) {},
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ final reason = 'at width $width, scale $scale';
+ expect(tester.takeException(), isNull, reason: reason);
+
+ // Each allowance column shows for every row that has the quota, or for none.
+ for (final (engine, owners) in [
+ ('claude', ['both', 'claude']),
+ ('codex', ['both', 'codex']),
+ ]) {
+ final shown = [
+ for (final id in owners) has('super-machine-figure-$id-$engine'),
+ ];
+ expect(shown.toSet(), hasLength(1), reason: '$engine $reason');
+ if (shown.first) {
+ // The % signs line up, whichever rows leave the other column blank.
+ final edges = {
+ for (final id in owners)
+ right('super-machine-figure-$id-$engine').toStringAsFixed(2),
+ };
+ expect(edges, hasLength(1), reason: '$engine $reason');
+ }
+ // Offline: never a chip.
+ expect(
+ has('super-machine-figure-gone-$engine'),
+ isFalse,
+ reason: reason,
+ );
+ }
+ // The agents column: one right edge for every row, those without agents too,
+ // and either avatars on every row that has agents or a count on all of them.
+ final slots = {
+ for (final id in ids)
+ if (has('super-machine-agents-slot-$id'))
+ right('super-machine-agents-slot-$id').toStringAsFixed(2),
+ };
+ expect(slots, hasLength(1), reason: reason);
+ final stacked = {
+ for (final id in ['both', 'claude', 'codex', 'gone'])
+ find
+ .descendant(
+ of: key('super-machine-$id'),
+ matching: find.byType(SuperTabAvatar),
+ )
+ .evaluate()
+ .isNotEmpty,
+ };
+ expect(stacked, hasLength(1), reason: reason);
+ if (width == 420 && scale == 1) {
+ expect(stacked.single, isTrue, reason: reason);
+ expect(has('super-machine-figure-both-claude'), isTrue);
+ expect(has('super-machine-figure-both-codex'), isTrue);
+ // Claude's column comes before Codex's, and the agents after both.
+ expect(
+ right('super-machine-figure-both-claude'),
+ lessThan(right('super-machine-figure-both-codex')),
+ );
+ expect(
+ right('super-machine-figure-both-codex'),
+ lessThan(slots.single.isEmpty ? 0 : double.parse(slots.single)),
+ );
+ }
+ }
+ }
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ c.dispose();
+ },
+ );
+
+ testWidgets(
+ 'as the list narrows the names keep their minimum: agents become a count, then Codex goes, then Claude',
(tester) async {
final server = ConversationServer();
final now = DateTime.now();
@@ -701,14 +849,26 @@ void main() {
// A chip goes only once the avatars have, Codex before Claude.
if (!state.$3) expect(avatars, 0, reason: reason);
if (!state.$2) expect(state.$3, isFalse, reason: reason);
- // The name keeps its minimum while anything at the end remains.
- final name = tester.getSize(
- find.descendant(of: row, matching: find.byType(RichText)).first,
- );
+ // The name's room, from where it starts to the first column, keeps its
+ // minimum while any column but the count remains.
+ final nameLeft = tester
+ .getTopLeft(
+ find.descendant(of: row, matching: find.byType(RichText)).first,
+ )
+ .dx;
+ final firstColumn = [
+ for (final key in [
+ 'super-machine-allowance-m-claude',
+ 'super-machine-allowance-m-codex',
+ 'super-machine-agents-slot-m',
+ ])
+ if (find.byKey(ValueKey(key)).evaluate().isNotEmpty)
+ tester.getTopLeft(find.byKey(ValueKey(key))).dx,
+ ].reduce(math.min);
if (state.$2 || avatars > 0) {
expect(
- name.width,
- greaterThanOrEqualTo(56 * scale - 1),
+ firstColumn - nameLeft,
+ greaterThanOrEqualTo(48 * scale - 1),
reason: reason,
);
}
diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dart
index 2e74cdbc5..6a7f25b08 100644
--- a/desktop/test/super_tab_sidebar_test.dart
+++ b/desktop/test/super_tab_sidebar_test.dart
@@ -313,22 +313,14 @@ void main() {
expect(devices.size, machinesAdd.size, reason: reason);
expect(devices.center.dy, machinesAdd.center.dy, reason: reason);
expect(devices.right, closeTo(machinesAdd.left, 0.01), reason: reason);
- // A machine row's last mark, its +N, centers on the same column.
+ // Every machine's agents column ends half an avatar past the + column, so a
+ // trailing avatar centers under the + and a +N count ends with it.
final more = find.descendant(
of: find.byKey(const ValueKey('super-machine-studio')),
matching: find.textContaining('+'),
);
expect(more, findsOneWidget, reason: reason);
- final moreRect = tester.getRect(more);
- final studio = tester.getRect(
- find.byKey(const ValueKey('super-machine-studio')),
- );
- if (moreRect.width <= SuperTabSectionHeading.actionWidth) {
- expect(moreRect.center.dx, closeTo(dot, 0.5), reason: reason);
- } else {
- // Enlarged text wider than the column ends at the row's edge instead.
- expect(moreRect.right, closeTo(studio.right, 0.5), reason: reason);
- }
+ expect(tester.getRect(more).right, closeTo(dot + 9, 0.5), reason: reason);
// The row never names the owner, even when another machine shares the name; a name cut short shows itself
// whole on hover.
final shared = find
@@ -611,27 +603,18 @@ void main() {
closeTo(add, .01),
reason: reason,
);
- // The last agent mark: the avatar, or +1 once the name needs its room.
- // Enlarged text wider than the column ends at the row's edge instead.
+ // The last agent mark, the avatar or +1 once the list counts agents, ends
+ // half an avatar past the + column: an avatar centers under it.
final more = inRow('super-machine-on', find.text('+1'));
- final last = tester.getRect(
- more.evaluate().isNotEmpty
- ? more
- : inRow('super-machine-on', find.byType(SuperTabAvatar)),
- );
- if (last.width <= SuperTabSectionHeading.actionWidth) {
- expect(last.center.dx, closeTo(add, .5), reason: reason);
- } else {
+ final avatar = inRow('super-machine-on', find.byType(SuperTabAvatar));
+ if (more.evaluate().isNotEmpty) {
expect(
- last.right,
- closeTo(
- tester
- .getRect(find.byKey(const ValueKey('super-machine-on')))
- .right,
- .5,
- ),
+ tester.getRect(more).right,
+ closeTo(add + 9, .5),
reason: reason,
);
+ } else {
+ expect(centerX(avatar), closeTo(add, .5), reason: reason);
}
// Every row's fill spans the full row, whatever its level.
diff --git a/docs/swarms.md b/docs/swarms.md
index d845c2e96..c20508464 100644
--- a/docs/swarms.md
+++ b/docs/swarms.md
@@ -97,14 +97,16 @@ a report every 15 seconds, so that a silent machine can be told from a quiet one
that fails waits a whole 15 seconds before the next.
Each machine in the sidebar is one line, at a project row's height and on its columns: a
-status dot where the project chevrons sit, the name where project names start, then a chip
-for each model allowance and up to three of its agents, overlapping, then +N, the last
-centered under the heading's +. A chip is the engine's mark and the share left of its tightest
-window, Claude first, then Codex; only a known, unexpired allowance gets one, and an offline
-or unreachable machine shows none. The share is amber below 20% and red below 10%, and
-hovering a chip shows its windows ("5-hour: 48% remaining · resets in 1h 59m"). When the
-line runs short, the name keeps about 56 points: the agents become +N first, then the Codex
-chip goes, then the Claude one. Online machines come first, by name; offline ones follow
+status dot where the project chevrons sit, the name where project names start, then three
+columns every row shares, so their figures line up down the list: Claude's allowance, Codex's,
+and the agents. An allowance is the engine's mark and the share left of its tightest window,
+right-aligned so the % signs line up; only a known, unexpired allowance shows, and a machine
+without one, or an offline or unreachable machine, leaves its slot blank. The share is amber
+below 20% and red below 10%, and hovering it shows its windows ("5-hour: 48% remaining ·
+resets in 1h 59m"). The agents column shows up to three overlapping avatars, then +N, and
+ends half an avatar past the heading's +. The list decides its columns once, never row by row:
+when the names would have less than about 48 points, the agents become a count, then the
+Codex column goes, then Claude's. Online machines come first, by name; offline ones follow
under "Offline · N", closed until opened, which the Desktop remembers like the groups
themselves. Clicking a machine opens its details.