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.

Desktop: agent faces, a gold ring for Leads, clear task status marks, Swarm design system and gallery (#4461) (#3533)

0xken15e94cba9b86c7
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.md
index 8d7834ef4..a442f645a 100644
--- a/desktop/design/desktop-design-system.md
+++ b/desktop/design/desktop-design-system.md
@@ -367,6 +367,51 @@ leaderboard) share four rules.
(`[email protected]` shows as `mai`); full identity stays available to
tooltips and accessibility.
+## Swarm elements
+
+Goal: every element in a Swarm looks like it came from one hand, Apple-quality
+and never random (anh Dee, 2026-11-07, task #4461). Each element below has one
+implementation; a screen uses it and never draws its own. The gallery
+(`test/swarm_elements_gallery_test.dart`) draws every one in light and dark
+against `test/goldens/swarm-elements-{light,dark}.png`, holding each element
+to its own area: a face or ring may barely differ, an icon or letter a
+quarter of its box, and nothing else outside the words more than 38 pixels.
+
+- **Agent face.** An agent with no chosen picture wears a face
+ (`SuperTabAvatarFace`, `avatar_art.dart`) in rows, cards, chat and profile:
+ a round disc with a soft top-to-bottom fill, two eyes and a small smile.
+ Everything comes from the FNV-1a hash of the trimmed, lowercased name, so a
+ name draws the same face on every computer. The fill is
+ `SwarmPalette.faces[hash % 8]`, top to bottom: coral hsl(14 86% 72%) to
+ hsl(10 76% 62%); apricot hsl(38 92% 70%) to hsl(32 84% 59%); sage
+ hsl(146 46% 64%) to hsl(150 42% 52%); teal hsl(178 44% 60%) to
+ hsl(182 48% 48%); sky hsl(206 82% 70%) to hsl(212 72% 59%); periwinkle
+ hsl(238 72% 76%) to hsl(242 60% 65%); lilac hsl(274 60% 76%) to
+ hsl(278 48% 64%); rose hsl(334 76% 76%) to hsl(338 66% 65%). On a 100-unit
+ disc, in ink `#221F29` (`SwarmPalette.faceInk`): eyes are ellipses at
+ (36,45) and (64,45) with radii 5.2 and 7; the mouth is a quadratic curve
+ from (37,62) through (50,74) to (63,62), stroke 5.6, round caps. Eyes and
+ mouth shift sideways by `[-3,0,3][(hash>>9)%3]` units and tilt around the
+ centre by `[-9,-4,0,5,10][(hash>>5)%5]` degrees. The face is artwork: the
+ same in light and dark, and always a disc. A chosen picture still wins.
+- **Person avatar.** A person keeps their photo, preset or initial; a person
+ never wears an agent face.
+- **Lead ring.** A Lead (a PM) wears a thin gold ring, hsl(42 92% 58%)
+ (`SwarmPalette.leadRing`), around its avatar: stroke 5% of the face's
+ diameter, gap 7%, drawn outside the avatar's box so no row moves. Its
+ accessible label says Lead. The crown is only number one's on the
+ leaderboard.
+- **Task status marks.** Proposal is Lucide `lightbulb`, Rejected
+ `thumbs-down`, Failed (Stuck) `triangle-alert` in the semantic error ink.
+ The check, question mark and spinner stay, from the shared activity
+ vocabulary. No status in Flutter draws an X: an X means close. Terminal text
+ and native tab marks may keep `✗`.
+- **Task card and row.** The Tasks pane card (`SuperTabPersonalTaskCard`) and
+ the sidebar row (`SuperTabBuddyRow`) carry the elements above at their
+ shipped sizes; their size and layout do not change when an element does.
+- **Adding or changing one.** A new or changed element updates this section
+ and the gallery, with its images, in the same pull request.
+
## Phone
The phone app speaks the same language at a thumb's scale. It uses the same
@@ -666,6 +711,9 @@ UI checklist (desktop/design/desktop-design-system.md)
- [ ] Phone: Phone table sizes, 44-point targets, differences from Desktop listed
- [ ] Copy follows the Naming System
- [ ] Keyboard, focus return and hand cursor (Desktop)
+- [ ] A new or changed element updates Swarm elements and the gallery
+ (test/swarm_elements_gallery_test.dart) in this pull request, or it
+ doesn't merge
```
`scripts/check-ui-style.py` runs in CI for `desktop/lib/super_tabs` and
diff --git a/desktop/design/icon-design-system.md b/desktop/design/icon-design-system.md
index 946b6506e..058d8b9aa 100644
--- a/desktop/design/icon-design-system.md
+++ b/desktop/design/icon-design-system.md
@@ -99,12 +99,19 @@ These are content or identities, not a second action-icon library:
- Harness activity has one vocabulary in `harness_activity.dart`: `?`, `✗`,
`✓`, the ten-frame Braille spinner, `◌`, `■`, `⊘`, and unmarked idle. Native
tabs and menu notifications share `HarnessNativeActivity`; Dart pane headers
- share `ActivityMark`. Bridge payloads use `nativeActivityPayload` and the
+ share `ActivityMark`. In Flutter, `ActivityMark` draws Failed as
+ `AppIcons.triangleAlert` in its cell rather than `✗`: an X means close
+ (task #4461). Native tabs and terminal text keep `✗`.
+- Swarm task status marks (`SuperTabTaskStatusMark`) add three icons of their
+ own: Proposal `AppIcons.lightbulb`, Rejected `AppIcons.thumbsDown`, and Failed
+ (Stuck) `AppIcons.triangleAlert` in the semantic error ink. No status uses an
+ X. See [Swarm elements](desktop-design-system.md#swarm-elements). Bridge payloads use `nativeActivityPayload` and the
same `activityColor`, including the monochrome preference. Do not substitute
SF Symbols or add status pills to a different Harness surface. A notification
mark describes its unread receipt; a tab/pane mark describes current activity.
- A rank is its numeral. The #1 crown and badges are content artwork beside
- it, never a replacement for it; see
+ it, never a replacement for it, and the crown means only that: a Lead wears
+ the gold Lead ring instead; see
[Team and celebration](desktop-design-system.md#team-and-celebration). A
trend is `AppIcons.arrowUp` or `arrowDown` with its number; see
[Numbers and rankings](desktop-design-system.md#numbers-and-rankings).
@@ -147,6 +154,14 @@ changed symbols in their real screens too: dense grids, menus, long labels,
hover/focus/disabled states, Increase Contrast and text scaling. A contact
sheet does not replace interaction checks.
+Swarm elements (agent faces, the Lead ring, person avatars, task status marks,
+the task card and the row) have their own gallery against checked-in images;
+it runs in every suite, and an intended change regenerates its images:
+
+```sh
+flutter test --no-pub --update-goldens test/swarm_elements_gallery_test.dart
+```
+
## Audit record — 2026-09-30
Reviewed the complete catalogue, all custom painters and SVG call sites,
diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dart
index e062f92f5..1e2210fdf 100644
--- a/desktop/lib/shared/theme/app_icons.dart
+++ b/desktop/lib/shared/theme/app_icons.dart
@@ -66,6 +66,10 @@ abstract final class AppIcons {
static const circleMinus = LucideIcons.circleMinus400;
static const circlePlus = LucideIcons.circlePlus400;
static const circleSlash = LucideIcons.circleSlash400;
+
+ /// The Lead choice in New agent: a person in a ring, as a Lead wears its
+ /// gold ring; the crown is only the leaderboard's number one (task #4461).
+ static const circleUser = LucideIcons.circleUser400;
static const circleX = LucideIcons.circleX400;
static const clipboardPaste = LucideIcons.clipboardPaste400;
static const clock = LucideIcons.clock400;
@@ -132,6 +136,9 @@ abstract final class AppIcons {
static const link2 = LucideIcons.link2400;
static const listFilter = LucideIcons.listFilter400;
static const loaderCircle = LucideIcons.loaderCircle400;
+
+ /// A task that is a proposal (task #4461).
+ static const lightbulb = LucideIcons.lightbulb400;
static const lock = LucideIcons.lock400;
static const logOut = LucideIcons.logOut400;
static const maximize = LucideIcons.maximize400;
@@ -203,6 +210,9 @@ abstract final class AppIcons {
static const starHalf = LucideIcons.starHalf400;
static const sun = LucideIcons.sun400;
static const terminal = LucideIcons.terminal400;
+
+ /// A task someone rejected (task #4461).
+ static const thumbsDown = LucideIcons.thumbsDown400;
static const trash2 = LucideIcons.trash2400;
static const triangleAlert = LucideIcons.triangleAlert400;
static const trophy = LucideIcons.trophy400;
diff --git a/desktop/lib/shared/theme/swarm_palette.dart b/desktop/lib/shared/theme/swarm_palette.dart
new file mode 100644
index 000000000..1c809e1ed
--- /dev/null
+++ b/desktop/lib/shared/theme/swarm_palette.dart
@@ -0,0 +1,26 @@
+import 'package:flutter/painting.dart';
+
+/// The Swarm's identity artwork colours (desktop-design-system.md, Swarm elements): an agent's face and a Lead's
+/// ring. Artwork, so the same in light and dark.
+abstract final class SwarmPalette {
+ /// An agent's face fills, top to bottom; its name's hash % 8 picks one.
+ static final faces = <(Color, Color)>[
+ (_hsl(14, 86, 72), _hsl(10, 76, 62)), // coral
+ (_hsl(38, 92, 70), _hsl(32, 84, 59)), // apricot
+ (_hsl(146, 46, 64), _hsl(150, 42, 52)), // sage
+ (_hsl(178, 44, 60), _hsl(182, 48, 48)), // teal
+ (_hsl(206, 82, 70), _hsl(212, 72, 59)), // sky
+ (_hsl(238, 72, 76), _hsl(242, 60, 65)), // periwinkle
+ (_hsl(274, 60, 76), _hsl(278, 48, 64)), // lilac
+ (_hsl(334, 76, 76), _hsl(338, 66, 65)), // rose
+ ];
+
+ /// The eyes and smile on every face.
+ static const faceInk = Color(0xFF221F29);
+
+ /// The thin ring a Lead wears around its avatar.
+ static final leadRing = _hsl(42, 92, 58);
+}
+
+Color _hsl(double hue, double saturation, double lightness) =>
+ HSLColor.fromAHSL(1, hue, saturation / 100, lightness / 100).toColor();
diff --git a/desktop/lib/super_tabs/avatar_art.dart b/desktop/lib/super_tabs/avatar_art.dart
index 822fafd01..e22408238 100644
--- a/desktop/lib/super_tabs/avatar_art.dart
+++ b/desktop/lib/super_tabs/avatar_art.dart
@@ -1,5 +1,9 @@
+import 'dart:math' as math;
+
import 'package:flutter/material.dart';
+import '../shared/theme/swarm_palette.dart';
+
import '../widgets/desktop_chrome.dart';
import 'profile_model.dart';
@@ -29,24 +33,24 @@ Color _tone(BuildContext context, double hue) => HSLColor.fromAHSL(
Theme.of(context).brightness == Brightness.dark ? .72 : .36,
).toColor();
-/// An agent's default face: a 5×5 grid mirrored left to right, and a hue, both
-/// from its name alone.
-({List<bool> cells, double hue}) superTabAgentPattern(String name) {
+/// An agent's default face (anh Dee, task #4461): its fill, top to bottom, and how far its eyes and smile shift
+/// sideways (units of a 100-unit disc) and tilt (degrees), all from its name alone.
+({Color top, Color bottom, double shift, double tilt}) superTabAgentFace(
+ String name,
+) {
final hash = _hash(name.trim().toLowerCase());
- final half = [for (var bit = 0; bit < 15; bit++) (hash >> bit) & 1 == 1];
- if (!half.contains(true)) half[7] = true;
+ final (top, bottom) = SwarmPalette.faces[hash % 8];
return (
- cells: [
- for (var row = 0; row < 5; row++)
- for (final column in const [0, 1, 2, 1, 0]) half[row * 3 + column],
- ],
- hue: ((hash >> 16) % 360).toDouble(),
+ top: top,
+ bottom: bottom,
+ shift: const [-3.0, 0.0, 3.0][(hash >> 9) % 3],
+ tilt: const [-9.0, -4.0, 0.0, 5.0, 10.0][(hash >> 5) % 5],
);
}
/// The face inside an avatar: [picture] when there is one, else the agent
-/// pattern when [pattern] is set, else the name's initial. Round, or a rounded
-/// square with [radius] corners.
+/// face when [face] is set, else the name's initial. Round, or a rounded
+/// square with [radius] corners; the agent face is always a disc.
class SuperTabAvatarFace extends StatelessWidget {
const SuperTabAvatarFace({
super.key,
@@ -54,13 +58,13 @@ class SuperTabAvatarFace extends StatelessWidget {
required this.name,
required this.size,
this.picture,
- this.pattern = false,
+ this.face = false,
this.radius,
});
final String identity, name;
final double size;
final SuperTabAvatarPicture? picture;
- final bool pattern;
+ final bool face;
final double? radius;
@override
@@ -93,8 +97,7 @@ class SuperTabAvatarFace extends StatelessWidget {
null => ClipOval(child: child),
};
- Widget _fallback(BuildContext context) =>
- pattern ? _pattern(context) : _initial(context);
+ Widget _fallback(BuildContext context) => face ? _face() : _initial(context);
Widget _disc(BuildContext context, Widget child, [Color? color]) => Container(
width: size,
@@ -135,43 +138,56 @@ class SuperTabAvatarFace extends StatelessWidget {
);
}
- Widget _pattern(BuildContext context) {
- final art = superTabAgentPattern(name);
- final color = _tone(context, art.hue);
- return _disc(
- context,
- CustomPaint(
- key: const ValueKey('super-avatar-pattern'),
- size: Size.square(size * .56),
- painter: _PatternPainter(art.cells, color),
- ),
- color,
- );
- }
+ Widget _face() => CustomPaint(
+ key: const ValueKey('super-agent-face'),
+ size: Size.square(size),
+ painter: _FacePainter(superTabAgentFace(name)),
+ );
}
-class _PatternPainter extends CustomPainter {
- const _PatternPainter(this.cells, this.color);
- final List<bool> cells;
- final Color color;
+/// The face on a 100-unit disc: a soft top-to-bottom fill, two eyes and a
+/// small smile in [SwarmPalette.faceInk], shifted and tilted around the centre.
+class _FacePainter extends CustomPainter {
+ const _FacePainter(this.face);
+ final ({Color top, Color bottom, double shift, double tilt}) face;
@override
void paint(Canvas canvas, Size size) {
- final cell = size.width / 5;
- final paint = Paint()..color = color;
- for (var i = 0; i < cells.length; i++) {
- if (!cells[i]) continue;
- canvas.drawRRect(
- RRect.fromRectAndRadius(
- Rect.fromLTWH((i % 5) * cell, (i ~/ 5) * cell, cell, cell),
- Radius.circular(cell * .2),
- ),
- paint,
+ canvas.scale(size.width / 100);
+ canvas.drawCircle(
+ const Offset(50, 50),
+ 50,
+ Paint()
+ ..shader = LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [face.top, face.bottom],
+ ).createShader(const Rect.fromLTWH(0, 0, 100, 100)),
+ );
+ canvas
+ ..translate(50, 50)
+ ..rotate(face.tilt * math.pi / 180)
+ ..translate(-50, -50);
+ final dx = face.shift;
+ final ink = Paint()..color = SwarmPalette.faceInk;
+ for (final x in [36.0, 64.0]) {
+ canvas.drawOval(
+ Rect.fromCenter(center: Offset(x + dx, 45), width: 10.4, height: 14),
+ ink,
);
}
+ canvas.drawPath(
+ Path()
+ ..moveTo(37 + dx, 62)
+ ..quadraticBezierTo(50 + dx, 74, 63 + dx, 62),
+ Paint()
+ ..color = SwarmPalette.faceInk
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = 5.6
+ ..strokeCap = StrokeCap.round,
+ );
}
@override
- bool shouldRepaint(_PatternPainter old) =>
- old.color != color || !identical(old.cells, cells);
+ bool shouldRepaint(_FacePainter old) => old.face != face;
}
diff --git a/desktop/lib/super_tabs/buddy_card.dart b/desktop/lib/super_tabs/buddy_card.dart
index dc23c3083..876f9e832 100644
--- a/desktop/lib/super_tabs/buddy_card.dart
+++ b/desktop/lib/super_tabs/buddy_card.dart
@@ -254,7 +254,7 @@ class _BuddyCardButtonState extends State<BuddyCardButton> {
identity: 'buddy:${widget.projectId}',
name: widget.label,
size: size,
- pattern: true,
+ face: true,
)
: SuperTabAvatar.agent(
buddy,
diff --git a/desktop/lib/super_tabs/buddy_rows.dart b/desktop/lib/super_tabs/buddy_rows.dart
index 050f903af..57ba02c63 100644
--- a/desktop/lib/super_tabs/buddy_rows.dart
+++ b/desktop/lib/super_tabs/buddy_rows.dart
@@ -62,7 +62,7 @@ class SuperTabBuddyRow extends StatelessWidget {
this.note,
this.detail,
this.status,
- this.crown = false,
+ this.lead = false,
this.compact = false,
});
@@ -70,7 +70,7 @@ class SuperTabBuddyRow extends StatelessWidget {
final String? agentId;
final String name;
- /// An agent in My agents: the row wears its face, picture or pattern, as
+ /// An agent in My agents: the row wears its picture or face, as
/// its chat, cards and Tasks pane draw it (audit finding 6 of task #4211).
final SuperTabAgent? agent;
@@ -90,8 +90,8 @@ class SuperTabBuddyRow extends StatelessWidget {
/// a PM leads.
final String? note;
- /// A PM: its crown on its avatar (anh Dee 11-07, task #4421).
- final bool crown;
+ /// A PM: the Lead ring around its avatar (anh Dee 11-07, task #4461).
+ final bool lead;
/// A line under the name, such as where a Buddy runs, with [status], its
/// activity mark, before it. Without one the mark sits at the row's right.
@@ -139,7 +139,7 @@ class SuperTabBuddyRow extends StatelessWidget {
name: name,
size: 20,
engineBadge: false,
- crown: crown,
+ lead: lead,
),
null => SuperTabAvatar(
identity: agentId == null
diff --git a/desktop/lib/super_tabs/identity.dart b/desktop/lib/super_tabs/identity.dart
index d2c12dd52..16b8294b0 100644
--- a/desktop/lib/super_tabs/identity.dart
+++ b/desktop/lib/super_tabs/identity.dart
@@ -1,7 +1,7 @@
import 'package:clock/clock.dart';
import 'package:flutter/material.dart';
-import '../shared/theme/app_icons.dart';
+import '../shared/theme/swarm_palette.dart';
import '../widgets/desktop_chrome.dart';
import '../widgets/engine_identity.dart';
import 'avatar_art.dart';
@@ -10,8 +10,8 @@ import 'until.dart';
/// The one avatar for a person or an agent everywhere in the Swarm: rows,
/// messages, mentions, the Glance and the leaderboard. Stable across
-/// engine/model changes. An agent wears its engine as a small badge, a PM its
-/// crown; a person their status emoji while it lasts.
+/// engine/model changes. An agent wears its engine as a small badge, a Lead its
+/// gold ring; a person their status emoji while it lasts.
class SuperTabAvatar extends StatelessWidget {
const SuperTabAvatar({
super.key,
@@ -21,10 +21,10 @@ class SuperTabAvatar extends StatelessWidget {
this.picture,
this.engine,
this.status,
- this.pattern = false,
+ this.face = false,
this.now,
this.radius,
- }) : crown = false;
+ }) : lead = false;
SuperTabAvatar.person(
SuperTabPerson person, {
@@ -37,26 +37,26 @@ class SuperTabAvatar extends StatelessWidget {
picture = person.avatar,
engine = null,
status = person.status,
- pattern = false,
- crown = false;
+ face = false,
+ lead = false;
/// [engineBadge] off where the row already shows the engine beside the
- /// name (the roster, messages), so it shows once. [crown] marks a PM
- /// (task #4421).
+ /// name (the roster, messages), so it shows once. [lead] marks a PM with
+ /// the Lead ring (task #4461).
SuperTabAvatar.agent(
SuperTabAgent agent, {
super.key,
String? name,
this.size = 30,
bool engineBadge = true,
- this.crown = false,
+ this.lead = false,
this.radius,
}) : identity = 'agent:${agent.id}',
name = name ?? agent.displayName ?? agent.name,
picture = agent.avatar,
engine = engineBadge ? agent.engine : null,
status = null,
- pattern = true,
+ face = true,
now = null;
/// The avatar of a roster row, agent or person, so their names start at one inset.
@@ -76,29 +76,30 @@ class SuperTabAvatar extends StatelessWidget {
/// A fixed time to judge [status] by; the clock's when null.
final DateTime? now;
- /// Draw the agent pattern rather than an initial when there is no picture.
- final bool pattern;
+ /// Draw the agent face rather than an initial when there is no picture.
+ final bool face;
/// The corner of a rounded-square face, as a message's; round when null.
final double? radius;
- /// A leader's crown on the top right corner: a PM in My agents.
- final bool crown;
+ /// A Lead's thin gold ring around the face, outside its box so no row
+ /// moves: a PM in My agents.
+ final bool lead;
@override
Widget build(BuildContext context) {
final badge = size * .46;
- final face = SuperTabAvatarFace(
+ final drawn = SuperTabAvatarFace(
identity: identity,
name: name,
size: size,
picture: picture,
- pattern: pattern,
+ face: face,
radius: radius,
);
return SuperTabUntil(
until: now == null ? status?.until : null,
- builder: (context) => _drawn(face, badge),
+ builder: (context) => _drawn(drawn, badge),
);
}
@@ -106,24 +107,32 @@ class SuperTabAvatar extends StatelessWidget {
final status = this.status?.shownAt(now ?? clock.now()) == true
? this.status
: null;
+ final said = [
+ if (status != null) '$name, ${status.label}',
+ if (lead) 'Lead',
+ ];
return Semantics(
- label: status == null ? null : '$name, ${status.label}',
+ label: said.isEmpty ? null : said.join(', '),
child: SizedBox.square(
dimension: size,
child: Stack(
clipBehavior: Clip.none,
children: [
face,
- if (crown)
- Positioned(
- right: -badge * .2,
- top: -badge * .2,
- child: _Badge(
- size: badge,
- child: Icon(
- AppIcons.crown,
- size: badge * .72,
- color: DesktopChrome.foreground,
+ if (lead)
+ Positioned.fill(
+ child: OverflowBox(
+ maxWidth: double.infinity,
+ maxHeight: double.infinity,
+ child: CustomPaint(
+ key: const ValueKey('super-lead-ring'),
+ size: Size.square(
+ size * (1 + 2 * (_ringGap + _ringStroke)),
+ ),
+ painter: _LeadRingPainter(
+ stroke: size * _ringStroke,
+ gap: size * _ringGap,
+ ),
),
),
),
@@ -156,6 +165,30 @@ class SuperTabAvatar extends StatelessWidget {
}
}
+/// The Lead ring's stroke and its gap from the face, as shares of the face's
+/// diameter (anh Dee, task #4461).
+const _ringStroke = .05, _ringGap = .07;
+
+class _LeadRingPainter extends CustomPainter {
+ _LeadRingPainter({required this.stroke, required this.gap});
+ final double stroke, gap;
+ final color = SwarmPalette.leadRing;
+
+ @override
+ void paint(Canvas canvas, Size size) => canvas.drawCircle(
+ size.center(Offset.zero),
+ size.width / 2 - stroke / 2,
+ Paint()
+ ..color = color
+ ..style = PaintingStyle.stroke
+ ..strokeWidth = stroke,
+ );
+
+ @override
+ bool shouldRepaint(_LeadRingPainter old) =>
+ old.stroke != stroke || old.gap != gap;
+}
+
class _Badge extends StatelessWidget {
const _Badge({required this.size, required this.child});
final double size;
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index 8784b57de..8fb7cf8c6 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -52,7 +52,7 @@ Widget superTabMessageAvatar(
identity: '${message.author['kind']}:${message.authorId}',
name: message.fromAgent ? author : superTabPersonName(message.authorName),
size: size,
- pattern: message.fromAgent,
+ face: message.fromAgent,
radius: radius,
);
}
@@ -1208,7 +1208,7 @@ class SuperTabThreadLine extends StatelessWidget {
? (author['displayName'] ?? author['name'] ?? 'Agent') as String
: superTabPersonName(author['name'] as String? ?? ''),
size: size,
- pattern: kind == 'agent',
+ face: kind == 'agent',
);
}
diff --git a/desktop/lib/super_tabs/my_agents.dart b/desktop/lib/super_tabs/my_agents.dart
index 967cfcedb..f55d4f3ce 100644
--- a/desktop/lib/super_tabs/my_agents.dart
+++ b/desktop/lib/super_tabs/my_agents.dart
@@ -22,7 +22,7 @@ List<SuperTabAgent> superTabMyAgents(
});
}
-/// Whether [agent] is a PM, to wear the crown: the backend's kind when it sends one (#4116), else whether it leads a
+/// Whether [agent] is a PM, to wear the Lead ring: the backend's kind when it sends one (#4116), else whether it leads a
/// project, as before.
bool superTabAgentIsPm(SuperTabSnapshot snapshot, SuperTabAgent agent) =>
agent.kind != null ? agent.kind == 'pm' : snapshot.isLead(agent.id);
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 535bf4ad4..b9bd7b320 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -662,7 +662,7 @@ class ProjectSidebar extends StatelessWidget {
}
/// My agents (Swarm v3, task #4118): the person's Buddy first, then the agents they brought, each with its face and name,
- /// a PM's crowned and followed by the project it leads (task #4421), the name bold while its chat has unread, and + New agent in the heading.
+ /// a PM's in its Lead ring and followed by the project it leads (tasks #4421, #4461), the name bold while its chat has unread, and + New agent in the heading.
List<Widget> _myAgents(
BuildContext context,
SuperTabSnapshot? snapshot,
@@ -716,7 +716,7 @@ class ProjectSidebar extends StatelessWidget {
: onOpenAgentTerminal != null
? '$name · opens its terminal'
: '$name · no chat yet',
- crown: pm,
+ lead: pm,
compact: compact,
note: agent.downSince != null
? 'offline'
diff --git a/desktop/lib/super_tabs/tasks/personal_task_card.dart b/desktop/lib/super_tabs/tasks/personal_task_card.dart
index aab047b3e..f6a70d27e 100644
--- a/desktop/lib/super_tabs/tasks/personal_task_card.dart
+++ b/desktop/lib/super_tabs/tasks/personal_task_card.dart
@@ -204,8 +204,8 @@ class _Tag extends StatelessWidget {
);
}
-/// A task's status as the Tasks pane marks it: a proposal and a rejection by their own icons, work by its activity,
-/// each named in the task's own words, never the terminal's.
+/// A task's status as the Tasks pane marks it: a proposal, a rejection and a failure by their own icons, other work by
+/// its activity, each named in the task's own words, never the terminal's. No mark is an X: an X means close (task #4461).
class SuperTabTaskStatusMark extends StatelessWidget {
const SuperTabTaskStatusMark(this.status, {super.key, this.reason});
final String status;
@@ -216,13 +216,24 @@ class SuperTabTaskStatusMark extends StatelessWidget {
@override
Widget build(BuildContext context) {
final label = superTabTaskStatusLabel(status);
- if (status == 'proposal' || status == 'rejected') {
+ final activity = superTabTaskActivity(status);
+ final (icon, color) = switch (status) {
+ 'proposal' => (AppIcons.lightbulb, null),
+ 'rejected' => (AppIcons.thumbsDown, null),
+ _ when activity == HarnessActivity.failed => (
+ AppIcons.triangleAlert,
+ Theme.of(context).colorScheme.error,
+ ),
+ _ => (null, null),
+ };
+ if (icon != null) {
final why = status == 'rejected' ? superTabTaskRejection(reason) : null;
return Tooltip(
message: why == null ? label : '$label: $why',
child: Icon(
- status == 'proposal' ? AppIcons.circleDashed : AppIcons.circleX,
+ icon,
size: AppIcons.metadataSize,
+ color: color,
semanticLabel: label,
),
);
@@ -230,7 +241,7 @@ class SuperTabTaskStatusMark extends StatelessWidget {
return Tooltip(
message: label,
child: ActivityMark(
- activity: superTabTaskActivity(status),
+ activity: activity,
color: Theme.of(context).colorScheme.onSurface,
tooltip: false,
),
diff --git a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
index 1fd306b01..c2566a10c 100644
--- a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
+++ b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart
@@ -350,7 +350,7 @@ class _TasksPaneState extends State<SuperTabPersonalTasksPane> {
SuperTabAvatarPicture.fromJson(
task.agent['avatar'],
),
- pattern: true,
+ face: true,
),
waiting: waiting,
onApprove: waiting && enabled
diff --git a/desktop/lib/super_tabs/tasks/task_header.dart b/desktop/lib/super_tabs/tasks/task_header.dart
index d1dbeba00..79feb9517 100644
--- a/desktop/lib/super_tabs/tasks/task_header.dart
+++ b/desktop/lib/super_tabs/tasks/task_header.dart
@@ -112,7 +112,7 @@ class SuperTabTaskHeader extends StatelessWidget {
picture: SuperTabAvatarPicture.fromJson(
task.agent['avatar'],
),
- pattern: true,
+ face: true,
),
words(
agent?.displayName ??
diff --git a/desktop/lib/widgets/harness_activity_mark.dart b/desktop/lib/widgets/harness_activity_mark.dart
index 7b888af54..c59932c4b 100644
--- a/desktop/lib/widgets/harness_activity_mark.dart
+++ b/desktop/lib/widgets/harness_activity_mark.dart
@@ -1,8 +1,10 @@
import 'dart:async';
+import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:xterm/xterm.dart' show TerminalTheme;
+import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/workspace_bar_style.dart';
@@ -194,16 +196,28 @@ class _ActivityMarkState extends State<ActivityMark> {
label: widget.activity.label,
child: ExcludeSemantics(
child: RepaintBoundary(
- child: SizedBox(
- width: cell.width,
- child: Text(
- mark,
- textAlign: TextAlign.center,
- maxLines: 1,
- overflow: TextOverflow.clip,
- style: style,
- ),
- ),
+ // Failed is the triangle, never the terminal's ✗: in the app an X
+ // means close (task #4461). It keeps the text's cell.
+ child: widget.activity == HarnessActivity.failed
+ ? SizedBox(
+ width: cell.width,
+ height: cell.height,
+ child: Icon(
+ AppIcons.triangleAlert,
+ size: math.min(cell.height, style.fontSize ?? cell.height),
+ color: widget.color,
+ ),
+ )
+ : SizedBox(
+ width: cell.width,
+ child: Text(
+ mark,
+ textAlign: TextAlign.center,
+ maxLines: 1,
+ overflow: TextOverflow.clip,
+ style: style,
+ ),
+ ),
),
),
);
diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dart
index 58284cb26..69f24f84c 100644
--- a/desktop/lib/widgets/new_harness_form.dart
+++ b/desktop/lib/widgets/new_harness_form.dart
@@ -2061,7 +2061,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {
label: kind == 'lead' ? 'Lead' : 'Member',
semanticLabel:
'Starts as, ${kind == 'lead' ? 'Lead' : 'Member'}',
- icon: kind == 'lead' ? AppIcons.crown : AppIcons.user,
+ icon: kind == 'lead' ? AppIcons.circleUser : AppIcons.user,
menu: true,
capsule: true,
tooltip: 'Start as Lead or Member',
@@ -3889,7 +3889,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {
children: [
for (final (kind, label, detail, icon) in [
('member', 'Member', 'Works with you in its own chat', AppIcons.user),
- ('lead', 'Lead', 'Names and starts a project', AppIcons.crown),
+ ('lead', 'Lead', 'Names and starts a project', AppIcons.circleUser),
])
AppMenuItem(
key: ValueKey('new-harness-agent-kind-$kind'),
diff --git a/desktop/test/goldens/swarm-elements-dark.png b/desktop/test/goldens/swarm-elements-dark.png
new file mode 100644
index 000000000..5778f6923
Binary files /dev/null and b/desktop/test/goldens/swarm-elements-dark.png differ
diff --git a/desktop/test/goldens/swarm-elements-light.png b/desktop/test/goldens/swarm-elements-light.png
new file mode 100644
index 000000000..a815ab3f6
Binary files /dev/null and b/desktop/test/goldens/swarm-elements-light.png differ
diff --git a/desktop/test/harness_activity_test.dart b/desktop/test/harness_activity_test.dart
index 58c2264b7..5f3102220 100644
--- a/desktop/test/harness_activity_test.dart
+++ b/desktop/test/harness_activity_test.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
import 'package:harness/notify/alert_sounds.dart';
+import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/state/harness_activity.dart';
import 'package:harness/state/pending_question.dart';
import 'package:harness/state/swarm.dart';
@@ -294,7 +295,9 @@ void main() {
'error': 'Failed',
});
await tester.pump();
- expect(find.text('✗'), findsOneWidget);
+ // A failed turn is the triangle, never an X beside the pane's close.
+ expect(find.byIcon(AppIcons.triangleAlert), findsOneWidget);
+ expect(find.text('✗'), findsNothing);
expect(
tester.getRect(find.byKey(const ValueKey('terminal-pane-title'))),
titleRect,
diff --git a/desktop/test/new_harness_agent_kind_test.dart b/desktop/test/new_harness_agent_kind_test.dart
index 3eb2c9023..3fbe47efd 100644
--- a/desktop/test/new_harness_agent_kind_test.dart
+++ b/desktop/test/new_harness_agent_kind_test.dart
@@ -4,6 +4,7 @@ import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/auth/auth_session.dart';
import 'package:harness/core/config.dart';
import 'package:harness/core/engine_availability.dart';
@@ -219,6 +220,12 @@ void main() {
expect(integration.agentKind, 'lead');
expect(find.descendant(of: _kind, matching: find.text('Lead')),
findsOneWidget);
+ // The crown is only the leaderboard's number one's (task #4461).
+ expect(
+ find.descendant(of: _kind, matching: find.byIcon(AppIcons.circleUser)),
+ findsOneWidget,
+ );
+ expect(find.byIcon(AppIcons.crown), findsNothing);
await capture(tester, mounted.image, 'new-agent-lead-${brightness.name}');
});
}
diff --git a/desktop/test/super_tab_agent_face_test.dart b/desktop/test/super_tab_agent_face_test.dart
index 90f87555d..11b74c8a7 100644
--- a/desktop/test/super_tab_agent_face_test.dart
+++ b/desktop/test/super_tab_agent_face_test.dart
@@ -23,7 +23,7 @@ Map<String, dynamic> _agent(String id, String name) => {
};
/// The reader's agents in My agents: Kestrel, a Regular agent with no picture
-/// (its pattern) talking in its own chat, and Orion, the project's PM, wearing
+/// (its face) talking in its own chat, and Orion, the project's PM, wearing
/// a picture.
ConversationServer agentFaceSwarm() {
final server = swarm();
@@ -121,9 +121,9 @@ Future<SuperTabController> showAgentFaces(
void main() {
Finder key(String k) => find.byKey(ValueKey(k));
- /// What a face draws: whose, its picture, and the pattern in its place.
+ /// What a face draws: whose, its picture, and the face in its place.
String look(SuperTabAvatarFace face) =>
- '${face.identity} pattern=${face.pattern} picture=${switch (face.picture) {
+ '${face.identity} face=${face.face} picture=${switch (face.picture) {
SuperTabPresetAvatar(:final key) => key,
_ => null,
}}';
@@ -160,7 +160,7 @@ void main() {
selectedId: 'agent-chat-kestrel',
);
final face = rowFace(tester, 'kestrel');
- expect(face.pattern, isTrue, reason: 'its pattern, not the letter K');
+ expect(face.face, isTrue, reason: 'its face, not the letter K');
expect(elsewhere(tester, 'kestrel'), {look(face)});
// The face alone: the row draws no engine badge.
expect(
diff --git a/desktop/test/super_tab_avatar_test.dart b/desktop/test/super_tab_avatar_test.dart
index 8ecc2a872..50b15a08c 100644
--- a/desktop/test/super_tab_avatar_test.dart
+++ b/desktop/test/super_tab_avatar_test.dart
@@ -1,3 +1,5 @@
+import 'dart:math' as math;
+
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/super_tabs/avatar_art.dart';
@@ -31,62 +33,99 @@ Widget host(Widget child) => MaterialApp(
);
void main() {
- test(
- 'an agent’s pattern is stable for its name and differs between names',
- () {
- final kai = superTabAgentPattern('Kai');
- expect(superTabAgentPattern('Kai').cells, kai.cells);
- expect(superTabAgentPattern('Kai').hue, kai.hue);
- final names = [
- 'Kai',
- 'Ivy',
- 'River',
- 'Ellis',
- 'Theo',
- 'Sage',
- 'Quinn',
- 'Atlas',
- ];
- final patterns = {
- for (final n in names) superTabAgentPattern(n).cells.join(),
- };
- expect(patterns, hasLength(names.length));
- // Mirrored left to right, like a face.
- for (var row = 0; row < 5; row++) {
- expect(kai.cells[row * 5], kai.cells[row * 5 + 4]);
- expect(kai.cells[row * 5 + 1], kai.cells[row * 5 + 3]);
- }
- expect(kai.cells.where((on) => on), isNotEmpty);
- },
- );
+ // anh Dee's pick (task #4461): the face's colour, shift and tilt come from the FNV-1a hash of the trimmed,
+ // lowercased name; these names cover all eight colours.
+ Color hsl(double h, double s, double l) =>
+ HSLColor.fromAHSL(1, h, s / 100, l / 100).toColor();
+ final palette = [
+ (hsl(14, 86, 72), hsl(10, 76, 62)), // coral
+ (hsl(38, 92, 70), hsl(32, 84, 59)), // apricot
+ (hsl(146, 46, 64), hsl(150, 42, 52)), // sage
+ (hsl(178, 44, 60), hsl(182, 48, 48)), // teal
+ (hsl(206, 82, 70), hsl(212, 72, 59)), // sky
+ (hsl(238, 72, 76), hsl(242, 60, 65)), // periwinkle
+ (hsl(274, 60, 76), hsl(278, 48, 64)), // lilac
+ (hsl(334, 76, 76), hsl(338, 66, 65)), // rose
+ ];
+ test('an agent’s face takes its colour, shift and tilt from its name', () {
+ // name: (hash % 8, shift, tilt), worked out by hand from the hash.
+ const faces = {
+ 'Kai': (0, 3.0, 0.0),
+ 'River': (1, 0.0, 5.0),
+ 'Quinn': (2, 3.0, -9.0),
+ 'Buddy': (3, -3.0, 10.0),
+ 'Atlas': (4, 0.0, -4.0),
+ 'Ivy': (5, -3.0, 0.0),
+ 'Milo': (6, -3.0, 0.0),
+ 'Nova': (7, 3.0, 0.0),
+ };
+ for (final MapEntry(key: name, value: (colour, shift, tilt))
+ in faces.entries) {
+ final face = superTabAgentFace(name);
+ expect(
+ (face.top, face.bottom, face.shift, face.tilt),
+ (palette[colour].$1, palette[colour].$2, shift, tilt),
+ reason: name,
+ );
+ expect(superTabAgentFace(' ${name.toUpperCase()} ').top, face.top);
+ }
+ });
- // The round dial draws Buddies from cli/src/superTabs/buddyAvatar.ts; these
- // vectors pin both to the same half bits and dark-mode tone.
- test('a Buddy\'s pattern matches the dial\'s vectors', () {
- int halfBits(List<bool> cells) {
- var bits = 0;
- for (var i = 0; i < 15; i++) {
- if (cells[(i ~/ 3) * 5 + i % 3]) bits |= 1 << i;
- }
- return bits;
+ testWidgets('a face draws the numbers of the design: disc, eyes and smile '
+ 'in ink #221F29, tilted and shifted', (tester) async {
+ const ink = Color(0xFF221F29);
+ Future<Finder> draw(String name) async {
+ await tester.pumpWidget(
+ host(
+ SuperTabAvatarFace(
+ identity: 'agent:$name',
+ name: name,
+ size: 100,
+ face: true,
+ ),
+ ),
+ );
+ return find.byKey(const ValueKey('super-agent-face'));
}
- Color darkTone(double hue) => HSLColor.fromAHSL(1, hue, .42, .72).toColor();
- final diego = superTabAgentPattern("diego's Buddy");
- expect((halfBits(diego.cells), diego.hue), (25513, 13.0));
- expect(darkTone(diego.hue), const Color(0xffd6a79a));
- final ken = superTabAgentPattern("ken's Buddy");
- expect((halfBits(ken.cells), ken.hue), (30735, 327.0));
- expect(darkTone(ken.hue), const Color(0xffd69abb));
+ bool eye(Symbol method, List<dynamic> args, double x) =>
+ method == #drawOval &&
+ args[0] ==
+ Rect.fromCenter(center: Offset(x, 45), width: 10.4, height: 14) &&
+ (args[1] as Paint).color.toARGB32() == ink.toARGB32();
+ final quinn = await draw('Quinn');
+ expect(tester.getSize(quinn), const Size.square(100));
+ // Quinn's hash shifts it 3 units right and tilts it 9 degrees left.
+ expect(
+ quinn,
+ paints
+ ..circle(x: 50, y: 50, radius: 50)
+ ..rotate(angle: -9 * math.pi / 180)
+ ..something((m, a) => eye(m, a, 36 + 3))
+ ..something((m, a) => eye(m, a, 64 + 3))
+ // The smile: (37,62) through (50,74) to (63,62), shifted; its dip
+ // reaches y 68 under the middle.
+ ..something((m, a) {
+ if (m != #drawPath) return false;
+ final (path, paint) = (a[0] as Path, a[1] as Paint);
+ return paint.color.toARGB32() == ink.toARGB32() &&
+ paint.style == PaintingStyle.stroke &&
+ (paint.strokeWidth - 5.6).abs() < 1e-5 &&
+ paint.strokeCap == StrokeCap.round &&
+ path.contains(const Offset(50 + 3, 65)) &&
+ !path.contains(const Offset(50 + 3, 60)) &&
+ !path.contains(const Offset(50 + 3, 70));
+ }),
+ );
});
- testWidgets('an agent without a picture shows its pattern and engine badge', (
+ testWidgets('an agent without a picture shows its face and engine badge', (
tester,
) async {
await tester.pumpWidget(
host(SuperTabAvatar.agent(agentNamed('Kai', engine: 'codex'), size: 28)),
);
- expect(find.byKey(const ValueKey('super-avatar-pattern')), findsOneWidget);
+ expect(find.byKey(const ValueKey('super-agent-face')), findsOneWidget);
final badge = tester.widget<EngineMark>(find.byType(EngineMark));
expect(badge.engine, 'codex');
expect(tester.getSize(find.byType(SuperTabAvatar)), const Size.square(28));
@@ -103,7 +142,7 @@ void main() {
),
);
expect(find.text('🦉'), findsOneWidget);
- expect(find.byKey(const ValueKey('super-avatar-pattern')), findsNothing);
+ expect(find.byKey(const ValueKey('super-agent-face')), findsNothing);
await tester.pumpWidget(
host(
SuperTabAvatar.person(
diff --git a/desktop/test/super_tab_avatars_view_test.dart b/desktop/test/super_tab_avatars_view_test.dart
index 0eb89e0c0..f0ddae9a6 100644
--- a/desktop/test/super_tab_avatars_view_test.dart
+++ b/desktop/test/super_tab_avatars_view_test.dart
@@ -13,7 +13,7 @@ Finder saying(String text) => find.byWidgetPredicate(
void main() {
testWidgets(
- 'the roster shows each person’s avatar and status, each agent its pattern',
+ 'the roster shows each person’s avatar and status, each agent its face',
(tester) async {
final f = RosterFixture();
addTearDown(f.dispose);
@@ -52,7 +52,7 @@ void main() {
);
expect(f.inRow(1, find.text('🦉')), findsOneWidget);
expect(
- f.inRow(3, find.byKey(const ValueKey('super-avatar-pattern'))),
+ f.inRow(3, find.byKey(const ValueKey('super-agent-face'))),
findsOneWidget,
);
await f.close(tester);
diff --git a/desktop/test/super_tab_personal_tasks_pane_test.dart b/desktop/test/super_tab_personal_tasks_pane_test.dart
index 05bb26275..33481e67b 100644
--- a/desktop/test/super_tab_personal_tasks_pane_test.dart
+++ b/desktop/test/super_tab_personal_tasks_pane_test.dart
@@ -147,7 +147,7 @@ void main() {
);
expect(find.text('Tasks'), findsOneWidget);
expect(find.byTooltip('Proposal'), findsNWidgets(2));
- expect(find.byIcon(AppIcons.circleDashed), findsNWidgets(2));
+ expect(find.byIcon(AppIcons.lightbulb), findsNWidgets(2));
f.rows.first['status'] = 'working';
f.rows.first['version'] = 2;
await f.controller.refresh();
@@ -314,7 +314,7 @@ void main() {
('planned', 'Planned', HarnessActivity.starting),
('working', 'Working', HarnessActivity.working),
('needs_human', 'Needs a human', HarnessActivity.needsInput),
- ('blocked', 'Stuck', HarnessActivity.failed),
+ ('blocked', 'Stuck', null),
('review', 'Ready for review', HarnessActivity.needsInput),
('done', 'Done', HarnessActivity.done),
('stopped', 'Stopped', HarnessActivity.paused),
@@ -359,6 +359,11 @@ void main() {
expect(mark.activity, activity, reason: status);
}
}
+ // Its own icon (task #4461): no ActivityMark, so no terminal ✗.
+ expect(
+ inCard('blocked', find.byIcon(AppIcons.triangleAlert)),
+ findsOneWidget,
+ );
});
group('a refused change unlocks the pane and says why (finding 3)', () {
FilledButton approve(String id) =>
@@ -768,4 +773,56 @@ void main() {
isNotNull,
);
});
+
+ // anh Dee's pick (task #4461): Proposal is a lightbulb, Rejected a thumbs-down, Failed a triangle in the error ink;
+ // the check, question mark and spinner stay. No Flutter status draws an X: an X means close.
+ testWidgets('each task status has its own mark and none is an X', (t) async {
+ late BuildContext context;
+ Future<void> show(String status) => t.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: Builder(
+ builder: (c) {
+ context = c;
+ return SuperTabTaskStatusMark(status);
+ },
+ ),
+ ),
+ ),
+ );
+ Icon? icon() => t.widgetList<Icon>(find.byType(Icon)).firstOrNull;
+ await show('proposal');
+ expect(icon()?.icon, AppIcons.lightbulb);
+ await show('rejected');
+ expect(icon()?.icon, AppIcons.thumbsDown);
+ await show('blocked');
+ expect(icon()?.icon, AppIcons.triangleAlert);
+ expect(icon()?.color, Theme.of(context).colorScheme.error);
+ expect(find.bySemanticsLabel('Stuck'), findsOneWidget);
+ for (final status in [
+ 'proposal',
+ 'rejected',
+ 'planned',
+ 'working',
+ 'needs_human',
+ 'blocked',
+ 'review',
+ 'done',
+ 'stopped',
+ 'cancelled',
+ 'lost',
+ ]) {
+ await show(status);
+ expect(
+ {AppIcons.circleX, AppIcons.close}.contains(icon()?.icon),
+ isFalse,
+ reason: status,
+ );
+ expect(
+ find.textContaining(RegExp('[✗✕×]')),
+ findsNothing,
+ reason: status,
+ );
+ }
+ });
}
diff --git a/desktop/test/super_tab_task_activity_test.dart b/desktop/test/super_tab_task_activity_test.dart
index f1f5f1df3..f17b3bcc0 100644
--- a/desktop/test/super_tab_task_activity_test.dart
+++ b/desktop/test/super_tab_task_activity_test.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/appearance_prefs_store.dart';
import 'package:harness/state/harness_activity.dart';
@@ -143,7 +144,10 @@ void main() {
expect(
find.descendant(
of: _mark('task'),
- matching: find.text(activity.mark),
+ // Failed draws the triangle, not the terminal's ✗ (task #4461).
+ matching: activity == HarnessActivity.failed
+ ? find.byIcon(AppIcons.triangleAlert)
+ : find.text(activity.mark),
),
findsOneWidget,
);
diff --git a/desktop/test/super_tab_threads_test.dart b/desktop/test/super_tab_threads_test.dart
index 507b82985..101797756 100644
--- a/desktop/test/super_tab_threads_test.dart
+++ b/desktop/test/super_tab_threads_test.dart
@@ -400,7 +400,7 @@ void main() {
expect(agent.identity, 'agent:river');
expect(agent.name, 'River');
expect(agent.picture, isA<SuperTabPresetAvatar>());
- expect(agent.pattern, isTrue);
+ expect(agent.face, isTrue);
// The row names the engine already where an agent writes; its reply
// line does not badge it either.
expect(agent.engine, isNull);
@@ -453,7 +453,7 @@ void main() {
await tester.pumpAndSettle();
[_, agent, _] = faces(tester);
expect(agent.picture, isNull);
- expect(agent.pattern, isTrue);
+ expect(agent.face, isTrue);
expect(agent.name, 'River');
expect(find.text('🦊'), findsNothing);
expect(find.text('🦉'), findsNothing);
diff --git a/desktop/test/super_tab_v3_left_shots_test.dart b/desktop/test/super_tab_v3_left_shots_test.dart
index 2e6639746..6522e953a 100644
--- a/desktop/test/super_tab_v3_left_shots_test.dart
+++ b/desktop/test/super_tab_v3_left_shots_test.dart
@@ -26,7 +26,7 @@ Map<String, dynamic> _agent(String id, String name) => {
'configuration': {'engine': 'codex'},
};
-/// Swarm v3's left pane and middle (task #4118), in both appearances: My agents with the Buddy first, a PM's crown and an
+/// Swarm v3's left pane and middle (task #4118), in both appearances: My agents with the Buddy first, a PM's Lead ring and an
/// unread name in bold; the chat of a selected agent in the middle; a project's Board with Projects open. Task #4192: no
/// arrows under the org switcher, the Buddy's own avatar, only the server's My agents, and My agents folded. Task #4220:
/// folded Projects keeps a project that tags you, and Decisions in the middle keeps Tasks on the right.
diff --git a/desktop/test/super_tab_v3_left_test.dart b/desktop/test/super_tab_v3_left_test.dart
index fe2716c4e..a512f4703 100644
--- a/desktop/test/super_tab_v3_left_test.dart
+++ b/desktop/test/super_tab_v3_left_test.dart
@@ -43,9 +43,9 @@ final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
void main() {
Finder key(String k) => find.byKey(ValueKey(k));
- Finder crown(String agent) => find.descendant(
+ Finder ring(String agent) => find.descendant(
of: key('super-agent-$agent'),
- matching: find.byIcon(AppIcons.crown),
+ matching: key('super-lead-ring'),
);
Finder text(String agent, String text) =>
find.descendant(of: key('super-agent-$agent'), matching: find.text(text));
@@ -323,25 +323,45 @@ void main() {
}
});
- // Task #4421 (anh Dee 11-07): "let's just put a leader crown on the avatar. it's too much." and "let's put the project
- // name next to the one that it leads".
- testWidgets('a PM wears its crown on its avatar and names the project it '
- 'leads after its name; a Regular agent neither', (tester) async {
+ // Task #4421 (anh Dee 11-07): "let's put the project name next to the one that it leads". Task #4461 (anh Dee
+ // 11-07): a Lead wears a thin gold ring instead of the crown, outside its avatar's box so no row moves.
+ testWidgets('a PM wears the gold Lead ring around its avatar and names the '
+ 'project it leads after its name; a Regular agent neither', (
+ tester,
+ ) async {
+ final semantics = tester.ensureSemantics();
await show(tester, agents: mine, setup: agents);
- expect(crown('orion'), findsOneWidget);
- final avatar = tester.getRect(
+ expect(ring('orion'), findsOneWidget);
+ expect(
find.descendant(
of: key('super-agent-orion'),
- matching: find.byType(SuperTabAvatar),
+ matching: find.byIcon(AppIcons.crown),
),
+ findsNothing,
+ );
+ final avatarFinder = find.descendant(
+ of: key('super-agent-orion'),
+ matching: find.byType(SuperTabAvatar),
);
- final badge = tester.getRect(crown('orion'));
- // On the avatar's top right corner, not after the name.
- expect(badge.center.dx, greaterThan(avatar.center.dx));
- expect(badge.center.dy, lessThan(avatar.center.dy));
- expect(badge.left, lessThan(avatar.right));
+ final avatar = tester.getRect(avatarFinder);
+ // The row's avatar keeps its size; the ring lies 7% + 5% of it outside.
+ expect(avatar.size, const Size.square(20));
+ expect(tester.getRect(ring('orion')), avatar.inflate(20 * (.07 + .05)));
+ final painter =
+ tester.widget<CustomPaint>(ring('orion')).painter! as dynamic;
+ expect(painter.stroke as double, closeTo(20 * .05, 1e-9));
+ expect(painter.gap as double, closeTo(20 * .07, 1e-9));
+ expect(
+ (painter.color as Color).toARGB32(),
+ HSLColor.fromAHSL(1, 42, .92, .58).toColor().toARGB32(),
+ );
+ // A reader still hears it is the Lead.
+ String said(String agent) =>
+ tester.getSemantics(key('super-agent-$agent')).label;
+ expect(said('orion').split('\n'), contains('Lead'));
+ expect(said('kestrel').split('\n'), isNot(contains('Lead')));
final name = tester.getRect(text('orion', 'Orion'));
- expect(badge.right, lessThan(name.left));
+ expect(tester.getRect(ring('orion')).right, lessThan(name.left));
final project = tester.getRect(text('orion', 'web-project'));
expect(project.left, greaterThan(name.right));
expect((project.center.dy - name.center.dy).abs(), lessThan(4));
@@ -349,8 +369,9 @@ void main() {
tester.widget<Text>(text('orion', 'web-project')).style?.color,
grid.SidebarInk.muted(tester.element(key('super-agent-orion'))),
);
- expect(crown('kestrel'), findsNothing);
+ expect(ring('kestrel'), findsNothing);
expect(text('kestrel', 'web-project'), findsNothing);
+ semantics.dispose();
});
testWidgets('in a narrow pane the project name is cut before the agent\'s '
@@ -408,8 +429,8 @@ void main() {
);
expect(avatar.name, 'Wren');
expect(avatar.identity, 'agent:buddy');
- // The agent's own pattern, as every other row draws it, not a letter.
- expect(avatar.pattern, isTrue);
+ // The agent's own face, as every other row draws it, not a letter.
+ expect(avatar.face, isTrue);
});
// Audit finding 9 of task #4436 (task #4444): working, waiting, offline and starting all looked the same.
@@ -496,7 +517,7 @@ void main() {
(Brightness.dark, 'dark'),
]) {
await show(tester, agents: mine, setup: agents, brightness: brightness);
- await captureWindow(tester, shots, 'my-agents-pm-crown-$name');
+ await captureWindow(tester, shots, 'my-agents-pm-ring-$name');
await tester.pumpWidget(const SizedBox());
}
}, skip: shots == null);
@@ -1084,25 +1105,26 @@ void main() {
expect((older.kind, older.chatId), (null, null));
});
- testWidgets('a PM by kind has the crown and opens the chat it names', (
- tester,
- ) async {
- final selected = <String>[];
- final c = await show(
- tester,
- agents: [
- {..._agent('zed', 'Zed'), 'kind': 'pm', 'chatId': 'offline'},
- {..._agent('amy', 'Amy'), 'kind': 'regular', 'chatId': null},
- ],
- selected: selected,
- );
- expect(crown('zed'), findsOneWidget);
- expect(crown('amy'), findsNothing);
- await tester.tap(key('super-agent-zed'));
- await tester.pump();
- expect(selected, ['offline']);
- await tester.runAsync(c.flush);
- });
+ testWidgets(
+ 'a PM by kind has the Lead ring and opens the chat it names',
+ (tester) async {
+ final selected = <String>[];
+ final c = await show(
+ tester,
+ agents: [
+ {..._agent('zed', 'Zed'), 'kind': 'pm', 'chatId': 'offline'},
+ {..._agent('amy', 'Amy'), 'kind': 'regular', 'chatId': null},
+ ],
+ selected: selected,
+ );
+ expect(ring('zed'), findsOneWidget);
+ expect(ring('amy'), findsNothing);
+ await tester.tap(key('super-agent-zed'));
+ await tester.pump();
+ expect(selected, ['offline']);
+ await tester.runAsync(c.flush);
+ },
+ );
testWidgets('its kind wins over the project it once led', (tester) async {
await show(
@@ -1115,7 +1137,7 @@ void main() {
.firstWhere((g) => g['id'] == 'lead')['leadId'] =
'orion',
);
- expect(crown('orion'), findsNothing);
+ expect(ring('orion'), findsNothing);
});
},
);
diff --git a/desktop/test/swarm_elements_gallery_test.dart b/desktop/test/swarm_elements_gallery_test.dart
new file mode 100644
index 000000000..e51a598e3
--- /dev/null
+++ b/desktop/test/swarm_elements_gallery_test.dart
@@ -0,0 +1,483 @@
+import 'dart:io';
+import 'dart:math' as math;
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/app_type.dart';
+import 'package:harness/super_tabs/buddy_rows.dart';
+import 'package:harness/super_tabs/avatar_art.dart';
+import 'package:harness/super_tabs/identity.dart';
+import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/tasks/personal_task_card.dart';
+import 'package:harness/super_tabs/tasks/personal_tasks.dart';
+import 'package:harness/terminal/terminal_typography.dart';
+
+/// The Swarm elements gallery (desktop-design-system.md, Swarm elements): every
+/// element drawn in light and dark against its checked-in image. A new or
+/// changed element updates the doc and this gallery in the same pull request.
+///
+/// Update the images with
+/// `flutter test --no-pub --update-goldens test/swarm_elements_gallery_test.dart`
+/// and look at them before committing.
+void main() {
+ late GoldenFileComparator previous;
+ setUpAll(() async {
+ // One font file on every host, so the images match on macOS, Linux and
+ // Windows; text is set in the bundled Roboto Mono, icons in Lucide.
+ final mono = rootBundle.load('assets/fonts/roboto-mono/RobotoMono.ttf');
+ for (final family in {AppType.sansFamily, terminalFontFamily, 'Roboto'}) {
+ await (FontLoader(family)..addFont(mono)).load();
+ }
+ // The activity marks' symbols (◌ ✓ ■ ⊘ and the spinner) come from the
+ // host's symbol font, as in the app; they are a few dozen pixels, inside
+ // the comparator's tolerance where hosts differ.
+ for (final (family, paths) in [
+ ('Apple Symbols', ['/System/Library/Fonts/Apple Symbols.ttf']),
+ (
+ 'DejaVu Sans',
+ [
+ '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf',
+ // macOS has no DejaVu; this face carries the same marks (✓).
+ '/System/Library/Fonts/Supplemental/Arial Unicode.ttf',
+ ],
+ ),
+ ]) {
+ final file = paths.map(File.new).where((f) => f.existsSync()).firstOrNull;
+ if (file == null) continue;
+ final bytes = ByteData.sublistView(file.readAsBytesSync());
+ await (FontLoader(family)..addFont(Future.value(bytes))).load();
+ }
+ await (FontLoader('packages/lucide_icons_flutter/Lucide400')..addFont(
+ rootBundle.load(
+ 'packages/lucide_icons_flutter/assets/build_font/LucideVariable-w400.ttf',
+ ),
+ ))
+ .load();
+ previous = goldenFileComparator;
+ goldenFileComparator = _NearlyComparator(
+ (previous as LocalFileComparator).basedir.resolve(
+ 'swarm_elements_gallery_test.dart',
+ ),
+ );
+ });
+ tearDownAll(() => goldenFileComparator = previous);
+
+ for (final brightness in Brightness.values) {
+ testWidgets('every Swarm element matches its image in ${brightness.name}', (
+ tester,
+ ) async {
+ await _show(tester, brightness);
+ (goldenFileComparator as _NearlyComparator).parts = _parts(tester);
+ await expectLater(
+ find.byKey(_Gallery.boundary),
+ matchesGoldenFile('goldens/swarm-elements-${brightness.name}.png'),
+ );
+ });
+ }
+
+ // Review of task #4461: a whole-image tolerance let a changed element pass. Ellis has Kai's colour with another
+ // tilt: only its eyes and smile move.
+ testWidgets('one changed face fails the gallery', (tester) async {
+ await _show(tester, Brightness.light, faces: ['Ellis', ..._faces.skip(1)]);
+ final boundary = tester.renderObject<RenderRepaintBoundary>(
+ find.byKey(_Gallery.boundary),
+ );
+ final problem = await tester.runAsync(() async {
+ final image = await boundary.toImage();
+ final png = await image.toByteData(format: ui.ImageByteFormat.png);
+ image.dispose();
+ return galleryDifference(
+ png!.buffer.asUint8List(),
+ File('test/goldens/swarm-elements-light.png').readAsBytesSync(),
+ _parts(tester),
+ );
+ });
+ expect(problem, contains('agent face Ellis'));
+ });
+}
+
+Future<void> _show(
+ WidgetTester tester,
+ Brightness brightness, {
+ List<String> faces = _faces,
+}) async {
+ final old = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = old);
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(760, 500);
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ // A still spinner, so the image holds one frame.
+ home: MediaQuery(
+ data: const MediaQueryData(disableAnimations: true),
+ child: _Gallery(brightness, faces: faces),
+ ),
+ ),
+ );
+ await tester.pump();
+ expect(tester.takeException(), isNull);
+}
+
+/// One element's area in the gallery and the share of it that may differ.
+typedef GalleryRegion = ({String name, Rect rect, double limit});
+
+/// Faces and the Lead ring are paths Skia draws the same on every host: almost
+/// nothing of them may differ.
+const _art = .01;
+
+/// An icon or letter is a font glyph that each host smooths differently; a
+/// different glyph changes far more than this.
+const _glyph = .25;
+
+/// Everything else but words (fills, pills, borders, where each element sits)
+/// is drawn alike on every host: at most 0.01% of the image (38 pixels) may
+/// differ, under the smallest Lead ring's 80, so a lost element fails too. Words
+/// are left out: macOS and Linux smooth their edges too differently to compare
+/// by pixel (14,638 pixels on one image), and their copy is tested where they
+/// are written.
+const _rest = .0001;
+
+/// Every element the gallery draws, each held to its own area, and its words,
+/// held to none.
+({List<GalleryRegion> regions, List<Rect> words}) _parts(WidgetTester tester) =>
+ (
+ regions: _regions(tester),
+ // A glyph's smoothed edge reaches a little past its box.
+ words: [
+ for (final text in find.byType(RichText).evaluate())
+ tester.getRect(find.byElementPredicate((e) => e == text)).inflate(2),
+ ],
+ );
+
+List<GalleryRegion> _regions(WidgetTester tester) {
+ final faces = find.byType(SuperTabAvatarFace);
+ final avatars = find.byType(SuperTabAvatar);
+ final marks = find.descendant(
+ of: find.byType(SuperTabTaskStatusMark),
+ matching: find.byType(Icon),
+ );
+ return [
+ for (var i = 0; i < faces.evaluate().length; i++)
+ if (tester.widget<SuperTabAvatarFace>(faces.at(i)) case final face)
+ face.face && face.picture == null
+ ? (
+ name: 'agent face ${face.name}',
+ rect: tester.getRect(faces.at(i)),
+ limit: _art,
+ )
+ : (
+ name: 'avatar ${face.name}',
+ rect: tester.getRect(faces.at(i)),
+ limit: _glyph,
+ ),
+ for (var i = 0; i < avatars.evaluate().length; i++)
+ if (tester.widget<SuperTabAvatar>(avatars.at(i)) case final avatar
+ when avatar.lead)
+ (
+ name: 'Lead ring ${avatar.name}',
+ // The ring, 12% of the face outside its box, and its smoothed edge.
+ rect: tester.getRect(avatars.at(i)).inflate(avatar.size * .12 + 1),
+ limit: _art,
+ ),
+ for (var i = 0; i < marks.evaluate().length; i++)
+ (
+ name: 'status mark ${tester.widget<Icon>(marks.at(i)).semanticLabel}',
+ rect: tester.getRect(marks.at(i)),
+ limit: _glyph,
+ ),
+ ];
+}
+
+/// Why [actual] does not match [expected], or null when it does. A pixel
+/// differs when a channel moves by more than a quarter; each region may hold
+/// its share of such pixels, and the image outside the words [_rest].
+Future<String?> galleryDifference(
+ Uint8List actual,
+ Uint8List expected,
+ ({List<GalleryRegion> regions, List<Rect> words}) parts,
+) async {
+ final (a, b) = (await _pixels(actual), await _pixels(expected));
+ if (a.width != b.width || a.height != b.height) {
+ return 'size ${a.width}x${a.height}, expected ${b.width}x${b.height}';
+ }
+ bool off(int x, int y) {
+ final i = (y * a.width + x) * 4;
+ for (var c = 0; c < 4; c++) {
+ if ((a.bytes[i + c] - b.bytes[i + c]).abs() > 64) return true;
+ }
+ return false;
+ }
+
+ int count(Rect rect, {List<Rect> skip = const []}) {
+ final r = rect.intersect(
+ Rect.fromLTWH(0, 0, a.width.toDouble(), a.height.toDouble()),
+ );
+ var n = 0;
+ for (var y = r.top.floor(); y < r.bottom.ceil(); y++) {
+ for (var x = r.left.floor(); x < r.right.ceil(); x++) {
+ final at = Offset(x + .5, y + .5);
+ if (off(x, y) && !skip.any((w) => w.contains(at))) n++;
+ }
+ }
+ return n;
+ }
+
+ for (final region in parts.regions) {
+ final n = count(region.rect);
+ final limit = math.max(
+ 2,
+ region.rect.width * region.rect.height * region.limit,
+ );
+ if (n > limit) {
+ return '${region.name}: $n pixels differ (limit ${limit.floor()})';
+ }
+ }
+ final n = count(
+ Rect.fromLTWH(0, 0, a.width.toDouble(), a.height.toDouble()),
+ skip: parts.words,
+ );
+ final limit = a.width * a.height * _rest;
+ return n > limit
+ ? 'the image outside its words: $n pixels differ (limit ${limit.floor()})'
+ : null;
+}
+
+Future<({int width, int height, Uint8List bytes})> _pixels(
+ Uint8List png,
+) async {
+ final codec = await ui.instantiateImageCodec(png);
+ final image = (await codec.getNextFrame()).image;
+ final data = await image.toByteData();
+ final pixels = (
+ width: image.width,
+ height: image.height,
+ bytes: data!.buffer.asUint8List(),
+ );
+ image.dispose();
+ codec.dispose();
+ return pixels;
+}
+
+/// Agent names that pick each of the face's eight colours, in palette order.
+const _faces = [
+ 'Kai',
+ 'River',
+ 'Quinn',
+ 'Buddy',
+ 'Atlas',
+ 'Ivy',
+ 'Milo',
+ 'Nova',
+];
+
+const _statuses = [
+ 'proposal',
+ 'planned',
+ 'working',
+ 'needs_human',
+ 'review',
+ 'blocked',
+ 'done',
+ 'stopped',
+ 'lost',
+ 'rejected',
+];
+
+SuperTabAgent _agent(String name, {String? kind}) => SuperTabAgent.fromJson({
+ 'id': 'id-$name',
+ 'name': name,
+ 'machineId': 'm',
+ 'harnessId': 'h',
+ 'contributorId': 'p',
+ 'configuration': {'engine': 'claude'},
+ 'kind': ?kind,
+});
+
+final _person = SuperTabPerson.fromJson({
+ 'id': 'p1',
+ 'email': '[email protected]',
+ 'role': 'owner',
+});
+
+class _Gallery extends StatelessWidget {
+ const _Gallery(this.brightness, {required this.faces});
+ final Brightness brightness;
+ final List<String> faces;
+ static const boundary = ValueKey('swarm-elements-gallery');
+
+ @override
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ Widget title(String text) => Padding(
+ padding: const EdgeInsets.only(top: 14, bottom: 8),
+ child: Text(text, style: Theme.of(context).textTheme.labelLarge),
+ );
+ Widget gap() => const SizedBox(width: 16);
+ return RepaintBoundary(
+ key: boundary,
+ child: Material(
+ color: Theme.of(context).colorScheme.surface,
+ child: Padding(
+ padding: const EdgeInsets.all(20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Swarm elements / ${brightness.name}',
+ style: Theme.of(context).textTheme.titleMedium,
+ ),
+ title('Agent face: eight colours'),
+ Row(
+ children: [
+ for (final name in faces) ...[
+ SuperTabAvatar.agent(
+ _agent(name),
+ size: 40,
+ engineBadge: false,
+ ),
+ gap(),
+ ],
+ ],
+ ),
+ title('Agent face, Lead ring and person at 20, 24, 30'),
+ Row(
+ children: [
+ for (final size in [20.0, 24.0, 30.0]) ...[
+ SuperTabAvatar.agent(
+ _agent('Kai'),
+ size: size,
+ engineBadge: false,
+ ),
+ gap(),
+ SuperTabAvatar.agent(
+ _agent('River'),
+ size: size,
+ engineBadge: false,
+ lead: true,
+ ),
+ gap(),
+ SuperTabAvatar.person(_person, size: size),
+ gap(),
+ gap(),
+ ],
+ ],
+ ),
+ title('Task status marks'),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ for (final status in _statuses)
+ SizedBox(
+ width: 72,
+ child: Column(
+ children: [
+ SuperTabTaskStatusMark(status),
+ const SizedBox(height: 4),
+ Text(
+ superTabTaskStatusLabel(status),
+ textAlign: TextAlign.center,
+ maxLines: 2,
+ style: Theme.of(context).textTheme.labelSmall,
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ title('Row and task card'),
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: 280,
+ child: Column(
+ children: [
+ SuperTabBuddyRow(
+ agentId: 'id-River',
+ agent: _agent('River', kind: 'pm'),
+ name: 'River',
+ note: 'harness',
+ tooltip: 'River',
+ lead: true,
+ onTap: () {},
+ ),
+ SuperTabBuddyRow(
+ agentId: 'id-Quinn',
+ agent: _agent('Quinn'),
+ name: 'Quinn',
+ tooltip: 'Quinn',
+ selected: true,
+ onTap: () {},
+ ),
+ ],
+ ),
+ ),
+ gap(),
+ SizedBox(
+ width: 340,
+ child: SuperTabPersonalTaskCard(
+ task: SuperTabPersonalTask({
+ 'id': 't1',
+ 'version': 1,
+ 'at': 0,
+ 'projectId': 'harness',
+ 'projectName': 'harness',
+ 'title': 'Friendly agent faces and a gold Lead ring',
+ 'status': 'proposal',
+ }),
+ project: 'harness',
+ selected: false,
+ onOpen: () {},
+ requester: SuperTabAvatar.person(_person, size: 20),
+ agent: SuperTabAvatar.agent(
+ _agent('Quinn'),
+ size: 20,
+ engineBadge: false,
+ ),
+ waiting: true,
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+/// Matches when [galleryDifference] finds none. A mismatch fails with what
+/// differs and saves the image it drew to the system temp folder, never into
+/// the source tree, where CI's runner would count it as a changed source.
+class _NearlyComparator extends LocalFileComparator {
+ _NearlyComparator(super.testFile);
+
+ /// The elements and words of the image being compared.
+ ({List<GalleryRegion> regions, List<Rect> words}) parts = (
+ regions: const [],
+ words: const [],
+ );
+
+ @override
+ Future<bool> compare(Uint8List imageBytes, Uri golden) async {
+ final file = File.fromUri(basedir.resolveUri(golden));
+ final problem = file.existsSync()
+ ? await galleryDifference(imageBytes, file.readAsBytesSync(), parts)
+ : 'no image yet; make it with --update-goldens';
+ if (problem == null) return true;
+ final drawn = File(
+ '${Directory.systemTemp.createTempSync('swarm-gallery-').path}/'
+ '${golden.pathSegments.last}',
+ )..writeAsBytesSync(imageBytes);
+ throw FlutterError('$golden: $problem. What it drew: ${drawn.path}');
+ }
+}
diff --git a/docs/plans/2026-11-07-swarm-elements-plan.md b/docs/plans/2026-11-07-swarm-elements-plan.md
new file mode 100644
index 000000000..274c6aa26
--- /dev/null
+++ b/docs/plans/2026-11-07-swarm-elements-plan.md
@@ -0,0 +1,84 @@
+# Swarm elements: agent face, Lead ring, task status marks, design system and gallery (task #4461)
+
+**Goal:** Build anh Dee's three picks (an agent face, a gold ring for Leads, clear task status marks) and write them
+into the design system with a gallery test against checked-in images, so every future Swarm element follows it.
+
+**Architecture:** The face replaces the pixel pattern inside `SuperTabAvatarFace` (`avatar_art.dart`), so every
+place that already draws an agent without a picture (rows, cards, chat, profile) gets it with no call-site change
+beyond the renamed flag. The Lead ring replaces the crown inside `SuperTabAvatar`, painted outside the avatar's box.
+The status marks change in `SuperTabTaskStatusMark` and, for Failed, in the shared `ActivityMark`. Colours live as
+named roles in a theme file so `check-ui-style.py` stays clean.
+
+**Tech Stack:** Flutter (Desktop), flutter_test goldens with a small pixel tolerance so macOS and Linux agree.
+
+**Spec:** task #4461 brief (anh Dee, 11-07 15:25): exact numbers below.
+
+Way of working: the project's Engineer flow: plan first, each task's failing test committed before its code, one
+pull request, one independent review.
+
+## Global Constraints
+
+- Desktop and docs only. Keep every row's size and layout: the ring is drawn outside the avatar's box.
+- People keep their photo or initial; an agent's chosen picture still wins over the face.
+- Light and dark draw the same face art.
+- Terminal text (the CLI, native tab marks) keeps `✗`; no Flutter status draws an X.
+- The leaderboard's #1 crown stays.
+- Out of scope: the left pane layout, the top bar.
+
+## Review Focus
+
+- The face numbers: palette by `hash % 8`, eyes, mouth, shift `[-3,0,3][(hash>>9)%3]`, tilt
+ `[-9,-4,0,5,10][(hash>>5)%5]`, ink `#221F29`.
+- The ring: hsl(42 92% 58%), stroke 5% of the diameter, gap 7%, outside the box; the Lead label is spoken.
+- The gallery is deterministic on macOS and Linux (test font for text, tolerance for anti-aliasing).
+
+## Task 1: the agent face
+
+**Files:** `desktop/lib/super_tabs/avatar_art.dart`, `desktop/lib/shared/theme/swarm_palette.dart` (new),
+`desktop/test/super_tab_avatar_test.dart`, call sites passing `pattern: true`.
+
+**Interfaces:** `superTabAgentFace(String name) → ({Color top, Color bottom, double shift, double tilt})`;
+`SuperTabAvatarFace.face` (was `pattern`), key `super-agent-face`.
+
+- [ ] Test: the face of a name has the palette entry, shift and tilt its hash picks, is stable, ignores case and
+ outer spaces; an agent without a picture draws the face, not an initial.
+- [ ] Watch it fail.
+- [ ] Replace `superTabAgentPattern` and `_PatternPainter` with the face and its painter; remove the pattern and
+ its CLI-parity vector test (the dial port in `cli/` is untouched; see the PR).
+- [ ] Pass.
+
+## Task 2: the Lead ring
+
+**Files:** `desktop/lib/super_tabs/identity.dart`, `buddy_rows.dart`, `project_sidebar.dart`,
+`desktop/test/super_tab_v3_left_test.dart`.
+
+**Interfaces:** `SuperTabAvatar.agent(lead: true)` (was `crown`), key `super-lead-ring`.
+
+- [ ] Test: a PM's row avatar wears the ring (no crown icon), the avatar keeps its size, the ring's rect is the
+ face's diameter + 2 × (7% + 5%), its label says Lead; a Regular agent has none.
+- [ ] Watch it fail.
+- [ ] Paint the ring; drop the crown badge.
+- [ ] Pass.
+
+## Task 3: task status marks
+
+**Files:** `desktop/lib/super_tabs/tasks/personal_task_card.dart`, `desktop/lib/widgets/harness_activity_mark.dart`,
+`desktop/lib/shared/theme/app_icons.dart`, tests beside them.
+
+- [ ] Test: Proposal draws `lightbulb`, Rejected `thumbsDown`, Stuck/Failed `triangleAlert` in the error ink;
+ `ActivityMark` for failed draws `triangleAlert`, never the `✗` text.
+- [ ] Watch it fail.
+- [ ] Add `lightbulb` and `thumbsDown` to the catalogue; change the marks.
+- [ ] Pass.
+
+## Task 4: design system and gallery
+
+**Files:** `desktop/design/desktop-design-system.md`, `desktop/design/icon-design-system.md`,
+`desktop/test/swarm_elements_gallery_test.dart` (new), `desktop/test/goldens/swarm-elements-{light,dark}.png`.
+
+- [ ] Gallery test drawing every Swarm element (agent faces of all eight colours, Lead ring, person avatar with
+ photo-less initial, every status mark, a task card, a row) in light and dark, compared to the checked-in
+ images; fails before the images exist.
+- [ ] Generate the images with `--update-goldens`, inspect them, commit.
+- [ ] Doc: a Swarm elements section with these rules; icon doc's activity line and status marks; UI checklist line
+ "a new or changed element updates the doc and gallery in the same pull request, or it doesn't merge".