The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Polish Swarm navigation and team identities (#1508)
Dee75dc01bc053c
diff --git a/backend/integration/superTabs.test.ts b/backend/integration/superTabs.test.tsindex e85d64c8e..9718266dd 100644--- a/backend/integration/superTabs.test.ts+++ b/backend/integration/superTabs.test.ts@@ -70,6 +70,29 @@ afterAll(async () => {await replica?.stop()})+describe('agent member identities', () => {+ it('keeps a name through replay and removal, including the stored message author', async () => {+ const tab = (await store.create(owner, randomUUID(), 'People and agents')).id+ const operationId = randomUUID()+ const command: Command = { type: 'agent.add', conversationId: 'lead', machineId: 'test-host',+ harnessId: randomUUID(), name: 'Lead', configuration: config, lead: true }+ const added = await run(tab, command, owner, undefined, operationId)+ const agentId = added.result.agentId as string+ const first = await store.read(owner, tab)+ const agent = first.state.agents.find(a => a.id === agentId)!+ expect(agent.displayName).toBeTruthy()+ expect(agent.displayName).not.toBe('Lead')+ expect(await run(tab, command, owner, undefined, operationId)).toEqual(added)+ expect((await store.read(owner, tab)).revision).toBe(first.revision)+ await run(tab, message('The plan is ready.'), host, agentId)+ await run(tab, { type: 'agent.remove', agentId })+ const rows = (await store.messages(owner, tab, 'lead', {})).messages+ expect(rows.find(row => row.text === 'The plan is ready.')!.author)+ .toMatchObject({ id: agentId, name: 'Lead', displayName: agent.displayName })+ expect((await store.read(owner, tab)).state.agents).toEqual([])+ })+})+describe('deleting abandoned swarm projects', () => {it('deletes the project through the API, fences stale requests, and replays only the deletion receipt', async () => {const { tab } = await fixture()@@ -498,6 +521,7 @@ describe('Super Tabs on a real Mongo replica set', () => {it('tells the group once, in plain words, that a claimed delivery is waiting, and only for the claim holder', async () => {const { tab, lead } = await fixture()+ const displayName = (await store.read(owner, tab)).state.agents.find(a => a.id === lead)!.displayName!await run(tab, message('Please start.'))const delivery = (await store.deliveries(host, tab, lead))[0]!await expect(store.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_draft' }))@@ -509,10 +533,12 @@ describe('Super Tabs on a real Mongo replica set', () => {expect(await store.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_idle' })).toEqual({ noticed: false })const rows = (await store.messages(owner, tab, 'lead', {})).messagesexpect(rows).toHaveLength(2)- expect(rows[1]).toMatchObject({ author: { kind: 'agent', id: lead }, recipientIds: [], deliveries: [],- text: expect.stringContaining('A message for Lead is waiting. There is unsent text in Lead\'s input box.') })+ expect(rows[1]).toMatchObject({ author: { kind: 'agent', id: lead, displayName }, recipientIds: [], deliveries: [],+ text: expect.stringContaining(`A message for ${displayName} is waiting. There is unsent text in ${displayName}'s input box.`) })await store.delivery(host, tab, lead, delivery.id, { type: 'ack', claimId: 'claim', receipt: 'done', uncertain: false })expect(await store.delivery(host, tab, lead, delivery.id, { type: 'hold', claimId: 'claim', reason: 'team_waiting_idle' })).toEqual({ noticed: false })+ await run(tab, { type: 'agent.remove', agentId: lead })+ expect((await store.messages(owner, tab, 'lead', {})).messages[1]!.author).toMatchObject({ displayName })})it('a withdrawn host can retire its receipt without regaining conversation access', async () => {@@ -770,6 +796,7 @@ describe('Super Tabs on a real Mongo replica set', () => {const { tab, lead } = await fixture()const worker = (await run(tab, { type: 'agent.add', conversationId: 'lead', machineId: 'test-host', harnessId: randomUUID(),name: 'Builder', configuration: config, lead: false })).result.agentId as string+ const displayName = (await store.read(owner, tab)).state.agents.find(a => a.id === worker)!.displayName!await run(tab, { type: 'work.define', conversationId: 'lead', brief: 'Build it.', checks: [{ description: 'Test passes.', independent: false }] })const assignmentId = (await run(tab, { type: 'work.assign', conversationId: 'lead', agentId: worker })).result.assignmentId as stringconst before = (await store.deliveries(host, tab, lead)).length@@ -777,10 +804,13 @@ describe('Super Tabs on a real Mongo replica set', () => {await store.stopped(host, tab, assignmentId, 'native-stop-receipt')const notices = (await store.messages(owner, tab, 'lead', {})).messages.filter(m => m.text.startsWith('Stopped'))expect(notices).toHaveLength(1)- expect(notices[0]).toMatchObject({ author: { kind: 'agent', id: worker, name: 'Builder' },+ expect(notices[0]).toMatchObject({ author: { kind: 'agent', id: worker, name: 'Builder', displayName },text: 'Stopped\n\nThe execution host confirmed that this harness stopped. If this work should continue, assign a new attempt.' })expect(await store.deliveries(host, tab, lead)).toHaveLength(before + 1)expect((await store.read(owner, tab)).state.conversations[0]!.lastMessageSequence).toBe(notices[0]!.sequence)+ await run(tab, { type: 'agent.remove', agentId: worker })+ expect((await store.messages(owner, tab, 'lead', {})).messages.find(m => m.id === notices[0]!.id)!.author)+ .toMatchObject({ displayName })})it('rejects unshared hosts and spoofed agent identities through the HTTP API', async () => {diff --git a/backend/src/superTabs/agentNames.test.ts b/backend/src/superTabs/agentNames.test.tsnew file mode 100644index 000000000..14df168a4--- /dev/null+++ b/backend/src/superTabs/agentNames.test.ts@@ -0,0 +1,72 @@+import { describe, expect, it } from 'vitest'+import { agentDisplayName, assignAgentDisplayNames, type NamedAgent } from './agentNames.js'+import { applyCommand } from './commands.js'+import { author, createSuperTab, visibleState, type Actor, type Agent } from './model.js'++const owner: Actor = { kind: 'person', userId: 'owner', email: '[email protected]' }+const peer: Actor = { kind: 'person', userId: 'peer', email: '[email protected]' }+const configuration = { engine: 'codex', model: null, effort: null, contextWindow: null, engineVersion: null }+function legacyState() {+ const state = createSuperTab('team', 'Team', { id: 'owner', email: '[email protected]' }, 'test', 'public')+ state.people.push({ id: 'peer', email: '[email protected]', role: 'collaborator', generation: 'first' })+ state.projects!.push({ ...state.projects![0]!, id: 'private', name: 'Private', visibility: 'private', leadConversationId: 'private-lead' })+ state.conversations.push({ ...state.conversations[0]!, id: 'private-lead', projectId: 'private', agentIds: [] })+ state.agents = Array.from({ length: 40 }, (_, i): Agent => ({+ id: `agent-${i}`, name: i % 2 ? 'Builder' : 'Lead', projectId: i % 2 ? 'private' : 'lead',+ machineId: 'machine', harnessId: `native-${i}`, machineOwnerId: 'host', contributorId: 'owner',+ membershipGeneration: 'team', configuration,+ }))+ return state+}++describe('individual agent names', () => {+ it('gives default roles distinct names while preserving chosen and persisted identities', () => {+ const agents: NamedAgent[] = [+ { id: 'custom', name: 'Multiply' },+ { id: 'existing', name: 'Lead', displayName: 'Atlas' },+ ...Array.from({ length: 80 }, (_, i) => ({ id: `a-${i}`, name: i % 2 ? 'Builder' : 'Lead' })),+ { id: 'clock', name: 'claude-2026-10-21-12-34' },+ ]+ const reversed = structuredClone(agents).reverse()+ assignAgentDisplayNames(agents)+ assignAgentDisplayNames(reversed)+ expect(new Set(agents.map(a => a.displayName)).size).toBe(agents.length)+ expect(agents[0]!.displayName).toBe('Multiply')+ expect(agents[1]!.displayName).toBe('Atlas')+ expect(agents.at(-1)!.displayName).not.toBe(agents.at(-1)!.name)+ expect(Object.fromEntries(agents.map(a => [a.id, a.displayName])))+ .toEqual(Object.fromEntries(reversed.map(a => [a.id, a.displayName])))+ const before = structuredClone(agents)+ agents.splice(2, 1)+ agents.push({ id: 'new', name: 'Lead' })+ assignAgentDisplayNames(agents)+ for (const a of agents.filter(a => a.id !== 'new')) {+ expect(a.displayName).toBe(before.find(b => b.id === a.id)!.displayName)+ }+ expect(agents.map(a => a.name)).toContain('Lead')+ })++ it('resolves legacy identities before filtering private projects without mutating reads', () => {+ const state = legacyState(), original = structuredClone(state)+ const all = visibleState(state, owner), publicOnly = visibleState(state, peer)+ expect(publicOnly.agents).toHaveLength(20)+ for (const a of publicOnly.agents) {+ expect(a.displayName).toBe(all.agents.find(b => b.id === a.id)!.displayName)+ expect(agentDisplayName(state.agents, a.id)).toBe(a.displayName)+ }+ expect(state).toEqual(original)+ expect(agentDisplayName(state.agents, 'removed')).toBeUndefined()+ })++ it('persists the displayed names on an authorized command and keeps routing identities unchanged', () => {+ const state = legacyState(), before = visibleState(state, owner)+ const command = { type: 'tab.rename' as const, name: 'Team renamed' }+ const context = { operationId: 'rename', now: 1000 }+ const result = applyCommand(state, owner, command, context)+ expect(result.state.agents).toEqual(before.agents)+ expect(applyCommand(state, owner, command, context)).toEqual(result)+ expect(state.agents.every(a => a.displayName === undefined)).toBe(true)+ const sender = author(result.state, { kind: 'agent', agentId: 'agent-0', machineOwnerId: 'host' })+ expect(sender).toMatchObject({ id: 'agent-0', name: 'Lead', displayName: before.agents[0]!.displayName })+ })+})diff --git a/backend/src/superTabs/agentNames.ts b/backend/src/superTabs/agentNames.tsnew file mode 100644index 000000000..587ce5582--- /dev/null+++ b/backend/src/superTabs/agentNames.ts@@ -0,0 +1,51 @@+/** Member identities are separate from native session names and routing roles.+ * Allocate on the full state, before filtering private projects. Once assigned,+ * a name stays with that agent when its role, project or engine changes. */+export interface NamedAgent { id: string; name: string; displayName?: string }++const names = [+ 'Atlas', 'Nova', 'Orion', 'Echo', 'Sage', 'Finn', 'Arlo', 'Iris',+ 'Rowan', 'Mira', 'Theo', 'Luna', 'Jules', 'Remy', 'Avery', 'Kai',+ 'Robin', 'Juno', 'Reed', 'Wren', 'Aster', 'Cleo', 'Ellis', 'Faye',+ 'Hugo', 'Indigo', 'Jasper', 'Lark', 'Milo', 'Nico', 'Quinn', 'River',+]+const defaults = /^(?:lead|builder|agent|new agent|product manager|engineer|pm|dev)(?:[\s#-]+\d+)?$/i+const automatic = /^(?:claude|codex|pi|agent)-\d{4}-\d{2}-\d{2}(?:[-T].*)?$/i++function chosen(agent: NamedAgent): string | undefined {+ if (agent.displayName?.trim()) return agent.displayName+ const name = agent.name.trim()+ return name && !defaults.test(name) && !automatic.test(name) ? name : undefined+}++export function assignAgentDisplayNames(agents: NamedAgent[]): void {+ const used = new Set(agents.map(chosen).filter((name): name is string => !!name).map(name => name.toLowerCase()))+ for (const agent of [...agents].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0)) {+ const existing = chosen(agent)+ if (existing) {+ agent.displayName = existing+ continue+ }+ let hash = 0+ for (const letter of agent.id) hash = (hash * 31 + letter.charCodeAt(0)) & 0x7fffffff+ for (let attempt = 0; ; attempt++) {+ const round = Math.floor(attempt / names.length)+ const candidate = `${names[(hash + attempt) % names.length]}${round ? ` ${round + 1}` : ''}`+ if (used.has(candidate.toLowerCase())) continue+ agent.displayName = candidate+ used.add(candidate.toLowerCase())+ break+ }+ }+}++/** Read-only callers (native observations and legacy snapshots) get the same+ * names as the next authorized transaction, without mutating stored state. */+export function agentDisplayName(agents: NamedAgent[], id: string): string | undefined {+ const member = agents.find(agent => agent.id === id)+ if (!member) return undefined+ if (member.displayName) return member.displayName+ const named = agents.map(agent => ({ ...agent }))+ assignAgentDisplayNames(named)+ return named.find(agent => agent.id === id)!.displayName+}diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.tsindex b2753c9f8..872e16885 100644--- a/backend/src/superTabs/commands.ts+++ b/backend/src/superTabs/commands.ts@@ -1,4 +1,5 @@import { admitMachineStart, machineContribution } from './machines.js'+import { assignAgentDisplayNames } from './agentNames.js'import { z } from 'zod'import {activeWork, actorKey, agent, author, conversation, fail, person, stableId, numberConversations, nextConversationNumber,@@ -155,6 +156,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Commaconst command = commandSchema.parse(input)const state = structuredClone(original)numberConversations(state)+ assignAgentDisplayNames(state.agents)const result: Record<string, unknown> = {}const effects: CommandEffects = { state, messages: [], cancelledAgents: [], previousAttempts: [], routeDecisions: [], result }const operationId = stableId(state.id, actorKey(actor), context.operationId)@@ -719,6 +721,7 @@ export function applyCommand(original: SuperTabState, actor: Actor, input: Comma}}// MongoDB limits a document to 16 MiB. Leave room for indexes and metadata, and refuse before losing state.+ assignAgentDisplayNames(state.agents)if (Buffer.byteLength(JSON.stringify(state)) > 8 * 1024 * 1024) fail('TAB_TOO_LARGE', 'This Super Tab has reached its metadata limit.', 413)return effects}diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex 149e45ec6..1a453a574 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -1,5 +1,6 @@import { createHash } from 'node:crypto'import type { RouteDecisionEffect } from './routeRecord.js'+import { agentDisplayName, assignAgentDisplayNames } from './agentNames.js'import { canReadAgent, canReadProject, groupProject, projectsOf, type ProjectVisibility, type SwarmProject } from './projects.js'export type Role = 'owner' | 'collaborator' | 'viewer'@@ -21,6 +22,8 @@ export interface Agent {membershipGeneration: stringhostGrant?: string | nullname: string+ /** A stable member name; native session and routing names remain in `name`. */+ displayName?: stringconfiguration: AgentConfiguration/** The last configuration operation fences delayed observations, including re-contribution. */configurationVersion?: string@@ -121,7 +124,7 @@ export interface SuperTabState {export type Actor =| { kind: 'person'; userId: string; email: string }| { kind: 'agent'; agentId: string; machineOwnerId: string }-export interface Author { kind: 'person' | 'agent'; id: string; name: string; membershipGeneration: string }+export interface Author { kind: 'person' | 'agent'; id: string; name: string; displayName?: string; membershipGeneration: string }export interface MessageDraft {id: stringconversationId: string@@ -188,7 +191,7 @@ export function author(state: SuperTabState, actor: Actor, write = false): Authoconst member = agent(state, actor.agentId)if (member.machineOwnerId !== actor.machineOwnerId) fail('FORBIDDEN', 'Only the execution host can speak as this agent.', 403)if (write && person(state, member.contributorId).role === 'viewer') fail('READ_ONLY', 'This contribution is read-only.', 403)- return { kind: 'agent', id: member.id, name: member.name, membershipGeneration: member.membershipGeneration }+ return { kind: 'agent', id: member.id, name: member.name, displayName: agentDisplayName(state.agents, member.id), membershipGeneration: member.membershipGeneration }}export function createSuperTab(id: string, name: string, owner: { id: string; email: string }, environment: string, visibility?: ProjectVisibility): SuperTabState {@@ -206,6 +209,7 @@ export function createSuperTab(id: string, name: string, owner: { id: string; emexport function visibleState(state: SuperTabState, actor: Actor): SuperTabState {author(state, actor)const visible = structuredClone(state)+ assignAgentDisplayNames(visible.agents)delete visible.sharingnumberConversations(visible)delete visible.retiredConversationNumberdiff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.tsindex 4ba734e3d..97b20cebe 100644--- a/backend/src/superTabs/store.ts+++ b/backend/src/superTabs/store.ts@@ -838,11 +838,12 @@ export class SuperTabStore {const id = stableId('hold-notice', delivery.tabId, delivery.id)if (delivery.status !== 'claimed' || await tx.superTabMessage.findUnique({ where: { id } })) return { noticed: false }const group = conversation(state, delivery.conversationId), waiting = agent(state, delivery.agentId)+ const sender = author(state, { kind: 'agent', agentId: waiting.id, machineOwnerId: waiting.machineOwnerId })const revision = row.revision + 1group.lastMessageSequence = revisionawait tx.superTab.update({ where: { id: row.id, revision: row.revision }, data: { revision, state: json(state) } })- await this.writeMessages(tx, row.id, state, [{ id, conversationId: group.id, replyTo: null, recipients: [], text: holdNoticeText(waiting.name, reason),- author: { kind: 'agent', id: waiting.id, name: waiting.name, membershipGeneration: waiting.membershipGeneration } }], revision)+ await this.writeMessages(tx, row.id, state, [{ id, conversationId: group.id, replyTo: null, recipients: [],+ text: holdNoticeText(sender.displayName ?? sender.name, reason), author: sender }], revision)return { noticed: true }}@@ -877,7 +878,7 @@ export class SuperTabStore {if (worker) {const lead = group.leadId && group.leadId !== worker.id && group.agentIds.includes(group.leadId) ? group.leadId : nullnotices.push({ id: stableId('stop-notice', tabId, assignmentId), conversationId: group.id,- author: { kind: 'agent', id: worker.id, name: worker.name, membershipGeneration: worker.membershipGeneration },+ author: author(state, { kind: 'agent', agentId: worker.id, machineOwnerId: worker.machineOwnerId }),text: `Stopped\n\n${assignment.result} If this work should continue, assign a new attempt.`, replyTo: null, recipients: lead ? [lead] : [] })group.lastMessageSequence = revision}diff --git a/desktop/integration_test/super_tab_native_test.dart b/desktop/integration_test/super_tab_native_test.dartindex 7b5ca5dff..c5d5fdc5c 100644--- a/desktop/integration_test/super_tab_native_test.dart+++ b/desktop/integration_test/super_tab_native_test.dart@@ -68,6 +68,9 @@ void main() {f.app.machineStates['m']!.agents = [Agent.fromJson(f.connection.native!)];final server = f.connection.server;server.state['name'] = 'Company';+ for (final agent in server.state['agents'] as List) {+ agent['displayName'] = agent['id'] == 'lead-agent' ? 'Atlas' : 'Sage';+ }server.state['projects'] = [projectFixture('lead', 'Lamp OS', 'lead'),projectFixture(@@ -145,6 +148,7 @@ void main() {'kind': 'agent','id': 'lead-agent','name': 'Lead',+ 'displayName': 'Atlas',};server.append('Keep changes on the device and sync when the connection returns.',@@ -202,6 +206,19 @@ void main() {expect(find.byTooltip('Invite people'), findsOneWidget);expect(find.text('CHATS'), findsNothing);expect(find.text('New group'), findsNothing);+ expect(find.text('New project'), findsOneWidget);+ await tester.tap(+ find.byKey(const ValueKey('super-project-expand-design')),+ );+ await tester.pumpAndSettle();+ expect(c!.selectedId, 'design-lead');+ expect(c.expandedProjects.contains('design'), isFalse);+ await tester.tap(find.byKey(const ValueKey('super-group-lead')));+ await tester.pumpAndSettle();+ expect(c.selectedId, 'lead');+ await tester.tap(find.byKey(const ValueKey('super-your-devices')));+ await tester.pumpAndSettle();+ expect(f.app.takeMachinesRequest(), (devicePub: null, phones: false));final folder = Platform.environment['SUPER_TAB_NATIVE_SHOTS'];Future<void> shot(String name) async {if (folder == null) return;@@ -237,7 +254,7 @@ void main() {await tester.tap(find.text('Cancel'));await tester.pumpAndSettle();await tester.tap(- find.byKey(ValueKey('super-member-${c!.snapshot!.agents.single.id}')),+ find.byKey(ValueKey('super-member-${c.snapshot!.agents.single.id}')),);debugPrint('Swarm fixture: terminal requested');for (var i = 0; i < 30 && f.app.activeSwarm.panes.isEmpty; i++) {@@ -274,7 +291,7 @@ void main() {tester.widget<Text>(find.byKey(const ValueKey('terminal-pane-title'))).data,- 'Lead',+ 'Atlas',);var reviews = 0;f.app.reviewSessionClose = (_, {tabName, canStop}) async {diff --git a/desktop/lib/super_tabs/identity.dart b/desktop/lib/super_tabs/identity.dartindex 074c167f9..191a2195c 100644--- a/desktop/lib/super_tabs/identity.dart+++ b/desktop/lib/super_tabs/identity.dart@@ -54,3 +54,28 @@ class SuperTabAvatar extends StatelessWidget {}String superTabPersonName(String email) => email.split('@').first;++/// A Bonjour hostname is useful in details, but noisy in a member list.+/// Only normalize generated hostnames; names chosen by a person stay intact.+String superTabMachineName(String name) {+ if (!name.toLowerCase().endsWith('.local')) return name;+ final host = name.substring(0, name.length - '.local'.length);+ for (final model in const [+ ('mac-?book-?pro', 'MacBook Pro'),+ ('mac-?book-?air', 'MacBook Air'),+ ('mac-?book', 'MacBook'),+ ('mac-?mini', 'Mac mini'),+ ('mac-?studio', 'Mac Studio'),+ ('mac-?pro', 'Mac Pro'),+ ('i-?mac-?pro', 'iMac Pro'),+ ('i-?mac', 'iMac'),+ ]) {+ if (RegExp(+ '(?:^|-)${model.$1}(?:-?[0-9]+(?:,[0-9]+)?)?\$',+ caseSensitive: false,+ ).hasMatch(host)) {+ return model.$2;+ }+ }+ return host;+}diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex 315bc4c27..65614dd75 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -476,7 +476,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {const SizedBox(height: 16),if (own.isNotEmpty)Text(- 'Let the lead run agents here using this machine’s signed-in accounts.',+ 'Let the product manager run agents here using this machine’s signed-in accounts.',style: DesktopChrome.text(),)else ...[@@ -668,13 +668,19 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {);String available(double? used) =>resourcePercent(used == null ? null : (100 - used).clamp(0, 100));- String compactBytes(num? bytes) =>- resourceBytes(bytes?.toDouble())- .replaceAll(' GB', 'G')- .replaceAll(' TB', 'T')- .replaceAll(' MB', 'M');+ final metrics = [+ if (value?.cpuPercent != null) 'CPU ${available(value!.cpuPercent)}',+ if (value?.busiestGpu?.utilizationPercent != null)+ 'GPU ${available(value!.busiestGpu!.utilizationPercent)}',+ if (memoryFree != null) 'RAM ${resourceBytes(memoryFree.toDouble())}',+ if (diskFree != null) 'SSD ${resourceBytes(diskFree)}',+ ];+ final visibleAccounts = usage.accounts+ .where((a) => a.figure != '—')+ .toList();return Padding(- padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),+ key: ValueKey('super-machine-row-$id'),+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [@@ -752,71 +758,72 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {),child: Tooltip(message: [name, if (person != null) person.email].join('\n'),- child: Row(- children: [- Flexible(- flex: 3,- child: Text(- name,+ child: ConstrainedBox(+ constraints: const BoxConstraints(minHeight: 32),+ child: Wrap(+ spacing: 8,+ runSpacing: 2,+ crossAxisAlignment: WrapCrossAlignment.center,+ children: [+ Text(+ superTabMachineName(name),maxLines: 1,overflow: TextOverflow.ellipsis,- style: DesktopChrome.control(medium: true),+ style: DesktopChrome.control(+ medium: true,+ color: online ? null : DesktopChrome.muted,+ ),),- ),- if (person != null) ...[- const SizedBox(width: 8),- Flexible(- child: ConstrainedBox(- constraints: const BoxConstraints(maxWidth: 64),- child: Text(- superTabPersonName(person.email),- maxLines: 1,- overflow: TextOverflow.ellipsis,+ Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (person != null) ...[+ Flexible(+ child: Text(+ superTabPersonName(person.email),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(),+ ),+ ),+ const SizedBox(width: 8),+ ],+ Text(+ paused+ ? 'Paused'+ : !online+ ? 'Offline'+ : '$running ${running == 1 ? 'agent' : 'agents'}',style: DesktopChrome.metadata(),),- ),+ ],),],- const SizedBox(width: 8),- Text(- paused- ? 'Paused'- : !online- ? 'Offline'- : '$running ${running == 1 ? 'agent' : 'agents'}',- style: DesktopChrome.metadata(),- ),- ],+ ),),),),- const SizedBox(height: 4),- Tooltip(- message:- 'Available capacity\nCPU and GPU: idle percentage at the latest reading\nRAM: ${resourceBytes(memoryFree?.toDouble())} free of ${resourceBytes(value?.memoryTotalBytes)}\nSSD: ${resourceBytes(diskFree)} free of ${resourceBytes(diskTotal)}',- child: Wrap(- spacing: 8,- runSpacing: 4,- children: [- for (final metric in [- 'CPU ${available(value?.cpuPercent)}',- 'GPU ${available(value?.busiestGpu?.utilizationPercent)}',- 'RAM ${compactBytes(memoryFree)}',- 'SSD ${compactBytes(diskFree)}',- ])- Text(metric, style: DesktopChrome.metadata()),- ],+ if (metrics.isNotEmpty) ...[+ Tooltip(+ message:+ 'Available capacity\nCPU and GPU: idle percentage at the latest reading\nRAM: ${resourceBytes(memoryFree?.toDouble())} free of ${resourceBytes(value?.memoryTotalBytes)}\nSSD: ${resourceBytes(diskFree)} free of ${resourceBytes(diskTotal)}',+ child: Wrap(+ spacing: 8,+ runSpacing: 4,+ children: [+ for (final metric in metrics)+ Text(metric, style: DesktopChrome.metadata()),+ ],+ ),),- ),- const SizedBox(height: 4),- if (usage.accounts.isEmpty)- Text('—', style: DesktopChrome.control())- else+ ],+ if (visibleAccounts.isNotEmpty) ...[+ const SizedBox(height: 4),Wrap(spacing: 16,runSpacing: 8,children: [- for (final account in usage.accounts)+ for (final account in visibleAccounts)Tooltip(message: account.detail,child: Row(@@ -838,6 +845,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {),],),+ ],],),);@@ -857,7 +865,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {Padding(padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),child: Text(- 'Add a machine for the lead to use.',+ 'Add a machine for the product manager to use.',style: DesktopChrome.metadata(),),)diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dartindex 70fe5e5fb..7ffee58ea 100644--- a/desktop/lib/super_tabs/model.dart+++ b/desktop/lib/super_tabs/model.dart@@ -36,11 +36,13 @@ class SuperTabAgent {: id = _text(row, 'id'),projectId = row['projectId'] as String? ?? 'lead',name = _text(row, 'name'),+ displayName = row['displayName'] as String?,machineId = _text(row, 'machineId'),harnessId = _text(row, 'harnessId'),contributorId = _text(row, 'contributorId'),configuration = Map.unmodifiable(superTabMap(row['configuration']));final String id, projectId, name, machineId, harnessId, contributorId;+ final String? displayName;final Map<String, dynamic> configuration;String get engine => configuration['engine'] as String? ?? '';}@@ -166,12 +168,9 @@ class SuperTabSnapshot {);String agentName(String id, {String fallback = 'Agent'}) =>- isLead(id) ? 'Lead' : agent(id)?.name ?? fallback;+ agent(id)?.displayName ?? agent(id)?.name ?? fallback;- String authorName(SuperTabMessage message) =>- message.fromAgent && isLead(message.authorId)- ? 'Lead'- : message.authorName;+ String authorName(SuperTabMessage message) => message.authorName;}class SuperTabRouteChoice {@@ -290,7 +289,12 @@ class SuperTabMessage {final DateTime? createdAt;final List<SuperTabAttachment> attachments;final List<Map<String, dynamic>> deliveries;- String get authorName => author['name'] as String? ?? 'Unknown';+ // History and message grouping use the identity recorded at send time, even+ // after removal. Legacy messages retain their original author label.+ String get authorName =>+ (fromAgent ? author['displayName'] as String? : null) ??+ author['name'] as String? ??+ 'Unknown';String get authorId => author['id'] as String? ?? '';bool get fromAgent => author['kind'] == 'agent';bool get fromTerminal => source['kind'] == 'native';diff --git a/desktop/lib/super_tabs/project_options.dart b/desktop/lib/super_tabs/project_options.dartindex 7026c4a18..ca3854b96 100644--- a/desktop/lib/super_tabs/project_options.dart+++ b/desktop/lib/super_tabs/project_options.dart@@ -104,7 +104,7 @@ Future<void> showProjectAction(],if (action == 'cadence') ...[Text(- 'The lead consolidates new workgroup reports while work is active.',+ 'The product manager consolidates new workgroup reports while work is active.',style: DesktopChrome.text(),),const SizedBox(height: 12),@@ -136,7 +136,7 @@ Future<void> showProjectAction(),const SizedBox(height: 12),Text(- group?.brief.isNotEmpty == true ? group!.brief : 'Discuss the project with its lead to define the work.',+ group?.brief.isNotEmpty == true ? group!.brief : 'Discuss the project with its product manager to define the work.',style: DesktopChrome.text(),),const SizedBox(height: 16),@@ -147,7 +147,10 @@ Future<void> showProjectAction('Not set',),const SizedBox(height: 16),- Text('Lead', style: DesktopChrome.metadata()),+ Text(+ 'Product Manager',+ style: DesktopChrome.metadata(),+ ),Text(group?.leadId == null? 'Starting…'diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex c4c42d4e5..831047d9f 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -13,11 +13,17 @@ class ProjectSidebar extends StatelessWidget {required this.onSelect,required this.needsHuman,this.onNewProject,+ this.onYourDevices,});final SuperTabController controller;final ValueChanged<String> onSelect;final int Function(SuperTabConversation group) needsHuman;final VoidCallback? onNewProject;+ final VoidCallback? onYourDevices;++ // Actions, project names and workgroup names share one text column.+ static const _iconColumn = 32.0;+ static const _textGap = 4.0;Widget _row(SuperTabConversation group, {SuperTabProject? project}) {final selected = controller.selectedId == group.id;@@ -28,10 +34,11 @@ class ProjectSidebar extends StatelessWidget {);final waiting = groups.any((g) => needsHuman(g) > 0);final unread = groups.any(controller.unread);- final expanded = controller.expandedProjects.contains(project?.id);final hasChildren =project != null &&groups.any((g) => g.id != project.leadConversationId);+ final expanded =+ hasChildren && controller.expandedProjects.contains(project.id);return Padding(padding: const EdgeInsets.only(bottom: 2),child: Material(@@ -46,7 +53,7 @@ class ProjectSidebar extends StatelessWidget {borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),child: Row(children: [- if (project != null && hasChildren)+ if (project != null)IconButton(key: ValueKey('super-project-expand-${project.id}'),icon: Icon(@@ -64,12 +71,15 @@ class ProjectSidebar extends StatelessWidget {overlayColor: WidgetStatePropertyAll(Colors.transparent),backgroundColor: WidgetStatePropertyAll(Colors.transparent),),- tooltip:- '${expanded ? 'Collapse' : 'Expand'} ${project.name}',- onPressed: () => controller.toggleProject(project.id),+ tooltip: hasChildren+ ? '${expanded ? 'Collapse' : 'Expand'} ${project.name}'+ : 'Chat with ${project.name} product manager',+ onPressed: () => hasChildren+ ? controller.toggleProject(project.id)+ : onSelect(group.id),)- else if (project != null)- const SizedBox(width: 32),+ else+ const SizedBox(width: _iconColumn),Expanded(child: Semantics(label: project?.isPrivate == true ? 'Private project' : null,@@ -79,35 +89,33 @@ class ProjectSidebar extends StatelessWidget {child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 36),child: Padding(- padding: EdgeInsets.fromLTRB(- project == null ? 44 : 4,- 8,- 12,- 8,- ),+ padding: const EdgeInsets.fromLTRB(_textGap, 8, 12, 8),child: Row(children: [- if (project?.isPrivate == true) ...[- Icon(- AppIcons.lock,- size: 14,- color: DesktopChrome.muted,- ),- const SizedBox(width: 6),- ],Expanded(child: Text(project?.name ?? group.label,maxLines: 1,overflow: TextOverflow.ellipsis,style: DesktopChrome.control(- medium: project != null || unread || selected,+ medium: unread || selected,color: selected || unread || project != null? DesktopChrome.foreground: DesktopChrome.muted,),),),+ if (project?.isPrivate == true) ...[+ const SizedBox(width: 8),+ Tooltip(+ message: 'Private project',+ child: Icon(+ AppIcons.lock,+ size: 14,+ color: DesktopChrome.muted,+ ),+ ),+ ],if (waiting) ...[const SizedBox(width: 8),Tooltip(@@ -148,6 +156,47 @@ class ProjectSidebar extends StatelessWidget {);}+ Widget _action({+ required String key,+ required IconData icon,+ required String label,+ required VoidCallback? onPressed,+ }) => TextButton(+ key: ValueKey(key),+ onPressed: onPressed,+ style:+ TextButton.styleFrom(+ foregroundColor: DesktopChrome.foreground,+ backgroundColor: Colors.transparent,+ disabledBackgroundColor: Colors.transparent,+ minimumSize: const Size(0, 36),+ padding: const EdgeInsets.symmetric(vertical: 8),+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,+ alignment: Alignment.centerLeft,+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),+ ),+ textStyle: DesktopChrome.control(),+ ).copyWith(+ side: WidgetStateProperty.resolveWith(+ (states) => states.contains(WidgetState.focused)+ ? BorderSide(color: DesktopChrome.accent, width: 1.5)+ : BorderSide.none,+ ),+ ),+ child: Row(+ children: [+ SizedBox(+ width: _iconColumn,+ child: Icon(icon, size: AppIcons.inlineSize),+ ),+ const SizedBox(width: _textGap),+ Expanded(child: Text(label)),+ const SizedBox(width: 12),+ ],+ ),+ );+@overrideWidget build(BuildContext context) {final snapshot = controller.snapshot;@@ -157,32 +206,25 @@ class ProjectSidebar extends StatelessWidget {children: [Padding(padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),- child: OutlinedButton(- key: const ValueKey('super-new-project'),- onPressed: controller.canWrite ? onNewProject : null,- style: OutlinedButton.styleFrom(- foregroundColor: DesktopChrome.muted,- backgroundColor: Colors.transparent,- disabledBackgroundColor: Colors.transparent,- alignment: Alignment.centerLeft,- padding: const EdgeInsets.symmetric(- horizontal: 12,- vertical: 10,+ child: Column(+ children: [+ _action(+ key: 'super-new-project',+ icon: AppIcons.plus,+ label: 'New project',+ onPressed: controller.canWrite ? onNewProject : null,),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),+ const SizedBox(height: 2),+ _action(+ key: 'super-your-devices',+ icon: AppIcons.circle,+ label: 'Your devices',+ onPressed: onYourDevices,),- textStyle: DesktopChrome.control(),- ),- child: const Row(- children: [- Icon(AppIcons.plus, size: 16),- SizedBox(width: 8),- Flexible(child: Text('New Project')),- ],- ),+ ],),),+ const SizedBox(height: 12),Expanded(child: ListView(padding: const EdgeInsets.all(8),diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dartindex a405f1b61..35b727f33 100644--- a/desktop/lib/super_tabs/roster.dart+++ b/desktop/lib/super_tabs/roster.dart@@ -41,6 +41,9 @@ class SuperTabRoster extends StatefulWidget {class _SuperTabRosterState extends State<SuperTabRoster> {SuperTabController get c => widget.controller;+ String _role(SuperTabAgent agent) =>+ c.snapshot!.isLead(agent.id) ? 'Product Manager' : 'Engineer';+HarnessActivity _activity(SuperTabAgent agent) {final app = widget.app;final native = app == null@@ -77,7 +80,13 @@ class _SuperTabRosterState extends State<SuperTabRoster> {mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,children: [+ Text(_role(agent)),Text(engineIdentity(agent.engine).label),+ if (agent.name != c.snapshot!.agentName(agent.id))+ Padding(+ padding: const EdgeInsets.only(top: 8),+ child: Text('Harness: ${agent.name}'),+ ),for (final field in [('Model', 'model'),('Effort', 'effort'),@@ -143,23 +152,57 @@ class _SuperTabRosterState extends State<SuperTabRoster> {child: ListTile(key: ValueKey('super-member-${agent.id}'),dense: true,- contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 1),+ minTileHeight: 48,+ minVerticalPadding: 6,+ contentPadding: const EdgeInsets.symmetric(horizontal: 16),title: Row(children: [Tooltip(message: engineIdentity(agent.engine).label,- child: EngineMark(engine: agent.engine, size: 20),+ child: SuperTabAvatar(+ identity: 'agent:${agent.id}',+ name: name,+ size: 24,+ ),),- const SizedBox(width: 10),+ const SizedBox(width: 8),Expanded(- child: Tooltip(- message: name,- child: Text(- name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.control(medium: true),- ),+ child: Row(+ children: [+ Flexible(+ child: Tooltip(+ message: name,+ child: Text(+ name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.control(),+ ),+ ),+ ),+ const SizedBox(width: 6),+ Tooltip(+ message: _role(agent),+ child: Semantics(+ label: _role(agent),+ excludeSemantics: true,+ child: Container(+ padding: const EdgeInsets.symmetric(+ horizontal: 5,+ vertical: 1,+ ),+ decoration: BoxDecoration(+ color: grid.AppSurface.hoverFill,+ borderRadius: BorderRadius.circular(4),+ ),+ child: Text(+ c.snapshot!.isLead(agent.id) ? 'PM' : 'Dev',+ style: DesktopChrome.metadata(),+ ),+ ),+ ),+ ),+ ],),),const SizedBox(width: 8),@@ -176,7 +219,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {subtitle: project == null? null: Padding(- padding: const EdgeInsets.only(left: 30),+ padding: const EdgeInsets.only(left: 32),child: Tooltip(message: project.name,child: Text(@@ -210,11 +253,15 @@ class _SuperTabRosterState extends State<SuperTabRoster> {for (final person in state?.people ?? const <SuperTabPerson>[])ListTile(dense: true,+ minTileHeight: 36,+ minVerticalPadding: 6,+ minLeadingWidth: 24,contentPadding: const EdgeInsets.symmetric(horizontal: 16),- horizontalTitleGap: 10,+ horizontalTitleGap: 8,leading: SuperTabAvatar(identity: 'person:${person.id}',name: superTabPersonName(person.email),+ size: 24,),title: Tooltip(message: person.email,@@ -246,7 +293,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {),),),- const SizedBox(height: 20),+ const SizedBox(height: 16),SuperTabSectionHeading('Agents',onAdd: c.canWrite && c.selected != null@@ -275,7 +322,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {padding: const EdgeInsets.symmetric(vertical: 12),children: [..._members(),- const SizedBox(height: 20),+ const SizedBox(height: 16),SuperTabMachines(controller: c,app: widget.app,diff --git a/desktop/lib/super_tabs/routing_policy_form.dart b/desktop/lib/super_tabs/routing_policy_form.dartindex b014427be..20c5f1c59 100644--- a/desktop/lib/super_tabs/routing_policy_form.dart+++ b/desktop/lib/super_tabs/routing_policy_form.dart@@ -250,7 +250,7 @@ class _RoutingPolicyFormState extends State<RoutingPolicyForm> {_block('notes','Notes for Jev',- 'Anything the Lead should weigh when choosing, in plain words.',+ 'Anything the product manager should weigh when choosing, in plain words.',TextFormField(key: const ValueKey('routing-notes'),initialValue: _value.notes,diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 3e24527a6..3c824f79a 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -610,6 +610,12 @@ class _SuperTabViewState extends State<SuperTabView> {Widget _sidebar() => ProjectSidebar(controller: c,onNewProject: widget.onNewProject,+ onYourDevices: widget.app == null+ ? null+ : () {+ _closeSidebar();+ widget.app!.requestMachines();+ },needsHuman: (group) => _needsHuman(group).length,onSelect: (id) {c.select(id);@@ -1053,8 +1059,8 @@ class _SuperTabViewState extends State<SuperTabView> {? 'Conversation unavailable.': group == null? 'Loading conversation…'- : group.id == 'lead'- ? 'Discuss the plan with your lead.'+ : c.snapshot!.isProjectLead(group.id)+ ? 'Discuss the plan with your product manager.': 'Start the conversation.',style: DesktopChrome.text(color: DesktopChrome.muted),),@@ -1410,7 +1416,9 @@ class _SuperTabViewState extends State<SuperTabView> {hintText: group == null? 'Loading conversation…': c.canWrite- ? 'Message ${group.title}'+ ? c.snapshot!.isProjectLead(group.id)+ ? 'Message Product Manager'+ : 'Message ${group.title}': 'Read-only conversation',border: InputBorder.none,enabledBorder: InputBorder.none,diff --git a/desktop/lib/super_tabs/work_details.dart b/desktop/lib/super_tabs/work_details.dartindex b977ad72c..4e03f009c 100644--- a/desktop/lib/super_tabs/work_details.dart+++ b/desktop/lib/super_tabs/work_details.dart@@ -31,7 +31,7 @@ Future<void> showSuperTabWork(SuperTabMessageText(group!.brief)elseconst Text(- 'The lead hasn’t defined an assignment in this conversation yet.',+ 'The product manager hasn’t defined an assignment in this conversation yet.',),if (assignment != null) ...[const SizedBox(height: 16),diff --git a/desktop/lib/super_tabs/workspace.dart b/desktop/lib/super_tabs/workspace.dartindex eebde9f3c..639a2f968 100644--- a/desktop/lib/super_tabs/workspace.dart+++ b/desktop/lib/super_tabs/workspace.dart@@ -371,7 +371,7 @@ class _SuperTabWorkspaceState extends State<SuperTabWorkspace> {key: ValueKey('super-agent-group-${group.id}'),title: Text(controller.snapshot!.isProjectLead(group.id)- ? '${controller.snapshot!.projectFor(group.id)!.name} lead'+ ? '${controller.snapshot!.projectFor(group.id)!.name} product manager': group.label,),onTap: () => Navigator.pop(context, group.id),@@ -435,7 +435,7 @@ class _SuperTabWorkspaceState extends State<SuperTabWorkspace> {final terminal = SuperPane(machineId: lead?.machineId ?? '',harnessId: lead?.harnessId ?? '',- title: 'Lead',+ title: 'Product Manager',titles: {for (final a in agents)(a.machineId, a.harnessId): controller.snapshot!.agentName(diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dartindex 0c6fe460a..eacb66fe3 100644--- a/desktop/test/super_tab_chat_test.dart+++ b/desktop/test/super_tab_chat_test.dart@@ -49,12 +49,13 @@ void main() {}testWidgets(- 'an existing lead named after a greeting is Lead in messages, replies and participants',+ 'an agent keeps its individual name in messages, replies and participants',(tester) async {final server = ConversationServer();(server.state['agents'] as List).add({'id': 'lead-agent','name': 'hi',+ 'displayName': 'Atlas','machineId': 'm','harnessId': 'native-lead','contributorId': 'owner',@@ -68,11 +69,12 @@ void main() {'kind': 'agent','id': 'lead-agent','name': 'hi',+ 'displayName': 'Atlas',};final c = await show(tester, server);final row = find.byKey(const ValueKey('super-message-message-1'));expect(- find.descendant(of: row, matching: find.text('Lead')),+ find.descendant(of: row, matching: find.text('Atlas')),findsOneWidget,);expect(find.text('hi'), findsNothing);@@ -85,7 +87,7 @@ void main() {await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.keyR);await tester.pump();- expect(find.text('Replying to Lead'), findsOneWidget);+ expect(find.text('Replying to Atlas'), findsOneWidget);final composer = find.byKey(const ValueKey('super-message-composer'));await tester.enterText(composer, 'Let’s discuss the plan.');await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -94,13 +96,13 @@ void main() {await tester.pumpAndSettle();final reply = find.byKey(const ValueKey('super-message-message-2'));expect(- find.descendant(of: reply, matching: find.text('Lead')),+ find.descendant(of: reply, matching: find.text('Atlas')),findsOneWidget,);await tester.tap(find.byTooltip('Members and machines'));await tester.pumpAndSettle();expect(find.text('hi'), findsNothing);- expect(find.text('Lead'), findsWidgets);+ expect(find.text('Atlas'), findsWidgets);expect(find.byKey(const ValueKey('super-member-lead-agent')),findsOneWidget,@@ -130,6 +132,49 @@ void main() {expect(find.text('[email protected]'), findsNothing);});+ testWidgets('a removed agent keeps its recorded individual name', (+ tester,+ ) async {+ final server = ConversationServer()..append('The review is complete.');+ server.messages.last['author'] = {+ 'kind': 'agent',+ 'id': 'removed-agent',+ 'name': 'Builder',+ 'displayName': 'Sage',+ };+ await show(tester, server);+ expect(find.text('Sage'), findsOneWidget);+ expect(find.text('Builder'), findsNothing);+ });++ test('legacy author labels stay the same before and after removal', () {+ final server = ConversationServer()..append('An older message');+ (server.state['agents'] as List).add({+ 'id': 'old-agent',+ 'name': 'Builder',+ 'displayName': 'Sage',+ 'machineId': 'm',+ 'harnessId': 'native',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'codex'},+ });+ server.messages.last['author'] = {+ 'kind': 'agent',+ 'id': 'old-agent',+ 'name': 'Builder',+ };+ final message = SuperTabMessage.fromJson(server.messages.last);+ expect(+ SuperTabSnapshot.fromJson(server.state).authorName(message),+ 'Builder',+ );+ server.state['agents'] = <Object>[];+ expect(+ SuperTabSnapshot.fromJson(server.state).authorName(message),+ 'Builder',+ );+ });+testWidgets('a keyboard reply keeps its quoted context after sending and refreshing',(tester) async {@@ -341,8 +386,9 @@ void main() {final links = <TextSpan>[];for (final text in tester.widgetList<RichText>(find.byType(RichText))) {text.text.visitChildren((span) {- if (span is TextSpan && span.recognizer is TapGestureRecognizer)+ if (span is TextSpan && span.recognizer is TapGestureRecognizer) {links.add(span);+ }return true;});}@@ -413,6 +459,19 @@ void main() {},);+ test('a new display name starts its own message heading', () {+ final server = ConversationServer()+ ..append('Older update')+ ..append('Newer update');+ for (final row in server.messages) {+ row['author'] = {'kind': 'agent', 'id': 'same-agent', 'name': 'Lead'};+ }+ server.messages[1]['author']['displayName'] = 'Atlas';+ final messages = server.messages.map(SuperTabMessage.fromJson).toList();+ expect(messages.map((m) => m.authorName), ['Lead', 'Atlas']);+ expect(SuperTabMessageRow.groupsWith(messages[1], messages[0]), isFalse);+ });+test('reading loaded messages cannot mark an unfetched tail as read',() async {diff --git a/desktop/test/super_tab_composer_layout_test.dart b/desktop/test/super_tab_composer_layout_test.dartindex bcda9b6f7..5b7a7915e 100644--- a/desktop/test/super_tab_composer_layout_test.dart+++ b/desktop/test/super_tab_composer_layout_test.dart@@ -87,7 +87,7 @@ void main() {final editableRect = editor.localToGlobal(Offset.zero) & editor.size;final hint = find.descendant(of: field,- matching: find.text('Message Lead'),+ matching: find.text('Message Product Manager'),);measurements[name] = {'surfaceHeight': rect.height,diff --git a/desktop/test/super_tab_machines_test.dart b/desktop/test/super_tab_machines_test.dartindex 1043c8bca..af7c8fa54 100644--- a/desktop/test/super_tab_machines_test.dart+++ b/desktop/test/super_tab_machines_test.dart@@ -6,11 +6,13 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';import 'package:harness/super_tabs/machines.dart';+import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/model.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/widgets/engine_identity.dart';import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;+import 'support/super_tab_fixture.dart';Future<void> _openAddMachineDialog(WidgetTester tester,@@ -52,6 +54,109 @@ final _picker = find.byKey(const ValueKey('swarm-machine-picker'));Finder _option(String id) => find.byKey(ValueKey('swarm-machine-option-$id'));void main() {+ test(+ 'generated computer names are readable and custom names stay intact',+ () {+ for (final hostname in [+ 'MacBookPro2021.local',+ 'MacBooks-MacBook-Pro-19.local',+ 'MacbookPro.local',+ ]) {+ expect(superTabMachineName(hostname), 'MacBook Pro');+ }+ expect(superTabMachineName('Mac-mini.local'), 'Mac mini');+ expect(superTabMachineName('build-server.local'), 'build-server');+ for (final name in [+ 'Ada’s Mac',+ 'M2',+ 'MacBook Pro lab',+ 'Build server',+ ]) {+ expect(superTabMachineName(name), name);+ }+ },+ );+ testWidgets(+ 'offline machines have one row and only available readings are shown',+ (tester) async {+ await tester.binding.setSurfaceSize(const Size(280, 700));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final server = ConversationServer();+ final now = DateTime.now().millisecondsSinceEpoch;+ server.state['machines'] = [+ for (final live in [true, false])+ {+ 'machineId': live ? 'online' : 'offline',+ 'name': live ? 'Studio Mac' : 'M2',+ 'contributorId': 'owner',+ 'observation': {+ 'receivedAt': now - (live ? 0 : 60000),+ 'resources': {+ 'cpuPercent': 0,+ 'memoryTotalBytes': 32000000000,+ 'memoryUsedBytes': 32000000000,+ 'diskTotalBytes': 1000000000000,+ 'diskFreeBytes': 141000000000,+ },+ 'quotas': [+ {'engine': 'claude', 'known': false, 'windows': []},+ {+ 'engine': 'codex',+ 'known': true,+ 'windows': [+ {'name': '5-hour', 'usedPercent': 0},+ ],+ },+ ],+ },+ },+ ];+ final c = server.controller();+ await c.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: SuperTabMachines(controller: c, onAddAgent: (_) {}),+ ),+ ),+ );+ await tester.pumpAndSettle();+ final offline = find.byKey(const ValueKey('super-machine-row-offline'));+ expect(+ find.descendant(of: offline, matching: find.text('Offline')),+ findsOneWidget,+ );+ expect(+ find.descendant(of: offline, matching: find.byType(EngineMark)),+ findsNothing,+ );+ expect(+ find.descendant(of: offline, matching: find.textContaining('CPU')),+ findsNothing,+ );+ expect(tester.getSize(offline).height, lessThanOrEqualTo(40));+ expect(find.text('CPU 100%'), findsOneWidget);+ expect(find.text('RAM 0 GB'), findsOneWidget);+ expect(find.text('SSD 141 GB'), findsOneWidget);+ expect(find.textContaining('GPU'), findsNothing);+ expect(find.text('—'), findsNothing);+ expect(find.text('100%'), findsOneWidget);+ expect(+ tester.widget<EngineMark>(find.byType(EngineMark)).engine,+ 'codex',+ );+ // The complete identity and actions remain accessible from the compact row.+ await tester.tap(find.byKey(const ValueKey('super-machine-offline')));+ await tester.pumpAndSettle();+ expect(find.widgetWithText(AlertDialog, 'M2'), findsOneWidget);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );+test('shared repository metadata excludes embedded credentials', () {expect(superTabRepositoryUrl('https://[email protected]/example/project'),@@ -499,7 +604,7 @@ void main() {);}- testWidgets('A machine card shows quota for Claude Code and Codex only', (+ testWidgets('A machine card omits unknown subscription allowances', (tester,) async {final f = SuperTabLaunchFixture();@@ -546,7 +651,7 @@ void main() {.widgetList<EngineMark>(find.byType(EngineMark)).map((mark) => mark.engine).toSet(),- {'claude', 'codex'},+ {'claude'},);await tester.pumpWidget(const SizedBox());diff --git a/desktop/test/super_tab_polish_test.dart b/desktop/test/super_tab_polish_test.dartindex 490947a9b..c9fa000d9 100644--- a/desktop/test/super_tab_polish_test.dart+++ b/desktop/test/super_tab_polish_test.dart@@ -30,6 +30,7 @@ void gap(ConversationServer server, {String author = 'lead-agent'}) {'kind': 'agent','id': author,'name': 'Lead',+ 'displayName': author == 'lead-agent' ? 'Atlas' : 'Sage',}..['source'] = {'kind': 'native', 'phase': 'gap'};}@@ -60,6 +61,11 @@ ConversationServer polishFixture() {{'id': pair.$1,'name': pair.$2,+ 'displayName': switch (pair.$1) {+ 'lead-agent' => 'Atlas',+ 'builder' => 'Nova',+ _ => 'Sage',+ },'projectId': 'lead','machineId': 'm','harnessId': pair.$1,@@ -85,6 +91,11 @@ ConversationServer polishFixture() {{...conversationFixture('long-lead', 'Lead'), 'projectId': 'long'},]);server.state['machines'] = [+ {+ 'machineId': 'offline',+ 'name': 'MacBooks-MacBook-Pro-19.local',+ 'contributorId': 'leo',+ },{'machineId': 'm','name': 'M2',@@ -121,13 +132,14 @@ ConversationServer polishFixture() {'kind': 'agent','id': 'lead-agent','name': 'Lead',+ 'displayName': 'Atlas',};}server.append('How is offline editing coming along?');lead(- 'The implementation is ready. Builder is checking reconnects, '- 'and Reviewer is testing restart recovery.',+ 'The implementation is ready. Nova is checking reconnects, '+ 'and Sage is testing restart recovery.',);lead('**Progress**\n- Edits survive a restart.\n- Reconnecting syncs each edit once.\n\n'diff --git a/desktop/test/super_tab_project_delete_test.dart b/desktop/test/super_tab_project_delete_test.dartindex 09b69e627..b73ccc731 100644--- a/desktop/test/super_tab_project_delete_test.dart+++ b/desktop/test/super_tab_project_delete_test.dart@@ -126,7 +126,7 @@ void main() {expect(find.text('Loading conversation…'), findsNothing);expect(composer, findsNothing);expect(find.byTooltip('Project options'), findsNothing);- expect(find.text('New Project'), findsOneWidget);+ expect(find.text('New project'), findsOneWidget);expect(find.byTooltip('Chat'), findsNothing);await finish(tester);},diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dartindex e5d9c89c6..d4178fbc7 100644--- a/desktop/test/super_tab_roster_test.dart+++ b/desktop/test/super_tab_roster_test.dart@@ -9,8 +9,8 @@ import 'package:harness/notify/alert_sounds.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/harness_activity.dart';import 'package:harness/super_tabs/model.dart';+import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/roster.dart';-import 'package:harness/widgets/engine_identity.dart';import 'package:harness/widgets/harness_activity_mark.dart';import 'harness_activity_test.dart' show activityQuestion;@@ -37,6 +37,7 @@ class RosterFixture {'id': 'agent-$i','projectId': i == 2 ? 'os' : 'lead','name': ['Lead', 'Multiply', 'Lead', 'Divide'][i],+ 'displayName': ['Atlas', 'Sage', 'Nova', 'Finn'][i],'machineId': 'm','harnessId': 'a$i','contributorId': 'owner',@@ -146,7 +147,11 @@ void main() {];await f.show(tester);for (var i = 0; i < 4; i++) {- expect(f.inRow(i, find.byType(EngineMark)), findsOneWidget);+ expect(f.inRow(i, find.byType(SuperTabAvatar)), findsOneWidget);+ expect(+ f.inRow(i, find.text(i == 0 || i == 2 ? 'PM' : 'Dev')),+ findsOneWidget,+ );expect(f.inRow(i, find.text(i == 2 ? 'autonomous-os' : 'openharness')),findsOneWidget,@@ -154,9 +159,19 @@ void main() {}expect(find.text('Join Super Tab roster'), findsNothing);expect(find.text('Ready'), findsNothing);- final nameX = tester.getTopLeft(f.inRow(0, find.text('Lead'))).dx;+ final nameX = tester.getTopLeft(f.inRow(0, find.text('Atlas'))).dx;final projectX = tester.getTopLeft(f.inRow(0, find.text('openharness'))).dx;expect(projectX, nameX);+ expect(+ tester.getCenter(f.inRow(0, find.text('Atlas'))).dy,+ lessThan(tester.getCenter(f.inRow(0, find.text('openharness'))).dy),+ );+ expect(tester.getSize(f.row(0)).height, lessThanOrEqualTo(60));+ expect(+ tester.getTopLeft(find.text('owner').first).dx,+ projectX,+ reason: 'People and agent identity use the same text column',+ );f.controller.select('os-lead');await tester.pumpAndSettle();expect(f.inRow(0, find.text('openharness')), findsOneWidget);diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dartnew file mode 100644index 000000000..c9c8709ae--- /dev/null+++ b/desktop/test/super_tab_sidebar_test.dart@@ -0,0 +1,148 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.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/super_tabs/project_sidebar.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/super_tab_fixture.dart';+import 'swarm_state_test.dart' show createApp;++void main() {+ for (final scale in [1.0, 2.0]) {+ testWidgets(+ 'sidebar shares text alignment and preserves lead navigation at ${scale}x',+ (tester) async {+ await tester.binding.setSurfaceSize(const Size(1600, 700));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final app = createApp(connected: true);+ addTearDown(app.dispose);+ final server = ConversationServer();+ server.state['projects'] = [+ projectFixture('lead', 'web-project', 'lead'),+ projectFixture(+ 'empty',+ 'sample-project',+ 'empty-lead',+ visibility: 'private',+ ),+ ];+ (server.state['conversations'] as List)[1]+ ..['projectId'] = 'lead'+ ..['number'] = 12;+ (server.state['conversations'] as List).add({+ ...conversationFixture('empty-lead', 'Lead'),+ 'projectId': 'empty',+ });+ final c = server.controller();+ await c.refresh();+ var created = 0;+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ builder: (context, child) => MediaQuery(+ data: MediaQuery.of(context)+ .copyWith(textScaler: TextScaler.linear(scale)),+ child: child!,+ ),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ app: app,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onNewProject: () => created++,+ machineName: (_) => 'Test Mac',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ final sidebar = find.byType(ProjectSidebar);+ Finder inside(Finder finder) =>+ find.descendant(of: sidebar, matching: finder);+ final expand = find.byKey(const ValueKey('super-project-expand-lead'));+ final empty = find.byKey(const ValueKey('super-project-expand-empty'));+ expect(expand, findsOneWidget);+ expect(empty, findsOneWidget);+ expect(inside(find.byType(OutlinedButton)), findsNothing);+ expect(+ tester+ .widget<TextButton>(+ find.byKey(const ValueKey('super-new-project')),+ )+ .style!+ .side!+ .resolve({}),+ BorderSide.none,+ );++ // Project names always select the lead; disclosure never switches chats.+ await tester.tap(inside(find.text('sample-project')));+ await tester.pumpAndSettle();+ expect(c.selectedId, 'empty-lead');+ await tester.tap(expand);+ await tester.pumpAndSettle();+ expect(c.selectedId, 'empty-lead');+ final work = find.byKey(const ValueKey('super-group-offline'));+ expect(work, findsOneWidget);+ final projectX = tester.getTopLeft(inside(find.text('web-project'))).dx;+ for (final label in [+ 'sample-project',+ '#12 Offline editing',+ 'New project',+ 'Your devices',+ ]) {+ expect(tester.getTopLeft(inside(find.text(label))).dx, projectX);+ }+ final projectRect = tester.getRect(+ find.byKey(const ValueKey('super-group-lead')),+ );+ final workRect = tester.getRect(work);+ expect(workRect.left, projectRect.left);+ expect(workRect.right, projectRect.right);++ await tester.tap(work);+ await tester.pumpAndSettle();+ expect(c.selectedId, 'offline');+ await tester.tap(empty);+ await tester.pumpAndSettle();+ expect(c.selectedId, 'empty-lead');+ expect(c.expandedProjects, isNot(contains('empty')));+ expect(+ find.byTooltip('Chat with sample-project product manager'),+ findsOneWidget,+ );+ expect(+ find.descendant(+ of: empty,+ matching: find.byIcon(AppIcons.chevronRight),+ ),+ findsOneWidget,+ );++ // Both navigation actions retain keyboard activation.+ final newProject = find.byKey(const ValueKey('super-new-project'));+ Focus.of(+ tester.element(+ find.descendant(of: newProject, matching: find.text('New project')),+ ),+ ).requestFocus();+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(created, 1);+ await tester.tap(find.byKey(const ValueKey('super-your-devices')));+ await tester.pumpAndSettle();+ expect(app.machinesRequest, (devicePub: null, phones: false));+ expect(c.selectedId, 'empty-lead');+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );+ }+}diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dartindex a3eb1f6b7..17934e486 100644--- a/desktop/test/swarm_projects_test.dart+++ b/desktop/test/swarm_projects_test.dart@@ -65,7 +65,7 @@ void main() {expect(find.byIcon(AppIcons.lock), findsOneWidget);expect(find.byKey(const ValueKey('super-project-expand-design')),- findsNothing,+ findsOneWidget,);expect(find.text('Leads'), findsNothing);expect(find.text('Projects'), findsNothing);@@ -130,7 +130,7 @@ void main() {expect(tester.getTopLeft(find.text('#12 Offline editing')).dx -tester.getTopLeft(projectName).dx,- 8,+ 0,);// A child row's formerly empty inset is part of its one click target.diff --git a/docs/naming-system.md b/docs/naming-system.mdindex 0d168c988..b81e05829 100644--- a/docs/naming-system.md+++ b/docs/naming-system.md@@ -54,7 +54,9 @@ and **Browser**. Technical documentation may still call the terminal interface a| **A harness** in the Store | A reusable setup containing agent instructions, tools, and an optional viewer. | Install the Blender harness. || **Tab** | A workspace group of harnesses. | Frontend and Backend tabs. || **Swarm** | A collaborative tab containing projects, people, agents and contributed machines. Invite-only by default; its owner can enable joining by email domain or a shared link. | Open your company Swarm beside your regular tabs. |-| **Project in a Swarm** | An initiative with its own lead, repository, sharing and workgroups. | Discuss Lamp OS with its lead; expand it to follow a workgroup. |+| **Project in a Swarm** | An initiative with its own product manager, repository, sharing and workgroups. | Discuss Lamp OS with its product manager; expand it to follow a workgroup. |+| **Product Manager** | The agent coordinating a Swarm project. Use **PM** in a compact role badge. | Message Product Manager. |+| **Engineer** | An agent carrying out project work. Use **Dev** in a compact role badge. | Atlas is an engineer on Lamp OS. || **Workgroup** | A numbered conversation for an independently assignable outcome within a project. | Follow #12 Offline editing. || **Pane** | A visible view of a harness, terminal, or viewer. | Split right; close pane. || **Terminal** | A shell for entering commands. | New terminal. |@@ -82,7 +84,10 @@ no CLI keeps its maker's name (Fo).A pane is a view, so closing a pane or tab closes views. **Stop Harness** ends therunning harness. Adding harnesses to a tab groups them without a separate teamsetup. A **Swarm** occupies one tab in that same tab bar. A person can belong to several Swarms.-Its project names open their lead chats; a separate chevron reveals each project's workgroups.+Its project names open their product manager chats; a separate chevron reveals each project's workgroups.+Agents have individual display names and the same avatar treatment as people. Their role badges+are **PM** and **Dev**; project context appears underneath. Engine names belong in details.+The stored `lead` and `builder` routing roles and native harness names remain compatible.People, agents and machines belong to the Swarm. A project's **Public** visibility means everyonein that Swarm; **Private** means its owner and explicitly invited project members. Swarms areinvite-only by default. Their owner can allow signed-in people with a chosen email domain or a