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 My agents: a PM wears its crown on its avatar and names the project it leads (#4421) (#3521)

0xken15610ccb05cdb0
diff --git a/desktop/lib/super_tabs/buddy_rows.dart b/desktop/lib/super_tabs/buddy_rows.dart
index c49bd34e6..b79924d1c 100644
--- a/desktop/lib/super_tabs/buddy_rows.dart
+++ b/desktop/lib/super_tabs/buddy_rows.dart
@@ -2,7 +2,6 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
-import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../widgets/desktop_chrome.dart';
import 'buddy_chat.dart';
@@ -62,7 +61,7 @@ class SuperTabBuddyRow extends StatelessWidget {
this.note,
this.detail,
this.status,
- this.crownKey,
+ this.crown = false,
});
/// The Buddy, for its avatar; null while none runs.
@@ -85,11 +84,12 @@ class SuperTabBuddyRow extends StatelessWidget {
/// What hovering says: "Your Buddy · openharness".
final String tooltip;
- /// A quiet word after the name, such as a Buddy's "offline".
+ /// A quiet word after the name, such as a Buddy's "offline" or the project
+ /// a PM leads.
final String? note;
- /// Set on a PM: its crown, right after the name (Swarm v3, task #4118).
- final Key? crownKey;
+ /// A PM: its crown on its avatar (anh Dee 11-07, task #4421).
+ final bool crown;
/// A line under the name, such as where a Buddy runs, with [status], its
/// activity mark, before it.
@@ -134,6 +134,7 @@ class SuperTabBuddyRow extends StatelessWidget {
name: name,
size: 20,
engineBadge: false,
+ crown: crown,
),
null => SuperTabAvatar(
identity: agentId == null
@@ -167,9 +168,6 @@ class SuperTabBuddyRow extends StatelessWidget {
maxWidth: math.max(
0,
box.maxWidth -
- (crownKey == null
- ? 0
- : 4 + AppIcons.metadataSize) -
8 * [project, note].nonNulls.length,
),
),
@@ -189,15 +187,6 @@ class SuperTabBuddyRow extends StatelessWidget {
),
),
),
- if (crownKey case final crownKey?) ...[
- const SizedBox(width: 4),
- Icon(
- AppIcons.crown,
- key: crownKey,
- size: AppIcons.metadataSize,
- color: color,
- ),
- ],
if (project case final project?) ...[
const SizedBox(width: 8),
Flexible(
diff --git a/desktop/lib/super_tabs/identity.dart b/desktop/lib/super_tabs/identity.dart
index 5cd739bf9..d2c12dd52 100644
--- a/desktop/lib/super_tabs/identity.dart
+++ b/desktop/lib/super_tabs/identity.dart
@@ -1,6 +1,7 @@
import 'package:clock/clock.dart';
import 'package:flutter/material.dart';
+import '../shared/theme/app_icons.dart';
import '../widgets/desktop_chrome.dart';
import '../widgets/engine_identity.dart';
import 'avatar_art.dart';
@@ -9,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 person
-/// their status emoji while it lasts.
+/// engine/model changes. An agent wears its engine as a small badge, a PM its
+/// crown; a person their status emoji while it lasts.
class SuperTabAvatar extends StatelessWidget {
const SuperTabAvatar({
super.key,
@@ -23,7 +24,7 @@ class SuperTabAvatar extends StatelessWidget {
this.pattern = false,
this.now,
this.radius,
- });
+ }) : crown = false;
SuperTabAvatar.person(
SuperTabPerson person, {
@@ -36,16 +37,19 @@ class SuperTabAvatar extends StatelessWidget {
picture = person.avatar,
engine = null,
status = person.status,
- pattern = false;
+ pattern = false,
+ crown = false;
/// [engineBadge] off where the row already shows the engine beside the
- /// name (the roster, messages), so it shows once.
+ /// name (the roster, messages), so it shows once. [crown] marks a PM
+ /// (task #4421).
SuperTabAvatar.agent(
SuperTabAgent agent, {
super.key,
String? name,
this.size = 30,
bool engineBadge = true,
+ this.crown = false,
this.radius,
}) : identity = 'agent:${agent.id}',
name = name ?? agent.displayName ?? agent.name,
@@ -78,6 +82,9 @@ class SuperTabAvatar extends StatelessWidget {
/// 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;
+
@override
Widget build(BuildContext context) {
final badge = size * .46;
@@ -107,6 +114,19 @@ class SuperTabAvatar extends StatelessWidget {
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 (engine case final engine? when engine.isNotEmpty)
Positioned(
right: -badge * .2,
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 58ccb9e9b..35de31f05 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -626,7 +626,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 crown after a PM's, the name bold while its chat has unread, and + New agent in the heading.
+ /// 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.
List<Widget> _myAgents(
BuildContext context,
SuperTabSnapshot? snapshot,
@@ -669,15 +669,15 @@ class ProjectSidebar extends StatelessWidget {
Widget _agentRow(SuperTabSnapshot snapshot, SuperTabAgent agent) {
final chat = superTabAgentChat(snapshot, agent);
final name = snapshot.agentName(agent.id, fallback: agent.name);
+ final pm = superTabAgentIsPm(snapshot, agent);
return SuperTabBuddyRow(
key: ValueKey('super-agent-${agent.id}'),
agentId: agent.id,
agent: agent,
name: name,
tooltip: chat == null ? '$name · no chat yet' : name,
- crownKey: superTabAgentIsPm(snapshot, agent)
- ? ValueKey('super-agent-crown-${agent.id}')
- : null,
+ crown: pm,
+ note: pm ? snapshot.leadProjectForAgent(agent.id)?.name : null,
status: _buddyMark(agent),
selected:
chat != null && !_paneCovered && controller.selectedId == chat.id,
diff --git a/desktop/test/super_tab_v3_left_test.dart b/desktop/test/super_tab_v3_left_test.dart
index 401cf460d..fab26417e 100644
--- a/desktop/test/super_tab_v3_left_test.dart
+++ b/desktop/test/super_tab_v3_left_test.dart
@@ -1,4 +1,7 @@
+import 'dart:io';
+
import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart' show RenderParagraph;
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/widgets/desktop_chrome.dart';
@@ -13,6 +16,7 @@ import 'package:harness/super_tabs/project_sidebar.dart';
import 'package:harness/super_tabs/view.dart';
import 'super_tab_activity_lists_test.dart' show load, swarm;
+import 'support/capture.dart';
import 'support/super_tab_fixture.dart';
import 'swarm_state_test.dart' show createApp;
@@ -33,8 +37,16 @@ Map<String, dynamic> _agent(
'configuration': {'engine': 'codex'},
};
+final shots = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+
void main() {
Finder key(String k) => find.byKey(ValueKey(k));
+ Finder crown(String agent) => find.descendant(
+ of: key('super-agent-$agent'),
+ matching: find.byIcon(AppIcons.crown),
+ );
+ Finder text(String agent, String text) =>
+ find.descendant(of: key('super-agent-$agent'), matching: find.text(text));
Future<void> settle(WidgetTester tester) async {
for (var i = 0; i < 3; i++) {
@@ -52,6 +64,8 @@ void main() {
void Function(ConversationServer server)? setup,
List<String>? selected,
List<String>? created,
+ double width = 300,
+ Brightness brightness = Brightness.light,
}) async {
final server = swarm();
if (agents != null) server.state['agents'] = agents;
@@ -60,11 +74,16 @@ void main() {
final c = activity.controller;
final AppNotifier app = createApp();
addTearDown(app.dispose);
- await tester.binding.setSurfaceSize(const Size(300, 900));
+ // The design tokens follow the app's brightness, which main.dart sets from the theme.
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ await tester.binding.setSurfaceSize(Size(width, 900));
addTearDown(() => tester.binding.setSurfaceSize(null));
await tester.pumpWidget(
MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.light),
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
home: Scaffold(
// The view rebuilds the sidebar as the controller changes.
body: ListenableBuilder(
@@ -254,23 +273,66 @@ void main() {
expect(key('super-agent-fir'), findsNothing);
});
- testWidgets('a PM has a crown right after its name, a Regular agent '
- 'none', (tester) async {
+ // 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 {
await show(tester, agents: mine, setup: agents);
- expect(key('super-agent-crown-orion'), findsOneWidget);
- expect(key('super-agent-crown-kestrel'), findsNothing);
- final name = find.descendant(
- of: key('super-agent-orion'),
- matching: find.text('Orion'),
- );
- final crown = tester.getRect(key('super-agent-crown-orion'));
- expect(crown.left - tester.getRect(name).right, inInclusiveRange(0, 12));
+ expect(crown('orion'), findsOneWidget);
+ final avatar = tester.getRect(
+ 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 name = tester.getRect(text('orion', 'Orion'));
+ expect(badge.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));
expect(
- (crown.center.dy - tester.getRect(name).center.dy).abs(),
- lessThan(4),
+ tester.widget<Text>(text('orion', 'web-project')).style?.color,
+ grid.SidebarInk.muted(tester.element(key('super-agent-orion'))),
);
+ expect(crown('kestrel'), findsNothing);
+ expect(text('kestrel', 'web-project'), findsNothing);
});
+ testWidgets('in a narrow pane the project name is cut before the agent\'s '
+ 'name', (tester) async {
+ await show(
+ tester,
+ agents: [
+ buddy,
+ {..._agent('orion', 'Orion Lead'), 'kind': 'pm'},
+ ],
+ setup: agents,
+ width: 280,
+ );
+ bool cut(String shown) => tester
+ .renderObject<RenderParagraph>(text('orion', shown))
+ .didExceedMaxLines;
+ expect(cut('web-project'), isTrue);
+ expect(cut('Orion Lead'), isFalse);
+ });
+
+ testWidgets('screenshots of My agents, light and dark', (tester) async {
+ await tester.runAsync(() => loadCaptureFonts(shots));
+ for (final (brightness, name) in [
+ (Brightness.light, 'light'),
+ (Brightness.dark, 'dark'),
+ ]) {
+ await show(tester, agents: mine, setup: agents, brightness: brightness);
+ await captureWindow(tester, shots, 'my-agents-pm-crown-$name');
+ await tester.pumpWidget(const SizedBox());
+ }
+ }, skip: shots == null);
+
testWidgets('unread is a bold name, with no dot and no number', (
tester,
) async {
@@ -833,8 +895,8 @@ void main() {
],
selected: selected,
);
- expect(key('super-agent-crown-zed'), findsOneWidget);
- expect(key('super-agent-crown-amy'), findsNothing);
+ expect(crown('zed'), findsOneWidget);
+ expect(crown('amy'), findsNothing);
await tester.tap(key('super-agent-zed'));
await tester.pump();
expect(selected, ['offline']);
@@ -852,7 +914,7 @@ void main() {
.firstWhere((g) => g['id'] == 'lead')['leadId'] =
'orion',
);
- expect(key('super-agent-crown-orion'), findsNothing);
+ expect(crown('orion'), findsNothing);
});
},
);
diff --git a/docs/plans/2026-11-07-pm-avatar-crown-plan.md b/docs/plans/2026-11-07-pm-avatar-crown-plan.md
new file mode 100644
index 000000000..15b12ee63
--- /dev/null
+++ b/docs/plans/2026-11-07-pm-avatar-crown-plan.md
@@ -0,0 +1,54 @@
+# A PM in My agents wears its crown on its avatar and says which project it leads: implementation plan
+
+> This plan is carried out by the project's Engineer way of working (test first, task by task, one pull request), not
+> subagent-driven-development. There is no execution handoff.
+
+**Goal:** In the left pane's My agents, a PM's crown moves from after its name to a small badge on its avatar's corner,
+and the name of the project it leads follows its name as quiet text: "Sage harness". Regular agents are unchanged.
+This is task #4421 (anh Dee 11-07 12:32 and 12:37: "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").
+
+```
+before after
+ (S) Sage 👑 (S)♛ Sage harness
+ (K) Kestrel (K) Kestrel
+```
+
+**Architecture:** `SuperTabAvatar` (`desktop/lib/super_tabs/identity.dart`) already draws corner badges (the engine
+mark, a person's status). `SuperTabAvatar.agent` gains `crown`, drawn as the same `_Badge` at the top right with
+`AppIcons.crown`. `SuperTabBuddyRow` (`buddy_rows.dart`) replaces `crownKey`, the icon after the name, with `crown`,
+passed to the avatar. `ProjectSidebar._agentRow` passes the project a PM leads (`snapshot.leadProjectForAgent`) as the
+row's `note`, the quiet text after the name that already yields its width first.
+
+**Tech Stack:** Flutter, widget tests.
+
+**Spec:** Task #4421's brief.
+
+## Global Constraints
+
+- Desktop only; only this delta. Bold for unread, dimmed for idle, Buddy first and + New agent stay as they are.
+- Existing crown icon, text styles and theme tokens; the project name from the snapshot the client already has.
+
+## Review Focus
+
+- The name keeps its width before the project name in a narrow pane.
+- Other avatars (messages, roster, cards) draw no crown.
+
+---
+
+### Task 1: The crown on the avatar, the project after the name
+
+**Files:**
+- Modify: `desktop/test/super_tab_v3_left_test.dart`
+- Modify: `desktop/lib/super_tabs/identity.dart`, `desktop/lib/super_tabs/buddy_rows.dart`,
+ `desktop/lib/super_tabs/project_sidebar.dart`
+
+**Interfaces:** `SuperTabAvatar.agent(..., bool crown = false)`; `SuperTabBuddyRow(..., bool crown = false)` replaces
+`crownKey`.
+
+- [ ] Test: a PM row has the crown on its avatar's top right corner, none after its name, and its project's name after
+ its name; a Regular row has neither; in a narrow pane the project name is cut and the name is whole. Light and dark
+ screenshots when `HARNESS_SUPER_TAB_CAPTURE` is set.
+- [ ] Run it and watch it fail.
+- [ ] Implement; run `flutter test test/super_tab_v3_left_test.dart` and the tests of the avatar and row's other users.
+- [ ] Commit and push.
diff --git a/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-dark.png b/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-dark.png
new file mode 100644
index 000000000..a98ca64ed
Binary files /dev/null and b/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-dark.png differ
diff --git a/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-light.png b/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-light.png
new file mode 100644
index 000000000..9c25f766f
Binary files /dev/null and b/docs/plans/assets/pm-avatar-crown/my-agents-pm-crown-light.png differ