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
Desktop left pane cleanup: no arrows, My agents folds, Buddy avatar, only your own agents (#4192) (#3460)
0xken15d1f33f5ca44a
diff --git a/backend/src/superTabs/agentKind.test.ts b/backend/src/superTabs/agentKind.test.tsindex 5b8d81fde..0f6fd59a5 100644--- a/backend/src/superTabs/agentKind.test.ts+++ b/backend/src/superTabs/agentKind.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest'-import { createSuperTab, type Agent, type Person } from './model.js'-import { agentChatId, agentKind } from './agentKind.js'+import { createSuperTab, type Actor, type Agent, type Person } from './model.js'+import { agentChatId, agentKind, inMyAgents } from './agentKind.js'import { openSwarmBuddyChat } from './buddies.js'// Task #4116 (Swarm v3, anh Dee 11-07): the left pane lists "My agents": the person's Buddy first, then their other agents,@@ -48,3 +48,52 @@ describe('an agent\'s kind and chat', () => {expect(agentChatId(state, worker)).toBeNull()})})++// Task #4192 (anh Dee 11-07, Desktop 1.3.87): his My agents showed about 30 rows, agents he never started among them. It lists+// only the reader's Buddy and the agents running on their own account: Team-account, stopped and finished agents leave it.+describe('the reader\'s My agents', () => {+ const peerReads: Actor = { kind: 'person', userId: 'peer', email: '[email protected]' }++ it('holds an agent they brought that runs on their own account', () => {+ const { state, agent } = setup()+ expect(inMyAgents(state, peerReads, agent('mine'))).toBe(true)+ })++ it('holds their own Buddy, never another person\'s or a thread session', () => {+ const { state, agent } = setup()+ const buddy = agent('buddy', { buddyOf: { personId: 'peer', generation: 'second' }, buddyScope: 'swarm' })+ const session = agent('session', { buddyOf: { personId: 'peer', generation: 'second' }, buddySession: { thread: 't', from: 1 } } as Partial<Agent>)+ const owners = agent('owners', { contributorId: 'owner', machineOwnerId: 'owner', buddyOf: { personId: 'owner', generation: 'test' } })+ expect(inMyAgents(state, peerReads, buddy)).toBe(true)+ expect(inMyAgents(state, peerReads, session)).toBe(false)+ expect(inMyAgents(state, peerReads, owners)).toBe(false)+ })++ it('leaves out another person\'s agent and an agent reader', () => {+ const { state, agent } = setup()+ const theirs = agent('theirs', { contributorId: 'owner', machineOwnerId: 'owner' })+ expect(inMyAgents(state, peerReads, theirs)).toBe(false)+ expect(inMyAgents(state, { kind: 'agent', agentId: 'theirs', machineOwnerId: 'peer' }, agent('mine'))).toBe(false)+ })++ it('leaves out an agent on a Team account', () => {+ const { state, agent } = setup()+ expect(inMyAgents(state, peerReads, agent('team', { teamAccount: true }))).toBe(false)+ })++ it('leaves out a stopped, asleep, finished or stopping agent', () => {+ const { state, agent } = setup()+ expect(inMyAgents(state, peerReads, agent('down', { downSince: new Date(0).toISOString() }))).toBe(false)+ expect(inMyAgents(state, peerReads, agent('asleep', { asleep: { since: 0 } }))).toBe(false)+ expect(inMyAgents(state, peerReads, agent('finished', { workDecision: 'awaiting' }))).toBe(false)+ expect(inMyAgents(state, peerReads, agent('stopping', { workDecision: 'stop' }))).toBe(false)+ expect(inMyAgents(state, peerReads, agent('kept', { workDecision: 'keep' }))).toBe(true)+ })++ it('keeps a PM leading a project while its session restarts', () => {+ const { state, agent } = setup()+ const pm = agent('pm', { downSince: new Date(0).toISOString() })+ state.conversations.find(c => c.id === 'lead')!.leadId = pm.id+ expect(inMyAgents(state, peerReads, pm)).toBe(true)+ })+})diff --git a/backend/src/superTabs/agentKind.ts b/backend/src/superTabs/agentKind.tsindex 86aecc0f7..3dee07d26 100644--- a/backend/src/superTabs/agentKind.ts+++ b/backend/src/superTabs/agentKind.ts@@ -4,8 +4,8 @@* reader's own by this, a crown beside a PM, each bold while its chat has news the reader has not read (their read marks).*/import { isBuddy, isBuddyChat } from './buddies.js'-import type { Agent, SuperTabState } from './model.js'-import { isAgentChat, ledProject } from './projects.js'+import type { Actor, Agent, SuperTabState } from './model.js'+import { isAgentChat, ledProject, onTeamAccount } from './projects.js'export type AgentKind = 'buddy' | 'pm' | 'regular'@@ -22,3 +22,13 @@ export function agentChatId(state: SuperTabState, target: Agent): string | nullif (led) return led.leadConversationIdreturn state.conversations.find(c => isAgentChat(c) && c.agentIds.includes(target.id))?.id ?? null}++/** Whether [target] is in [actor]'s My agents (task #4192, anh Dee 11-07: his list showed about 30 rows, agents he never+ * started among them): their own main Buddy, or an agent they brought that runs on their own account, is running and is not+ * finished or being stopped. A PM leading a project stays while its session restarts: its project chat is its person's. */+export function inMyAgents(state: SuperTabState, actor: Actor, target: Agent): boolean {+ if (actor.kind !== 'person' || target.contributorId !== actor.userId) return false+ if (isBuddy(target)) return target.buddyOf!.personId === actor.userId && !target.buddySession+ if (onTeamAccount(state, target) || target.workDecision === 'awaiting' || target.workDecision === 'stop') return false+ return (!target.downSince && !target.asleep) || !!ledProject(state, target.id)+}diff --git a/backend/src/superTabs/read/contract.ts b/backend/src/superTabs/read/contract.tsindex cb349cf04..9013959e2 100644--- a/backend/src/superTabs/read/contract.ts+++ b/backend/src/superTabs/read/contract.ts@@ -81,8 +81,9 @@ export interface Derived {/** `roleName`: the role it goes by (instructions.ts roleNameOf), its stored one or what it is. *//** `kind`: the reader's Buddy, a PM leading a project, or a Regular agent; `chatId`: the chat its person talks to it in, or null* (agentKind.ts, task #4116). Absent from an older backend. */+ /** `myAgent`: whether it is in the reader's My agents (agentKind.ts inMyAgents, task #4192). Absent from an older backend. */agents: Record<string, { downSince: string | null; limitedUntil: string | null; workDecision: 'awaiting' | null; roleId: string | null; roleName: string;- kind: import('../agentKind.js').AgentKind; chatId: string | null }>+ kind: import('../agentKind.js').AgentKind; chatId: string | null; myAgent: boolean }>/** Every contributed machine the reader can see. *//** `clientVersion`: the CLI version its daemon last connected with (routing reads a machine updated since its failed starts). */machines: Record<string, { availableSlots: number; teamWork: { allowed: true } | { allowed: false; reason: string; [key: string]: unknown }; clientVersion?: stringdiff --git a/backend/src/superTabs/read/derivedEtag.test.ts b/backend/src/superTabs/read/derivedEtag.test.tsindex dbc2538bc..d3c30d207 100644--- a/backend/src/superTabs/read/derivedEtag.test.ts+++ b/backend/src/superTabs/read/derivedEtag.test.ts@@ -3,7 +3,7 @@ import type { Derived } from './contract.js'import { derivedEtag, MARK_FIELDS } from './derivedEtag.js'const summary = (): Derived => ({- agents: { a1: { downSince: null, limitedUntil: null, workDecision: null, roleId: null, roleName: 'Engineer', kind: 'regular', chatId: null } },+ agents: { a1: { downSince: null, limitedUntil: null, workDecision: null, roleId: null, roleName: 'Engineer', kind: 'regular', chatId: null, myAgent: false } },machines: { m1: { availableSlots: 2, teamWork: { allowed: true } } },mentionsWaiting: 1, mentionsDigest: 'd1', avatars: { 'person:p1': 'https://example.test/a?sig=1' },})diff --git a/backend/src/superTabs/read/views.test.ts b/backend/src/superTabs/read/views.test.tsindex fba19e813..58e08a08f 100644--- a/backend/src/superTabs/read/views.test.ts+++ b/backend/src/superTabs/read/views.test.ts@@ -126,7 +126,7 @@ describe('reader view of the parts (design 4.1, 4.3)', () => {const view = readerView(parts, peer, NOW, { teamMachines: [] })const worker = view.parts.agents.find(a => a.key === s.worker)!for (const hidden of ['downNamed', 'downSince', 'limitedUntil', 'roleId']) expect(worker.data).not.toHaveProperty(hidden)- expect(view.derived.agents[s.worker]).toEqual({ downSince: new Date(NOW - 5 * MINUTE).toISOString(), limitedUntil: null, workDecision: null, roleId: null, roleName: 'Engineer', kind: 'regular', chatId: null })+ expect(view.derived.agents[s.worker]).toEqual({ downSince: new Date(NOW - 5 * MINUTE).toISOString(), limitedUntil: null, workDecision: null, roleId: null, roleName: 'Engineer', kind: 'regular', chatId: null, myAgent: false })expect(Object.keys(view.derived.agents).sort()).toEqual([s.lead, s.worker].sort())})@@ -138,6 +138,16 @@ describe('reader view of the parts (design 4.1, 4.3)', () => {expect(view.derived.agents[s.worker]).toMatchObject({ kind: 'regular', chatId: null })})+ // Task #4192: whether each agent is in this reader's My agents comes from the server, so every client lists the same.+ it('says which agents are in the reader\'s My agents', () => {+ const { parts, s } = scene()+ const contributor = s.state.agents.find(a => a.id === s.lead)!.contributorId+ for (const actor of [owner, peer]) {+ const view = readerView(parts, actor, NOW, { teamMachines: [] })+ expect(view.derived.agents[s.lead]!.myAgent).toBe(actor.userId === contributor)+ }+ })+// Free slots count every session the machine runs, as today, even ones this reader cannot see.it('derives a machine\'s free slots and team work, and cuts its harness ids to what the reader can see', () => {const { parts } = scene()diff --git a/backend/src/superTabs/read/views.ts b/backend/src/superTabs/read/views.tsindex 9c817a733..ff09615c0 100644--- a/backend/src/superTabs/read/views.ts+++ b/backend/src/superTabs/read/views.ts@@ -16,7 +16,7 @@ import { canReadGroup } from '../projects.js'import { promptWaits } from '../promptWaits.js'import { storedPulse, type Pulse } from '../pulse.js'import { coordinatorNameOf, roleNameOf } from '../instructions.js'-import { agentChatId, agentKind } from '../agentKind.js'+import { agentChatId, agentKind, inMyAgents } from '../agentKind.js'import { withAvatarView } from '../profile.js'import { swarmUsernames } from '../usernames.js'import type { AgentView, Derived, GroupView, HeadView, LivePart, MachineView, MemberView, ProgressView, StartView } from './contract.js'@@ -196,6 +196,8 @@ function derive(state: SuperTabState, visible: SuperTabState, actor: Actor, now:...(Object.keys(suspended).length ? { suspendedEngines: suspended } : {}), ...(machineSuspended ? { machineSuspended } : {}), ...(leads[pool.machineId] ? { lead: leads[pool.machineId] } : {}) }] as const}const pulse = pulses(state, visible, actor, isBuddyReader(state, actor))+ // Each visible agent's stored row, looked up once rather than once per derived field.+ const storedAgents = new Map(state.agents.map(a => [a.id, a]))// The next release times the settle recorded (releases.ts), for the projects this reader sees: the release list itself stays// the server's (task #3827).const releaseTimes = Object.fromEntries(visible.projects?.flatMap(seen => {@@ -205,13 +207,18 @@ function derive(state: SuperTabState, visible: SuperTabState, actor: Actor, now:return {...(pulse ? { pulse } : {}),...(Object.keys(releaseTimes).length ? { releaseTimes } : {}),- agents: Object.fromEntries(visible.agents.map(seen => [seen.id, { downSince: seen.downSince ?? null, limitedUntil: seen.limitedUntil ?? null,- workDecision: seen.workDecision === 'awaiting' && state.agents.find(a => a.id === seen.id)!.workDecision !== 'awaiting' ? 'awaiting' as const : null,- roleId: seen.roleId ?? null,- // Derived on every read: who leads a project, and its role set, live outside the agent's own part.- roleName: roleNameOf(state, state.agents.find(a => a.id === seen.id)!),- // What it is and where its person talks to it, for the left pane's "My agents" (agentKind.ts, task #4116).- kind: agentKind(state, state.agents.find(a => a.id === seen.id)!), chatId: agentChatId(state, state.agents.find(a => a.id === seen.id)!) }])),+ agents: Object.fromEntries(visible.agents.map(seen => {+ const stored = storedAgents.get(seen.id)!+ return [seen.id, { downSince: seen.downSince ?? null, limitedUntil: seen.limitedUntil ?? null,+ workDecision: seen.workDecision === 'awaiting' && stored.workDecision !== 'awaiting' ? 'awaiting' as const : null,+ roleId: seen.roleId ?? null,+ // Derived on every read: who leads a project, and its role set, live outside the agent's own part.+ roleName: roleNameOf(state, stored),+ // What it is and where its person talks to it, for the left pane's "My agents" (agentKind.ts, task #4116).+ kind: agentKind(state, stored), chatId: agentChatId(state, stored),+ // Whether it is in this reader's My agents, decided here so every client lists the same (task #4192).+ myAgent: inMyAgents(state, actor, stored) }]+ })),machines: Object.fromEntries((visible.machines ?? []).map(machine)),...(visible.otherProjectsWork ? { otherProjectsWork: visible.otherProjectsWork } : {}),...(visible.pmAccounts ? { pmAccounts: visible.pmAccounts } : {}),diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dartindex 872461f68..eb42c5a48 100644--- a/desktop/lib/super_tabs/controller.dart+++ b/desktop/lib/super_tabs/controller.dart@@ -251,6 +251,7 @@ class SuperTabController extends ChangeNotifier {machinesGroupOpen = initial['machinesGroupOpen'] as bool? ?? true;buddiesGroupOpen = initial['buddiesGroupOpen'] as bool? ?? true;projectsGroupOpen = initial['projectsGroupOpen'] as bool?;+ agentsGroupOpen = initial['agentsGroupOpen'] as bool? ?? true;modelsGroupOpen = initial['modelsGroupOpen'] as bool? ?? true;offlineMachinesOpen = initial['offlineMachinesOpen'] as bool? ?? false;sessionProjectId = initial['sessionProjectId'] as String? ?? '';@@ -1114,6 +1115,9 @@ class SuperTabController extends ChangeNotifier {/// Whether the left pane's Projects is open when the reader chose (Swarm v3, task #4118); null until they do: it is then/// closed while they have an agent and open when they have none.bool? projectsGroupOpen;++ /// Whether the left pane's My agents is open (task #4192): it folds like Projects, open until the reader closes it.+ bool agentsGroupOpen = true;bool get projectsOpen =>projectsGroupOpen ??(snapshot == null || superTabMyAgents(snapshot!, accountId).isEmpty);@@ -1194,6 +1198,12 @@ class SuperTabController extends ChangeNotifier {_changed();}+ void toggleAgentsGroup() {+ agentsGroupOpen = !agentsGroupOpen;+ _saveSoon();+ _changed();+ }+void toggleBuddiesGroup() {buddiesGroupOpen = !buddiesGroupOpen;_saveSoon();@@ -2837,6 +2847,7 @@ class SuperTabController extends ChangeNotifier {'machinesGroupOpen': machinesGroupOpen,'buddiesGroupOpen': buddiesGroupOpen,if (projectsGroupOpen != null) 'projectsGroupOpen': projectsGroupOpen,+ 'agentsGroupOpen': agentsGroupOpen,'modelsGroupOpen': modelsGroupOpen,'offlineMachinesOpen': offlineMachinesOpen,'sessionProjectId': sessionProjectId,diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dartindex ecffc0f76..932f0e245 100644--- a/desktop/lib/super_tabs/model.dart+++ b/desktop/lib/super_tabs/model.dart@@ -175,6 +175,7 @@ class SuperTabAgent {role = row['role'] as String?,kind = row['kind'] as String?,chatId = row['chatId'] as String?,+ myAgent = row['myAgent'] as bool?,roleId = row['roleId'] as String?,roleName = row['roleName'] as String?,buddyOf = switch (row['buddyOf']) {@@ -226,6 +227,10 @@ class SuperTabAgent {/// has, or none yet. An older backend sends neither.final String? kind, chatId;+ /// Whether it is in the reader's My agents (backend agentKind.ts inMyAgents, task #4192): their Buddy, or an agent of+ /// theirs running on their own account and not finished. Null from an older backend.+ final bool? myAgent;+/// Set by its contributor or its project's Lead; null draws its pattern.final SuperTabAvatarPicture? avatar;diff --git a/desktop/lib/super_tabs/my_agents.dart b/desktop/lib/super_tabs/my_agents.dartindex 933aa0be2..967cfcedb 100644--- a/desktop/lib/super_tabs/my_agents.dart+++ b/desktop/lib/super_tabs/my_agents.dart@@ -1,15 +1,17 @@import 'model.dart';-/// The agents [accountId] brought to the Swarm, for the left pane's My agents (Swarm v3, task #4118): their Buddy first,-/// then the others by name. Only the person's own: another person's agent, and another person's Buddy, never appear.+/// The agents in [accountId]'s My agents, for the left pane (Swarm v3, task #4118): their Buddy first, then the others by+/// name. The server says which (task #4192: their own account's, running and not finished), so every client lists the same.+/// An older backend says nothing: then every agent the person brought, and only their own Buddy (this can go 2026-12-07).List<SuperTabAgent> superTabMyAgents(SuperTabSnapshot snapshot,String accountId,) {final own = [for (final agent in snapshot.agents)- if (agent.contributorId == accountId &&- (agent.buddyOf == null || agent.buddyOf == accountId))+ if (agent.myAgent ??+ (agent.contributorId == accountId &&+ (agent.buddyOf == null || agent.buddyOf == accountId)))agent,];String name(SuperTabAgent agent) =>diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex 2f31aa110..f9f9e63b9 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -104,8 +104,9 @@ class ProjectSidebar extends StatelessWidget {/// Mentions read what the server says waits, and Threads nothing.final SuperTabActivity? activity;- /// The reader's places, for the back and forward arrows at the top;- /// without it there are none.+ /// The reader's places, for the back and forward arrows at the top of a+ /// layout that is not the Desktop's; without it there are none. The+ /// Desktop has none (anh Dee, task #4192): ⌘[ and ⌘] still step.final SuperTabPlaces? places;/// What needs the reader, as Slack shows it: each row's red number counts@@ -590,6 +591,26 @@ class ProjectSidebar extends StatelessWidget {// (Tony, 11-02: it vanished from the latest Desktop under the filter).final agent = controller.buddy(key);final busy = controller.saving || controller.hasPendingAction;+ // The Desktop's My agents draws it as every agent, its face and name, never the robot icon (anh Dee, task #4192).+ if (board) {+ final muted =+ chat != null && controller.notifyOf(chat.id) == SuperTabNotify.muted;+ return SuperTabBuddyRow(+ key: const ValueKey('super-swarm-buddy'),+ agentId: agent?.id,+ name: 'Buddy',+ tooltip: 'Your Buddy',+ status: agent == null ? null : _buddyMark(agent),+ selected:+ chat != null && !_paneCovered && controller.selectedId == chat.id,+ unread: chat != null && !muted && controller.unreadShown(chat),+ onTap: switch (chat) {+ null when busy => null,+ null => () => _openBuddyChat(key),+ final chat => () => (onOpenAgentChat ?? onSelect)(chat.id),+ },+ );+ }return _drawRow(chat ?? _unopenedSwarmBuddyChat,label: 'Buddy',@@ -599,12 +620,7 @@ class ProjectSidebar extends StatelessWidget {// Muted, it is greyed and never bold, as every chat (_drawRow).unread: chat != null && controller.unreadShown(chat),trailing: agent == null ? null : _buddyMark(agent),- // On the Desktop its chat opens in the middle (Swarm v3, task #4118), like any agent's.- onTap: chat == null- ? () => _openBuddyChat(key)- : board && onOpenAgentChat != null- ? () => onOpenAgentChat!(chat.id)- : null,+ onTap: chat == null ? () => _openBuddyChat(key) : null,tappable: chat != null || !busy,);}@@ -627,20 +643,25 @@ class ProjectSidebar extends StatelessWidget {'My agents',titleStyle: _headingStyle,endInset: 0,+ // It folds as Projects does, remembered (task #4192).+ collapsed: !controller.agentsGroupOpen,+ onToggleCollapsed: controller.toggleAgentsGroup,),- if (controller.oneBuddy)- ?_swarmBuddyRow()- else- ..._buddies([...snapshot.projects], reading),- for (final agent in mine) _agentRow(snapshot, agent),- // The last row opens the creation dialog, where Regular or PM is chosen.- if (controller.canWrite && onNewAgent != null)- _navigationRow(- key: 'super-new-agent-row',- label: 'New agent',- icon: AppIcons.plus,- onTap: onNewAgent,- ),+ if (controller.agentsGroupOpen) ...[+ if (controller.oneBuddy)+ ?_swarmBuddyRow()+ else+ ..._buddies([...snapshot.projects], reading),+ for (final agent in mine) _agentRow(snapshot, agent),+ // The last row opens the creation dialog, where Regular or PM is chosen.+ if (controller.canWrite && onNewAgent != null)+ _navigationRow(+ key: 'super-new-agent-row',+ label: 'New agent',+ icon: AppIcons.plus,+ onTap: onNewAgent,+ ),+ ],const SizedBox(height: 16),];}@@ -798,11 +819,14 @@ class ProjectSidebar extends StatelessWidget {child: LaidOutListView(padding: const EdgeInsets.all(8),children: [- // The Desktop's org switcher is the first thing in the pane (Swarm v3 spec); elsewhere it follows the- // back and forward arrows.- if (board) ?switcher,- if (places case final places?) _arrows(places),- if (!board) ?switcher,+ // The Desktop's org switcher is the first thing in the pane (Swarm v3 spec), with no arrows under it+ // (task #4192); elsewhere it follows the back and forward arrows.+ if (board)+ ?switcher+ else ...[+ if (places case final places?) _arrows(places),+ ?switcher,+ ],// Three rows, each one thing, in anh Dee's order (11-05, task// #2996): bold when something waits, grey when not, and no// numbers (task #3128). The Swarm switcher stands apart fromdiff --git a/desktop/test/super_tab_v3_left_shots_test.dart b/desktop/test/super_tab_v3_left_shots_test.dartindex 1fea3db18..ee25c1105 100644--- a/desktop/test/super_tab_v3_left_shots_test.dart+++ b/desktop/test/super_tab_v3_left_shots_test.dart@@ -27,7 +27,8 @@ Map<String, dynamic> _agent(String id, String name) => {};/// Swarm v3's left pane and middle (task #4118), in both appearances: My agents with the Buddy first, a PM's crown and an-/// unread name in bold; the chat of a selected agent in the middle; a project's Board with Projects open.+/// 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.void main() {setUpAll(() async {await loadCaptureFonts(shots);@@ -40,7 +41,7 @@ void main() {});for (final brightness in Brightness.values) {- for (final scene in ['agent-chat', 'no-agents', 'board']) {+ for (final scene in ['agent-chat', 'no-agents', 'board', 'folded']) {testWidgets('$scene (${brightness.name})', (tester) async {await tester.binding.setSurfaceSize(const Size(1500, 800));addTearDown(() => tester.binding.setSurfaceSize(null));@@ -61,13 +62,27 @@ void main() {'buddyOf': {'personId': 'owner'},'kind': 'buddy','chatId': 'swarm-buddy-owner',+ 'myAgent': true,},{..._agent('kestrel', 'Kestrel'),'kind': 'regular','chatId': 'agent-chat-kestrel',+ 'myAgent': true,+ },+ {+ ..._agent('orion', 'Orion'),+ 'kind': 'pm',+ 'chatId': 'lead',+ 'myAgent': true,+ },+ // A finished or Team-account agent the server leaves out of My agents (task #4192).+ {+ ..._agent('avatarrow', 'Avatarrow'),+ 'kind': 'regular',+ 'chatId': null,+ 'myAgent': false,},- {..._agent('orion', 'Orion'), 'kind': 'pm', 'chatId': 'lead'},];groups.add({...conversationFixture('swarm-buddy-owner', 'Buddy'),@@ -108,7 +123,9 @@ void main() {'tabId': 'tab','accountId': 'owner','selectedId': 'lead',- if (scene == 'board') 'projectsGroupOpen': true,+ if (scene == 'board' || scene == 'folded')+ 'projectsGroupOpen': true,+ if (scene == 'folded') 'agentsGroupOpen': false,},);await tester.runAsync(c.refresh);diff --git a/desktop/test/super_tab_v3_left_test.dart b/desktop/test/super_tab_v3_left_test.dartindex 07e457725..36648d4f0 100644--- a/desktop/test/super_tab_v3_left_test.dart+++ b/desktop/test/super_tab_v3_left_test.dart@@ -3,7 +3,9 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/widgets/desktop_chrome.dart';import 'package:harness/state/app_state.dart';+import 'package:harness/shared/theme/app_icons.dart';import 'package:harness/super_tabs/buddy_rows.dart' show SuperTabCountBadge;+import 'package:harness/super_tabs/identity.dart' show SuperTabAvatar;import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/model.dart' show SuperTabAgent;import 'package:harness/super_tabs/places.dart';@@ -94,12 +96,14 @@ void main() {}group('the org switcher is the first thing in the left pane', () {- testWidgets('on the Desktop it sits above the back and forward arrows '- 'and Decisions', (tester) async {+ // Task #4192 (anh Dee 11-07): no back and forward arrows under it; ⌘[ and ⌘] still step back and forward.+ testWidgets('on the Desktop it sits above Decisions, with no back and '+ 'forward arrows', (tester) async {await show(tester);double top(String k) => tester.getTopLeft(key(k)).dy;- expect(top('super-swarm-switcher'), lessThan(top('super-back')));expect(top('super-swarm-switcher'), lessThan(top('super-decisions')));+ expect(key('super-back'), findsNothing);+ expect(key('super-forward'), findsNothing);});testWidgets('a layout that is not the Desktop\'s keeps its order', (@@ -229,6 +233,27 @@ void main() {);});+ // Task #4192 (anh Dee 11-07): his list showed about 30 rows, Team-account and finished agents he never started among+ // them. The server says which agents are the reader's; the list follows it.+ testWidgets('lists only the agents the server says are the reader\'s', (+ tester,+ ) async {+ await show(+ tester,+ agents: [+ {...buddy, 'myAgent': true},+ {..._agent('kestrel', 'Kestrel'), 'myAgent': true},+ {..._agent('avatarrow', 'Avatarrow'), 'myAgent': false},+ {..._agent('fir', 'Fir'), 'myAgent': false},+ ],+ setup: agents,+ );+ expect(key('super-swarm-buddy'), findsOneWidget);+ expect(key('super-agent-kestrel'), findsOneWidget);+ expect(key('super-agent-avatarrow'), findsNothing);+ expect(key('super-agent-fir'), findsNothing);+ });+testWidgets('a PM has a crown right after its name, a Regular agent ''none', (tester) async {await show(tester, agents: mine, setup: agents);@@ -337,6 +362,78 @@ void main() {expect(created, ['new']);});+ // Task #4192: My agents folds with the same chevron as Projects, and the choice is remembered.+ testWidgets('its heading folds and unfolds it, and the choice is saved', (+ tester,+ ) async {+ late ConversationServer server;+ final c = await show(+ tester,+ agents: mine,+ setup: (s) {+ server = s;+ agents(s);+ },+ );+ expect(key('super-agent-kestrel'), findsOneWidget);+ await tester.tap(find.byTooltip('Collapse My agents'));+ await tester.pump();+ for (final row in [+ 'super-swarm-buddy',+ 'super-agent-kestrel',+ 'super-new-agent-row',+ ]) {+ expect(key(row), findsNothing, reason: row);+ }+ expect(key('project-sidebar-agents'), findsOneWidget);+ expect(c.agentsGroupOpen, isFalse);+ await tester.runAsync(c.flush);+ final again = server.controller(initial: server.saved);+ addTearDown(again.dispose);+ expect(again.agentsGroupOpen, isFalse);+ await tester.tap(find.byTooltip('Expand My agents'));+ await tester.pump();+ expect(key('super-agent-kestrel'), findsOneWidget);+ expect(c.agentsGroupOpen, isTrue);+ await tester.runAsync(c.flush);+ });++ // Task #4192: the Buddy wears the face every agent has, not the robot icon, and is still first.+ testWidgets('the Buddy has the avatar every agent has, first', (+ tester,+ ) async {+ await show(+ tester,+ agents: mine,+ setup: (server) {+ agents(server);+ (server.state['conversations'] as List).add({+ ...conversationFixture('swarm-buddy-owner', 'Buddy'),+ 'kind': 'swarm-buddy',+ 'buddyOwnerId': 'owner',+ 'agentIds': ['buddy'],+ });+ },+ );+ Finder inBuddy(Finder f) =>+ find.descendant(of: key('super-swarm-buddy'), matching: f);+ expect(inBuddy(find.byType(SuperTabAvatar)), findsOneWidget);+ expect(inBuddy(find.byIcon(AppIcons.bot)), findsNothing);+ expect(+ tester.getSize(inBuddy(find.byType(SuperTabAvatar))),+ tester.getSize(+ find.descendant(+ of: key('super-agent-kestrel'),+ matching: find.byType(SuperTabAvatar),+ ),+ ),+ );+ expect(+ top(tester, 'super-swarm-buddy'),+ lessThan(top(tester, 'super-agent-kestrel')),+ );+ });+testWidgets('a layout that is not the Desktop\'s has no My agents', (tester,) async {diff --git a/docs/plans/2026-11-07-desktop-left-pane-cleanup-plan.md b/docs/plans/2026-11-07-desktop-left-pane-cleanup-plan.mdnew file mode 100644index 000000000..afb2453d9--- /dev/null+++ b/docs/plans/2026-11-07-desktop-left-pane-cleanup-plan.md@@ -0,0 +1,86 @@+# Desktop left pane cleanup: implementation plan++> Written by the project's Engineer way of working (project instructions, Engineer): plan first, then each task test first,+> the failing test committed before its code. No Execution Handoff.++**Goal:** Task #4192 (anh Dee 2026-11-07 06:05 VN, Desktop 1.3.87): the left pane is clean and a person's My agents list is+short and recognisable. No back and forward arrows under the org switcher; My agents folds with the same chevron as Projects,+remembered; the Buddy wears the same avatar as every agent, still first; My agents lists only the person's Buddy and the agents+running on their own account, so Team-account agents and stopped or finished agents leave it.++**Architecture:** Delta to what the app shows today.+- Server (`backend/src/superTabs/agentKind.ts`, `read/views.ts`): each agent's derived summary gains `myAgent`, whether it is+ in the reader's My agents: the reader's own Buddy, or an agent they brought (`contributorId`) that runs on their own account+ (not `onTeamAccount`), is running (no `downSince`, not asleep) and is not finished or being stopped (`workDecision` neither+ `awaiting` nor `stop`). A PM leading a project stays while its session restarts: its project chat is the person's. Every+ client reads the one rule.+- Desktop (`desktop/lib/super_tabs/`): `superTabMyAgents` lists by `myAgent` when the server sends it, else today's rule+ (an older backend; the fallback can go 2026-12-07). The board layout drops the arrows (⌘[ and ⌘] stay). My agents' heading+ takes `collapsed`/`onToggleCollapsed` like Projects, saved as `agentsGroupOpen` (open by default). The board's Buddy row is a+ `SuperTabBuddyRow` (the avatar every agent row has) instead of `_drawRow`'s robot icon.++**Tech Stack:** TypeScript and Vitest (backend); Dart and Flutter widget tests with the fake Swarm of+`test/support/super_tab_fixture.dart`; screenshots by `test/super_tab_v3_left_shots_test.dart`.++**Spec:** Task #4192's brief; the Swarm v3 left pane (#4118, `2026-11-07-swarm-v3-desktop-left-plan.md`); `agentKind` (#4116).++## Mockup++```+ +------------------------++ | [ Company v ] | no < > under it+ | Decisions |+ | Leaderboard |+ | |+ | v My agents [+] | chevron folds it, remembered+ | (B) Buddy | the Buddy's own avatar, first+ | (A) Kestrel | only running agents on your account+ | (A) Orion [crown] |+ | + New agent |+ | |+ | > Projects [+] |+ +------------------------++```++## Global Constraints++- Owns `desktop/lib/super_tabs/`; the server read is in scope by the brief ("filter on the server read so every client+ agrees"). Ships in Desktop 1.3.88 with #4191. Harness design tokens only; docs/windows-rules.md (no process, no window).+- Backend first: `myAgent` only extends the derived summary; an older Desktop ignores it, a new Desktop on an older backend+ keeps today's list.++## Review Focus++- `myAgent` is the reader's alone (actor), and costs no extra read: one pass over the visible agents.+- The Buddy row on the board still opens its chat in the middle, and the unopened Buddy still opens it on the server.++## Task 1: the server says which agents are the reader's++**Files:** `backend/src/superTabs/agentKind.ts`, `agentKind.test.ts`, `read/views.ts`, `read/contract.ts`, `read/views.test.ts`++**Interfaces:** `inMyAgents(state, actor, target): boolean`; `Derived.agents[id].myAgent: boolean`.++- [ ] Test: own running agent yes; another person's, a Team-account one, a down one, an asleep one, an awaiting or stopping+ one no; own Buddy yes, another's Buddy no; a down PM leading a project yes; an agent reader never. Derived carries it.+- [ ] Run, see it fail; commit.+- [ ] Implement; run `agentKind.test.ts` and `read/views.test.ts`; commit.++## Task 2: Desktop lists by the server's word++**Files:** `desktop/lib/super_tabs/model.dart`, `my_agents.dart`, `desktop/test/super_tab_v3_left_test.dart`++- [ ] Test: with `myAgent` sent, an agent marked false is not listed even when the reader brought it; without it, today's rule.+- [ ] Fail; commit. Implement; run the file; commit.++## Task 3: no arrows, My agents folds, the Buddy's avatar++**Files:** `desktop/lib/super_tabs/project_sidebar.dart`, `controller.dart`, `desktop/test/super_tab_v3_left_test.dart`++- [ ] Tests: the board has no `super-back`/`super-forward` (another layout keeps them); My agents' chevron hides and shows its+ rows and `agentsGroupOpen` is saved and read back; the board's Buddy row draws a `SuperTabAvatar` and no robot icon, first.+- [ ] Fail; commit. Implement; run the file and the sidebar tests that import what changed; commit.++## Task 4: pictures++- [ ] `super_tab_v3_left_shots_test.dart` gains a folded My agents scene; run with `SUPER_TAB_V3_LEFT_SHOTS` for light and+ dark; attach to the pull request.diff --git a/mobile/lib/swarm/model.dart b/mobile/lib/swarm/model.dartindex 3a9c9a511..442d3968e 100644--- a/mobile/lib/swarm/model.dart+++ b/mobile/lib/swarm/model.dart@@ -174,6 +174,7 @@ class SuperTabAgent {role = row['role'] as String?,kind = row['kind'] as String?,chatId = row['chatId'] as String?,+ myAgent = row['myAgent'] as bool?,roleId = row['roleId'] as String?,roleName = row['roleName'] as String?,buddyOf = switch (row['buddyOf']) {@@ -236,6 +237,10 @@ class SuperTabAgent {/// What it is and where its person talks to it (Swarm v3, backend #4116), read as the desktop's model reads them.final String? kind, chatId;+ /// Whether it is in the reader's My agents (backend agentKind.ts inMyAgents, task #4192), read as the desktop's model+ /// reads it. Null from an older backend.+ final bool? myAgent;+/// Set by its contributor or its project's Lead; null draws its pattern.final SuperTabAvatarPicture? avatar;