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: a cleaner Swarm sidebar: three actions, Swarm items in the menu bar and Dock, Mac icons by type (#1832)
0xken158fb89d0966fa
diff --git a/backend/src/superTabs/model.ts b/backend/src/superTabs/model.tsindex d0ddec7d1..0bddb73cf 100644--- a/backend/src/superTabs/model.ts+++ b/backend/src/superTabs/model.ts@@ -476,7 +476,7 @@ export function createSuperTab(id: string, name: string, owner: { id: string; emstate.projects = [{ ...projectsOf(state)[0]!, ...(visibility ? { visibility } : {}), skillMode: 'default' }]// Its models are on from the start (owner, 2026-10-24): the owner's computer makes the Swarm's grid in the background// (CLI `superTabs/swarmGrids.ts`) and reports how it went. Fire and forget: a grid that could not be made leaves the- // Swarm as it is, and the owner's first share or run in Manage models sets the models up then.+ // Swarm as it is, and the owner's first share or run in Your models sets the models up then.state.localModels = { grid: swarmGridName(id), enabled: true }syncLeads(state)return statediff --git a/cli/src/lib/swarmApiShares.ts b/cli/src/lib/swarmApiShares.tsindex 661835bf8..3a567b589 100644--- a/cli/src/lib/swarmApiShares.ts+++ b/cli/src/lib/swarmApiShares.ts@@ -131,7 +131,7 @@ export class SwarmApiShares {/** Brings back the shares an earlier process noted: their endpoints died with it, so each listens again at the address* it had and joins again, reading the saved API afresh. A note from before addresses were kept is taken off its grid* and shared at a new one. One whose API is no longer saved, or that grid refuses, stays off: a person shares again- * from the Swarm's Manage models. */+ * from the Swarm's Your models. */restore(): Promise<void> {return this.serial(() => this.restoreNow())}diff --git a/cli/src/superTabs/route.spec.ts b/cli/src/superTabs/route.spec.tsindex 23ed39df2..586fe37cc 100644--- a/cli/src/superTabs/route.spec.ts+++ b/cli/src/superTabs/route.spec.ts@@ -557,7 +557,7 @@ describe('local models on the Swarm\'s grid', () => {expect(ok(choose([opus, api], policy, a({ model: 'Claude Opus' }), NOW)).shown.map(s => s.model)).toEqual(['opus'])expect(ok(choose([older], policy, a({ difficulty: 'low' }), NOW)).shown[0]!.title).toContain('(shared)')expect(choose([opus], policy, a({ model: 'gpt 9' }), NOW)).toEqual({ error: 'NO_CANDIDATE',- excluded: [{ title: 'Named model', reason: 'No candidate runs "gpt 9". Share it with the Swarm (Manage models), or check its name.' }] })+ excluded: [{ title: 'Named model', reason: 'No candidate runs "gpt 9". Share it with the Swarm (Your models), or check its name.' }] })expect(parseAssessment({ difficulty: 'low', risk: 'low', why: 'x', model: ' deepseek 4.1 flash ' })).toMatchObject({ model: 'deepseek 4.1 flash' })expect(parseAssessment({ difficulty: 'low', risk: 'low', why: 'x', model: '...' })).toContain('model')expect(parseAssessment({ difficulty: 'low', risk: 'low', why: 'x', model: 7 })).toContain('model')@@ -586,7 +586,7 @@ describe('local models on the Swarm\'s grid', () => {expect(choose([probe()], policy, a({ model: 'gpt 9' }), NOW, [], [], [qwen])).toMatchObject({ excluded: [{ reason: expect.stringContaining('No candidate runs "gpt 9"') }] })expect(choose([probe()], policy, a({ local: true }), NOW, [], [], [qwen])).toEqual({ error: 'NO_CANDIDATE', excluded: [{ title: 'Local models',reason: '"Qwen 3 4B" is shared with the Swarm, but Builder Faye is on it: a local model serves one Builder at a time. Assign the work to that Builder once it is free, or stop it to free the model.' }] })- expect(LOCAL_NONE).toContain('Manage models')+ expect(LOCAL_NONE).toContain('Your models')})describe('first for simple work (roadmap, Dec: about 30% of work on cheaper models)', () => {@@ -618,7 +618,7 @@ describe('local models on the Swarm\'s grid', () => {it('says why a named model the Swarm has is never offered to Builders, rather than to share it', () => {const llama = { model: 'llama3.2:3b', label: 'llama3.2:3b', kind: 'local' as const, holders: [],refused: 'llama3.2:3b is too small for a coding agent (about 3B parameters; Builders need 7B or more).' }- const reason = '"llama3.2:3b" is shared with the Swarm, but Builders are not offered it: llama3.2:3b is too small for a coding agent (about 3B parameters; Builders need 7B or more). Ask a member to run a larger model, or share an API (Manage models).'+ const reason = '"llama3.2:3b" is shared with the Swarm, but Builders are not offered it: llama3.2:3b is too small for a coding agent (about 3B parameters; Builders need 7B or more). Ask a member to run a larger model, or share an API (Your models).'expect(choose([probe()], policy, a({ model: 'llama 3.2 3b' }), NOW, [], [], [llama])).toEqual({ error: 'NO_CANDIDATE', excluded: [{ title: 'Named model', reason }] })expect(choose([probe()], policy, a({ local: true }), NOW, [], [], [llama])).toEqual({ error: 'NO_CANDIDATE', excluded: [{ title: 'Local models', reason }] })})diff --git a/cli/src/superTabs/route.ts b/cli/src/superTabs/route.tsindex 10373e33f..cb0115b16 100644--- a/cli/src/superTabs/route.ts+++ b/cli/src/superTabs/route.ts@@ -219,7 +219,7 @@ function runsNamed(p: Probe, named: string): boolean {const name = words([p.gridModel ?? p.model, p.gridLabel ?? '', ENGINE[p.engine]].join(' ')).join('')return words(named).every(w => name.includes(w))}-const NAMED_NONE = (named: string) => `No candidate runs "${named}". Share it with the Swarm (Manage models), or check its name.`+const NAMED_NONE = (named: string) => `No candidate runs "${named}". Share it with the Swarm (Your models), or check its name.`/** How many Builders may run on one API model a member shares: the share answers four requests at once* (cli/src/lib/swarmApiShares.ts CONCURRENCY), unlike a local engine, which answers one conversation at a time. */@@ -231,7 +231,7 @@ export interface HeldModel { model: string; label: string; kind: 'local' | 'api'/** Why a held model is not offered, and what frees it: a model in use reads as unshared otherwise (owner, 2026-10-24). */function heldReason(m: HeldModel): string {- if (m.refused) return `"${m.label}" is shared with the Swarm, but Builders are not offered it: ${m.refused} Ask a member to run a larger model, or share an API (Manage models).`+ if (m.refused) return `"${m.label}" is shared with the Swarm, but Builders are not offered it: ${m.refused} Ask a member to run a larger model, or share an API (Your models).`const who = m.holders.length === 1 ? `Builder ${m.holders[0]} is on it` : `Builders ${m.holders.slice(0, -1).join(', ')} and ${m.holders.at(-1)} are on it`const limit = m.kind === 'api' ? `an API model takes ${API_BUILDERS} Builders at a time` : 'a local model serves one Builder at a time'return `"${m.label}" is shared with the Swarm, but ${who}: ${limit}. Assign the work to ${m.holders.length === 1 ? 'that Builder once it is free, or stop it' : 'one of them once it is free, or stop one'} to free the model.`@@ -335,7 +335,7 @@ function sizeUp(p: Probe, policy: Policy, a: Assessment, now: number, open: Commconst WAY = ['right away', 'about a quarter of the way in', 'about halfway', 'about three quarters of the way in', 'near the end']const runsOut = (w: Measured) => `The ${w.name} window is expected to run out ${WAY[Math.round(Math.max(0, w.usable / w.needed) * 4)]}${w.resetsIn === null ? '' : `; resets in ${span(w.resetsIn)}`}.`const UNREAD = 'Its quota could not be read in full, and another candidate\'s quota fits this task.'-export const LOCAL_NONE = 'No local model is being served on this Swarm\'s grid. Ask a member to run one or share an API (Manage models, in the Swarm\'s sidebar).'+export const LOCAL_NONE = 'No local model is being served on this Swarm\'s grid. Ask a member to run one or share an API (Your models, in the Swarm\'s sidebar).'/** The fixed order: the owner's preferred engine, a model on the Swarm's grid for simple work, an idle member before a new* agent and a less busy machine first when the owner prefers idle agents; then the policy order: cheaper in effect,diff --git a/desktop/design/icon-design-system.md b/desktop/design/icon-design-system.mdindex 18bb82aa5..10e9b2b1f 100644--- a/desktop/design/icon-design-system.md+++ b/desktop/design/icon-design-system.md@@ -27,6 +27,13 @@ meaning: a warning triangle remains a triangle, a chevron remains a chevron.- AppKit controls use `HarnessControlSymbols`: regular monochrome SF Symbolsat the shared 16-point size. Native menu items and the title bar share thisfactory. Native tab close is the optically matched 8-point regular `xmark`.+- One exception draws SF Symbols inside Flutter: a Swarm's machine rows lead+ with each Mac's own shape (`laptopcomputer`, `macstudio`, `macmini`,+ `desktopcomputer`, else `display`; `super_tabs/machine_icon.dart`). AppKit+ draws the symbol as a one-ink PNG over `harness/system_symbols`, and Flutter+ tints it with the row's ink. Off a Mac, for a symbol this macOS lacks, and+ when the call fails, the row draws `AppIcons.laptop` or `AppIcons.monitor`,+ never nothing. No Apple artwork ships with the app.Add a missing semantic symbol to the catalogue, then reuse it. Do not createa local font alias or duplicate a drawing. A new optical variant belongs indiff --git a/desktop/design/images/notification-swarm-dark.png b/desktop/design/images/notification-swarm-dark.pngnew file mode 100644index 000000000..6a94f67ceBinary files /dev/null and b/desktop/design/images/notification-swarm-dark.png differdiff --git a/desktop/design/images/notification-swarm-light.png b/desktop/design/images/notification-swarm-light.pngnew file mode 100644index 000000000..8caf882f4Binary files /dev/null and b/desktop/design/images/notification-swarm-light.png differdiff --git a/desktop/design/images/notification-swarms-dark.png b/desktop/design/images/notification-swarms-dark.pngnew file mode 100644index 000000000..5162095c1Binary files /dev/null and b/desktop/design/images/notification-swarms-dark.png differdiff --git a/desktop/design/images/notification-swarms-light.png b/desktop/design/images/notification-swarms-light.pngnew file mode 100644index 000000000..c7d950575Binary files /dev/null and b/desktop/design/images/notification-swarms-light.png differdiff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.mdindex b10e3a946..48a8cb2c9 100644--- a/desktop/design/new-harness-entry-rules.md+++ b/desktop/design/new-harness-entry-rules.md@@ -142,7 +142,7 @@ Machine identifies where the agent, project and tools run. The model can beserved from a different machine. Changing Machine or Agent preserves an explicitmodel, refreshes availability, and blocks Start with an explanation if the newcombination is unavailable. It never substitutes a subscription. Refresh models-updates the choices; Manage Models opens the existing Models panel for lifecycle+updates the choices; Your models opens the existing Models panel for lifecyclemanagement and preserves the launch draft. Choosing Terminal clears model routing;its Model row is omitted.diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.mdindex c0c55d6d4..d64343fc3 100644--- a/desktop/design/workspace-status-bar.md+++ b/desktop/design/workspace-status-bar.md@@ -341,6 +341,34 @@ Tab, machine, project and full status descriptions remain in tooltips andaccessibility text. Unavailablerows remain visible and disabled. An empty inbox says “No unread notifications.”+A Swarm section follows, on a Mac only, and disappears when empty: what needs+the person in their open Swarm tabs, which the Swarm sidebar's Notifications+row listed before (`statusMenuSwarmEntries`). Each Swarm's open decisions come+first, then the tags waiting for them, newest first within each, as its+Notifications page lists them: who asks or tagged them, the question or the+message, and when it was asked; the Swarm, project and conversation are in the+tooltip and accessibility text. Each Swarm shows at most five, then its own+View all, which opens that Swarm's Notifications page; with several Swarms each+has a heading with its name and count, so a second Swarm's items are never+behind the first's overflow. Only rows whose conversation the person can read+now are listed: when access changes, the lists clear and are read again, and a+read that started before is dropped. Choosing a tag opens its+conversation at the message; choosing a decision opens that Swarm's+Notifications page, where it is answered. A row answered while the menu is open+does nothing. Mark all read leaves them: a tag is done when it is replied to or+marked done, a decision when it is answered. They add to the menu bar badge,+and their count, the tags plus open decisions across every Swarm tab, counted+for this account alone by the Swarm, is the badge on the Dock's app icon,+cleared at zero and when the workspace leaves.+++++++++Working starts expanded and disappears when empty. It shows active, known sessions thatare not already in Notifications, with elapsed time only when the app observedtheir turn start. Exclude idle shells, paused/offline sessions, and waitingdiff --git a/desktop/lib/core/system_symbols.dart b/desktop/lib/core/system_symbols.dartnew file mode 100644index 000000000..ca1ee381d--- /dev/null+++ b/desktop/lib/core/system_symbols.dart@@ -0,0 +1,57 @@+import 'package:flutter/foundation.dart';+import 'package:flutter/services.dart';++/// AppKit's own SF Symbols, which the Mac runner draws as one-ink PNGs for+/// Flutter to tint (`MainFlutterWindow.swift`). Only the Mac app has them:+/// elsewhere, for a name this macOS lacks, and when the call fails, there is+/// no picture and the caller draws its catalogue icon instead.+class SystemSymbols {+ SystemSymbols({MethodChannel? channel})+ : _channel = channel ?? const MethodChannel(channelName);++ static const channelName = 'harness/system_symbols';+ static final shared = SystemSymbols();++ final MethodChannel _channel;+ final _drawn = <String, Uint8List?>{};+ final _drawing = <String, Future<Uint8List?>>{};++ bool get available =>+ !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS;++ static String _key(String name, double size, double scale) =>+ '$name@$size@$scale';++ /// [name] as already drawn at [size] points and [scale], or null.+ Uint8List? drawn(+ String name, {+ required double size,+ required double scale,+ }) => _drawn[_key(name, size, scale)];++ /// [name] drawn at [size] points for a [scale]× screen; null when there is+ /// none. Each is asked once.+ Future<Uint8List?> png(+ String name, {+ required double size,+ required double scale,+ }) {+ final key = _key(name, size, scale);+ if (_drawn.containsKey(key)) return SynchronousFuture(_drawn[key]);+ if (!available) return SynchronousFuture(null);+ return _drawing[key] ??= () async {+ Uint8List? bytes;+ try {+ bytes = await _channel.invokeMethod<Uint8List>('png', {+ 'name': name,+ 'size': size,+ 'scale': scale,+ });+ } catch (_) {+ bytes = null;+ }+ _drawing.remove(key);+ return _drawn[key] = bytes;+ }();+ }+}diff --git a/desktop/lib/models/models_panel.dart b/desktop/lib/models/models_panel.dartindex 82418ec00..2e178a989 100644--- a/desktop/lib/models/models_panel.dart+++ b/desktop/lib/models/models_panel.dart@@ -426,7 +426,7 @@ class _ModelsPanelState extends State<ModelsPanel> with SectionWakes {foregroundColor: AppPalette.textSecondary,textStyle: AppType.monoMeta(),),- child: const Text('Manage models'),+ child: const Text('Your models'),),],),diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex 56d95521a..33da39eac 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -2190,6 +2190,12 @@ class _SwarmScreenState extends State<SwarmScreen> {app,colorForActivity: activityInk,),+ // The Dock's badge: what needs the person in their Swarms. AppKit clears+ // it at zero and whenever an update leaves it out.+ if (_native) 'dockBadge': swarmsNeedYou(app),+ // The menu bar's Swarm section: what the Swarm sidebar's Notifications+ // row listed before it moved there.+ if (_native) 'statusMenuSwarmEntries': statusMenuSwarmEntries(app),// The fallback bell and the macOS menu use the same unread ledger.'unread': _unread,'sessionsOpen': _harnessesVisible,@@ -2815,6 +2821,8 @@ class _SwarmScreenState extends State<SwarmScreen> {unawaited(_showNotificationInbox());case 'openStatusHarness':await _openStatusHarness(args);+ case 'openSwarmNotice':+ await _openSwarmNotice(args);case 'clearStatusNotifications':if (args['receipts'] case final List receipts) {clearStatusMenuNotifications(app, receipts);@@ -2847,6 +2855,7 @@ class _SwarmScreenState extends State<SwarmScreen> {'notifications','notificationInbox','openStatusHarness',+ 'openSwarmNotice','addAgent','newAgent','newTerminal',@@ -7170,6 +7179,29 @@ class _SwarmScreenState extends State<SwarmScreen> {}}+ /// A row of the menu bar's Swarm section: its Swarm tab comes forward and+ /// opens the tag or decision there; View all (`all`) opens the Swarm's+ /// Notifications page. One no longer listed opens nothing.+ Future<void> _openSwarmNotice(Map receipt) async {+ final tabId = receipt['swarmTabId'], kind = receipt['kind'];+ final id = receipt['id'];+ if (tabId is! String || kind is! String || id is! String) return;+ final listed = statusMenuSwarmEntries(app).any(+ (row) =>+ row['swarmTabId'] == tabId &&+ (kind == 'all' || (row['kind'] == kind && row['id'] == id)),+ );+ final controller = app.superTabs.peek(tabId);+ final tab = app.swarms.where((s) => s.superTabId == tabId).firstOrNull;+ if (!listed || controller == null || tab == null) return;+ if (_newHarness?.requestDismiss() == false) return;+ _closeNewHarness(restoreFocus: false);+ _closeSearch(restoreFocus: false);+ app.openSuperTab(tabId, tab.name);+ controller.openNotice(kind, id);+ await revealWindow();+ }+/// The bell's inbox, a titlebar dropdown.Future<void> _showNotificationInbox() async {if (_closeTitlebarDropdown('notificationInbox')) return;diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex 196d06f68..dc4dcd476 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -525,7 +525,7 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('models.manage',- 'Manage models',+ 'Your models',ShortcutGroup.actions,keywords: ['download', 'start', 'stop', 'local', 'API'],),diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex e0882b87e..7bfa27f6a 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -1758,6 +1758,7 @@ class AppNotifier extends ChangeNotifier {avatarUpload: uploadAvatarWith(() => api),onMention: superTabMentionNotice(systemNotifications),onTagCounts: notifyListeners,+ onNotices: notifyListeners,discoveryInterval: kUnderTest ? Duration.zero : const Duration(seconds: 15),onTabs: (tabs, hidden) {// Discovery can finish while an already signed-in machine is re-seatingdiff --git a/desktop/lib/state/harness_activity.dart b/desktop/lib/state/harness_activity.dartindex 628647aea..108148837 100644--- a/desktop/lib/state/harness_activity.dart+++ b/desktop/lib/state/harness_activity.dart@@ -139,3 +139,16 @@ HarnessActivity? tabActivity(AppNotifier app, Swarm tab) {}return result;}++/// What needs this account across its Swarm tabs: the tags and open decisions+/// the Swarm counts for it alone, each Swarm once. None from a Swarm it lost,+/// none signed out. The Dock's badge, and what the Swarm's sidebar row counted.+int swarmsNeedYou(AppNotifier app) {+ if (app.currentUser == null) return 0;+ var count = 0;+ for (final id in {for (final tab in app.swarms) ?tab.superTabId}) {+ if (app.superTabs.peek(id)?.accessRevoked == true) continue;+ count += app.superTabs.waitingTags(id) + app.superTabs.waitingDecisions(id);+ }+ return count;+}diff --git a/desktop/lib/state/new_harness.dart b/desktop/lib/state/new_harness.dartindex 0c3872e64..538fee0e7 100644--- a/desktop/lib/state/new_harness.dart+++ b/desktop/lib/state/new_harness.dart@@ -1176,7 +1176,7 @@ class NewHarnessController extends ChangeNotifier {return 'The selected model is unavailable. Choose another model or your subscription.';}if (catalog.sections.every((section) => section.models.isEmpty)) {- return 'No models are running on your machines. Open Manage Models to start one.';+ return 'No models are running on your machines. Open Your models to start one.';}return null;}@@ -1263,7 +1263,7 @@ class NewHarnessController extends ChangeNotifier {),const NewHarnessOption(id: manageModelsId,- title: 'Manage Models…',+ title: 'Your models…',synthetic: true,),];diff --git a/desktop/lib/state/status_menu.dart b/desktop/lib/state/status_menu.dartindex a3ce89f47..57212a5aa 100644--- a/desktop/lib/state/status_menu.dart+++ b/desktop/lib/state/status_menu.dart@@ -1,4 +1,6 @@import '../notify/alert_sounds.dart';+import '../super_tabs/decisions.dart';+import '../super_tabs/notifications.dart';import 'app_state.dart';import 'harness_activity.dart';import 'harness_sessions.dart';@@ -192,3 +194,76 @@ void clearStatusMenuNotifications(AppNotifier app, List receipts) {);}}++/// The menu bar's Swarm section: in each open Swarm tab, the decisions asked+/// of this account, then the tags waiting for it, newest first in each, as its+/// Notifications page lists them. Only from conversations it can read now,+/// none from a Swarm it lost, none signed out: the lists are what was read+/// last, and access can leave before they are read again. Choosing one opens+/// it there (`SuperTabController.openNotice`).+List<Map<String, Object?>> statusMenuSwarmEntries(AppNotifier app) {+ if (app.currentUser == null) return [];+ final needs = nativeActivityPayload(HarnessActivity.needsInput);+ final rows = <Map<String, Object?>>[];+ for (final id in {for (final tab in app.swarms) ?tab.superTabId}) {+ final controller = app.superTabs.peek(id);+ final snapshot = controller?.snapshot;+ if (controller == null || snapshot == null || controller.accessRevoked) {+ continue;+ }+ Map<String, Object?> row(+ String kind,+ String noticeId,+ String title,+ String message,+ String projectName,+ String conversationTitle,+ DateTime? createdAt,+ ) => {+ 'swarmTabId': id,+ 'kind': kind,+ 'id': noticeId,+ 'title': title,+ 'message': statusMenuMessage(message),+ 'unread': true,+ 'activity': needs,+ 'tabName': snapshot.name,+ 'detail': [+ projectName,+ conversationTitle,+ ].where((part) => part.isNotEmpty).join(' · '),+ 'receivedAt': createdAt?.millisecondsSinceEpoch,+ };+ bool readable(String conversationId) =>+ snapshot.conversation(conversationId) != null;+ for (final d in SuperTabDecisions.of(controller).open) {+ if (!readable(d.conversationId)) continue;+ rows.add(+ row(+ 'decision',+ d.id,+ '${d.askerName} asks you',+ d.question,+ d.projectName,+ d.conversationTitle,+ d.createdAt,+ ),+ );+ }+ for (final m in SuperTabMentions.of(controller).waiting) {+ if (!readable(m.conversationId)) continue;+ rows.add(+ row(+ 'mention',+ m.id,+ '${m.leadName} tagged you',+ m.text,+ m.projectName,+ m.conversationTitle,+ m.createdAt,+ ),+ );+ }+ }+ return rows;+}diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex d9afe6197..12e5f18d8 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -2456,7 +2456,7 @@ class SwarmSearchController extends ChangeNotifier {notifyListeners();}- /// The models list of a Swarm's Manage models, drawn in its own way (`super_tabs/local_models.dart`).+ /// The models list of a Swarm's Your models, drawn in its own way (`super_tabs/local_models.dart`).bool get isSwarmModels => isModelMode && swarmModels != null;/// How many of the Swarm's APIs' models [row]'s API shares with the Swarm. Null for any row but an API's own.@@ -2467,7 +2467,7 @@ class SwarmSearchController extends ChangeNotifier {return swarm.shares.where((key) => key.startsWith('$id\u0000')).length;}- /// The one model section the list shows, or every section: the scope buttons of a Swarm's Manage models.+ /// The one model section the list shows, or every section: the scope buttons of a Swarm's Your models.ModelSearchSection? modelScope;void setModelScope(ModelSearchSection? section) {diff --git a/desktop/lib/super_tabs/client.dart b/desktop/lib/super_tabs/client.dartindex 142c47c59..61f09005b 100644--- a/desktop/lib/super_tabs/client.dart+++ b/desktop/lib/super_tabs/client.dart@@ -8,6 +8,7 @@ import '../core/local_key_value_store.dart';import 'attachment_upload.dart';import 'avatar_upload.dart';import 'controller.dart';+import 'decisions.dart';import 'model.dart';import 'notifications.dart';import 'parts.dart';@@ -34,6 +35,7 @@ class SuperTabClient {this.onSelection,this.onMention,this.onTagCounts,+ this.onNotices,this.upload = refuseUpload,this.avatarUpload = refuseAvatarUpload,this.discoveryInterval = const Duration(seconds: 15),@@ -55,6 +57,10 @@ class SuperTabClient {/// The waiting tags of a Swarm that is not open changed ([waitingTags]).final void Function()? onTagCounts;++ /// An open Swarm's list of the reader's tags or decisions changed: what the+ /// menu bar lists.+ final void Function()? onNotices;final _tagCounts = <String, int>{};final _tagsSeen = <String, Set<String>>{};@@ -68,6 +74,11 @@ class SuperTabClient {return _loaded[id]?.snapshot?.mentionsWaiting ?? _tagCounts[id] ?? 0;}+ /// The open decisions asked of this account in a Swarm open here; none for+ /// one not open.+ int waitingDecisions(String id) =>+ _loaded[id]?.snapshot?.decisionsWaiting ?? 0;+/// The unread messages in this account's own PM chats in a Swarm open/// here ([SuperTabController.pmUnread]); none for one not open.int waitingPm(String id) => _loaded[id]?.pmUnread ?? 0;@@ -476,7 +487,12 @@ class SuperTabClient {avatarUpload: avatarUpload,reading: _reading,)..away = _isAway(id);- var seenChange = (lastChangedAt: -1, mentionsWaiting: -1, pmUnread: -1);+ var seenChange = (+ lastChangedAt: -1,+ mentionsWaiting: -1,+ decisionsWaiting: -1,+ pmUnread: -1,+ );var seenSelected = controller.selectedId;controller.addListener(() {if (_reading.drawsSaved && generation == _generation) {@@ -497,6 +513,8 @@ class SuperTabClient {final change = (lastChangedAt: controller.lastChangedAt,mentionsWaiting: snapshot.mentionsWaiting,+ // What needs the person moves the Dock's badge.+ decisionsWaiting: snapshot.decisionsWaiting,// A read mark or a PM chat's messages move the Swarm badge too.pmUnread: controller.pmUnread,);@@ -510,6 +528,10 @@ class SuperTabClient {SuperTabMentions.of(controller)..seen(_tagsSeen.remove(id))..onArrived = onMention;+ if (onNotices case final changed?) {+ SuperTabMentions.of(controller).addListener(changed);+ SuperTabDecisions.of(controller).addListener(changed);+ }_tagCounts.remove(id);_loaded[id] = controller;void drawSaved(Map<String, dynamic>? view) {diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dartindex a388f08a4..692ed483c 100644--- a/desktop/lib/super_tabs/controller.dart+++ b/desktop/lib/super_tabs/controller.dart@@ -881,6 +881,18 @@ class SuperTabController extends ChangeNotifier {: state.projects.firstOrNull?.id;}+ /// A tag or decision the menu bar asked to open ([openNotice]), until the+ /// Swarm view on screen takes it.+ ({String kind, String id})? noticeRequest;++ /// Opens the reader's tag (`mention`) at its message, or shows their+ /// decisions (`decision`) where they are answered, in the view on screen,+ /// or the one shown next.+ void openNotice(String kind, String id) {+ noticeRequest = (kind: kind, id: id);+ notifyListeners();+ }+/// Set by the Swarm view on screen: opens a project's PM chat in front of/// whatever covers the conversation, Notifications or a terminal.Future<bool> Function(String projectId)? pmChatOpener;diff --git a/desktop/lib/super_tabs/local_models.dart b/desktop/lib/super_tabs/local_models.dartindex e80da1516..b7278d38c 100644--- a/desktop/lib/super_tabs/local_models.dart+++ b/desktop/lib/super_tabs/local_models.dart@@ -161,7 +161,7 @@ class _SwarmModelsWindowState extends State<_SwarmModelsWindow> {textBaseline: TextBaseline.alphabetic,children: [Text(- 'Manage models',+ 'Your models',style: DesktopChrome.text(size: 15,medium: true,diff --git a/desktop/lib/super_tabs/machine_icon.dart b/desktop/lib/super_tabs/machine_icon.dartnew file mode 100644index 000000000..3ae3c491d--- /dev/null+++ b/desktop/lib/super_tabs/machine_icon.dart@@ -0,0 +1,99 @@+import 'dart:typed_data';++import 'package:flutter/widgets.dart';++import '../core/system_symbols.dart';+import '../shared/theme/app_icons.dart';++/// The SF Symbol for a machine of [deviceType], as the machine reports it+/// (`MacBook Pro`, `Mac Studio`, a PC's product name): each Mac its own shape,+/// anything else, or nothing known, a plain display.+String superTabMachineSymbol(String? deviceType) {+ final type = deviceType?.trim().toLowerCase() ?? '';+ if (type.startsWith('macbook')) return 'laptopcomputer';+ if (type.startsWith('mac studio')) return 'macstudio';+ if (type.startsWith('mac mini')) return 'macmini';+ if (type.startsWith('imac')) return 'desktopcomputer';+ return 'display';+}++/// A machine row's leading mark: AppKit's symbol for its type on a Mac, the+/// catalogue's laptop or display everywhere else, and while or when AppKit+/// has no picture for it. Never empty.+class SuperTabMachineIcon extends StatefulWidget {+ const SuperTabMachineIcon({+ super.key,+ required this.deviceType,+ required this.color,+ this.size = AppIcons.inlineSize,+ this.symbols,+ });++ final String? deviceType;+ final Color color;+ final double size;++ /// Where the symbols come from; [SystemSymbols.shared] when not given.+ final SystemSymbols? symbols;++ @override+ State<SuperTabMachineIcon> createState() => _SuperTabMachineIconState();+}++class _SuperTabMachineIconState extends State<SuperTabMachineIcon> {+ Uint8List? _png;+ String? _asked;++ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ _ask();+ }++ @override+ void didUpdateWidget(SuperTabMachineIcon oldWidget) {+ super.didUpdateWidget(oldWidget);+ _ask();+ }++ void _ask() {+ final symbols = widget.symbols ?? SystemSymbols.shared;+ final name = superTabMachineSymbol(widget.deviceType);+ final size = widget.size;+ final scale = MediaQuery.devicePixelRatioOf(context);+ final asked = '$name@$size@$scale';+ if (asked == _asked) return;+ _asked = asked;+ _png = symbols.drawn(name, size: size, scale: scale);+ if (_png != null || !symbols.available) return;+ symbols.png(name, size: size, scale: scale).then((png) {+ if (mounted && _asked == asked && png != null) setState(() => _png = png);+ });+ }++ @override+ Widget build(BuildContext context) {+ final fallback = Icon(+ superTabMachineSymbol(widget.deviceType) == 'laptopcomputer'+ ? AppIcons.laptop+ : AppIcons.monitor,+ size: widget.size,+ color: widget.color,+ );+ final png = _png;+ if (png == null) return fallback;+ return Image.memory(+ png,+ width: widget.size,+ height: widget.size,+ color: widget.color,+ colorBlendMode: BlendMode.srcIn,+ gaplessPlayback: true,+ excludeFromSemantics: true,+ // Until its first frame decodes, the catalogue's icon holds the place.+ frameBuilder: (_, child, frame, synchronous) =>+ frame == null && !synchronous ? fallback : child,+ errorBuilder: (_, _, _) => fallback,+ );+ }+}diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dartindex 52dd2a09b..d8816e064 100644--- a/desktop/lib/super_tabs/machines.dart+++ b/desktop/lib/super_tabs/machines.dart@@ -29,6 +29,7 @@ import 'identity.dart';import 'local_models.dart';import '../models/swarm_models_target.dart' show swarmSharedWithYouShown;import 'machine_details.dart';+import 'machine_icon.dart';import 'machine_status.dart';import 'model.dart';import 'team_account_setup.dart';@@ -2193,16 +2194,14 @@ class _MachineLine extends StatelessWidget {child: Row(children: [const SizedBox(width: 4),- // A machine reads as a home directory, "~ Diego's Mac", beside the- // sidebar's "# project" channels.+ // A machine leads with what it is, a MacBook, a Mac Studio, beside+ // the sidebar's "# project" channels; dimmed with its name.SizedBox(width: 32,- child: Text(- '~',- textAlign: TextAlign.center,- style: DesktopChrome.control(- color: DesktopChrome.muted,- medium: true,+ child: Center(+ child: SuperTabMachineIcon(+ deviceType: view.resources?.deviceType,+ color: muted ? DesktopChrome.muted : DesktopChrome.foreground,),),),diff --git a/desktop/lib/super_tabs/notifications.dart b/desktop/lib/super_tabs/notifications.dartindex 395224fd5..e51dc3044 100644--- a/desktop/lib/super_tabs/notifications.dart+++ b/desktop/lib/super_tabs/notifications.dart@@ -1,6 +1,7 @@import 'dart:async';-import 'package:flutter/foundation.dart' show kIsWeb;+import 'package:flutter/foundation.dart'+ show TargetPlatform, defaultTargetPlatform, kIsWeb;import 'package:flutter/material.dart';import '../notify/system_notifications.dart';@@ -38,6 +39,12 @@ class SuperTabMention {final String? resolvedBy;}+/// Whether the menu bar's Harness menu lists the reader's tags and decisions,+/// with their count on the Dock: the Mac app's. Elsewhere the Swarm's sidebar+/// keeps its Notifications row.+bool get superTabNoticesInMenuBar =>+ !kIsWeb && defaultTargetPlatform == TargetPlatform.macOS;+/// What tells the person about a new tag outside the window: the operating/// system, on Desktop only. The web shows only the badge and the list (spec/// decision 6). The Settings switch for system notifications still applies.@@ -76,6 +83,7 @@ class SuperTabMentions extends ChangeNotifier {String? error;int? _count;int _lastChangedAt = -1;+ int? _epoch;// Null until the first read: tags waiting then are not news.Set<String>? _seen;Future<void>? _loading;@@ -96,6 +104,23 @@ class SuperTabMentions extends ChangeNotifier {void _changed() {final snapshot = controller.snapshot;if (snapshot == null) return;+ final epoch = controller.visibilityEpoch;+ if (epoch != null && epoch != _epoch) {+ final moved = _epoch != null;+ _epoch = epoch;+ if (moved) {+ // Who may read what changed: no tag read before shows until read+ // again, even while the count stays, as the decisions do.+ if (waiting.isNotEmpty || earlier.isNotEmpty) {+ waiting = earlier = const [];+ notifyListeners();+ }+ _lastChangedAt = controller.lastChangedAt;+ _count = snapshot.mentionsWaiting;+ unawaited(load());+ return;+ }+ }// A tag that expires moves the count without changing the Swarm.final count = snapshot.mentionsWaiting;final moved = count != _count;@@ -139,11 +164,15 @@ class SuperTabMentions extends ChangeNotifier {}Future<void> _read() async {+ final epoch = _epoch;try {final [nextWaiting, nextEarlier] = await Future.wait([_list('waiting'),_list('earlier'),]);+ // Read before who may read what changed: the read asked again since+ // replaces it.+ if (epoch != _epoch) return;waiting = nextWaiting;earlier = nextEarlier;error = null;@@ -155,6 +184,7 @@ class SuperTabMentions extends ChangeNotifier {}}} catch (_) {+ if (epoch != _epoch) return;error = 'Could not load notifications. Try again.';}notifyListeners();diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dartindex de314bdea..098291f6f 100644--- a/desktop/lib/super_tabs/project_sidebar.dart+++ b/desktop/lib/super_tabs/project_sidebar.dart@@ -488,24 +488,24 @@ class ProjectSidebar extends StatelessWidget {icon: AppIcons.plus,onTap: controller.canWrite ? onNewProject : null,),+ if (onYourDevices != null)+ _navigationRow(+ key: 'super-your-devices',+ label: 'Your devices',+ icon: AppIcons.circle,+ onTap: onYourDevices,+ selected: devicesSelected,+ ),// The Swarm's models (docs/plans/2026-10-23-swarm-local-models.md), for everyone: the owner sets them up here,// and everyone runs and shares models here once they are. What each machine offers is on the machine.if (snapshot != null)_navigationRow(key: 'super-local-models',- label: 'Manage models',+ label: 'Your models',icon: AppIcons.brain,onTap: () =>showSwarmLocalModels(context, controller, app: app, now: now),),- if (onYourDevices != null)- _navigationRow(- key: 'super-your-devices',- label: 'Your devices',- icon: AppIcons.circle,- onTap: onYourDevices,- selected: devicesSelected,- ),if (onNotifications != null)_navigationRow(key: 'super-notifications',diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 98dddf92a..e9c88cd48 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -221,6 +221,7 @@ class _SuperTabViewState extends State<SuperTabView>void _changed() {if (!mounted) return;+ _takeNotice();if (c.accessRevoked) {_replies.clear();_newAfter.clear();@@ -1036,14 +1037,18 @@ class _SuperTabViewState extends State<SuperTabView>onNewProject: widget.onNewProject,devicesSelected: _devicesVisible,notificationsSelected: _notificationsVisible,- onNotifications: () {- _closeSidebar();- setState(() {- _showNotifications = true;- _showPullRequests = false;- });- widget.onCloseTerminal?.call();- },+ // On a Mac what needs the person is in the menu bar's Harness menu and on+ // the Dock's badge, so the sidebar keeps no Notifications row.+ onNotifications: superTabNoticesInMenuBar+ ? null+ : () {+ _closeSidebar();+ setState(() {+ _showNotifications = true;+ _showPullRequests = false;+ });+ widget.onCloseTerminal?.call();+ },onOpenAgent: (agent) {_closeSidebar();setState(() {@@ -1080,6 +1085,24 @@ class _SuperTabViewState extends State<SuperTabView>return c.openPmChat(projectId);}+ /// What the menu bar asked to open ([SuperTabController.openNotice]): a tag+ /// at its message, a decision on the Notifications page where it is answered.+ void _takeNotice() {+ final request = c.noticeRequest;+ if (request == null || c.snapshot == null) return;+ c.noticeRequest = null;+ widget.onCloseTerminal?.call();+ setState(() {+ _showNotifications = true;+ _showPullRequests = false;+ });+ if (request.kind != 'mention') return;+ final mention = SuperTabMentions.of(c).waiting+ .where((m) => m.id == request.id)+ .firstOrNull;+ if (mention != null) unawaited(_openMention(mention));+ }+bool get _notificationsVisible =>_showNotifications && !_devicesVisible && !c.accessRevoked;diff --git a/desktop/lib/widgets/api_picker_form.dart b/desktop/lib/widgets/api_picker_form.dartindex 3f0b6d898..a1a26b7b2 100644--- a/desktop/lib/widgets/api_picker_form.dart+++ b/desktop/lib/widgets/api_picker_form.dart@@ -33,7 +33,7 @@ class ApiPickerForm extends StatefulWidget {final String? connectionId;final bool removing;- /// In a Swarm's Manage models: how many of this API's models are shared with the Swarm, which stop when it is+ /// In a Swarm's Your models: how many of this API's models are shared with the Swarm, which stop when it is/// deleted (the CLI takes them off first). Null elsewhere.final int? swarmShares;final ValueChanged<String?> onClose;diff --git a/desktop/lib/widgets/swarm_model_tile.dart b/desktop/lib/widgets/swarm_model_tile.dartindex cbc478b08..5b44466a8 100644--- a/desktop/lib/widgets/swarm_model_tile.dart+++ b/desktop/lib/widgets/swarm_model_tile.dart@@ -7,7 +7,7 @@ import '../state/swarm_navigation.dart';import '../state/swarm_search.dart';import 'desktop_chrome.dart';-/// What a row of a Swarm's Manage models is, which its mark says at a glance.+/// What a row of a Swarm's Your models is, which its mark says at a glance.enum SwarmModelKind { api, apiModel, local, live, get, add, more, shared }SwarmModelKind swarmModelKind(diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dartindex f604c1eb4..b137f9b5b 100644--- a/desktop/lib/widgets/swarm_resource_preview.dart+++ b/desktop/lib/widgets/swarm_resource_preview.dart@@ -698,7 +698,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {List<_ResourceAction> _visibleActions() => [..._actions(),- // A Swarm's Manage models has no Actions menu: an API's other actions, Edit and Delete, are beside its button.+ // A Swarm's Your models has no Actions menu: an API's other actions, Edit and Delete, are beside its button.// Delete asks first, as ⌘I's does; the CLI takes the API off every Swarm it is shared with before removing it.if (_swarmCards) ...[if (model?.api case final api? when model?.apiModel == null) ...[@@ -1375,7 +1375,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {];}- /// The preview is a Swarm's Manage models, drawn as a card of its own rather than ⌘I's lines.+ /// The preview is a Swarm's Your models, drawn as a card of its own rather than ⌘I's lines.bool get _swarmCards =>widget.search.isSwarmModels && DesktopChrome.of(context);diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex e7fc41054..7af793a7c 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -1047,7 +1047,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {? oneLine.clamp(48, double.infinity): _twoLineRowHeight;}- // A Swarm's Manage models: two lines a row (its name, then what it is), under headings that read as headings.+ // A Swarm's Your models: two lines a row (its name, then what it is), under headings that read as headings.final swarmRows = desktop && search.isSwarmModels;if (swarmRows) {_rowHeight = math.max(@@ -2752,7 +2752,7 @@ class SwarmSearchCount extends StatelessWidget {}}-/// A section heading of a Swarm's Manage models: its title, how many it holds, a rule, and a note at the right.+/// A section heading of a Swarm's Your models: its title, how many it holds, a rule, and a note at the right.class _SwarmModelHeading extends StatelessWidget {const _SwarmModelHeading({super.key,@@ -2838,7 +2838,7 @@ class _SwarmModelHeading extends StatelessWidget {}}-/// A row of a Swarm's Manage models: its mark, its name over what it is, and what it is to the Swarm.+/// A row of a Swarm's Your models: its mark, its name over what it is, and what it is to the Swarm.class _SwarmModelRow extends StatelessWidget {const _SwarmModelRow({required this.search,diff --git a/desktop/macos/Runner/HarnessStatusMenu.swift b/desktop/macos/Runner/HarnessStatusMenu.swiftindex a18b2eb93..c0e9b085e 100644--- a/desktop/macos/Runner/HarnessStatusMenu.swift+++ b/desktop/macos/Runner/HarnessStatusMenu.swift@@ -8,6 +8,8 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {private(set) var statusItem: NSStatusItem?private var entries: [[String: Any]] = []private var working: [[String: Any]] = []+ /// What needs the person in their Swarms: decisions asked of them, then tags waiting for them.+ private var swarm: [[String: Any]] = []private var activityTimer: Timer?private var motionObserver: NSObjectProtocol?private var reduceMotion = false@@ -58,14 +60,17 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {let nextEntries = (state["statusMenuEntries"] as? [[String: Any]] ?? []).filter { $0["unread"] as? Bool == true }let nextWorking = state["statusMenuWorkingEntries"] as? [[String: Any]] ?? []+ let nextSwarm = nextAvailable ? state["statusMenuSwarmEntries"] as? [[String: Any]] ?? [] : []guard dirty || enabled != nextEnabled || workspaceAvailable != nextAvailable ||!NSArray(array: entries).isEqual(to: nextEntries) ||- !NSArray(array: working).isEqual(to: nextWorking) else { return }+ !NSArray(array: working).isEqual(to: nextWorking) ||+ !NSArray(array: swarm).isEqual(to: nextSwarm) else { return }enabled = nextEnabledworkspaceAvailable = nextAvailableentries = nextEntriesworking = nextAvailable ? nextWorking : []- let count = entries.count+ swarm = nextSwarm+ let count = entries.count + swarm.countstatusItem?.button?.image = Self.badgeImage(logo: NSImage(named: "HarnessStatusIcon"),count: workspaceAvailable ? count : nil)statusItem?.button?.toolTip = workspaceAvailable ? "Harness · \(count) unread" : "Harness"@@ -170,6 +175,39 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {add("View all \(entries.count) notifications…", "notificationInbox", enabled: enabled)}}+ if workspaceAvailable && !swarm.isEmpty {+ // By Swarm, in Dart's order: each its own five rows and View all, so a+ // second Swarm's items are never behind the first's overflow.+ var groups: [[[String: Any]]] = []+ for entry in swarm {+ if let last = groups.last?.last, last["swarmTabId"] as? String == entry["swarmTabId"] as? String {+ groups[groups.count - 1].append(entry)+ } else {+ groups.append([entry])+ }+ }+ menu.addItem(.separator())+ for group in groups {+ // One Swarm reads "Swarm"; several are told apart by name.+ let name = groups.count == 1 ? "Swarm" : group.first?["tabName"] as? String ?? "Swarm"+ let heading = NSMenuItem(title: "\(name) (\(group.count))", action: nil, keyEquivalent: "")+ heading.identifier = NSUserInterfaceItemIdentifier("swarmHeading")+ heading.isEnabled = false+ heading.view = HarnessStatusMenuRow(item: heading, heading: name, count: group.count)+ menu.addItem(heading)+ for entry in group.prefix(5) {+ let item = addSession(entry, to: menu)+ item.identifier = NSUserInterfaceItemIdentifier("openSwarmNotice")+ item.isEnabled = enabled+ }+ if group.count > 5, let first = group.first {+ // That Swarm's Notifications page, which lists them all.+ let swarmName = first["tabName"] as? String ?? "Swarm"+ let all = add("View all \(group.count) in \(swarmName)…", "openSwarmNotice", enabled: enabled)+ all.representedObject = ["swarmTabId": first["swarmTabId"] ?? "", "kind": "all", "id": ""]+ }+ }+ }if workspaceAvailable && !working.isEmpty {menu.addItem(.separator())let heading = NSMenuItem(title: "Working (\(working.count))", action: nil, keyEquivalent: "")@@ -224,6 +262,11 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {// Dart opens the destination before revealing the window, so activating// the previously selected tab cannot acknowledge the wrong notification.emit(action, receipt)+ case "openSwarmNotice":+ // Dart brings its Swarm tab forward and opens it, then reveals the window.+ guard enabled, let receipt = item.representedObject as? [String: Any],+ swarm.contains(where: { sameSwarmNotice($0, receipt) }) else { return }+ emit(action, receipt)case "clearStatusNotifications":guard enabled, let receipts = item.representedObject as? [[String: Any]] else { return }emit(action, ["receipts": receipts])@@ -239,6 +282,12 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {}}+ private func sameSwarmNotice(_ current: [String: Any], _ displayed: [String: Any]) -> Bool {+ current["swarmTabId"] as? String == displayed["swarmTabId"] as? String &&+ (displayed["kind"] as? String == "all" ||+ ["kind", "id"].allSatisfy { current[$0] as? String == displayed[$0] as? String })+ }+private func sameReceipt(_ current: [String: Any], _ displayed: [String: Any]) -> Bool {["machineId", "agentId", "sessionId", "readToken", "questionId"].allSatisfy {current[$0] as? String == displayed[$0] as? Stringdiff --git a/desktop/macos/Runner/MainFlutterWindow.swift b/desktop/macos/Runner/MainFlutterWindow.swiftindex 359fd5b47..65d3e762b 100644--- a/desktop/macos/Runner/MainFlutterWindow.swift+++ b/desktop/macos/Runner/MainFlutterWindow.swift@@ -20,11 +20,17 @@ private let kClipboardImageChannel = "harness/clipboard_image"/// `system_profiler SPFontsDataType` takes ~10s, and it can say which families are monospaced.private let kFontsChannel = "harness/fonts"+/// Channel Dart asks for an SF Symbol drawn as a one-ink PNG, which it tints itself+/// (`lib/core/system_symbols.dart`): a Swarm's machine rows show each Mac's own shape. A name+/// this macOS lacks answers nil, and Dart draws its catalogue icon instead.+private let kSystemSymbolsChannel = "harness/system_symbols"+class MainFlutterWindow: NSWindow {private var swarmTitlebar: SwarmTitlebar?private var menuChannel: FlutterMethodChannel?private var clipboardImageChannel: FlutterMethodChannel?private var fontsChannel: FlutterMethodChannel?+ private var systemSymbolsChannel: FlutterMethodChannel?private var notifications: HarnessNotifications?override func awakeFromNib() {@@ -48,6 +54,7 @@ class MainFlutterWindow: NSWindow {swarmTitlebar = SwarmTitlebar(window: self, messenger: flutterViewController.engine.binaryMessenger)installClipboardImageChannel(messenger: flutterViewController.engine.binaryMessenger)installFontsChannel(messenger: flutterViewController.engine.binaryMessenger)+ installSystemSymbolsChannel(messenger: flutterViewController.engine.binaryMessenger)notifications = HarnessNotifications(messenger: flutterViewController.engine.binaryMessenger)// Flutter's own theme does not reach AppKit — every native surface (the@@ -387,6 +394,53 @@ class MainFlutterWindow: NSWindow {return advances.allSatisfy { abs($0.width - first) < 0.01 }}+ private func installSystemSymbolsChannel(messenger: FlutterBinaryMessenger) {+ let channel = FlutterMethodChannel(name: kSystemSymbolsChannel, binaryMessenger: messenger)+ channel.setMethodCallHandler { call, result in+ guard call.method == "png" else {+ result(FlutterMethodNotImplemented)+ return+ }+ let args = call.arguments as? [String: Any] ?? [:]+ guard let name = args["name"] as? String, !name.isEmpty, name.count <= 64,+ let size = args["size"] as? Double, size > 0, size <= 64,+ let scale = args["scale"] as? Double, scale > 0, scale <= 4,+ let png = MainFlutterWindow.systemSymbolPng(name, size: CGFloat(size), scale: CGFloat(scale))+ else {+ result(nil)+ return+ }+ result(FlutterStandardTypedData(bytes: png))+ }+ systemSymbolsChannel = channel+ }++ /// [name] in one ink (black on clear), fitted and centred in a [size]-point square at [scale]+ /// pixels a point, as a PNG. Nil when this macOS has no such symbol.+ static func systemSymbolPng(_ name: String, size: CGFloat, scale: CGFloat) -> Data? {+ var configuration = NSImage.SymbolConfiguration(pointSize: size, weight: .regular)+ if #available(macOS 13.0, *) { configuration = configuration.applying(.preferringMonochrome()) }+ guard let symbol = NSImage(systemSymbolName: name, accessibilityDescription: nil)?+ .withSymbolConfiguration(configuration),+ symbol.size.width > 0, symbol.size.height > 0 else { return nil }+ let pixels = Int((size * scale).rounded())+ guard let bitmap = NSBitmapImageRep(+ bitmapDataPlanes: nil, pixelsWide: pixels, pixelsHigh: pixels, bitsPerSample: 8,+ samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB,+ bytesPerRow: 0, bitsPerPixel: 0) else { return nil }+ // Points before the context: it draws at the bitmap's scale only once it knows its size.+ bitmap.size = NSSize(width: size, height: size)+ guard let context = NSGraphicsContext(bitmapImageRep: bitmap) else { return nil }+ let fit = min(size / symbol.size.width, size / symbol.size.height)+ let drawn = NSSize(width: symbol.size.width * fit, height: symbol.size.height * fit)+ NSGraphicsContext.saveGraphicsState()+ NSGraphicsContext.current = context+ symbol.draw(in: NSRect(x: (size - drawn.width) / 2, y: (size - drawn.height) / 2,+ width: drawn.width, height: drawn.height))+ NSGraphicsContext.restoreGraphicsState()+ return bitmap.representation(using: .png, properties: [:])+ }+private func installClipboardImageChannel(messenger: FlutterBinaryMessenger) {let channel = FlutterMethodChannel(name: kClipboardImageChannel, binaryMessenger: messenger)channel.setMethodCallHandler { call, result indiff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex bd4019979..a13621f6d 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -112,6 +112,10 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {self.updateHistory(state["history"] as? [[String: Any]] ?? [], closed: state["closedHistory"] as? [[String: Any]] ?? [])self.strip.update(state)self.statusMenu?.update(state)+ // What needs the person in their Swarms; none, or no workspace, clears it.+ let badge = state["dockBadge"] as? Int ?? 0+ let label: String? = badge > 0 ? String(badge) : nil+ if NSApp.dockTile.badgeLabel != label { NSApp.dockTile.badgeLabel = label }self.statusBarHeight?.constant = self.strip.preferredStatusBarHeight// A new background repaints the whole window, title bar included: only on a change.if let window = self.window, window.backgroundColor != self.strip.palette.tabBar {diff --git a/desktop/test/api_connections_test.dart b/desktop/test/api_connections_test.dartindex 8be4cd0d9..f5336b439 100644--- a/desktop/test/api_connections_test.dart+++ b/desktop/test/api_connections_test.dart@@ -567,7 +567,7 @@ void main() {expect(field('API key'), findsOneWidget);expect(find.text('Qwen3.8-27B'), findsNothing);expect(find.text('Subscriptions'), findsNothing);- expect(find.text('Manage models'), findsNothing);+ expect(find.text('Your models'), findsNothing);await tester.tap(find.byKey(const ValueKey('models-tab-all')));await tester.pump();expect(field('API key'), findsOneWidget);diff --git a/desktop/test/models_panel_test.dart b/desktop/test/models_panel_test.dartindex e8c9fac9b..fab28e7db 100644--- a/desktop/test/models_panel_test.dart+++ b/desktop/test/models_panel_test.dart@@ -668,7 +668,7 @@ void main() {expect(find.text('Qwen3.8-27B'), findsNothing);expect(find.text('gemma-4-12B'), findsNothing);}- await tester.tap(find.text('Manage models'));+ await tester.tap(find.text('Your models'));expect(manages, 1);await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();diff --git a/desktop/test/new_harness_models_test.dart b/desktop/test/new_harness_models_test.dartindex 416863bb2..3352642de 100644--- a/desktop/test/new_harness_models_test.dart+++ b/desktop/test/new_harness_models_test.dart@@ -711,7 +711,7 @@ void main() {await tester.pumpAndSettle();expect(connections['m']!.modelReads, greaterThan(beforeRefresh));await tester.scrollUntilVisible(- find.text('Manage Models…'),+ find.text('Your models…'),60,scrollable: find.descendant(of: find.byKey(const ValueKey('new-harness-choices')),@@ -722,7 +722,7 @@ void main() {),),);- await tester.tap(find.text('Manage Models…'));+ await tester.tap(find.text('Your models…'));await tester.pumpAndSettle();expect(managed, 1);await startHarness(tester);diff --git a/desktop/test/new_harness_scenarios_test.dart b/desktop/test/new_harness_scenarios_test.dartindex 428904f04..f6657c2d5 100644--- a/desktop/test/new_harness_scenarios_test.dart+++ b/desktop/test/new_harness_scenarios_test.dart@@ -1431,7 +1431,7 @@ void main() {);testWidgets(- 'controller-selected Model opens its row and Manage Models uses the app door',+ 'controller-selected Model opens its row and Your models uses the app door',(tester) async {final scenario = await _mount(tester, git: false, editProject: false);var requests = 0;diff --git a/desktop/test/resting_models_panel_test.dart b/desktop/test/resting_models_panel_test.dartindex 7b37ba254..68e1fe4bd 100644--- a/desktop/test/resting_models_panel_test.dart+++ b/desktop/test/resting_models_panel_test.dart@@ -133,7 +133,7 @@ void main() {'DeepSeek-V4-Flash','scholes-60001','Select models in a harness’s model picker.',- 'Manage models',+ 'Your models',]);});diff --git a/desktop/test/super_tab_machine_freshness_test.dart b/desktop/test/super_tab_machine_freshness_test.dartindex 9e9fa0141..7e7a54cec 100644--- a/desktop/test/super_tab_machine_freshness_test.dart+++ b/desktop/test/super_tab_machine_freshness_test.dart@@ -240,7 +240,7 @@ void main() {expect(tipOf(tester, 'm'), tip);expect(labelOf(tester, 'm'), 'Studio Mac, Live, $tip');// Collapsed: name and owner avatar, with readings reserved for disclosure.- expect(textsOf('m'), ['~', 'Studio Mac', 'O']);+ expect(textsOf('m'), ['Studio Mac', 'O']);expect(nameInkOf(tester, 'm'), isNot(DesktopChrome.muted));expect(find.byType(SuperTabMachinesPill), findsNothing);@@ -264,7 +264,7 @@ void main() {labelOf(tester, 'm'),startsWith('Studio Mac, Late, Owned by owner'),);- expect(textsOf('m'), ['~', 'Studio Mac', 'O']);+ expect(textsOf('m'), ['Studio Mac', 'O']);semantics.dispose();await tester.pumpWidget(const SizedBox());@@ -318,7 +318,7 @@ void main() {const tip = 'Offline · Owned by owner';expect(tipOf(tester, 'm'), tip);expect(labelOf(tester, 'm'), 'Studio Mac, Offline, $tip');- expect(textsOf('m'), ['~', 'Studio Mac', 'O']);+ expect(textsOf('m'), ['Studio Mac', 'O']);expect(find.byType(SuperTabMachinesPill), findsNothing);// Opened, it stays open: saved with the Swarm's other sidebar state.@@ -429,7 +429,7 @@ void main() {const tip = 'Refreshing… · Owned by owner';expect(tipOf(tester, 'far'), tip);expect(labelOf(tester, 'far'), 'Far Mac, Refreshing, $tip');- expect(textsOf('far'), ['~', 'Far Mac', 'O']);+ expect(textsOf('far'), ['Far Mac', 'O']);gate.complete();await landed(tester);diff --git a/desktop/test/super_tab_machine_icon_test.dart b/desktop/test/super_tab_machine_icon_test.dartnew file mode 100644index 000000000..ee346f07f--- /dev/null+++ b/desktop/test/super_tab_machine_icon_test.dart@@ -0,0 +1,213 @@+import 'dart:convert';++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/system_symbols.dart';+import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/super_tabs/machine_icon.dart';+import 'package:harness/super_tabs/machines.dart';+import 'package:harness/widgets/desktop_chrome.dart';++import 'support/super_tab_fixture.dart';++/// A real 1×1 PNG, so the image decodes as AppKit's would.+final _png = base64Decode(+ 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=',+);++/// Answers the AppKit channel as a Mac would: [missing] names have no symbol.+List<String> fakeAppKit({Set<String> missing = const {}, bool fail = false}) {+ final asked = <String>[];+ TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger+ .setMockMethodCallHandler(+ const MethodChannel(SystemSymbols.channelName),+ (call) async {+ expect(call.method, 'png');+ final name = (call.arguments as Map)['name'] as String;+ asked.add(name);+ if (fail) throw PlatformException(code: 'BROKEN');+ return missing.contains(name) ? null : _png;+ },+ );+ addTearDown(+ () => TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger+ .setMockMethodCallHandler(+ const MethodChannel(SystemSymbols.channelName),+ null,+ ),+ );+ return asked;+}++Future<void> showIcon(+ WidgetTester tester,+ String? deviceType,+ SystemSymbols symbols,+) async {+ await tester.pumpWidget(+ MaterialApp(+ home: Center(+ child: SuperTabMachineIcon(+ deviceType: deviceType,+ color: const Color(0xFF123456),+ symbols: symbols,+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+}++/// What the icon draws: an AppKit symbol's picture, or a catalogue icon.+Object drawn(WidgetTester tester) {+ final images = find.descendant(+ of: find.byType(SuperTabMachineIcon),+ matching: find.byType(Image),+ );+ if (images.evaluate().isNotEmpty) return 'symbol';+ return tester+ .widget<Icon>(+ find.descendant(+ of: find.byType(SuperTabMachineIcon),+ matching: find.byType(Icon),+ ),+ )+ .icon!;+}++void main() {+ test('each Mac draws its own symbol; anything else a plain display', () {+ expect(superTabMachineSymbol('MacBook Pro'), 'laptopcomputer');+ expect(superTabMachineSymbol('MacBook Air'), 'laptopcomputer');+ expect(superTabMachineSymbol('MacBook'), 'laptopcomputer');+ expect(superTabMachineSymbol('Mac Studio'), 'macstudio');+ expect(superTabMachineSymbol('Mac mini'), 'macmini');+ expect(superTabMachineSymbol('iMac'), 'desktopcomputer');+ expect(superTabMachineSymbol('Mac Pro'), 'display');+ expect(superTabMachineSymbol('ThinkPad X1 Carbon Gen 11'), 'display');+ expect(superTabMachineSymbol(''), 'display');+ expect(superTabMachineSymbol(null), 'display');+ });++ testWidgets('on a Mac the symbol is AppKit\'s own, in the row\'s ink', (+ tester,+ ) async {+ final asked = fakeAppKit();+ await showIcon(tester, 'Mac Studio', SystemSymbols());+ expect(asked, ['macstudio']);+ expect(drawn(tester), 'symbol');+ final image = tester.widget<Image>(find.byType(Image));+ expect(image.color, const Color(0xFF123456));+ expect(image.colorBlendMode, BlendMode.srcIn);+ expect(image.width, 16);+ expect(image.height, 16);+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));++ testWidgets(+ 'while AppKit\'s picture decodes, the catalogue\'s icon holds its place',+ (tester) async {+ fakeAppKit();+ await showIcon(tester, 'Mac Studio', SystemSymbols());+ // A widget test never decodes an image outside runAsync: still decoding.+ expect(find.byType(Image), findsOneWidget);+ expect(find.byIcon(AppIcons.monitor), findsOneWidget);+ },+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),+ );++ testWidgets(+ 'a symbol this macOS lacks, or a channel that fails, draws the catalogue\'s',+ (tester) async {+ fakeAppKit(missing: {'macstudio'});+ await showIcon(tester, 'Mac Studio', SystemSymbols());+ expect(drawn(tester), AppIcons.monitor);++ fakeAppKit(fail: true);+ await showIcon(tester, 'MacBook Air', SystemSymbols());+ expect(drawn(tester), AppIcons.laptop);+ expect(tester.takeException(), isNull);+ },+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),+ );++ testWidgets(+ 'off a Mac AppKit is never asked: a laptop or a display from the catalogue',+ (tester) async {+ final asked = fakeAppKit();+ await showIcon(tester, 'MacBook Pro', SystemSymbols());+ expect(drawn(tester), AppIcons.laptop);+ await showIcon(tester, null, SystemSymbols());+ expect(drawn(tester), AppIcons.monitor);+ expect(asked, isEmpty);+ },+ variant: TargetPlatformVariant.only(TargetPlatform.linux),+ );++ testWidgets(+ 'each machine row leads with its type\'s icon, dimmed while offline, '+ 'instead of ~',+ (tester) async {+ final asked = fakeAppKit();+ final now = DateTime.now().millisecondsSinceEpoch;+ final server = ConversationServer();+ server.state['agents'] = <Object>[];+ server.state['machines'] = [+ {+ 'machineId': 'studio',+ 'name': 'Studio',+ 'contributorId': 'owner',+ 'observation': {+ 'receivedAt': now,+ 'resources': {'deviceType': 'Mac Studio'},+ },+ },+ {+ 'machineId': 'air',+ 'name': 'Air',+ 'contributorId': 'owner',+ 'observation': {+ 'receivedAt': now - const Duration(hours: 3).inMilliseconds,+ 'resources': {'deviceType': 'MacBook Air'},+ },+ },+ {'machineId': 'linux', 'name': 'Box', 'contributorId': 'owner'},+ ];+ final c = server.controller();+ await c.refresh();+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: SizedBox(+ width: 300,+ height: 600,+ child: SuperTabMachines(+ controller: c,+ embedded: true,+ onAddAgent: (_) {},+ ),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ SuperTabMachineIcon iconOf(String id) => tester.widget(+ find.descendant(+ of: find.byKey(ValueKey('super-machine-$id')),+ matching: find.byType(SuperTabMachineIcon),+ ),+ );+ expect(find.text('~'), findsNothing);+ expect(iconOf('studio').deviceType, 'Mac Studio');+ expect(iconOf('studio').color, DesktopChrome.foreground);+ expect(iconOf('air').deviceType, 'MacBook Air');+ expect(iconOf('air').color, DesktopChrome.muted);+ expect(iconOf('linux').deviceType, isNull);+ expect(asked.toSet(), {'macstudio', 'laptopcomputer', 'display'});+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),+ );+}diff --git a/desktop/test/super_tab_mentions_test.dart b/desktop/test/super_tab_mentions_test.dartindex 1bcf8efce..5f6efa858 100644--- a/desktop/test/super_tab_mentions_test.dart+++ b/desktop/test/super_tab_mentions_test.dart@@ -18,6 +18,7 @@ import 'package:harness/super_tabs/view.dart';import 'support/super_tab_fixture.dart';import 'box_render_preview_test.dart' show loadPreviewFonts;+import 'super_tab_decisions_test.dart' show swarm;import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;import 'swarm_screen_test.dart' show mount;import 'swarm_state_test.dart' show MemoryStore;@@ -171,6 +172,64 @@ void main() {});group('notification list', () {+ /// The reader leaves the private chat their tag is in, and the Lead tags+ /// them elsewhere: one still waits. Who may read what moved.+ void leaveChatTaggedElsewhere(ConversationServer server) {+ final pmChat = (server.state['conversations'] as List)+ .cast<Map<String, dynamic>>()+ .firstWhere((g) => g['id'] == 'pm-chat');+ pmChat['audience'] = {'people': <Object>[]};+ server.mentions.removeWhere((m) => m['conversationId'] == 'pm-chat');+ server.state['mentionsWaiting'] =+ (server.state['mentionsWaiting'] as int) - 1;+ server.tag('message-2', text: 'Here instead');+ server.parts.epoch++;+ }++ test('drops the tags of a conversation the reader leaves at once, '+ 'while the new list is slow to come', () async {+ final server = swarm()+ ..tag('message-1', conversationId: 'pm-chat', text: 'Private');+ final controller = server.controller(account: 'peer');+ addTearDown(controller.dispose);+ final mentions = SuperTabMentions.of(controller);+ await controller.refresh();+ await pumpEventQueue();+ expect(mentions.waiting.map((m) => m.text), ['Private']);++ leaveChatTaggedElsewhere(server);+ final slow = server.holdMentions = Completer<void>();+ await controller.refresh();+ await pumpEventQueue();+ expect(controller.snapshot!.mentionsWaiting, 1);+ expect(mentions.waiting, isEmpty);+ expect(mentions.earlier, isEmpty);++ server.holdMentions = null;+ slow.complete();+ await pumpEventQueue();+ expect(mentions.waiting.map((m) => m.text), ['Here instead']);+ });++ test('a tag the reader can no longer read stays gone when the new list '+ 'fails', () async {+ final server = swarm()+ ..tag('message-1', conversationId: 'pm-chat', text: 'Private');+ final controller = server.controller(account: 'peer');+ addTearDown(controller.dispose);+ final mentions = SuperTabMentions.of(controller);+ await controller.refresh();+ await pumpEventQueue();+ expect(mentions.waiting, hasLength(1));++ leaveChatTaggedElsewhere(server);+ server.failMentions = true;+ await controller.refresh();+ await pumpEventQueue();+ expect(mentions.waiting, isEmpty);+ expect(mentions.error, isNotNull);+ });+test('reads waiting and earlier tags, newest first', () async {final server = ConversationServer()..tag('m1', text: 'First')diff --git a/desktop/test/super_tab_menu_bar_notices_test.dart b/desktop/test/super_tab_menu_bar_notices_test.dartnew file mode 100644index 000000000..35a4eed9d--- /dev/null+++ b/desktop/test/super_tab_menu_bar_notices_test.dart@@ -0,0 +1,350 @@+import 'dart:async';++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/state/status_menu.dart';+import 'package:harness/super_tabs/decisions.dart';+import 'package:harness/super_tabs/notifications.dart';+import 'package:harness/super_tabs/view.dart';++import 'super_tab_launch_test.dart'+ show SuperTabFixtureConnection, SuperTabLaunchFixture, tabId;+import 'support/super_tab_fixture.dart';+import 'swarm_screen_test.dart' show mount;++const otherId = 'fedcba9876543210fedcba98';++/// The fixture's machine, answering a second Swarm, [otherId], from a server+/// of its own: a tag and a decision wait there too.+class TwoSwarms extends SuperTabFixtureConnection {+ TwoSwarms(super.store) : super(local: true) {+ other.state['id'] = otherId;+ other+ ..tag('message-1', text: 'In Atlas')+ ..ask(['Atlas question?']);+ }+ final other = ConversationServer();++ @override+ Future<Map<String, dynamic>> request(+ String type, {+ Map<String, dynamic> payload = const {},+ Duration timeout = const Duration(seconds: 20),+ }) async {+ if (type == 'super_tabs' &&+ payload['action'] == 'backend' &&+ (payload['path'] as String).startsWith('/api/super-tabs/$otherId')) {+ final body = payload['body'];+ return {+ 'ok': true,+ 'value': await other.request(+ payload['method'] as String,+ payload['path'] as String,+ body: body is Map ? Map<String, dynamic>.from(body) : null,+ ),+ };+ }+ return super.request(type, payload: payload, timeout: timeout);+ }+}++/// A Swarm open in a tab of [f]'s app, with a tag and a decision waiting.+Future<void> openWithNotices(SuperTabLaunchFixture f) async {+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ f.connection.server+ ..tag('message-1', text: 'Please confirm the release.')+ ..ask(['Ship it behind a flag?']);+ await c.refresh();+ await SuperTabMentions.of(c).load();+ await SuperTabDecisions.of(c).load();+}++void main() {+ test('the menu bar lists what needs the person in each Swarm: decisions, '+ 'then tags, with where they were asked', () async {+ final f = SuperTabLaunchFixture(local: true);+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ await openWithNotices(f);+ final rows = statusMenuSwarmEntries(f.app);+ expect(rows.map((r) => (r['kind'], r['title'], r['message'])), [+ ('decision', 'Wren asks you', 'Ship it behind a flag?'),+ ('mention', 'Wren tagged you', 'Please confirm the release.'),+ ]);+ for (final row in rows) {+ expect(row['swarmTabId'], tabId);+ expect(row['tabName'], 'Pilot');+ expect(row['detail'], 'web-project · Lead');+ expect(row['unread'], isTrue);+ expect(row['receivedAt'], isA<int>());+ }+ expect(rows.first['id'], 'decision-1');+ expect(rows.last['id'], 'mention-1');+ });++ group('a conversation the person can no longer read', () {+ /// A tag and a decision in "Offline editing", then that conversation+ /// leaves what this account reads.+ Future<SuperTabLaunchFixture> askedInOffline() async {+ final f = SuperTabLaunchFixture(local: true);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ f.connection.server+ ..tag('message-1', conversationId: 'offline', text: 'Private tag')+ ..ask(['Private question?'], conversationId: 'offline');+ await c.refresh();+ await SuperTabMentions.of(c).load();+ await SuperTabDecisions.of(c).load();+ expect(statusMenuSwarmEntries(f.app), hasLength(2));+ (f.connection.server.state['conversations'] as List).removeWhere(+ (g) => (g as Map)['id'] == 'offline',+ );+ return f;+ }++ test('leaves the menu at once, though its lists still hold it', () async {+ final f = await askedInOffline();+ final c = f.app.superTabs.peek(tabId)!;+ await c.refresh();+ expect(c.snapshot!.conversation('offline'), isNull);+ expect(SuperTabMentions.of(c).waiting, isNotEmpty);+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ });++ test('stays out while the new lists are slow to come', () async {+ final f = await askedInOffline();+ final server = f.connection.server;+ server.parts.epoch++;+ server+ ..holdMentions = Completer<void>()+ ..holdDecisions = Completer<void>();+ final c = f.app.superTabs.peek(tabId)!;+ await c.refresh();+ await pumpEventQueue();+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ expect(SuperTabMentions.of(c).waiting, isEmpty);+ expect(SuperTabDecisions.of(c).open, isEmpty);+ server.holdMentions!.complete();+ server.holdDecisions!.complete();+ });++ test('stays out when the new lists fail', () async {+ final f = await askedInOffline();+ final server = f.connection.server;+ server.parts.epoch++;+ server+ ..failMentions = true+ ..failDecisions = true;+ final c = f.app.superTabs.peek(tabId)!;+ await c.refresh();+ await pumpEventQueue();+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ });+ });++ testWidgets(+ 'with two Swarms, each one\'s rows and View all open in that Swarm',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ final messenger = tester.binding.defaultBinaryMessenger;+ messenger.setMockMethodCallHandler(channel, (call) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return true;+ });+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));+ final f = SuperTabLaunchFixture(connectionFactory: TwoSwarms.new);+ await tester.runAsync(() => openWithNotices(f));+ final first = f.app.activeSwarmId;+ f.app.newSwarm(name: 'Second');+ f.app.bindSuperTab(f.app.activeSwarmId, otherId, 'Atlas');+ final second = f.app.activeSwarmId;+ await tester.runAsync(() async {+ final c = await f.app.superTabs.open(otherId);+ await c.refresh();+ await SuperTabMentions.of(c).load();+ await SuperTabDecisions.of(c).load();+ });+ f.app.newSwarm(name: 'Desktop');+ await mount(tester, f.app, nativeTabs: true);+ await tester.pump();+ final rows = (updates.last['statusMenuSwarmEntries'] as List).cast<Map>();+ expect(rows.map((r) => r['swarmTabId']), [+ tabId,+ tabId,+ otherId,+ otherId,+ ]);+ Future<void> choose(Map receipt) async {+ messenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall('openSwarmNotice', receipt),+ ),+ (_) {},+ );+ await tester.pump();+ await tester.pump();+ }++ await choose(rows.last);+ expect(f.app.activeSwarmId, second);+ await choose({'swarmTabId': tabId, 'kind': 'all', 'id': ''});+ expect(f.app.activeSwarmId, first);+ await choose({'swarmTabId': otherId, 'kind': 'all', 'id': ''});+ expect(f.app.activeSwarmId, second);+ await tester.pumpWidget(const SizedBox());+ f.dispose();+ },+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),+ );++ test('none from a Swarm this account lost, and none signed out', () async {+ final f = SuperTabLaunchFixture(local: true);+ await openWithNotices(f);+ final c = f.app.superTabs.peek(tabId)!;+ c.accessRevoked = true;+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ c.accessRevoked = false;+ f.app.currentUser = null;+ expect(statusMenuSwarmEntries(f.app), isEmpty);+ });++ test(+ 'the app hears when a Swarm\'s list of tags or decisions arrives',+ () async {+ final f = SuperTabLaunchFixture(local: true);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ var heard = 0;+ f.app.addListener(() => heard++);+ f.connection.server.ask(['Ship it behind a flag?']);+ await SuperTabDecisions.of(c).load();+ expect(heard, greaterThan(0));+ },+ );++ group('choosing a row', () {+ Future<SuperTabView> showView(+ WidgetTester tester,+ ConversationServer server,+ ) async {+ await tester.binding.setSurfaceSize(const Size(1200, 900));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final c = server.controller();+ await c.refresh();+ final view = SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Team Mac',+ );+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(body: view),+ ),+ );+ await tester.pumpAndSettle();+ return view;+ }++ Future<void> close(WidgetTester tester, SuperTabView view) async {+ await tester.pumpWidget(const SizedBox());+ await view.controller.flush();+ view.controller.dispose();+ }++ testWidgets('a tag opens its conversation at the tagged message', (+ tester,+ ) async {+ final server = ConversationServer()+ ..append('Please confirm the release.')+ ..tag('message-1');+ final view = await showView(tester, server);+ final c = view.controller;+ await SuperTabMentions.of(c).load();+ c.select('offline');+ await tester.pumpAndSettle();+ c.openNotice('mention', 'mention-1');+ await tester.pumpAndSettle();+ expect(c.selectedId, 'lead');+ expect(c.noticeRequest, isNull);+ expect(find.byType(SuperTabNotifications), findsNothing);+ expect(find.text('Please confirm the release.'), findsWidgets);+ await close(tester, view);+ });++ testWidgets('a decision opens the Swarm\'s notifications, where it is '+ 'answered', (tester) async {+ final server = ConversationServer()..ask(['Ship it behind a flag?']);+ final view = await showView(tester, server);+ final c = view.controller;+ c.openNotice('decision', 'decision-1');+ await tester.pumpAndSettle();+ expect(find.byType(SuperTabNotifications), findsOneWidget);+ expect(find.text('Ship it behind a flag?'), findsOneWidget);+ expect(c.noticeRequest, isNull);+ await close(tester, view);+ });++ testWidgets('from the menu bar: its Swarm tab comes forward and opens it', (+ tester,+ ) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ final messenger = tester.binding.defaultBinaryMessenger;+ messenger.setMockMethodCallHandler(channel, (call) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return true;+ });+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));+ final f = SuperTabLaunchFixture(local: true);+ await tester.runAsync(() => openWithNotices(f));+ final swarmTab = f.app.activeSwarmId;+ f.app.newSwarm(name: 'Desktop');+ await mount(tester, f.app, nativeTabs: true);+ await tester.pump();+ final rows = (updates.last['statusMenuSwarmEntries'] as List).cast<Map>();+ expect(rows, hasLength(2));+ final done = Completer<void>();+ messenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall('openSwarmNotice', rows.first),+ ),+ (_) => done.complete(),+ );+ await tester.pump();+ await tester.pump();+ expect(f.app.activeSwarmId, swarmTab);++ // View all: the Swarm's Notifications page, which lists them all.+ f.app.selectSwarm(f.app.swarms.last.id);+ await tester.pump();+ messenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall('openSwarmNotice', {+ 'swarmTabId': tabId,+ 'kind': 'all',+ 'id': '',+ }),+ ),+ (_) {},+ );+ await tester.pump();+ await tester.pump();+ expect(f.app.activeSwarmId, swarmTab);+ await tester.pumpWidget(const SizedBox());+ expect(updates.last['statusMenuSwarmEntries'], isNull);+ f.dispose();+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));+ });+}diff --git a/desktop/test/super_tab_pm_chat_pinned_test.dart b/desktop/test/super_tab_pm_chat_pinned_test.dartindex 441508f62..bee850f14 100644--- a/desktop/test/super_tab_pm_chat_pinned_test.dart+++ b/desktop/test/super_tab_pm_chat_pinned_test.dart@@ -18,6 +18,7 @@ import 'package:harness/state/app_state.dart';import 'package:harness/state/harness_activity.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/identity.dart';+import 'package:harness/super_tabs/machine_icon.dart';import 'package:harness/super_tabs/machines.dart';import 'package:harness/super_tabs/pm_chat.dart';import 'package:harness/super_tabs/pm_chat_shortcut.dart';@@ -739,10 +740,11 @@ void main() {expect(name('m2'), "Diego's Mac");expect(name('studio'), 'Studio');final row = find.byKey(const ValueKey('super-machine-m2'));- expect(find.descendant(of: row, matching: find.text('~')), findsOne);+ // Its type's icon leads the row, not a "~".+ expect(find.descendant(of: row, matching: find.text('~')), findsNothing);expect(- find.descendant(of: row, matching: find.byIcon(AppIcons.monitor)),- findsNothing,+ find.descendant(of: row, matching: find.byType(SuperTabMachineIcon)),+ findsOne,);expect(find.descendant(of: row, matching: find.byType(SuperTabMachineDot)),diff --git a/desktop/test/super_tab_sidebar_cleanup_test.dart b/desktop/test/super_tab_sidebar_cleanup_test.dartnew file mode 100644index 000000000..78e2e0078--- /dev/null+++ b/desktop/test/super_tab_sidebar_cleanup_test.dart@@ -0,0 +1,109 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/controller.dart';+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;++/// The sidebar's top navigation rows, top to bottom: everything above Projects.+List<String> topRows(WidgetTester tester) {+ final projects = tester.getTopLeft(find.text('Projects')).dy;+ final rows =+ tester+ .widgetList<InkWell>(+ find.descendant(+ of: find.byType(ProjectSidebar),+ matching: find.byWidgetPredicate(+ (w) =>+ w is InkWell &&+ w.key is ValueKey<String> &&+ (w.key! as ValueKey<String>).value.startsWith('super-'),+ ),+ ),+ )+ .map((w) => find.byWidget(w))+ .where((row) => tester.getTopLeft(row).dy < projects)+ .toList()+ ..sort(+ (a, b) => tester.getTopLeft(a).dy.compareTo(tester.getTopLeft(b).dy),+ );+ return [+ for (final row in rows)+ tester+ .widgetList<Text>(+ find.descendant(of: row, matching: find.byType(Text)),+ )+ .map((t) => t.data)+ .join(),+ ];+}++Future<SuperTabController> showSwarm(WidgetTester tester) async {+ await tester.binding.setSurfaceSize(const Size(1200, 900));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final app = createApp(connected: true);+ addTearDown(app.dispose);+ final server = ConversationServer();+ server.state['mentionsWaiting'] = 2;+ server.state['decisionsWaiting'] = 1;+ final c = server.controller();+ await c.refresh();+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ app: app,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onNewProject: () {},+ machineName: (_) => 'Team Mac',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return c;+}++Future<void> closeSwarm(WidgetTester tester, SuperTabController c) async {+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+}++void main() {+ testWidgets(+ 'on a Mac the top reads New project, Your devices, Your models: what '+ 'needs the person is in the menu bar and on the Dock instead',+ (tester) async {+ final c = await showSwarm(tester);+ expect(topRows(tester), ['New project', 'Your devices', 'Your models']);+ expect(find.byKey(const ValueKey('super-notifications')), findsNothing);+ expect(tester.takeException(), isNull);+ await closeSwarm(tester, c);+ },+ variant: TargetPlatformVariant.only(TargetPlatform.macOS),+ );++ testWidgets(+ 'with no menu-bar list to carry them, Notifications stays last with its '+ 'count',+ (tester) async {+ final c = await showSwarm(tester);+ expect(topRows(tester), [+ 'New project',+ 'Your devices',+ 'Your models',+ 'Notifications3',+ ]);+ await closeSwarm(tester, c);+ },+ variant: TargetPlatformVariant.only(TargetPlatform.linux),+ );+}diff --git a/desktop/test/super_tab_sidebar_shots_test.dart b/desktop/test/super_tab_sidebar_shots_test.dartnew file mode 100644index 000000000..23b61d057--- /dev/null+++ b/desktop/test/super_tab_sidebar_shots_test.dart@@ -0,0 +1,115 @@+import 'dart:io';++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/view.dart';++import 'support/capture.dart';+import 'support/super_tab_fixture.dart';+import 'swarm_state_test.dart' show createApp;++/// Set to a folder to write the PR's sidebar pictures there.+final shots = Platform.environment['SUPER_TAB_SIDEBAR_SHOTS'];++/// SF Symbols as AppKit draws them (`systemSymbolPng`), `<name>.png` at 2×:+/// what the Mac app's channel answers with.+final symbols = Platform.environment['SUPER_TAB_SIDEBAR_SYMBOLS'];++void main() {+ setUpAll(() => loadCaptureFonts(shots));++ for (final brightness in Brightness.values) {+ testWidgets('the Swarm sidebar in ${brightness.name}', (tester) async {+ if (shots == null) return;+ if (symbols != null) {+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ const MethodChannel('harness/system_symbols'),+ (call) async {+ final name = (call.arguments as Map)['name'];+ final file = File('$symbols/$name.png');+ return file.existsSync() ? file.readAsBytesSync() : null;+ },+ );+ }+ final previous = grid.AppTheme.brightness.value;+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = previous);+ tester.view.devicePixelRatio = 2;+ tester.view.physicalSize = const Size(2400, 1400);+ addTearDown(tester.view.reset);+ final app = createApp(connected: true);+ addTearDown(app.dispose);+ final now = DateTime.now().millisecondsSinceEpoch;+ Map<String, dynamic> machine(+ String id,+ String name,+ String? type, {+ bool online = true,+ }) => {+ 'machineId': id,+ 'name': name,+ 'contributorId': 'owner',+ 'observation': {+ 'receivedAt': online ? now : now - 3 * 3600 * 1000,+ 'resources': {'deviceType': ?type},+ },+ };+ final server = ConversationServer()+ ..tag('message-1')+ ..tag('message-2')+ ..ask(['Ship it behind a flag?']);+ server.state['agents'] = <Object>[];+ server.state['machines'] = [+ machine('studio', 'MACs-Mac-Studio.local', 'Mac Studio'),+ machine('mbp', "Dee's MacBook Pro", 'MacBook Pro'),+ machine('mini', 'Build Mac mini', 'Mac mini', online: false),+ machine('imac', 'Front desk iMac', 'iMac'),+ machine('box', 'WIN-DELL', null),+ ];+ final c = server.controller();+ await c.refresh();+ final picture = GlobalKey();+ await tester.pumpWidget(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: brightness),+ home: RepaintBoundary(+ key: picture,+ child: Scaffold(+ body: SuperTabView(+ controller: c,+ app: app,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ onNewProject: () {},+ machineName: (_) => 'Team Mac',+ ),+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ // Decode the symbols' pictures, which a widget test does only for real.+ for (final image in tester.widgetList<Image>(find.byType(Image))) {+ await tester.runAsync(+ () =>+ precacheImage(image.image, tester.element(find.byType(Scaffold))),+ );+ }+ await tester.pumpAndSettle();+ await captureBoundary(+ tester,+ picture.currentContext!.findRenderObject()! as RenderRepaintBoundary,+ shots,+ 'sidebar-${brightness.name}',+ );+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));+ }+}diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dartindex a26cc522c..aa26ae834 100644--- a/desktop/test/super_tab_sidebar_test.dart+++ b/desktop/test/super_tab_sidebar_test.dart@@ -263,8 +263,8 @@ void main() {final order = [find.byKey(const ValueKey('super-new-project')),- find.byKey(const ValueKey('super-local-models')),find.byKey(const ValueKey('super-your-devices')),+ find.byKey(const ValueKey('super-local-models')),find.text('Projects'),find.byKey(const ValueKey('super-group-leads')),find.byKey(const ValueKey('super-group-empty-lead')),@@ -529,16 +529,18 @@ void main() {final setUp = find.byKey(const ValueKey('super-local-models-setup'));testWidgets(- 'the owner sets models up from Manage models; there is no switch',+ 'the owner sets models up from Your models; there is no switch',(tester) async {final server = ConversationServer();server.state['machines'] = [machine()];final c = server.controller();await c.refresh();await mount(tester, c);- expect(find.text('Manage models'), findsOneWidget);+ expect(find.text('Your models'), findsOneWidget);await tester.tap(open);await tester.pumpAndSettle();+ // The page is titled as the row that opens it.+ expect(find.text('Your models'), findsNWidgets(2));expect(find.byType(Switch), findsNothing);expect(find.textContaining('Set up connects this computer to the Swarm'),@@ -564,7 +566,7 @@ void main() {);testWidgets(- 'everyone sees Manage models; before it is set up a member is told the owner sets it up',+ 'everyone sees Your models; before it is set up a member is told the owner sets it up',(tester) async {final server = ConversationServer();(server.state['people'] as List).add({diff --git a/desktop/test/support/super_tab_fixture.dart b/desktop/test/support/super_tab_fixture.dartindex 107b6b787..80016cc10 100644--- a/desktop/test/support/super_tab_fixture.dart+++ b/desktop/test/support/super_tab_fixture.dart@@ -415,6 +415,8 @@ class ConversationServer {bool mentionsMissing = false;// While set, every read of the mentions list waits for it.Completer<void>? holdMentions;+ // Every read of the mentions list fails, as offline.+ bool failMentions = false;// The effective routing policy answered by GET .../routing-policy.Map<String, dynamic>? routingPolicy;final state = <String, dynamic>{@@ -769,6 +771,7 @@ class ConversationServer {throw const SuperTabFailure('NOT_FOUND', 'Not found.', statusCode: 404);}if (holdMentions case final hold?) await hold.future;+ if (failMentions) throw StateError('Offline');final waiting = uri.queryParameters['state'] == 'waiting';return jsonDecode(jsonEncode({diff --git a/desktop/test/support/workspace_tools.dart b/desktop/test/support/workspace_tools.dartindex ba6554fda..8b39bbd0c 100644--- a/desktop/test/support/workspace_tools.dart+++ b/desktop/test/support/workspace_tools.dart@@ -20,7 +20,7 @@ Future<void> openWorkspaceTool(WidgetTester tester, String tool) async {Future<void> openWorkspaceManagement(WidgetTester tester, String tool) async {final command = switch (tool) {'machines' => 'Machine connection settings',- 'models' => 'Manage models',+ 'models' => 'Your models',_ => 'Manage harnesses',};await key(tester, LogicalKeyboardKey.keyP, cmd: true);diff --git a/desktop/test/swarm_dock_badge_test.dart b/desktop/test/swarm_dock_badge_test.dartnew file mode 100644index 000000000..9708782b8--- /dev/null+++ b/desktop/test/swarm_dock_badge_test.dart@@ -0,0 +1,52 @@+import 'package:flutter/services.dart';+import 'package:flutter/widgets.dart';+import 'package:flutter_test/flutter_test.dart';++import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;+import 'swarm_screen_test.dart' show mount;++void main() {+ testWidgets(+ 'the Dock badge counts what needs the person in their Swarms and clears '+ 'when nothing does, or the workspace leaves',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ final messenger = tester.binding.defaultBinaryMessenger;+ messenger.setMockMethodCallHandler(channel, (call) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return true;+ });+ addTearDown(() => messenger.setMockMethodCallHandler(channel, null));+ final f = SuperTabLaunchFixture(local: true);+ final app = f.app;+ app.bindSuperTab(app.activeSwarmId, tabId, 'Pilot');+ app.newSwarm(name: 'Desktop');+ final c = await app.superTabs.open(tabId);+ await c.refresh();+ await mount(tester, app, nativeTabs: true);+ await tester.pump();+ expect(updates.last['dockBadge'], 0);++ final server = f.connection.server+ ..tag('message-1')+ ..ask(['Ship it behind a flag?']);+ await tester.runAsync(c.refresh);+ await tester.pump();+ expect(updates.last['dockBadge'], 2);++ server.state+ ..['mentionsWaiting'] = 0+ ..['decisionsWaiting'] = 0;+ server.revision++;+ await tester.runAsync(c.refresh);+ await tester.pump();+ expect(updates.last['dockBadge'], 0);++ await tester.pumpWidget(const SizedBox());+ expect(updates.last['enabled'], isFalse);+ expect(updates.last['dockBadge'], isNull);+ f.dispose();+ },+ );+}diff --git a/desktop/test/swarm_needs_you_test.dart b/desktop/test/swarm_needs_you_test.dartnew file mode 100644index 000000000..7e94cb0b5--- /dev/null+++ b/desktop/test/swarm_needs_you_test.dart@@ -0,0 +1,53 @@+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/state/harness_activity.dart';++import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;++void main() {+ test('counts the tags and open decisions waiting for this account in its '+ 'Swarm tabs, as the sidebar row did', () async {+ final f = SuperTabLaunchFixture(local: true);+ expect(swarmsNeedYou(f.app), 0);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ expect(swarmsNeedYou(f.app), 0);+ f.connection.server+ ..tag('message-1')+ ..tag('message-2')+ ..ask(['Ship it behind a flag?']);+ await c.refresh();+ expect(swarmsNeedYou(f.app), 3);+ });++ test('the app hears when only the open decisions move', () async {+ final f = SuperTabLaunchFixture(local: true);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ var heard = 0;+ f.app.addListener(() => heard++);+ f.connection.server.ask(['Ship it behind a flag?']);+ await c.refresh();+ expect(heard, greaterThan(0));+ expect(swarmsNeedYou(f.app), 1);+ });++ test('nothing is counted from a Swarm this account lost, or once signed '+ 'out', () async {+ final f = SuperTabLaunchFixture(local: true);+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Pilot');+ final c = await f.app.superTabs.open(tabId);+ await c.refresh();+ f.connection.server+ ..tag('message-1')+ ..ask(['Ship it behind a flag?']);+ await c.refresh();+ expect(swarmsNeedYou(f.app), 2);+ c.accessRevoked = true;+ expect(swarmsNeedYou(f.app), 0);+ c.accessRevoked = false;+ f.app.currentUser = null;+ expect(swarmsNeedYou(f.app), 0);+ });+}diff --git a/desktop/tool/status_menu_checks.swift b/desktop/tool/status_menu_checks.swiftindex 79ad4d70a..078e883e8 100644--- a/desktop/tool/status_menu_checks.swift+++ b/desktop/tool/status_menu_checks.swift@@ -265,6 +265,76 @@ do {"Footer shortcuts follow remapping and unbinding, including after a rebuild")status.click(status.item("sessions"))try check(emitted.last?.0 == "sessions", "Keymap identifiers preserve the existing Open Harness action")++ // The Swarm section: what needs the person in their Swarms, which the+ // Swarm sidebar's Notifications row listed before.+ func notice(_ kind: String, _ id: String, _ title: String, swarm: String = "swarm-1",+ name: String = "Pilot") -> [String: Any] {+ ["swarmTabId": swarm, "kind": kind, "id": id, "title": title,+ "message": "Ship it behind a flag?", "unread": true, "tabName": name,+ "detail": "web-project · Lead", "receivedAt": Date().timeIntervalSince1970 * 1000 - 60_000,+ "activity": ["mark": "?", "label": "Needs input", "working": false, "color": Int64(0xffe5e510)]]+ }+ func swarmRows() -> [NSMenuItem] {+ status.menu.items.filter { $0.identifier?.rawValue == "openSwarmNotice" &&+ ($0.representedObject as? [String: Any])?["kind"] as? String != "all" }+ }+ var notices = [notice("decision", "decision-1", "Wren asks you"), notice("mention", "mention-1", "Wren tagged you")]+ status.update(["enabled": true, "statusMenuEntries": [], "statusMenuSwarmEntries": notices])+ let swarmHeading = status.menu.items.first { $0.identifier?.rawValue == "swarmHeading" }+ try check(swarmHeading?.view?.accessibilityLabel() == "Swarm (2)" &&+ swarmRows().map { $0.title } == ["Wren asks you", "Wren tagged you"],+ "The Swarm section lists the person's decisions, then tags")+ try check(swarmRows().first?.view?.accessibilityLabel()?.contains("Ship it behind a flag?") == true &&+ swarmRows().first?.toolTip?.contains("web-project · Lead") == true,+ "A Swarm row reads its question and where it was asked")+ let beforeSwarm = reveals+ status.click(swarmRows()[1])+ try check(emitted.last?.0 == "openSwarmNotice" &&+ (emitted.last?.1 as? [String: Any])?["id"] as? String == "mention-1" && reveals == beforeSwarm,+ "Choosing a Swarm row sends its receipt; Dart opens it and reveals the window")+ status.menuWillOpen(status.menu)+ let answered = swarmRows()[0]+ let beforeAnswered = emitted.count+ notices.removeFirst()+ status.update(["enabled": true, "statusMenuEntries": [], "statusMenuSwarmEntries": notices])+ status.click(answered)+ try check(emitted.count == beforeAnswered, "A decision answered meanwhile cannot be opened from a stale menu")+ status.menuDidClose(status.menu)+ let many = (1...6).map { notice("mention", "mention-\($0)", "Tag \($0)") }+ status.update(["enabled": true, "statusMenuEntries": [], "statusMenuSwarmEntries": many])+ let viewAll = status.menu.items.first { ($0.representedObject as? [String: Any])?["kind"] as? String == "all" }+ try check(swarmRows().count == 5 && viewAll?.title == "View all 6 in Pilot…",+ "Five Swarm rows, then View all")+ if let viewAll { status.click(viewAll) }+ try check((emitted.last?.1 as? [String: Any])?["kind"] as? String == "all",+ "View all opens the Swarm's Notifications page")+ // Two Swarms: each its own heading, five rows and View all, so nothing in+ // the second is out of reach behind the first's.+ let second = (1...2).map { notice("decision", "d\($0)", "Ask \($0)", swarm: "swarm-2", name: "Atlas") }+ status.update(["enabled": true, "statusMenuEntries": [], "statusMenuSwarmEntries": many + second])+ let headings = status.menu.items.filter { $0.identifier?.rawValue == "swarmHeading" }+ try check(headings.compactMap { $0.view?.accessibilityLabel() } == ["Pilot (6)", "Atlas (2)"],+ "Several Swarms each have a heading with their name and count")+ let viewAlls = status.menu.items.filter { ($0.representedObject as? [String: Any])?["kind"] as? String == "all" }+ try check(swarmRows().count == 7 && viewAlls.map { $0.title } == ["View all 6 in Pilot…"] &&+ swarmRows().suffix(2).map { $0.title } == ["Ask 1", "Ask 2"],+ "Each Swarm shows five rows, and only one with more has View all")+ status.click(swarmRows().last!)+ try check((emitted.last?.1 as? [String: Any])?["swarmTabId"] as? String == "swarm-2" &&+ (emitted.last?.1 as? [String: Any])?["id"] as? String == "d2",+ "A row of the second Swarm opens in its own Swarm")+ let secondMany = (1...7).map { notice("mention", "s\($0)", "Tag \($0)", swarm: "swarm-2", name: "Atlas") }+ status.update(["enabled": true, "statusMenuEntries": [], "statusMenuSwarmEntries": many + secondMany])+ let secondAll = status.menu.items.last { ($0.representedObject as? [String: Any])?["kind"] as? String == "all" }+ try check(secondAll?.title == "View all 7 in Atlas…", "The second Swarm has its own View all")+ if let secondAll { status.click(secondAll) }+ try check((emitted.last?.1 as? [String: Any])?["swarmTabId"] as? String == "swarm-2",+ "Its View all opens the second Swarm")+ status.update(["enabled": true, "statusMenuSwarmEntries": many])+ try check(!status.menu.items.contains { $0.identifier?.rawValue == "swarmHeading" },+ "With no workspace on screen there is no Swarm section")+ status.update([:])print("Harness status menu passed \(checks) checks")} catch {fputs("Harness status menu failed: \(error)\n", stderr)diff --git a/desktop/tool/status_menu_preview.swift b/desktop/tool/status_menu_preview.swiftindex cdbc9100f..c4b695c91 100644--- a/desktop/tool/status_menu_preview.swift+++ b/desktop/tool/status_menu_preview.swift@@ -28,8 +28,19 @@ let bindings: [[String: Any]] = []let map = HarnessNativeKeymap(["version": 1, "contexts": ["workspace": bindings, "terminal": [], "picker": [], "project": []]])!+let swarm: [[String: Any]] = [+ ["swarmTabId": "pilot", "kind": "decision", "id": "d1", "title": "Wren asks you",+ "message": "Ship the sidebar cleanup behind a flag first?", "unread": true, "tabName": "Pilot",+ "detail": "openharness · Desktop sidebar cleanup", "receivedAt": timestamp - 90_000,+ "activity": ["mark": "?", "label": "Needs input", "working": false]],+ ["swarmTabId": "pilot", "kind": "mention", "id": "m1", "title": "River tagged you",+ "message": "Screenshots of the new sidebar are in the PR. Can you check the dark ones?", "unread": true,+ "tabName": "Pilot", "detail": "openharness · Lead", "receivedAt": timestamp - 600_000,+ "activity": ["mark": "?", "label": "Needs input", "working": false]],+]+func render(_ name: String, dark: Bool, entries: [[String: Any]], work: [[String: Any]],- highlight: Bool = false) {+ swarmEntries: [[String: Any]] = [], highlight: Bool = false) {app.appearance = NSAppearance(named: dark ? .darkAqua : .aqua)let status = HarnessStatusMenu(installStatusItem: false, showWindow: {}, emit: { _, _ in })status.menu.appearance = app.appearance@@ -46,7 +57,8 @@ func render(_ name: String, dark: Bool, entries: [[String: Any]], work: [[Stringreturn row}status.update(["enabled": true, "statusMenuEntries": entries.map { styled($0) },- "statusMenuWorkingEntries": work.map { styled($0, working: true) }])+ "statusMenuWorkingEntries": work.map { styled($0, working: true) },+ "statusMenuSwarmEntries": swarmEntries.map { styled($0) }])var captured = falselet timer = Timer(timeInterval: 0.2, repeats: false) { _ inif highlight {@@ -100,3 +112,20 @@ let long = news("long", String(repeating: "Long session title ", count: 6),var offline = notifications[1]offline["unavailable"] = "Offline"render("notification-overview-long", dark: false, entries: [long, offline], work: working, highlight: true)+render("notification-swarm-light", dark: false, entries: notifications, work: working, swarmEntries: swarm)+render("notification-swarm-dark", dark: true, entries: notifications, work: working, swarmEntries: swarm)+// Two Swarms, the first with more than five: each its own heading and View all.+let pilot = (1...6).map { index -> [String: Any] in+ var row = swarm[index % 2]+ row["id"] = "p\(index)"+ row["receivedAt"] = timestamp - Double(index) * 120_000+ return row+}+var atlas = swarm[0]+atlas["swarmTabId"] = "atlas"+atlas["tabName"] = "Atlas"+atlas["id"] = "a1"+atlas["title"] = "Juno asks you"+atlas["message"] = "Keep the old Linux build for one more release?"+render("notification-swarms-light", dark: false, entries: [], work: [], swarmEntries: pilot + [atlas])+render("notification-swarms-dark", dark: true, entries: [], work: [], swarmEntries: pilot + [atlas])diff --git a/docs/naming-system.md b/docs/naming-system.mdindex 11a195467..80ad45fca 100644--- a/docs/naming-system.md+++ b/docs/naming-system.md@@ -98,8 +98,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 sidebar reads like a chat app's. It starts with **New project**, **Manage models**,-**Your devices** and **Notifications**, then three sections in this order: **Projects**,+Its sidebar reads like a chat app's. It starts with **New project**, **Your devices** and+**Your models** (and **Notifications** where no menu-bar list carries it: on a Mac, what needs+the person is in the menu bar's Harness menu and on the Dock's badge), then three sections in this+order: **Projects**,**Direct messages** and **Machines**. Projects and Machines have section headings with disclosureafter the label and an add action at the right. Project rows read as channels, from A to Z:**#** at the left, then their name and status, with no chevron. The Product Managers'