Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Batch Q: New Project places the PM (#2083), leaderboard crown and bold unread (#2086) (#2095)

0xken156fa16874ee2e
diff --git a/desktop/lib/state/harness_launch_integration.dart b/desktop/lib/state/harness_launch_integration.dart
index b93c2bd5e..9999cc1fb 100644
--- a/desktop/lib/state/harness_launch_integration.dart
+++ b/desktop/lib/state/harness_launch_integration.dart
@@ -1,4 +1,5 @@
import 'harness_attachments.dart';
+import 'lead_placement.dart';
class HarnessLaunchRole {
const HarnessLaunchRole({
@@ -55,6 +56,15 @@ class HarnessLaunchIntegration {
final String? forcedPermissionMode;
String? projectVisibility;
bool projectVisibilityLocked;
+
+ /// A new project in a Swarm: the Swarm's machines its Product Manager may
+ /// start on, best first. The form then shows only the task, repo and
+ /// visibility, with the machine on a "Product Manager:" line. Null keeps
+ /// the ordinary machine, agent and folder controls.
+ List<LeadMachine>? leadMachines;
+
+ /// With [leadMachines]: the Swarm's model list for its engine and model.
+ LeadModelList? leadModels;
final Future<String> Function(String machineId, String task) prepare;
final Future<void> Function(String machineId, String harnessId) complete;
final Future<void> Function(String machineId, String creationId) beforeSubmit;
diff --git a/desktop/lib/state/lead_placement.dart b/desktop/lib/state/lead_placement.dart
new file mode 100644
index 000000000..3d8fa671f
--- /dev/null
+++ b/desktop/lib/state/lead_placement.dart
@@ -0,0 +1,192 @@
+/// A machine of the Swarm a new project's Product Manager could start on, as
+/// New Project lists it under "Lead: … · Change".
+class LeadMachine {
+ const LeadMachine({
+ required this.id,
+ required this.name,
+ required this.online,
+ required this.freeAgents,
+ this.repositories = const {},
+ this.folders = const {},
+ this.maySleep = false,
+ this.unavailable,
+ this.inSwarm = true,
+ });
+ final String id, name;
+ final bool online;
+
+ /// The agent slots it offers the Swarm that nothing runs in; null for a
+ /// machine of the person's the Swarm does not list, which it does not limit.
+ final int? freeAgents;
+
+ /// Listed by the Swarm. A person may still start their project's Product
+ /// Manager on another machine of theirs, as before.
+ final bool inSwarm;
+
+ /// The repositories the Swarm already checked out there, as
+ /// [leadRepositoryKey] reads them.
+ final Set<String> repositories;
+
+ /// Where those checkouts are on that machine, by the same key, when known.
+ final Map<String, String> folders;
+
+ /// A laptop: it may sleep with the Product Manager on it.
+ final bool maySleep;
+
+ /// Why the Product Manager cannot start here whatever its state, or null.
+ final String? unavailable;
+
+ bool has(String? repository) {
+ final key = leadRepositoryKey(repository);
+ return key != null && repositories.contains(key);
+ }
+
+ bool get startable => unavailable == null && online && (freeAgents ?? 1) > 0;
+}
+
+/// One repository however its remote is spelled: `host/owner/name`, lower
+/// case, without scheme, user, `.git` or trailing slash. Null for none.
+String? leadRepositoryKey(String? remote) {
+ var value = remote?.trim().toLowerCase() ?? '';
+ if (value.isEmpty) return null;
+ value = value.replaceFirst(RegExp(r'^[a-z+]+://'), '');
+ value = value.replaceFirst(RegExp(r'^[^@/]+@'), '');
+ // scp-like `host:owner/name`.
+ value = value.replaceFirstMapped(
+ RegExp(r'^([^/:]+):(?!\d)'),
+ (m) => '${m[1]}/',
+ );
+ value = value.replaceFirst(RegExp(r'/+$'), '');
+ value = value.replaceFirst(RegExp(r'\.git$'), '');
+ return value.isEmpty ? null : value;
+}
+
+/// Best first: one the Product Manager can start on now (the Swarm's machines
+/// before the person's others, always on with laptops that may sleep last,
+/// with [repository] already there, with the most room); then the ones it
+/// cannot use yet (full), then other people's, then offline ones.
+List<LeadMachine> rankLeadMachines(
+ Iterable<LeadMachine> machines,
+ String? repository,
+) {
+ int tier(LeadMachine m) => m.startable
+ ? 0
+ : m.unavailable == null && m.online
+ ? 1
+ : m.online
+ ? 2
+ : 3;
+ int flag(bool value) => value ? 0 : 1;
+ return [...machines]..sort(
+ (a, b) => [
+ tier(a).compareTo(tier(b)),
+ flag(a.inSwarm).compareTo(flag(b.inSwarm)),
+ flag(!a.maySleep).compareTo(flag(!b.maySleep)),
+ flag(a.has(repository)).compareTo(flag(b.has(repository))),
+ (b.freeAgents ?? 0).compareTo(a.freeAgents ?? 0),
+ a.name.toLowerCase().compareTo(b.name.toLowerCase()),
+ ].firstWhere((order) => order != 0, orElse: () => 0),
+ );
+}
+
+/// Where the Swarm places the Product Manager, or null when no machine can
+/// take it now.
+LeadMachine? bestLeadMachine(
+ Iterable<LeadMachine> machines,
+ String? repository,
+) => rankLeadMachines(
+ machines,
+ repository,
+).where((m) => m.startable).firstOrNull;
+
+/// A machine's row detail, in words, so colour is never the only signal.
+String leadMachineDetail(LeadMachine machine, String? repository) {
+ if (machine.unavailable case final why?) return why;
+ if (!machine.online) return 'Offline';
+ final free = machine.freeAgents;
+ if (free == null) return 'Online · Not in this Swarm';
+ return [
+ 'Online',
+ free <= 0
+ ? 'No agents free'
+ : '$free ${free == 1 ? 'agent' : 'agents'} free',
+ if (free > 0 && machine.has(repository)) 'Has repo',
+ if (free > 0 && machine.maySleep) 'May sleep',
+ ].join(' · ');
+}
+
+/// Why a paused Swarm's machines take no work, as its rows and the
+/// Product Manager line say it.
+const kLeadSwarmPaused = 'New work is paused in this Swarm';
+
+/// The Swarm's model list (its routing policy) for a new project's Product
+/// Manager: engines and models it turns off. Empty, it rules nothing out.
+///
+/// The owners' per-project rules (preferred engine, forbidden models) are not
+/// read here: a new project has none until it is created.
+class LeadModelList {
+ const LeadModelList({
+ this.disabledEngines = const {},
+ this.disabledModels = const {},
+ this.gridModels = true,
+ });
+
+ /// Engines the list has no enabled model of.
+ final Set<String> disabledEngines;
+
+ /// Models the list turns off at every effort, as (engine, model).
+ final Set<(String, String)> disabledModels;
+
+ /// Whether the list lets work run on models served on the Swarm's grid.
+ final bool gridModels;
+
+ /// Why the list rules [engine] out, or null.
+ String? engineRefusal(String engine) => disabledEngines.contains(engine)
+ ? 'The Swarm’s model list has no enabled ${_engineName(engine)} model.'
+ : null;
+
+ /// Why [engine] running [model] (null for its default) is ruled out, or
+ /// null.
+ String? refusal(String engine, String? model) {
+ if (engineRefusal(engine) case final why?) return why;
+ if (disabledModels.contains((engine, model ?? 'default'))) {
+ return 'The Swarm’s model list turns off ${_engineName(engine)} '
+ '${model ?? 'default model'}.';
+ }
+ return null;
+ }
+
+ /// Read from the Swarm's routing policy; null reads as an empty list.
+ factory LeadModelList.of(Map<String, dynamic>? policy) {
+ final byModel = <(String, String), bool>{};
+ final byEngine = <String, bool>{};
+ for (final row in policy?['models'] as List? ?? const []) {
+ if (row case {
+ 'engine': final String engine,
+ 'model': final String model,
+ 'enabled': final bool enabled,
+ }) {
+ byModel[(engine, model)] =
+ (byModel[(engine, model)] ?? false) || enabled;
+ byEngine[engine] = (byEngine[engine] ?? false) || enabled;
+ }
+ }
+ return LeadModelList(
+ disabledEngines: {
+ for (final MapEntry(:key, :value) in byEngine.entries)
+ if (!value) key,
+ },
+ disabledModels: {
+ for (final MapEntry(:key, :value) in byModel.entries)
+ if (!value) key,
+ },
+ gridModels: switch (policy?['localModels']) {
+ {'enabled': false} => false,
+ _ => true,
+ },
+ );
+ }
+}
+
+String _engineName(String engine) =>
+ const {'claude': 'Claude', 'codex': 'Codex'}[engine] ?? engine;
diff --git a/desktop/lib/state/new_harness.dart b/desktop/lib/state/new_harness.dart
index 538fee0e7..7bc9db41a 100644
--- a/desktop/lib/state/new_harness.dart
+++ b/desktop/lib/state/new_harness.dart
@@ -33,6 +33,7 @@ import 'attached_task_delivery.dart';
import 'harness_placement.dart';
import 'harness_attachments.dart';
import 'harness_launch_integration.dart';
+import 'lead_placement.dart';
import 'pane_arrangement.dart';
/// Whether New Harness opens as a line in the box, or as the full form.
@@ -862,17 +863,27 @@ class NewHarnessController extends ChangeNotifier {
bool get worktree =>
isGitProject &&
!inWorktree &&
- (_worktree ??
- (_desktopChoices
- ? app.agentPreference.successfulWorktree ?? true
- : app.projectHistory.worktreeFor(
- _machineId,
- _project.folder ?? '',
- ) ??
- worktreeByDefault(_gitProject)));
+ // A Swarm's Product Manager never edits the person's checkout.
+ (placesLead ||
+ (_worktree ??
+ (_desktopChoices
+ ? app.agentPreference.successfulWorktree ?? true
+ : app.projectHistory.worktreeFor(
+ _machineId,
+ _project.folder ?? '',
+ ) ??
+ worktreeByDefault(_gitProject))));
bool? _recoveredWorktreePreference;
+ /// The Worktree setting a successful start saves for the next New Harness,
+ /// or null to leave it: a Swarm's Product Manager always gets a worktree,
+ /// which is not the person's choice.
+ bool? get worktreeToRemember => placesLead
+ ? null
+ : _recoveredWorktreePreference ??
+ (isGitProject && !inWorktree ? worktree : null);
+
/// Fresh desktop work starts on main, with or without a worktree. A retry
/// must instead keep the branch of the folder its first attempt prepared.
bool get _defaultsToMain =>
@@ -969,7 +980,7 @@ class NewHarnessController extends ChangeNotifier {
: _branchHere == null && _worktreeOf(branchRef) != null;
void toggleWorktree() {
- if (locked || !canUseWorktree) return;
+ if (locked || !canUseWorktree || placesLead) return;
_worktree = !worktree;
_recoveredWorktreePreference = null;
if (_project.folder case final folder? when !_desktopChoices) {
@@ -1226,6 +1237,8 @@ class NewHarnessController extends ChangeNotifier {
group: 'Subscription',
engine: _engine,
machineId: _machineId,
+ enabled: _leadModelRefusal(null) == null,
+ why: _leadModelRefusal(null),
),
]),
if (catalog?.supportsModelLaunch == true &&
@@ -1253,6 +1266,8 @@ class NewHarnessController extends ChangeNotifier {
grid: section.name,
),
machineId: _machineId,
+ enabled: _leadModelRefusal(model.id, grid: true) == null,
+ why: _leadModelRefusal(model.id, grid: true),
),
]),
NewHarnessOption(
@@ -1557,6 +1572,156 @@ class NewHarnessController extends ChangeNotifier {
/// one takes a GitHub repository, and Devin Cloud an ACU limit.
bool get isCloud => _harnessId == null && isCloudAgentId(_engine);
+ /// New Project in a Swarm: the Swarm places the Product Manager on one of
+ /// [HarnessLaunchIntegration.leadMachines], and the form asks only the
+ /// task, repo and visibility.
+ bool get placesLead => integration?.leadMachines != null;
+
+ /// The machine the Product Manager starts on, as the Swarm lists it.
+ LeadMachine? get leadMachine =>
+ integration?.leadMachines?.where((m) => m.id == _machineId).firstOrNull;
+
+ /// Why New Project cannot start its Product Manager now, or null.
+ String? get leadBlocked {
+ final machines = integration?.leadMachines;
+ if (machines == null) return null;
+ if (leadMachine?.startable == true) return _leadModelListRefusal;
+ if (machines.isNotEmpty &&
+ machines.every((m) => m.unavailable == kLeadSwarmPaused)) {
+ return '$kLeadSwarmPaused. New Project can start once it resumes.';
+ }
+ if (bestLeadMachine(machines, cloudRepository) == null) {
+ return 'No machine of yours in this Swarm is free. New Project can start once one is.';
+ }
+ final name = leadMachine?.name ?? machineLabel;
+ return '$name cannot start the Product Manager. Choose another machine.';
+ }
+
+ /// Moves the Product Manager to the best machine the Swarm lists, unless
+ /// it is already there or nothing can take it.
+ void placeLead() {
+ final machines = integration?.leadMachines;
+ if (machines == null || locked) return;
+ final best = bestLeadMachine(machines, cloudRepository);
+ if (best == null || best.id == _machineId) return;
+ chooseLeadMachine(best.id);
+ }
+
+ /// Starts the Product Manager on [id], one of the person's own machines the
+ /// list can start it on now. Anything else is refused with its reason.
+ void chooseLeadMachine(String id) {
+ if (locked) return;
+ final listed = integration?.leadMachines
+ ?.where((m) => m.id == id)
+ .firstOrNull;
+ final choice = machineChoices.where((m) => m.id == id).firstOrNull;
+ if (listed == null ||
+ !listed.startable ||
+ choice == null ||
+ !choice.enabled) {
+ warn(
+ listed?.unavailable ??
+ choice?.why ??
+ '${listed?.name ?? 'This machine'} cannot start the Product Manager.',
+ );
+ return;
+ }
+ error = null;
+ final remote = _remoteOf(_machineId, _project);
+ _selectMachine(id);
+ if (remote != null) _keepRepository(id, remote, listed.name);
+ // That machine's branches: a branch chosen on the other one is not here.
+ if (_desktopChoices) _syncGitProject();
+ notifyListeners();
+ }
+
+ /// The model the Product Manager runs: the one chosen, else its engine's
+ /// default, which nothing knows before it starts.
+ String get leadModelLabel => _model != null ? modelLabel : 'Default model';
+
+ /// Why the Swarm's model list rules out [model] (null for the engine's
+ /// default) for a new project's Product Manager, or null.
+ String? _leadModelRefusal(String? model, {bool grid = false}) {
+ final list = integration?.leadModels;
+ if (!placesLead || list == null) return null;
+ if (grid && !list.gridModels) {
+ return 'The Swarm’s model list turns off models on its grid.';
+ }
+ return list.refusal(_engine, model);
+ }
+
+ /// Why the Swarm's model list rules out the engine or model chosen, or
+ /// null.
+ String? get _leadModelListRefusal {
+ final list = integration?.leadModels;
+ if (!placesLead || list == null) return null;
+ if (list.engineRefusal(_engine) case final why?) {
+ return '$why Choose another engine under Advanced.';
+ }
+ final why = _leadModelRefusal(_model?.id, grid: _model != null);
+ return why == null ? null : '$why Choose another model under Advanced.';
+ }
+
+ /// The repo the Product Manager starts in is cloned on its machine first:
+ /// that machine has no checkout of it.
+ bool get leadClones => placesLead && _project.repository != null;
+
+ /// The remote [project] on [machineId] has, when anything says so: a
+ /// repository to clone, an agent that ran in that folder, or the Swarm's
+ /// own checkout there.
+ String? _remoteOf(String machineId, NewHarnessProject project) {
+ if (project.repository case final repository?) return repository.url;
+ final folder = project.folder;
+ if (folder == null) return null;
+ final machine = app.stateOf(machineId);
+ for (final agent in machine?.agents ?? const <Agent>[]) {
+ final known = machine!.projectOf(agent);
+ if (known?.remote case final remote?
+ when known!.root == folder || known.cwd == folder) {
+ return remote;
+ }
+ }
+ final listed = integration?.leadMachines
+ ?.where((m) => m.id == machineId)
+ .firstOrNull;
+ for (final MapEntry(:key, :value) in listed?.folders.entries ?? const []) {
+ if (value == folder) return key;
+ }
+ return null;
+ }
+
+ /// Keeps the repo [remote] names on [machineId]: its folder there, found by
+ /// its remote, or else the repository to clone there.
+ void _keepRepository(String machineId, String remote, String machineName) {
+ final key = leadRepositoryKey(remote);
+ String? folder;
+ final machine = app.stateOf(machineId);
+ for (final agent in machine?.agents ?? const <Agent>[]) {
+ final known = machine!.projectOf(agent);
+ if (known != null &&
+ !known.worktree &&
+ leadRepositoryKey(known.remote) == key) {
+ folder = known.root ?? known.cwd;
+ break;
+ }
+ }
+ folder ??= integration?.leadMachines
+ ?.where((m) => m.id == machineId)
+ .firstOrNull
+ ?.folders[key];
+ final clone = GitHubRepository.parse(
+ remote.startsWith('github.com/') ? 'https://$remote' : remote,
+ );
+ if (folder != null) {
+ _project = NewHarnessProject.folder(folder);
+ } else if (clone != null) {
+ _project = NewHarnessProject.clone(clone);
+ } else {
+ warn('$machineName has no copy of $remote. Choose its folder there.');
+ return;
+ }
+ }
+
/// The GitHub repository a cloud coding agent works on: the one chosen to
/// clone, else the chosen folder's own remote; null when neither is on GitHub.
String? get cloudRepository {
@@ -3245,12 +3410,15 @@ class NewHarnessController extends ChangeNotifier {
/// machine its row says so instead of opening.
NewHarnessOption _engineOption(String id) {
final finderElsewhere = isFinderEngine(id) && !canOpenFinderOn(_machine);
+ final ruledOut = placesLead
+ ? integration?.leadModels?.engineRefusal(id)
+ : null;
return NewHarnessOption(
id: id,
title: labelOf(id),
engine: id,
- enabled: !finderElsewhere,
- why: finderElsewhere ? kFinderElsewhere : null,
+ enabled: !finderElsewhere && ruledOut == null,
+ why: finderElsewhere ? kFinderElsewhere : ruledOut,
);
}
@@ -4195,7 +4363,7 @@ class NewHarnessController extends ChangeNotifier {
choice,
harnessId: harness,
setup: launchSetup,
- worktree: launchedWorktree,
+ worktree: worktreeToRemember,
),
);
}
diff --git a/desktop/lib/super_tabs/agent_line.dart b/desktop/lib/super_tabs/agent_line.dart
new file mode 100644
index 000000000..0c1cd4bd7
--- /dev/null
+++ b/desktop/lib/super_tabs/agent_line.dart
@@ -0,0 +1,89 @@
+import '../state/harness_activity.dart';
+import 'agent_details.dart';
+
+/// An agent row's one line (Dee, 2026-10-27: "it's hard to monitor the team"): its state, where it runs, and on which
+/// model and effort. Read from the Swarm the person already sees, so nobody sees an agent or a machine they could not
+/// see before.
+
+/// [label] is the agent's state in a word: "Waiting" is on a person (a question, needs-human work, an input prompt);
+/// "Assigned" holds a task with no turn seen running: a task can outlive its turn or connection, so it never reads
+/// as working.
+/// One agent in one line: "Working · Mac Studio · Opus 5.5 · high".
+class SuperTabAgentGlance {
+ const SuperTabAgentGlance({
+ required this.label,
+ required this.machine,
+ required this.model,
+ required this.effort,
+ });
+
+ /// The state as shown: one word, or "Limited until 09:05".
+ final String label;
+ final String? machine, model;
+
+ /// The effort to show: the recorded one, else its start's; null when neither names one. A row says only what is
+ /// known: the PM's row read "opus unknown" (2026-10-28).
+ final String? effort;
+
+ /// "Opus 5.5 · high", or "Opus 5.5" when no effort is known; null when the model is not known (an agent read
+ /// before it reported one).
+ String? get modelEffort =>
+ model == null ? null : [model, ?effort].join(' · ');
+
+ String get line => [label, ?machine, ?modelEffort].join(' · ');
+}
+
+/// An effort that says which one runs. 'auto' is what Claude Code reports for an effort it was launched with, and
+/// 'default' what a start asks when it leaves the engine's own: neither names one.
+String? _concrete(Object? effort) =>
+ effort is String &&
+ effort.isNotEmpty &&
+ effort != 'auto' &&
+ effort != 'default'
+ ? effort
+ : null;
+
+SuperTabAgentGlance superTabAgentGlance(
+ SuperTabAgentInfo info, {
+ DateTime? now,
+}) {
+ final at = now ?? DateTime.now();
+ final agent = info.agent;
+ final work = info.taskGroup?.assignment?['status'];
+ final activity = info.activity;
+ final until = agent.limitedUntil?.toLocal();
+ String two(int n) => n.toString().padLeft(2, '0');
+ final label = switch (null) {
+ _ when work == 'lost' => 'Lost',
+ _
+ when agent.downSince != null ||
+ activity == HarnessActivity.offline ||
+ activity == HarnessActivity.failed =>
+ 'Down',
+ _ when until != null && until.isAfter(at) =>
+ 'Limited until ${two(until.hour)}:${two(until.minute)}',
+ _ when activity == HarnessActivity.starting => 'Starting',
+ _ when activity == HarnessActivity.paused => 'Stopped',
+ // Before waiting: the sidebar marks blocked work as needing input too.
+ _ when work == 'blocked' => 'Stuck',
+ _
+ when info.hasQuestion ||
+ work == 'needs_human' ||
+ activity == HarnessActivity.needsInput =>
+ 'Waiting',
+ _ when work == 'review' => 'In review',
+ _ when work == 'reconciling' => 'Checking',
+ _ when activity == HarnessActivity.working => 'Working',
+ _ when work == 'planned' || work == 'working' => 'Assigned',
+ _ when activity == HarnessActivity.done => 'Finished',
+ _ => 'Idle',
+ };
+ return SuperTabAgentGlance(
+ label: label,
+ machine: info.machine,
+ model: info.model,
+ effort:
+ _concrete(agent.configuration['effort']) ??
+ _concrete(info.controller.snapshot?.startEfforts[agent.harnessId]),
+ );
+}
diff --git a/desktop/lib/super_tabs/detail_dialog.dart b/desktop/lib/super_tabs/detail_dialog.dart
index 56acda9ae..2004c6706 100644
--- a/desktop/lib/super_tabs/detail_dialog.dart
+++ b/desktop/lib/super_tabs/detail_dialog.dart
@@ -11,7 +11,7 @@ const _halfGap = _gap / 2;
/// Where every value of a details dialog starts: after the label column and its gap.
const superTabDetailLabelWidth = 120.0;
-/// The frame the Swarm's details dialogs share (machine, person, project, Team at a glance, Share Swarm, Add
+/// The frame the Swarm's details dialogs share (machine, person, project, Share Swarm, Add
/// machine): the title with a quiet close, a hairline under it only while content has scrolled beneath it, a
/// scrolling body, and actions at the bottom — [leadingActions] at the left, [actions] at the right, at most one of
/// them filled.
diff --git a/desktop/lib/super_tabs/launch.dart b/desktop/lib/super_tabs/launch.dart
index 29a820c5d..b16a2f554 100644
--- a/desktop/lib/super_tabs/launch.dart
+++ b/desktop/lib/super_tabs/launch.dart
@@ -1,12 +1,18 @@
import 'dart:convert';
+import 'dart:math' as math;
+
+import 'package:path/path.dart' as p;
import '../core/first_task.dart';
import '../core/models.dart';
import '../state/app_state.dart';
import '../state/harness_attachments.dart';
import '../state/harness_launch_integration.dart';
+import '../state/lead_placement.dart';
import '../state/swarm.dart';
import 'controller.dart';
+import 'machine_icon.dart';
+import 'machine_status.dart';
import 'model.dart';
import 'launch_prompt.dart';
@@ -67,129 +73,176 @@ class SuperTabLaunch {
];
}
}
+ // A project's Product Manager starts on one of the Swarm's machines.
+ // Read from the open Swarm when there is one; each submit reads afresh.
+ List<LeadMachine>? leadMachines;
+ LeadModelList? leadModels;
+ if (saved['newProject'] == true && tab.superTabId != null) {
+ final id = tab.superTabId!;
+ final policy = launch.readRoutingPolicy(id);
+ final snapshot =
+ app.superTabs.peek(id)?.snapshot ??
+ await app.superTabs.readSnapshot(id);
+ leadMachines = launch.leadMachinesOf(snapshot);
+ leadModels = LeadModelList.of(await policy);
+ }
final selectedRole =
roles?.where((role) => role.id == saved['roleId']).firstOrNull ??
roles?.where((role) => role.kind == 'builder').firstOrNull ??
roles?.firstOrNull;
late final HarnessLaunchIntegration integration;
- integration = HarnessLaunchIntegration(
- forcedPermissionMode: 'full',
- creationId: saved['creationId'] as String? ?? superTabOperationId(),
- initialTask: saved['initialMessage'] as String?,
- swarmRole: saved['lead'] == true
- ? 'lead'
- : selectedRole?.swarmRole ??
- (saved['roleKind'] == 'reviewer' ? 'review' : 'dev'),
- swarmSkillMode: saved['skillMode'] as String? ?? 'orchestration',
- roles: roles,
- roleId: recovering ? saved['roleId'] as String? : selectedRole?.id,
- actionLabel: saved['newProject'] == true
- ? 'New Project'
- : saved['lead'] == true
- ? 'New Swarm'
- : 'New Harness',
- // Routing reads quota for Claude Code and Codex only, so a Lead is one
- // of them; the agents it starts may be anything.
- engines: saved['lead'] == true ? const ['claude', 'codex'] : null,
- projectVisibility: saved['lead'] == true
- ? saved['visibility'] as String? ?? 'public'
- : null,
- projectVisibilityLocked:
- saved['projectPrepared'] == true || saved['creationRequest'] != null,
- prepare: (machine, task) async {
- if (integration.roles != null) {
- final chosen = integration.roles!
- .where((role) => role.id == integration.roleId)
- .firstOrNull;
- if (chosen == null) {
- throw const SuperTabFailure(
- 'ROLE_UNAVAILABLE',
- 'Choose a role before starting this agent.',
- );
- }
- saved['roleId'] = chosen.id;
- saved['roleKind'] = chosen.kind;
- }
- if (saved['projectPrepared'] != true &&
- saved['creationRequest'] == null) {
- saved['visibility'] = integration.projectVisibility ?? 'public';
- }
- try {
- final prompt = await launch.prepare(machine, task);
- integration.swarmSkillMode =
- saved['skillMode'] as String? ?? 'orchestration';
- integration.swarmRole = saved['lead'] == true
- ? 'lead'
- : saved['roleKind'] == 'reviewer'
- ? 'review'
- : 'dev';
- return prompt;
- } on SuperTabFailure catch (failure) {
- if (failure.code == 'PROJECT_UNAVAILABLE' && launch.started) {
- integration.discard = launch.discard;
- }
- // Validation rejects the request before applying it. A lost response
- // stays locked so retrying cannot create a second project or change
- // the visibility of a project that may already exist.
- if (saved['projectPrepared'] != true &&
- const {
- 'VALIDATION_ERROR',
- 'UPDATE_REQUIRED',
- }.contains(failure.code)) {
- saved.remove('creationRequest');
- saved['operationId'] = superTabOperationId();
- await launch.persist();
- }
- rethrow;
- } finally {
- integration.projectVisibilityLocked =
- saved['projectPrepared'] == true ||
- saved['creationRequest'] != null;
- }
- },
- beforeSubmit: (machine, receipt) async {
- saved['machineId'] = machine;
- saved['creationId'] = receipt;
- saved['phase'] = 'starting';
- saved['engine'] = integration.engine;
- saved['folder'] = integration.folder;
- await launch.persist();
- },
- complete: (machine, harnessId) async {
- try {
- await launch.join(machine, harnessId);
- } catch (_) {
- // The harness exists and its join did not finish: the journal now
- // holds it, and the person may rather drop it than retry.
- integration.discard = launch.discard;
- rethrow;
- }
- },
- stageAttachments: launch.stageAttachments,
- needsAttachmentReview: () => saved['filesState'] == 'sending',
- resolveAttachments: (resend) async {
- launch.checkAccount();
- saved['filesState'] = resend ? 'pending' : 'delivered';
- await launch.persist();
- await launch.resume();
- },
- resume: recovering
- ? () async {
+ integration =
+ HarnessLaunchIntegration(
+ forcedPermissionMode: 'full',
+ creationId: saved['creationId'] as String? ?? superTabOperationId(),
+ initialTask: saved['initialMessage'] as String?,
+ swarmRole: saved['lead'] == true
+ ? 'lead'
+ : selectedRole?.swarmRole ??
+ (saved['roleKind'] == 'reviewer' ? 'review' : 'dev'),
+ swarmSkillMode: saved['skillMode'] as String? ?? 'orchestration',
+ roles: roles,
+ roleId: recovering ? saved['roleId'] as String? : selectedRole?.id,
+ actionLabel: saved['newProject'] == true
+ ? 'New Project'
+ : saved['lead'] == true
+ ? 'New Swarm'
+ : 'New Harness',
+ // Routing reads quota for Claude Code and Codex only, so a Lead is one
+ // of them; the agents it starts may be anything.
+ engines: saved['lead'] == true ? const ['claude', 'codex'] : null,
+ projectVisibility: saved['lead'] == true
+ ? saved['visibility'] as String? ?? 'public'
+ : null,
+ projectVisibilityLocked:
+ saved['projectPrepared'] == true ||
+ saved['creationRequest'] != null,
+ prepare: (machine, task) async {
+ if (integration.leadMachines != null) {
+ // The list from when the form opened may be stale by now. With
+ // no fresh read nothing is created: the machine is unchecked.
+ final name =
+ integration.leadMachines!
+ .where((m) => m.id == machine)
+ .firstOrNull
+ ?.name ??
+ launch.machineNameOf(machine);
+ final SuperTabSnapshot fresh;
+ try {
+ fresh = await app.superTabs.readSnapshot(tab.superTabId!);
+ } on SuperTabFailure catch (failure) {
+ if (failure.code == 'ACCOUNT_CHANGED') rethrow;
+ throw SuperTabFailure(
+ 'SWARM_UNREADABLE',
+ 'Couldn’t check $name for the '
+ 'Product Manager: ${failure.message} Try again.',
+ );
+ } catch (_) {
+ throw SuperTabFailure(
+ 'SWARM_UNREADABLE',
+ 'Couldn’t check $name for the '
+ 'Product Manager: the Swarm didn’t answer. Try again.',
+ );
+ }
+ integration.leadMachines = launch.leadMachinesOf(fresh);
+ launch.checkLeadMachine(integration.leadMachines!, machine);
+ }
+ if (integration.roles != null) {
+ final chosen = integration.roles!
+ .where((role) => role.id == integration.roleId)
+ .firstOrNull;
+ if (chosen == null) {
+ throw const SuperTabFailure(
+ 'ROLE_UNAVAILABLE',
+ 'Choose a role before starting this agent.',
+ );
+ }
+ saved['roleId'] = chosen.id;
+ saved['roleKind'] = chosen.kind;
+ }
+ if (saved['projectPrepared'] != true &&
+ saved['creationRequest'] == null) {
+ saved['visibility'] = integration.projectVisibility ?? 'public';
+ }
try {
- await launch.resume();
+ final prompt = await launch.prepare(machine, task);
+ integration.swarmSkillMode =
+ saved['skillMode'] as String? ?? 'orchestration';
+ integration.swarmRole = saved['lead'] == true
+ ? 'lead'
+ : saved['roleKind'] == 'reviewer'
+ ? 'review'
+ : 'dev';
+ return prompt;
} on SuperTabFailure catch (failure) {
- if (failure.code == 'CREATION_FAILED') {
- saved.remove('phase');
- saved.remove('creationId');
+ if (failure.code == 'PROJECT_UNAVAILABLE' && launch.started) {
+ integration.discard = launch.discard;
+ }
+ // Validation rejects the request before applying it. A lost response
+ // stays locked so retrying cannot create a second project or change
+ // the visibility of a project that may already exist.
+ if (saved['projectPrepared'] != true &&
+ const {
+ 'VALIDATION_ERROR',
+ 'UPDATE_REQUIRED',
+ }.contains(failure.code)) {
+ saved.remove('creationRequest');
+ saved['operationId'] = superTabOperationId();
await launch.persist();
- integration.pending = false;
- integration.resume = null;
}
rethrow;
+ } finally {
+ integration.projectVisibilityLocked =
+ saved['projectPrepared'] == true ||
+ saved['creationRequest'] != null;
}
- }
- : null,
- )..pending = recovering;
+ },
+ beforeSubmit: (machine, receipt) async {
+ saved['machineId'] = machine;
+ saved['creationId'] = receipt;
+ saved['phase'] = 'starting';
+ saved['engine'] = integration.engine;
+ saved['folder'] = integration.folder;
+ await launch.persist();
+ },
+ complete: (machine, harnessId) async {
+ try {
+ await launch.join(machine, harnessId);
+ } catch (_) {
+ // The harness exists and its join did not finish: the journal now
+ // holds it, and the person may rather drop it than retry.
+ integration.discard = launch.discard;
+ rethrow;
+ }
+ },
+ stageAttachments: launch.stageAttachments,
+ needsAttachmentReview: () => saved['filesState'] == 'sending',
+ resolveAttachments: (resend) async {
+ launch.checkAccount();
+ saved['filesState'] = resend ? 'pending' : 'delivered';
+ await launch.persist();
+ await launch.resume();
+ },
+ resume: recovering
+ ? () async {
+ try {
+ await launch.resume();
+ } on SuperTabFailure catch (failure) {
+ if (failure.code == 'CREATION_FAILED') {
+ saved.remove('phase');
+ saved.remove('creationId');
+ await launch.persist();
+ integration.pending = false;
+ integration.resume = null;
+ }
+ rethrow;
+ }
+ }
+ : null,
+ )
+ ..pending = recovering
+ ..leadMachines = leadMachines
+ ..leadModels = leadModels;
if (recovering) {
integration
..machineId = saved['machineId'] as String?
@@ -210,9 +263,12 @@ class SuperTabLaunch {
String get machineName {
final machine = saved['machineId'] as String?;
if (machine == null) return 'the machine';
- return app.stateOf(machine)?.machine.displayName ?? machine;
+ return machineNameOf(machine);
}
+ String machineNameOf(String machine) =>
+ app.stateOf(machine)?.machine.displayName ?? machine;
+
String get startedNote =>
'The $who started on $machineName. Check status to add it to the project.';
String get waitingNote {
@@ -224,6 +280,140 @@ class SuperTabLaunch {
: 'Waiting for $machineName to start the harness.';
}
+ /// The Swarm's machines, one row per computer, then the person's others,
+ /// best first. A new project's Product Manager starts only on one of the
+ /// person's own, connected to this Desktop: it runs on its owner's machine,
+ /// in their account (Ken, 10-28; docs/swarms.md), so teammates' rows only
+ /// say why not.
+ List<LeadMachine> leadMachinesOf(SuperTabSnapshot snapshot, {DateTime? now}) {
+ final at = (now ?? DateTime.now()).millisecondsSinceEpoch;
+ // A machine reports readiness and resources only once it has them.
+ Map<String, dynamic> part(Object? value) =>
+ value is Map ? superTabMap(value) : const {};
+ LeadMachine row(String id, Map<String, dynamic> pool) {
+ final reading = snapshot.readingPoolOf(id, accountId) ?? pool;
+ final observation = part(reading['observation']);
+ final received = observation['receivedAt'];
+ final online =
+ received is num &&
+ at - received < kSuperTabMachineOfflineAfter.inMilliseconds;
+ final running = observation['runningHarnessIds'];
+ final max = reading['maxAgents'];
+ final checkouts = part(observation['readiness'])['checkouts'];
+ final device = part(observation['resources'])['deviceType'];
+ return LeadMachine(
+ id: id,
+ name: pool['name'] as String? ?? id,
+ online: online,
+ // The server's count: it also holds pending starts and the Team
+ // account sharing a Mac. A backend without it: slots minus running.
+ freeAgents: switch (reading['availableSlots']) {
+ final num slots => math.max(0, slots.toInt()),
+ _ => math.max(
+ 0,
+ (max is num ? max.toInt() : 0) -
+ (running is List ? running.length : 0),
+ ),
+ },
+ repositories: {
+ if (checkouts is List)
+ for (final checkout in checkouts)
+ ?leadRepositoryKey(switch (part(checkout)['repository']) {
+ final String repository => repository,
+ _ => null,
+ }),
+ },
+ // The Swarm's clone of each project there: its folder in the
+ // machine's Swarm folder, in that machine's own path style.
+ folders: {
+ if (pool['cwd'] case final String root when checkouts is List)
+ for (final checkout in checkouts.map(part))
+ if ((
+ leadRepositoryKey(switch (checkout['repository']) {
+ final String repository => repository,
+ _ => null,
+ }),
+ checkout['folder'],
+ )
+ case (final String key, final String folder))
+ key: (root.contains('\\') ? p.windows : p.posix).join(
+ root,
+ folder,
+ ),
+ },
+ maySleep:
+ superTabMachineSymbol(device is String ? device : null) ==
+ 'laptopcomputer',
+ unavailable: snapshot.paused
+ ? kLeadSwarmPaused
+ : pool['contributorId'] != accountId
+ ? 'Another person’s machine'
+ : app.stateOf(id) == null
+ ? 'Not connected to this computer'
+ : pool['paused'] == true
+ ? 'Paused in this Swarm'
+ : null,
+ );
+ }
+
+ final listed = [
+ for (final pool in snapshot.machines)
+ if (pool['machineId'] case final String id
+ when snapshot.placeOf(id) == id && pool['removal'] == null)
+ row(id, pool),
+ ];
+ return rankLeadMachines([
+ ...listed,
+ // A person's start may still name a machine of theirs the Swarm does
+ // not list (backend agent.start), as New Project always could.
+ for (final state in app.machineStates.values)
+ if (!state.belongsToOtherAccount &&
+ !listed.any((m) => m.id == state.machine.machineId))
+ LeadMachine(
+ id: state.machine.machineId,
+ name: state.machine.displayName,
+ online: !state.needsLink && !state.isOffline,
+ freeAgents: null,
+ inSwarm: false,
+ unavailable: snapshot.paused ? kLeadSwarmPaused : null,
+ ),
+ ], null);
+ }
+
+ /// The Swarm's routing policy, or null when it cannot be read: nothing is
+ /// then ruled out by it.
+ Future<Map<String, dynamic>?> readRoutingPolicy(String tabId) async {
+ try {
+ final answer = await app.superTabs.map(
+ 'GET',
+ '/api/super-tabs/$tabId/routing-policy',
+ );
+ return answer['policy'] is Map ? superTabMap(answer['policy']) : null;
+ } catch (_) {
+ return null;
+ }
+ }
+
+ /// Refuses a machine the list cannot start the Product Manager on now.
+ void checkLeadMachine(List<LeadMachine> machines, String machine) {
+ final chosen = machines.where((m) => m.id == machine).firstOrNull;
+ if (chosen == null) {
+ throw const SuperTabFailure(
+ 'MACHINE_NOT_LISTED',
+ 'Choose one of this Swarm’s machines.',
+ );
+ }
+ if (chosen.startable) return;
+ throw SuperTabFailure(
+ 'MACHINE_UNAVAILABLE',
+ chosen.unavailable != null
+ ? '${chosen.name}: ${chosen.unavailable}. Choose another machine.'
+ : !chosen.online
+ ? '${chosen.name} is offline. Choose another machine.'
+ : '${chosen.name} has no free agents. Choose another machine.',
+ );
+ }
+
void checkAccount() {
if (app.currentUser?.id != accountId) {
throw const SuperTabFailure('ACCOUNT_CHANGED', 'The account changed.');
diff --git a/desktop/lib/super_tabs/leaderboard/goal_line.dart b/desktop/lib/super_tabs/leaderboard/goal_line.dart
deleted file mode 100644
index 11d624973..000000000
--- a/desktop/lib/super_tabs/leaderboard/goal_line.dart
+++ /dev/null
@@ -1,58 +0,0 @@
-import 'package:flutter/material.dart';
-
-import '../../widgets/desktop_chrome.dart';
-import 'format.dart';
-import 'model.dart';
-
-/// The team's total at the top of Humans, as quiet text: "N shipped this
-/// week" for the week shown (Dee, 2026-10-28: no open count). The week before
-/// and the median time to ship are on hover.
-class LeaderboardGoalLine extends StatelessWidget {
- const LeaderboardGoalLine({
- super.key,
- required this.goal,
- required this.weekName,
- });
- final SuperTabTeamGoal goal;
-
- /// "this week", "last week", …: the week the board shows.
- final String weekName;
-
- @override
- Widget build(BuildContext context) {
- final now = goal.thisWeek, before = goal.lastWeek;
- final earlier = weekName == 'this week' ? 'last week' : 'the week before';
- final median = _median(now.medianAskToShipMs, before.medianAskToShipMs);
- return Padding(
- key: const ValueKey('leaderboard-goal'),
- padding: const EdgeInsets.fromLTRB(
- DesktopChrome.groupGap,
- 0,
- DesktopChrome.groupGap,
- DesktopChrome.controlGap / 2,
- ),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Tooltip(
- message: ['${before.shipped} shipped $earlier', ?median].join('\n'),
- child: Text(
- '${now.shipped} shipped $weekName',
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(),
- ),
- ),
- ),
- );
- }
-
- static String? _median(int? now, int? before) {
- if (now == null) return null;
- final text = 'Median ask to ship ${leaderboardDuration(now)}';
- if (before == null) return text;
- if (leaderboardDuration(now) == leaderboardDuration(before)) {
- return '$text, as before';
- }
- return '$text, ${now < before ? 'down' : 'up'} from ${leaderboardDuration(before)}';
- }
-}
diff --git a/desktop/lib/super_tabs/leaderboard/model.dart b/desktop/lib/super_tabs/leaderboard/model.dart
index 6f32070ed..7339ed1b4 100644
--- a/desktop/lib/super_tabs/leaderboard/model.dart
+++ b/desktop/lib/super_tabs/leaderboard/model.dart
@@ -18,7 +18,6 @@ class SuperTabLeaderboard {
SuperTabLeaderboard.fromJson(Map<String, dynamic> json)
: projectId = json['projectId'] as String? ?? '',
week = _int(json['week']),
- goal = SuperTabTeamGoal.fromJson(_map(json['goal'])),
people = _list(json['people']).map(SuperTabPersonScore.fromJson).toList(),
waiting = SuperTabWaiting.fromJson(_map(json['waiting']));
@@ -26,31 +25,12 @@ class SuperTabLeaderboard {
/// The week's Monday 00:00 UTC, in epoch milliseconds.
final int week;
- final SuperTabTeamGoal goal;
/// Most points first.
final List<SuperTabPersonScore> people;
final SuperTabWaiting waiting;
}
-class SuperTabWeekGoal {
- SuperTabWeekGoal.fromJson(Map<String, dynamic> json)
- : shipped = _int(json['shipped']),
- points = _int(json['points']),
- medianAskToShipMs = _optional(json['medianAskToShipMs']);
- final int shipped, points;
- final int? medianAskToShipMs;
-}
-
-class SuperTabTeamGoal {
- SuperTabTeamGoal.fromJson(Map<String, dynamic> json)
- : openRequests = _int(json['openRequests']),
- thisWeek = SuperTabWeekGoal.fromJson(_map(json['thisWeek'])),
- lastWeek = SuperTabWeekGoal.fromJson(_map(json['lastWeek']));
- final int openRequests;
- final SuperTabWeekGoal thisWeek, lastWeek;
-}
-
class SuperTabPersonScore {
SuperTabPersonScore.fromJson(Map<String, dynamic> json)
: personId = json['personId'] as String? ?? '',
diff --git a/desktop/lib/super_tabs/leaderboard/person_row.dart b/desktop/lib/super_tabs/leaderboard/person_row.dart
index 690ff6e61..1363f32e3 100644
--- a/desktop/lib/super_tabs/leaderboard/person_row.dart
+++ b/desktop/lib/super_tabs/leaderboard/person_row.dart
@@ -2,7 +2,6 @@ import 'package:clock/clock.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
-import '../../shared/theme/app_icons.dart';
import '../../shared/theme/app_theme.dart' as grid;
import '../../widgets/desktop_chrome.dart';
import '../../widgets/finger_target.dart';
@@ -35,23 +34,15 @@ TextStyle _pointsStyle() => grid.AppType.label(
fontFeatures: grid.AppFont.tabularFigures,
);
-TextStyle _trendStyle(Color color) =>
- DesktopChrome.metadata(color: color)
- .copyWith(fontFeatures: grid.AppFont.tabularFigures);
-
/// A person as the leaderboard names them: the board's display name, else the
/// email's first part, as before the board had names.
String leaderboardName(SuperTabPerson person, SuperTabPersonScore? score) =>
score?.displayName ?? superTabPersonName(person.email);
-/// "Up 6 from last week", "down 7 …"; null when level, or from a server
-/// without last week.
-String? leaderboardTrend(SuperTabPersonScore score) {
- final before = score.prevWeekPoints;
- if (before == null || before == score.points) return null;
- final change = score.points - before;
- return '${change > 0 ? 'up' : 'down'} ${change.abs()} from last week';
-}
+/// Whether a person wears the crown: first on the board, with points. At the
+/// start of a week everyone ties at 0, and no one has taken #1 yet.
+bool leaderboardCrowned(SuperTabPersonScore? score) =>
+ score != null && score.rank == 1 && score.points > 0;
/// "16 shipped", "1 unblocked", "43 hours lent": each number that would not
/// read zero, in words; empty when all would.
@@ -65,13 +56,9 @@ List<String> leaderboardNumbers(SuperTabPersonScore score) {
}
/// The board's fixed numeric columns, each as wide as its widest value at
-/// the current text size, so rank, trend and points line up on every row.
+/// the current text size, so rank and points line up on every row.
class LeaderboardColumns {
- const LeaderboardColumns({
- required this.rank,
- required this.points,
- this.trend,
- });
+ const LeaderboardColumns({required this.rank, required this.points});
factory LeaderboardColumns.of(
BuildContext context,
@@ -93,35 +80,23 @@ class LeaderboardColumns {
String widest(Iterable<int> values) => values
.map((value) => '$value')
.fold('0', (a, b) => b.length > a.length ? b : a);
- final changes = [
- for (final score in scores)
- if (score.prevWeekPoints case final before? when before != score.points)
- (score.points - before).abs(),
- ];
return LeaderboardColumns(
rank: width(widest(scores.map((score) => score.rank)), _rankStyle()),
points: width(
widest(scores.map((score) => score.points)),
_pointsStyle(),
),
- trend: changes.isEmpty
- ? null
- : AppIcons.metadataSize +
- width(widest(changes), _trendStyle(DesktopChrome.muted)),
);
}
final double rank, points;
-
- /// Null when no one on the board moved against last week.
- final double? trend;
}
/// One person in the Humans section: their rank as a bold numeral in its own
-/// column, avatar, name and status, and a quiet line of their non-zero
-/// numbers beneath; at the right the change against last week, then their
-/// points, the one emphasized number. The viewer's own row carries
-/// the selected fill. Without a [score] (no board yet, or a server without
+/// column, avatar, name (number one's with a crown beside it) and status, and
+/// a quiet line of their non-zero numbers beneath; at the right their points,
+/// the one number (Dee, 2026-10-29). The viewer's own row carries the selected
+/// fill. Without a [score] (no board yet, or a server without
/// one) only the name and status.
class LeaderboardPersonRow extends StatelessWidget {
const LeaderboardPersonRow({
@@ -131,6 +106,7 @@ class LeaderboardPersonRow extends StatelessWidget {
required this.onTap,
this.columns,
this.own = false,
+ this.weekName = 'this week',
});
final SuperTabPerson person;
final SuperTabPersonScore? score;
@@ -142,6 +118,9 @@ class LeaderboardPersonRow extends StatelessWidget {
/// Whether this is the viewer's own row.
final bool own;
+ /// The week the board shows, "this week", "last week", …, as the crown says it.
+ final String weekName;
+
@override
Widget build(BuildContext context) {
final score = this.score;
@@ -149,7 +128,6 @@ class LeaderboardPersonRow extends StatelessWidget {
final numbers = score == null
? const <String>[]
: leaderboardNumbers(score);
- final trend = score == null ? null : leaderboardTrend(score);
final radius = BorderRadius.circular(DesktopChrome.rowRadius);
Widget column(String kind, double width, Widget? child) => Padding(
padding: const EdgeInsets.only(left: _gap),
@@ -218,18 +196,6 @@ class LeaderboardPersonRow extends StatelessWidget {
],
),
),
- if (columns?.trend case final width?)
- column(
- 'trend-column',
- width,
- trend == null || score == null
- ? null
- : _Trend(
- personId: person.id,
- score: score,
- trend: trend,
- ),
- ),
if (columns != null && score != null)
column(
'points',
@@ -253,7 +219,9 @@ class LeaderboardPersonRow extends StatelessWidget {
);
}
- /// The name, then the status quietly; on hover the whole name, which a long one cut short needs, and the email.
+ /// The name, number one's crown, then the status quietly; on hover the whole name, which a long one cut short
+ /// needs, and the email. The crown is content artwork beside the name, said in words, at the metadata size so a
+ /// crowned row is as tall as any other (Team and celebration, design system).
Widget _name() => Tooltip(
message: '${leaderboardName(person, score)}\n${person.email}',
child: SuperTabUntil(
@@ -262,6 +230,19 @@ class LeaderboardPersonRow extends StatelessWidget {
TextSpan(
text: leaderboardName(person, score),
children: [
+ if (leaderboardCrowned(score))
+ WidgetSpan(
+ alignment: PlaceholderAlignment.middle,
+ child: Padding(
+ padding: const EdgeInsets.only(left: _halfGap),
+ child: Semantics(
+ key: ValueKey('leaderboard-crown-${person.id}'),
+ label: 'Number one $weekName',
+ excludeSemantics: true,
+ child: Text('\u{1F451}', style: DesktopChrome.metadata()),
+ ),
+ ),
+ ),
if (person.statusAt(clock.now()) case final status?)
TextSpan(
text: ' ${status.text}',
@@ -326,51 +307,6 @@ class _Numbers extends StatelessWidget {
}
}
-/// An arrow and the change against last week, by shape and colour both: up in
-/// the online green, down in the theme's error ink.
-class _Trend extends StatelessWidget {
- const _Trend({
- required this.personId,
- required this.score,
- required this.trend,
- });
- final String personId;
- final SuperTabPersonScore score;
- final String trend;
-
- @override
- Widget build(BuildContext context) {
- final up = score.points > score.prevWeekPoints!;
- final color = up
- ? grid.AppPalette.online
- : Theme.of(context).colorScheme.error;
- return Tooltip(
- key: ValueKey('leaderboard-trend-$personId'),
- message: capitalized(trend),
- excludeFromSemantics: true,
- child: Semantics(
- label: capitalized(trend),
- excludeSemantics: true,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- up ? AppIcons.arrowUp : AppIcons.arrowDown,
- size: AppIcons.metadataSize,
- color: color,
- ),
- Text(
- '${(score.points - score.prevWeekPoints!).abs()}',
- style: DesktopChrome.metadata(color: color)
- .copyWith(fontFeatures: grid.AppFont.tabularFigures),
- ),
- ],
- ),
- ),
- );
- }
-}
-
/// A person's week, shown when their name is tapped: what they shipped, what
/// they unblocked and what they lent, item by item. From a server without
/// details, the medians, the time freed and lent, and their shipping streak.
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index 62577043e..b0634dc1d 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -448,7 +448,7 @@ class SuperTabSnapshot {
/// The pool whose reading [accountId] sees for the machine row [machineId]: the Mac's Harness Team account for
/// everyone but the Mac's own contributor, since it runs their agents, also while the owner is away from the Mac; the
- /// machine's own pool otherwise. The Machines view and Team at a glance read a machine by this one rule.
+ /// machine's own pool otherwise. The Machines view reads a machine by this one rule.
Map<String, dynamic>? readingPoolOf(String machineId, String? accountId) {
final own = pool(machineId), team = teamPoolOf(machineId);
final contributor =
diff --git a/desktop/lib/super_tabs/pm_chat_rows.dart b/desktop/lib/super_tabs/pm_chat_rows.dart
index 8b4d02ddb..1d49aed4c 100644
--- a/desktop/lib/super_tabs/pm_chat_rows.dart
+++ b/desktop/lib/super_tabs/pm_chat_rows.dart
@@ -83,11 +83,9 @@ class SuperTabPmChatRow extends StatelessWidget {
final String? note;
static const _column = SuperTabSectionHeading.actionWidth;
- static const _dotSize = 6.0;
@override
Widget build(BuildContext context) {
- final strong = selected || unread;
final color = onTap == null
? DesktopChrome.muted
: DesktopChrome.foreground;
@@ -136,10 +134,16 @@ class SuperTabPmChatRow extends StatelessWidget {
name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(
- medium: strong,
- color: color,
- ),
+ // Unread is the name in bold, no dot (Dee, 2026-10-29).
+ style:
+ DesktopChrome.control(
+ medium: selected,
+ color: color,
+ ).copyWith(
+ fontWeight: unread
+ ? grid.AppFont.semibold
+ : null,
+ ),
),
),
if (project case final project?) ...[
@@ -164,22 +168,16 @@ class SuperTabPmChatRow extends StatelessWidget {
),
SizedBox(
width: _column,
- child: Center(
- child: unreadCount > 0
- ? SuperTabPmUnread(unreadCount)
- : unread
- ? Semantics(
- label: 'Unread messages',
- child: Container(
- width: _dotSize,
- height: _dotSize,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: DesktopChrome.accent,
- ),
- ),
- )
+ // Unread is drawn as a bold name and heard in words.
+ child: Semantics(
+ label: unread && unreadCount == 0
+ ? 'Unread messages'
: null,
+ child: Center(
+ child: unreadCount > 0
+ ? SuperTabPmUnread(unreadCount)
+ : null,
+ ),
),
),
const SizedBox(width: _column),
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index ad353d2d0..36ab4a803 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -86,7 +86,6 @@ class ProjectSidebar extends StatelessWidget {
/// Projects and workgroups share a text column. Only projects use its icon.
static const _iconColumn = SuperTabSectionHeading.actionWidth;
- static const _dotSize = 6.0;
Widget _navigationRow({
required String key,
@@ -181,7 +180,7 @@ class ProjectSidebar extends StatelessWidget {
final waiting = reading == null
? needsHuman(group) > 0
: reading.waiting.isNotEmpty;
- // A project's PM chat shows its own count rather than the dot.
+ // A project's PM chat shows its own count rather than a bold name.
final pmChat = reading?.pmChat;
final projectPmUnread = reading?.pmUnread ?? 0;
final unread = reading == null
@@ -237,12 +236,13 @@ class ProjectSidebar extends StatelessWidget {
!notificationsSelected &&
selectedProjectId == project.id &&
controller.selectedId != pmChat?.id);
+ // Unread is the name in bold and nothing else, no dot (Dee, 2026-10-29).
final style = DesktopChrome.control(
- medium: unread || highlighted,
+ medium: highlighted,
color: highlighted || unread || project != null || label != null
? DesktopChrome.foreground
: DesktopChrome.muted,
- );
+ ).copyWith(fontWeight: unread ? grid.AppFont.semibold : null);
return Padding(
padding: const EdgeInsets.only(bottom: 2),
child: Material(
@@ -349,31 +349,24 @@ class ProjectSidebar extends StatelessWidget {
),
SizedBox(
width: _iconColumn,
- child: Center(
- child: waiting
- ? Tooltip(
- message: 'Needs a human',
- child: Text(
- '?',
- style: DesktopChrome.control(
- color: grid.AppPalette.warn,
- medium: true,
- ),
- ),
- )
- : unread
- ? Semantics(
- label: 'Unread messages',
- child: Container(
- width: _dotSize,
- height: _dotSize,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: DesktopChrome.accent,
+ // Unread is drawn as a bold name; a screen reader
+ // hears it said, as it heard the dot it replaces.
+ child: Semantics(
+ label: unread ? 'Unread messages' : null,
+ child: Center(
+ child: waiting
+ ? Tooltip(
+ message: 'Needs a human',
+ child: Text(
+ '?',
+ style: DesktopChrome.control(
+ color: grid.AppPalette.warn,
+ medium: true,
+ ),
),
- ),
- )
- : null,
+ )
+ : null,
+ ),
),
),
],
@@ -381,7 +374,7 @@ class ProjectSidebar extends StatelessWidget {
),
),
),
- // At the far right edge, since it is always there and the dot
+ // At the far right edge, since it is always there and the mark
// beside it comes and goes (Dee, 2026-10-28).
if (project != null) _toggle(project, expanded: expanded),
],
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index 6be1bde5c..25007d1d4 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -2,11 +2,9 @@ import 'dart:async';
import 'package:flutter/material.dart';
-import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/widgets/app_dialog.dart';
-import '../shared/widgets/app_icon_button.dart';
import '../shared/widgets/app_select_field.dart';
import '../state/app_state.dart';
import '../state/harness_activity.dart';
@@ -21,7 +19,6 @@ import 'detail_dialog.dart';
import 'dialog_scope.dart';
import 'identity.dart';
import 'leaderboard/format.dart';
-import 'leaderboard/goal_line.dart';
import 'leaderboard/model.dart';
import 'leaderboard/person_row.dart';
import 'leaderboard/reader.dart';
@@ -29,8 +26,7 @@ import 'leaderboard/waiting_line.dart';
import 'model.dart';
import 'profile_sheet.dart';
import 'section_heading.dart';
-import 'team_glance.dart';
-import 'team_glance_panel.dart';
+import 'agent_line.dart';
/// The current Swarm's authorized people, each with their week on the
/// leaderboard of the open conversation's project, and agents from the
@@ -555,11 +551,6 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
],
),
- if (board != null)
- LeaderboardGoalLine(
- goal: board.goal,
- weekName: weekName(_board.week, current),
- ),
if (_board.error case final error?)
Padding(
padding: const EdgeInsets.fromLTRB(
@@ -576,6 +567,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
score: scores[person.id],
columns: columns,
own: person.id == c.accountId,
+ weekName: weekName(_board.week, current),
onTap: () => _person(person, scores[person.id]),
),
if (board != null && board.waiting.total > 0)
@@ -603,14 +595,6 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
? () => widget.onAddAgent(c.selected!)
: null,
addTooltip: 'Add agent',
- actions: [
- AppIconButton(
- icon: AppIcons.layoutGrid,
- tooltip: 'Team at a glance',
- onPressed: () =>
- unawaited(showSuperTabTeamGlance(context, c, widget.app)),
- ),
- ],
),
for (final agent in [...leads, ...agents]) _agent(agent),
];
diff --git a/desktop/lib/super_tabs/team_glance.dart b/desktop/lib/super_tabs/team_glance.dart
deleted file mode 100644
index 0a079535c..000000000
--- a/desktop/lib/super_tabs/team_glance.dart
+++ /dev/null
@@ -1,319 +0,0 @@
-import '../state/app_state.dart';
-import '../state/harness_activity.dart';
-import 'agent_details.dart';
-import 'controller.dart';
-import 'machine_status.dart';
-
-/// Team at a glance (Dee, 2026-10-27: "it's hard to monitor the team"): where every agent runs, on which model and
-/// effort, and whether the spread makes sense. Read from the Swarm the person already sees, so nobody sees an agent
-/// or a machine they could not see before.
-
-/// An agent's state in a word. [waiting]: on a person (a question, needs-human work, an input prompt). [assigned]:
-/// holding a task with no turn seen running: a task can outlive its turn or connection, so it never reads as working.
-enum SuperTabAgentState {
- working,
- assigned,
- stuck,
- review,
- checking,
- waiting,
- idle,
- down,
- lost,
- limited,
- starting,
- paused,
-}
-
-/// One agent in one line: "Working · Mac Studio · Opus 5.5 · high".
-class SuperTabAgentGlance {
- const SuperTabAgentGlance({
- required this.state,
- required this.label,
- required this.machine,
- required this.model,
- required this.effort,
- required this.busy,
- this.recordedEffort,
- this.requestedEffort,
- });
-
- final SuperTabAgentState state;
-
- /// The state as shown: one word, or "Limited until 09:05".
- final String label;
- final String? machine, model;
-
- /// The effort to show: the recorded one, else its start's; null when neither names one. A row says only what is
- /// known: the PM's row read "opus unknown" (2026-10-28).
- final String? effort;
-
- /// Holding a task: what the Swarm counts as this agent's load.
- final bool busy;
-
- /// The effort the agent's configuration records, and the one its start asked for; null when not known.
- final String? recordedEffort, requestedEffort;
-
- /// "Opus 5.5 · high", or "Opus 5.5" when no effort is known; null when the model is not known (an agent read
- /// before it reported one).
- String? get modelEffort =>
- model == null ? null : [model, ?effort].join(' · ');
-
- String get line => [label, ?machine, ?modelEffort].join(' · ');
-}
-
-/// An effort that says which one runs. 'auto' is what Claude Code reports for an effort it was launched with, and
-/// 'default' what a start asks when it leaves the engine's own: neither names one.
-String? _concrete(Object? effort) =>
- effort is String &&
- effort.isNotEmpty &&
- effort != 'auto' &&
- effort != 'default'
- ? effort
- : null;
-
-const _activeWork = {
- 'planned',
- 'working',
- 'review',
- 'reconciling',
- 'needs_human',
- 'blocked',
-};
-
-SuperTabAgentGlance superTabAgentGlance(
- SuperTabAgentInfo info, {
- DateTime? now,
-}) {
- final at = now ?? DateTime.now();
- final agent = info.agent;
- final work = info.taskGroup?.assignment?['status'];
- final activity = info.activity;
- final until = agent.limitedUntil?.toLocal();
- String two(int n) => n.toString().padLeft(2, '0');
- final (state, label) = switch (null) {
- _ when work == 'lost' => (SuperTabAgentState.lost, 'Lost'),
- _
- when agent.downSince != null ||
- activity == HarnessActivity.offline ||
- activity == HarnessActivity.failed =>
- (SuperTabAgentState.down, 'Down'),
- _ when until != null && until.isAfter(at) => (
- SuperTabAgentState.limited,
- 'Limited until ${two(until.hour)}:${two(until.minute)}',
- ),
- _ when activity == HarnessActivity.starting => (
- SuperTabAgentState.starting,
- 'Starting',
- ),
- _ when activity == HarnessActivity.paused => (
- SuperTabAgentState.paused,
- 'Stopped',
- ),
- // Before waiting: the sidebar marks blocked work as needing input too.
- _ when work == 'blocked' => (SuperTabAgentState.stuck, 'Stuck'),
- _
- when info.hasQuestion ||
- work == 'needs_human' ||
- activity == HarnessActivity.needsInput =>
- (SuperTabAgentState.waiting, 'Waiting'),
- _ when work == 'review' => (SuperTabAgentState.review, 'In review'),
- _ when work == 'reconciling' => (SuperTabAgentState.checking, 'Checking'),
- _ when activity == HarnessActivity.working => (
- SuperTabAgentState.working,
- 'Working',
- ),
- _ when work == 'planned' || work == 'working' => (
- SuperTabAgentState.assigned,
- 'Assigned',
- ),
- _ when activity == HarnessActivity.done => (
- SuperTabAgentState.idle,
- 'Finished',
- ),
- _ => (SuperTabAgentState.idle, 'Idle'),
- };
- final recorded = _concrete(agent.configuration['effort']);
- final requested = _concrete(
- info.controller.snapshot?.startEfforts[agent.harnessId],
- );
- return SuperTabAgentGlance(
- state: state,
- label: label,
- machine: info.machine,
- model: info.model,
- effort: recorded ?? requested,
- busy: _activeWork.contains(work),
- recordedEffort: recorded,
- requestedEffort: requested,
- );
-}
-
-/// A machine of the Swarm with the agents on it. [status] is null for a machine the Swarm has no reading of.
-class SuperTabGlanceMachine {
- SuperTabGlanceMachine(
- this.id,
- this.name,
- this.status,
- this.total,
- this.free, {
- this.paused = false,
- });
- final String id, name;
- final SuperTabMachineStatus? status;
- final int? total, free;
- final bool paused;
- final agents = <(String, SuperTabAgentGlance)>[];
- bool get online =>
- status == SuperTabMachineStatus.live ||
- status == SuperTabMachineStatus.late;
- int get busy => agents.where((a) => a.$2.busy).length;
-}
-
-/// One thing that looks wrong, and the agents it is about, which the glance folds under it.
-class SuperTabGlanceWarning {
- const SuperTabGlanceWarning(this.text, [this.names = const []]);
- final String text;
- final List<String> names;
-}
-
-class SuperTabTeamGlance {
- SuperTabTeamGlance._(this.machines, this.models, this.warnings);
-
- final List<SuperTabGlanceMachine> machines;
-
- /// "opus high" and how many agents run it, most first.
- final List<(String, int)> models;
- final List<SuperTabGlanceWarning> warnings;
-
- factory SuperTabTeamGlance.of(
- SuperTabController c,
- AppNotifier? app, {
- DateTime? now,
- }) {
- final at = now ?? DateTime.now();
- final snapshot = c.snapshot;
- if (snapshot == null) {
- return SuperTabTeamGlance._(const [], const [], const []);
- }
- final machines = <String, SuperTabGlanceMachine>{};
- for (final pool in snapshot.machines) {
- final id = pool['machineId'] as String? ?? '';
- // A Mac's Harness Team account is that Mac (SuperTabSnapshot.placeOf).
- if (id.isEmpty || snapshot.placeOf(id) != id) continue;
- // As the Machines view reads it: a teammate reads a Mac by its Harness Team account (review of #1759).
- final reading = snapshot.readingPoolOf(id, c.accountId) ?? pool;
- final received = (reading['observation'] as Map?)?['receivedAt'];
- final total = (reading['maxAgents'] as num?)?.toInt();
- machines[id] = SuperTabGlanceMachine(
- id,
- pool['name'] as String? ?? 'Unnamed machine',
- superTabMachineStatus(
- age: received is num
- ? at.difference(
- DateTime.fromMillisecondsSinceEpoch(received.toInt()),
- )
- : null,
- ),
- total,
- (reading['availableSlots'] as num?)?.toInt(),
- // A paused machine, or a paused Swarm, takes no new work.
- paused:
- snapshot.paused ||
- pool['paused'] == true ||
- reading['paused'] == true,
- );
- }
- final models = <String, int>{};
- final warnings = <SuperTabGlanceWarning>[];
- final efforts = <(String, String, String)>[];
- for (final agent in snapshot.agents) {
- final info = SuperTabAgentInfo(c, app, agent);
- final glance = superTabAgentGlance(info, now: at);
- final name = snapshot.agentName(agent.id);
- final place = snapshot.placeOf(agent.machineId);
- (machines[place] ??= SuperTabGlanceMachine(
- place,
- glance.machine ?? 'Unknown machine',
- null,
- null,
- null,
- )).agents.add((name, glance));
- final model = glance.modelEffort ?? 'Model not reported';
- models[model] = (models[model] ?? 0) + 1;
- if (glance.recordedEffort case final recorded?
- when glance.requestedEffort != null &&
- recorded != glance.requestedEffort) {
- efforts.add((name, recorded, glance.requestedEffort!));
- }
- }
- // One line per offline machine and one for every effort that differs, not one per agent (Ken, 2026-10-28).
- for (final machine in machines.values) {
- if (machine.status != SuperTabMachineStatus.offline) continue;
- final busy = [
- for (final (name, agent) in machine.agents)
- if (agent.busy) name,
- ];
- if (busy.length == 1) {
- warnings.add(
- SuperTabGlanceWarning(
- '${busy.single} is busy on ${machine.name}, which is offline.',
- ),
- );
- } else if (busy.isNotEmpty) {
- warnings.add(
- SuperTabGlanceWarning(
- '${busy.length} agents are busy on ${machine.name}, which is offline.',
- busy,
- ),
- );
- }
- }
- if (efforts.length == 1) {
- final (name, recorded, requested) = efforts.single;
- warnings.add(
- SuperTabGlanceWarning(
- '$name runs at $recorded effort; it was started at $requested.',
- ),
- );
- } else if (efforts.isNotEmpty) {
- warnings.add(
- SuperTabGlanceWarning(
- '${efforts.length} agents run at another effort than they were started with.',
- [
- for (final (name, recorded, requested) in efforts)
- '$name ($recorded, started at $requested)',
- ],
- ),
- );
- }
- if (_pileUp(machines.values.toList()) case final warning?) {
- warnings.insert(0, SuperTabGlanceWarning(warning));
- }
- return SuperTabTeamGlance._(
- machines.values.toList(),
- (models.entries.map((e) => (e.key, e.value)).toList()
- ..sort((a, b) => b.$2.compareTo(a.$2))),
- warnings,
- );
- }
-}
-
-/// More than half the busy agents on one machine while an online one, not paused, has free slots.
-String? _pileUp(List<SuperTabGlanceMachine> machines) {
- final busy = machines.fold(0, (sum, m) => sum + m.busy);
- if (busy < 2) return null;
- final crowded = machines.reduce((a, b) => a.busy >= b.busy ? a : b);
- if (crowded.busy * 2 <= busy) return null;
- int free(SuperTabGlanceMachine m) =>
- m.free ?? ((m.total ?? 0) - m.agents.length).clamp(0, 1 << 30);
- final room =
- machines
- .where((m) => m != crowded && m.online && !m.paused && free(m) > 0)
- .toList()
- ..sort((a, b) => free(b).compareTo(free(a)));
- if (room.isEmpty) return null;
- final slots = free(room.first);
- return '${crowded.busy} of $busy busy agents are on ${crowded.name}, while ${room.first.name} has $slots free '
- 'slot${slots == 1 ? '' : 's'}.';
-}
diff --git a/desktop/lib/super_tabs/team_glance_panel.dart b/desktop/lib/super_tabs/team_glance_panel.dart
deleted file mode 100644
index 2dd914dc8..000000000
--- a/desktop/lib/super_tabs/team_glance_panel.dart
+++ /dev/null
@@ -1,208 +0,0 @@
-import 'package:flutter/material.dart';
-
-import '../shared/theme/app_icons.dart';
-import '../shared/theme/app_theme.dart' as grid;
-import '../shared/widgets/app_dialog.dart';
-import '../state/app_state.dart';
-import '../widgets/desktop_chrome.dart';
-import 'controller.dart';
-import 'detail_dialog.dart';
-import 'machine_status.dart';
-import 'team_glance.dart';
-
-/// The spacing scale's steps (4, 8, 12) from the shared control gap, as the leaderboard rows take them.
-const _gap = DesktopChrome.controlGap;
-const _halfGap = _gap / 2;
-
-/// Opens Team at a glance over the Swarm, live: it follows the Swarm as it changes.
-Future<void> showSuperTabTeamGlance(
- BuildContext context,
- SuperTabController c,
- AppNotifier? app,
-) => showAppDialog<void>(
- context: context,
- builder: (context) => SuperTabDetailDialog(
- title: 'Team at a glance',
- body: ListenableBuilder(
- listenable: Listenable.merge([c, ?app]),
- builder: (context, _) =>
- SuperTabTeamGlancePanel(glance: SuperTabTeamGlance.of(c, app)),
- ),
- ),
-);
-
-/// The glance as one column of at most [width]: what looks wrong, each machine with its agents by state, and the
-/// models in use, in the details dialogs' label and value rows.
-class SuperTabTeamGlancePanel extends StatelessWidget {
- const SuperTabTeamGlancePanel({super.key, required this.glance});
- final SuperTabTeamGlance glance;
- static const width = 420.0;
-
- @override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- return ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: width),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisSize: MainAxisSize.min,
- children: [
- if (glance.warnings.isEmpty)
- Text('Nothing looks wrong.', style: DesktopChrome.metadata())
- else
- for (final warning in glance.warnings) _Warning(warning),
- SuperTabDetailSection(
- title: 'Machines',
- children: [
- for (final machine in glance.machines) _Machine(machine),
- ],
- ),
- SuperTabDetailSection(
- title: 'Models',
- children: [
- Column(
- key: const ValueKey('glance-models'),
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- for (final (model, count) in glance.models)
- Padding(
- padding: const EdgeInsets.symmetric(
- vertical: _halfGap / 2,
- ),
- child: Text(
- '$model · $count',
- style: DesktopChrome.control(),
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- );
- }
-}
-
-/// A warning, and the agents it is about folded beneath it: the first three, the rest a click away.
-class _Warning extends StatefulWidget {
- const _Warning(this.warning);
- final SuperTabGlanceWarning warning;
-
- @override
- State<_Warning> createState() => _WarningState();
-}
-
-class _WarningState extends State<_Warning> {
- static const _shown = 3;
- bool _expanded = false;
-
- @override
- Widget build(BuildContext context) {
- final names = widget.warning.names;
- final folded = !_expanded && names.length > _shown;
- final list = folded
- ? '${names.take(_shown).join(', ')} and ${names.length - _shown} more'
- : names.join(', ');
- return Padding(
- padding: const EdgeInsets.only(bottom: _gap),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Padding(
- padding: const EdgeInsets.only(top: _halfGap / 4),
- child: Icon(
- AppIcons.triangleAlert,
- size: grid.AppControl.iconSize,
- color: grid.AppPalette.warn,
- ),
- ),
- const SizedBox(width: 8),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(widget.warning.text, style: DesktopChrome.control()),
- if (names.isNotEmpty)
- Padding(
- padding: const EdgeInsets.only(top: _halfGap / 2),
- child: folded
- ? MouseRegion(
- cursor: SystemMouseCursors.click,
- child: GestureDetector(
- onTap: () => setState(() => _expanded = true),
- child: Semantics(
- button: true,
- hint: 'Shows every name',
- child: Text(
- list,
- style: DesktopChrome.metadata(),
- ),
- ),
- ),
- )
- : Text(list, style: DesktopChrome.metadata()),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
-}
-
-/// A machine as the machine details read it: its name, its state and slots, then its agents grouped by what they
-/// are doing, one label and value row per state.
-class _Machine extends StatelessWidget {
- const _Machine(this.machine);
- final SuperTabGlanceMachine machine;
-
- String get _summary {
- final state = switch (machine.status) {
- null => 'Not reported',
- SuperTabMachineStatus.offline => 'Offline',
- SuperTabMachineStatus.late => 'Late',
- _ => 'Online',
- };
- final total = machine.total;
- if (total == null) return state;
- final used = machine.free == null
- ? machine.agents.length
- : total - machine.free!;
- return '$state · $used of $total slots used';
- }
-
- @override
- Widget build(BuildContext context) {
- final byState = <String, List<String>>{};
- for (final (name, agent) in machine.agents) {
- (byState[agent.label] ??= []).add(name);
- }
- return Padding(
- key: ValueKey('glance-machine-${machine.id}'),
- padding: const EdgeInsets.only(top: _gap, bottom: _halfGap),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Wrap(
- spacing: 8,
- crossAxisAlignment: WrapCrossAlignment.end,
- children: [
- Text(machine.name, style: DesktopChrome.control(medium: true)),
- Text(_summary, style: DesktopChrome.metadata()),
- ],
- ),
- if (byState.isEmpty)
- Padding(
- padding: const EdgeInsets.only(top: _halfGap),
- child: Text('No agents', style: DesktopChrome.metadata()),
- )
- else
- for (final MapEntry(key: state, value: names) in byState.entries)
- SuperTabDetailRow(label: state, value: names.join(', ')),
- ],
- ),
- );
- }
-}
diff --git a/desktop/lib/widgets/new_harness_form.dart b/desktop/lib/widgets/new_harness_form.dart
index 46fd0ae10..f54fd999b 100644
--- a/desktop/lib/widgets/new_harness_form.dart
+++ b/desktop/lib/widgets/new_harness_form.dart
@@ -18,6 +18,9 @@ import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
import '../state/new_harness.dart';
import '../state/device_form.dart';
+import '../state/harness_attachments.dart';
+import '../state/lead_placement.dart';
+import '../super_tabs/machine_status.dart';
import '../super_tabs/project_visibility.dart';
import 'box_chrome.dart' show kTerminalCornerRadius, terminalPaneBorder;
import 'dsh_install_panel.dart' show describeInstallFailure;
@@ -87,6 +90,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {
final _headerMachineAnchor = GlobalKey();
bool get _desktopStartEnabled =>
!box.busy &&
+ box.leadBlocked == null &&
!box.linkingProfile &&
box.requiredChoice == null &&
!box.taskTooLong &&
@@ -160,6 +164,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
box.useDesktopChoices(widget.desktop);
+ box.placeLead();
if (box.checking) _row = _Row.start;
_syncField();
// Restoring the successful agent can replace an unfocusable Terminal
@@ -1668,7 +1673,10 @@ class NewHarnessFormState extends State<NewHarnessForm> {
else ...[
_desktopTaskEditor(),
const SizedBox(height: 6),
- _desktopSettings(),
+ if (box.placesLead)
+ _desktopLeadPanel()
+ else
+ _desktopSettings(),
if (box.requiredChoice
case final required?) ...[
const SizedBox(height: 14),
@@ -1788,19 +1796,42 @@ class NewHarnessFormState extends State<NewHarnessForm> {
);
}
- Widget _desktopHeader() {
+ String get _desktopProjectName {
final folder = box.project.folder;
final lastPart = folder
?.split(RegExp(r'[/\\]'))
.where((p) => p.isNotEmpty)
.lastOrNull;
// A guest starts in its workspace or a folder the owner shares (NewHarnessController.asGuest).
- final projectName = box.asGuest
+ return box.asGuest
? lastPart ?? 'My workspace'
: box.project.name ??
lastPart ??
box.project.repository?.name ??
'Choose repo';
+ }
+
+ Widget _desktopHeader() {
+ // New Project in a Swarm: the repo sits in the task box and the machine
+ // on the Product Manager line, so the header keeps only Close.
+ if (box.placesLead) {
+ return widget.embedded
+ ? const SizedBox.shrink()
+ : Align(
+ alignment: Alignment.centerRight,
+ child: FocusTraversalOrder(
+ order: const NumericFocusOrder(9.9),
+ child: KeyedSubtree(
+ key: _desktopCloseAnchor,
+ child: Opacity(
+ opacity: _picking ? 0 : 1,
+ child: _desktopCloseButton(behindChooser: _picking),
+ ),
+ ),
+ ),
+ );
+ }
+ final projectName = _desktopProjectName;
// A phone has room for neither the capsules side by side nor a mouse's
// target: there each is a line of its own, a finger tall.
final phone = workspaceIsCompact(context);
@@ -1969,6 +2000,7 @@ class NewHarnessFormState extends State<NewHarnessForm> {
/// 📎 and the attached files, then New Harness — or New Harness alone.
Widget _desktopTaskActions() {
final attachments = box.takesTask ? box.attachments : null;
+ if (box.placesLead) return _desktopLeadActions(attachments);
if (attachments == null) {
return Align(
alignment: Alignment.centerRight,
@@ -2018,6 +2050,343 @@ class NewHarnessFormState extends State<NewHarnessForm> {
);
}
+ /// Whether New Project's machine list is open, and its Advanced part.
+ bool _leadOpen = false, _leadAdvanced = false;
+
+ /// New Project in a Swarm, as confirmed (Dee, 10-29): 📎, the repo and
+ /// visibility, then the Product Manager line beside New Project.
+ Widget _desktopLeadActions(HarnessAttachments? attachments) => LayoutBuilder(
+ builder: (context, constraints) {
+ // Enlarged text or a narrow window: the chips wrap and the Product
+ // Manager line takes a line of its own above New Project.
+ final narrow =
+ constraints.maxWidth <
+ 480 * MediaQuery.textScalerOf(context).scale(1);
+ final attach = attachments == null
+ ? null
+ : FocusTraversalOrder(
+ order: const NumericFocusOrder(4.5),
+ child: NewHarnessAttachButton(
+ attachments: attachments,
+ enabled: !box.locked,
+ ),
+ );
+ final chips = attachments == null
+ ? null
+ : FocusTraversalOrder(
+ order: const NumericFocusOrder(4.65),
+ child: NewHarnessAttachmentChips(
+ attachments: attachments,
+ enabled: !box.locked,
+ ),
+ );
+ // Capped, not flexible: a loose slot beside the attachments' would
+ // take half the free space and leave it empty.
+ final repo = _desktopField(
+ order: 4.6,
+ anchor: _desktopAnchors[_Row.project]!,
+ maxWidth: narrow
+ ? constraints.maxWidth
+ : math.min(260, constraints.maxWidth * .4),
+ child: _desktopChoiceButton(
+ _Row.project,
+ AppIcons.folder,
+ label: _desktopProjectName,
+ capsule: true,
+ ),
+ );
+ final visibility = box.integration?.projectVisibility != null
+ ? _desktopProjectVisibility(4.7)
+ : null;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ spacing: 8,
+ children: narrow
+ ? [
+ Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ crossAxisAlignment: WrapCrossAlignment.center,
+ children: [?attach, repo, ?visibility],
+ ),
+ ?chips,
+ _desktopLeadLine(),
+ Align(
+ alignment: Alignment.centerRight,
+ child: _desktopLaunchActions(),
+ ),
+ ]
+ : [
+ Row(
+ children: [
+ if (attach != null) ...[attach, const SizedBox(width: 6)],
+ repo,
+ const SizedBox(width: 8),
+ Expanded(child: chips ?? const SizedBox.shrink()),
+ if (visibility != null) ...[
+ const SizedBox(width: 8),
+ visibility,
+ ],
+ ],
+ ),
+ Row(
+ children: [
+ Expanded(child: _desktopLeadLine()),
+ const SizedBox(width: 12),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: constraints.maxWidth * .6,
+ ),
+ child: _desktopLaunchActions(),
+ ),
+ ],
+ ),
+ ],
+ );
+ },
+ );
+
+ /// A quiet text control of the Product Manager line and its panel.
+ ButtonStyle get _desktopLeadLink => TextButton.styleFrom(
+ foregroundColor: DesktopChrome.accent,
+ backgroundColor: Colors.transparent,
+ side: BorderSide.none,
+ enabledMouseCursor: SystemMouseCursors.click,
+ disabledMouseCursor: SystemMouseCursors.basic,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
+ minimumSize: Size.zero,
+ textStyle: DesktopChrome.text(size: 12, medium: true),
+ );
+
+ /// "Product Manager: Mac Studio · Claude Code · Opus 5.5 · Change", or why
+ /// New Project waits.
+ Widget _desktopLeadLine() {
+ final blocked = box.leadBlocked;
+ final machine = box.leadMachine?.name ?? box.machineLabel;
+ return Row(
+ key: const ValueKey('new-harness-lead-line'),
+ children: [
+ Flexible(
+ child: Text(
+ blocked ??
+ [
+ 'Product Manager: $machine',
+ box.agentLabel,
+ box.leadModelLabel,
+ if (box.leadClones)
+ '${box.project.repository!.name} will be cloned there',
+ ].join(' · '),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(size: 12, color: DesktopChrome.muted),
+ ),
+ ),
+ const SizedBox(width: 4),
+ FocusTraversalOrder(
+ order: const NumericFocusOrder(9.8),
+ child: Semantics(
+ expanded: _leadOpen,
+ child: TextButton(
+ key: const ValueKey('new-harness-lead-change'),
+ style: _desktopLeadLink,
+ onPressed: box.locked
+ ? null
+ : () => setState(() => _leadOpen = !_leadOpen),
+ child: const Text('Change'),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+
+ /// Under the task box once Change is pressed: the Swarm's machines, best
+ /// first, each with its state in words, then Advanced.
+ Widget _desktopLeadPanel() {
+ final machines = box.integration?.leadMachines;
+ if (!_leadOpen || machines == null) return const SizedBox.shrink();
+ final repository = box.cloudRepository;
+ final label = DesktopChrome.text(size: 12, color: DesktopChrome.muted);
+ Widget setting(String name, Widget control) => Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
+ child: Row(
+ children: [
+ SizedBox(
+ width: 96 * MediaQuery.textScalerOf(context).scale(1),
+ child: Text(name, style: label),
+ ),
+ Flexible(child: control),
+ ],
+ ),
+ );
+ return Material(
+ key: const ValueKey('new-harness-lead-panel'),
+ color: DesktopChrome.field,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ side: BorderSide(color: DesktopChrome.rim),
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(8),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(8, 2, 8, 4),
+ child: Semantics(
+ header: true,
+ child: Text('Machine', style: label),
+ ),
+ ),
+ for (final (i, machine) in machines.indexed)
+ _desktopLeadRow(machine, repository, 9.81 + i / 10000),
+ Align(
+ alignment: Alignment.centerLeft,
+ child: FocusTraversalOrder(
+ order: const NumericFocusOrder(9.85),
+ child: Semantics(
+ expanded: _leadAdvanced,
+ child: TextButton.icon(
+ key: const ValueKey('new-harness-lead-advanced'),
+ style: _desktopLeadLink,
+ onPressed: () =>
+ setState(() => _leadAdvanced = !_leadAdvanced),
+ icon: Icon(
+ _leadAdvanced
+ ? AppIcons.chevronDown
+ : AppIcons.chevronRight,
+ size: 16,
+ ),
+ label: const Text('Advanced'),
+ ),
+ ),
+ ),
+ ),
+ if (_leadAdvanced) ...[
+ setting(
+ 'Engine',
+ _desktopField(
+ order: 9.86,
+ anchor: _desktopAnchors[_Row.agent]!,
+ child: _desktopChoiceButton(_Row.agent, AppIcons.code),
+ ),
+ ),
+ if (!box.isTerminal && !box.isCloud && !box.asGuest)
+ setting(
+ 'Model',
+ _desktopField(
+ order: 9.87,
+ anchor: _desktopAnchors[_Row.model]!,
+ child: _desktopChoiceButton(_Row.model, AppIcons.brain),
+ ),
+ ),
+ if (box.usesProfile)
+ setting(
+ 'Account',
+ _desktopField(
+ order: 9.88,
+ anchor: _desktopAnchors[_Row.profile]!,
+ child: _desktopChoiceButton(_Row.profile, AppIcons.user),
+ ),
+ ),
+ if (box.isGitProject || box.checkingGit || box.gitError != null)
+ setting(
+ 'Start from',
+ _desktopField(
+ order: 9.89,
+ anchor: _desktopAnchors[_Row.branch]!,
+ child: _desktopChoiceButton(
+ _Row.branch,
+ AppIcons.gitBranch,
+ label: box.compactBranchLabel,
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ ),
+ );
+ }
+
+ /// One machine of the list: its dot, name and state in words, and a check
+ /// on the one chosen. Another person's or a busy machine says why it is
+ /// not a choice.
+ Widget _desktopLeadRow(
+ LeadMachine machine,
+ String? repository,
+ double order,
+ ) {
+ final chosen = machine.id == box.machineId;
+ final enabled = machine.startable && !box.locked;
+ final detail = leadMachineDetail(machine, repository);
+ return KeyedSubtree(
+ key: ValueKey('new-harness-lead-machine-${machine.id}'),
+ child: FocusTraversalOrder(
+ order: NumericFocusOrder(order),
+ child: Semantics(
+ button: true,
+ enabled: enabled,
+ selected: chosen,
+ label: '${machine.name}, $detail',
+ excludeSemantics: true,
+ child: InkWell(
+ onTap: enabled ? () => box.chooseLeadMachine(machine.id) : null,
+ mouseCursor: enabled
+ ? SystemMouseCursors.click
+ : SystemMouseCursors.basic,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ hoverColor: DesktopChrome.selection,
+ focusColor: DesktopChrome.selection,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
+ child: Row(
+ children: [
+ SuperTabMachineDot(
+ status: machine.online
+ ? SuperTabMachineStatus.live
+ : SuperTabMachineStatus.offline,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ machine.name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(
+ size: 13,
+ color: enabled
+ ? DesktopChrome.foreground
+ : DesktopChrome.muted,
+ ),
+ ),
+ Text(
+ detail,
+ style: DesktopChrome.text(
+ size: 12,
+ color: DesktopChrome.muted,
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (chosen) ...[
+ const SizedBox(width: 8),
+ Icon(AppIcons.check, size: 16, color: DesktopChrome.accent),
+ ],
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
Widget _desktopTaskBox() => ListenableBuilder(
listenable: _taskFocus,
builder: (context, _) => Material(
@@ -2355,27 +2724,28 @@ class NewHarnessFormState extends State<NewHarnessForm> {
),
if (includeProjectVisibility &&
box.integration?.projectVisibility != null)
- FocusTraversalOrder(
- order: const NumericFocusOrder(9.95),
- child: ProjectVisibility(
- key: const ValueKey('new-harness-project-visibility'),
- value: box.integration!.projectVisibility!,
- disabledReason: box.integration!.projectVisibilityLocked
- ? 'Project creation has started. Visibility is fixed for this request.'
- : box.locked
- ? 'Finish the current request before changing visibility.'
- : null,
- onChanged: box.locked || box.integration!.projectVisibilityLocked
- ? null
- : (value) => setState(
- () => box.integration!.projectVisibility = value,
- ),
- ),
- ),
+ _desktopProjectVisibility(9.95),
_desktopStartButton(),
],
);
+ Widget _desktopProjectVisibility(double order) => FocusTraversalOrder(
+ order: NumericFocusOrder(order),
+ child: ProjectVisibility(
+ key: const ValueKey('new-harness-project-visibility'),
+ value: box.integration!.projectVisibility!,
+ disabledReason: box.integration!.projectVisibilityLocked
+ ? 'Project creation has started. Visibility is fixed for this request.'
+ : box.locked
+ ? 'Finish the current request before changing visibility.'
+ : null,
+ onChanged: box.locked || box.integration!.projectVisibilityLocked
+ ? null
+ : (value) =>
+ setState(() => box.integration!.projectVisibility = value),
+ ),
+ );
+
Widget _desktopStartButton() => ListenableBuilder(
listenable: _desktopFocus[_Row.start]!,
builder: (context, _) {
diff --git a/desktop/test/lead_placement_test.dart b/desktop/test/lead_placement_test.dart
new file mode 100644
index 000000000..660b45f92
--- /dev/null
+++ b/desktop/test/lead_placement_test.dart
@@ -0,0 +1,146 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/state/lead_placement.dart';
+
+const _repo = 'https://github.com/autonomous-ai/autonomous-os.git';
+
+LeadMachine _machine(
+ String id, {
+ bool online = true,
+ int free = 4,
+ Set<String> repositories = const {},
+ bool maySleep = false,
+ String? unavailable,
+ bool inSwarm = true,
+}) => LeadMachine(
+ id: id,
+ name: id,
+ online: online,
+ freeAgents: free,
+ repositories: repositories,
+ maySleep: maySleep,
+ unavailable: unavailable,
+ inSwarm: inSwarm,
+);
+
+void main() {
+ group('leadRepositoryKey', () {
+ test('reads HTTPS, SSH and bare remotes as one repository', () {
+ for (final remote in [
+ 'https://github.com/Autonomous-AI/autonomous-os.git',
+ '[email protected]:autonomous-ai/autonomous-os.git',
+ 'ssh://[email protected]/autonomous-ai/autonomous-os',
+ 'github.com/autonomous-ai/autonomous-os/',
+ ]) {
+ expect(
+ leadRepositoryKey(remote),
+ 'github.com/autonomous-ai/autonomous-os',
+ reason: remote,
+ );
+ }
+ expect(leadRepositoryKey(null), isNull);
+ expect(leadRepositoryKey(''), isNull);
+ });
+ });
+
+ group('rankLeadMachines', () {
+ test('an always-on machine with the repo and room comes first', () {
+ final ranked = rankLeadMachines([
+ _machine('offline', online: false, free: 30),
+ _machine(
+ 'laptop',
+ maySleep: true,
+ free: 9,
+ repositories: {'github.com/autonomous-ai/autonomous-os'},
+ ),
+ _machine('rig', free: 14),
+ _machine(
+ 'studio',
+ free: 9,
+ repositories: {'github.com/autonomous-ai/autonomous-os'},
+ ),
+ _machine('teammate', free: 20, unavailable: 'Not yours'),
+ _machine(
+ 'full',
+ free: 0,
+ repositories: {'github.com/autonomous-ai/autonomous-os'},
+ ),
+ ], _repo);
+ expect(ranked.map((m) => m.id), [
+ 'studio',
+ 'rig',
+ 'laptop',
+ 'full',
+ 'teammate',
+ 'offline',
+ ]);
+ expect(bestLeadMachine(ranked, _repo)?.id, 'studio');
+ });
+
+ test('more free agents wins among otherwise equal machines', () {
+ final ranked = rankLeadMachines([
+ _machine('a', free: 2),
+ _machine('b', free: 8),
+ ], null);
+ expect(ranked.map((m) => m.id), ['b', 'a']);
+ });
+
+ test('one of the person’s machines the Swarm does not list comes after '
+ 'the Swarm’s own and is still startable', () {
+ final outside = LeadMachine(
+ id: 'mine',
+ name: 'Mine',
+ online: true,
+ freeAgents: null,
+ inSwarm: false,
+ );
+ final ranked = rankLeadMachines([
+ outside,
+ _machine('laptop', maySleep: true, free: 1),
+ ], _repo);
+ expect(ranked.map((m) => m.id), ['laptop', 'mine']);
+ expect(outside.startable, isTrue);
+ expect(bestLeadMachine([outside], _repo)?.id, 'mine');
+ expect(leadMachineDetail(outside, _repo), 'Online · Not in this Swarm');
+ });
+
+ test('no machine is best when none is online, free and allowed', () {
+ expect(
+ bestLeadMachine([
+ _machine('offline', online: false),
+ _machine('full', free: 0),
+ _machine('teammate', unavailable: 'Not yours'),
+ ], _repo),
+ isNull,
+ );
+ });
+ });
+
+ group('leadMachineDetail', () {
+ test('says each state in words', () {
+ expect(
+ leadMachineDetail(
+ _machine(
+ 's',
+ free: 9,
+ repositories: {'github.com/autonomous-ai/autonomous-os'},
+ ),
+ _repo,
+ ),
+ 'Online · 9 agents free · Has repo',
+ );
+ expect(
+ leadMachineDetail(_machine('l', free: 1, maySleep: true), _repo),
+ 'Online · 1 agent free · May sleep',
+ );
+ expect(
+ leadMachineDetail(_machine('f', free: 0), _repo),
+ 'Online · No agents free',
+ );
+ expect(leadMachineDetail(_machine('o', online: false), _repo), 'Offline');
+ expect(
+ leadMachineDetail(_machine('t', unavailable: 'Diego’s machine'), _repo),
+ 'Diego’s machine',
+ );
+ });
+ });
+}
diff --git a/desktop/test/super_tab_agent_line_test.dart b/desktop/test/super_tab_agent_line_test.dart
new file mode 100644
index 000000000..f3b37a347
--- /dev/null
+++ b/desktop/test/super_tab_agent_line_test.dart
@@ -0,0 +1,310 @@
+// Each agent row says, in one line, its state, the machine it runs on and its model and effort (Dee, 2026-10-27:
+// "it's hard to monitor the team"). The Team at a glance screen that once opened from the Agents heading is gone
+// (Dee, 2026-10-29: fewer, clearer things).
+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/state/harness_activity.dart';
+import 'package:harness/super_tabs/agent_details.dart';
+import 'package:harness/super_tabs/roster.dart';
+import 'package:harness/super_tabs/agent_line.dart';
+
+import 'support/super_tab_fixture.dart';
+
+Map<String, dynamic> _machine(
+ String id,
+ String name, {
+ int max = 4,
+ int? free,
+ int age = 0,
+ bool paused = false,
+ String? host,
+}) => {
+ 'machineId': id,
+ 'name': name,
+ 'contributorId': 'owner',
+ 'hostMachineId': ?host,
+ 'scope': 'swarm',
+ 'cwd': '/swarm',
+ 'engines': ['claude', 'codex'],
+ 'maxAgents': max,
+ 'paused': paused,
+ 'availableSlots': ?free,
+ 'observation': {'receivedAt': DateTime.now().millisecondsSinceEpoch - age},
+};
+
+Map<String, dynamic> _agent(
+ String id,
+ String machineId, {
+ String model = 'opus',
+ String? effort = 'high',
+ String engine = 'claude',
+ Map<String, dynamic> extra = const {},
+}) => {
+ 'id': id,
+ 'projectId': 'lead',
+ 'name': id,
+ 'displayName': id,
+ 'machineId': machineId,
+ 'harnessId': 'h-$id',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': engine, 'model': model, 'effort': ?effort},
+ ...extra,
+};
+
+Map<String, dynamic> _task(String agentId, String status) => {
+ ...conversationFixture('task-$agentId', 'Task of $agentId'),
+ 'leadId': 'Lead',
+ 'agentIds': ['Lead', agentId],
+ 'assignment': {'id': 'as-$agentId', 'agentId': agentId, 'status': status},
+};
+
+Map<String, dynamic> _start(String agentId, String effort) => {
+ 'id': 'start-$agentId',
+ 'harnessId': 'h-$agentId',
+ 'request': {
+ 'machineId': 'm1',
+ 'engine': 'claude',
+ 'model': 'opus',
+ 'effort': effort,
+ 'name': agentId,
+ },
+};
+
+/// A Swarm whose Lead runs on Mac Studio, with [agents], [machines], [tasks] and [starts] besides.
+Future<ConversationServer> _swarm(
+ WidgetTester tester, {
+ List<Map<String, dynamic>> agents = const [],
+ List<Map<String, dynamic>>? machines,
+ List<Map<String, dynamic>> tasks = const [],
+ List<Map<String, dynamic>> starts = const [],
+ String account = 'owner',
+}) async {
+ final server = ConversationServer();
+ if (account != 'owner') {
+ (server.state['people'] as List).add({
+ 'id': account,
+ 'email': '[email protected]',
+ 'role': 'collaborator',
+ });
+ }
+ server.state['machines'] =
+ machines ?? [_machine('m1', 'Mac Studio'), _machine('m2', 'MacBook Pro')];
+ server.state['agents'] = [_agent('Lead', 'm1'), ...agents];
+ (server.state['conversations'] as List)[0]['leadId'] = 'Lead';
+ (server.state['conversations'] as List).addAll(tasks);
+ server.state['starts'] = starts;
+ final c = server.controller(account: account);
+ await c.refresh();
+ addTearDown(c.dispose);
+ await tester.binding.setSurfaceSize(const Size(320, 1600));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ home: Scaffold(
+ body: SuperTabRoster(
+ controller: c,
+ onInvite: () {},
+ onOpenAgent: (_) {},
+ onAddAgent: (_) {},
+ onAnswer: (_) {},
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ return server;
+}
+
+Finder _row(String id) => find.byKey(ValueKey('super-member-$id'));
+Finder _line(String id, String text) =>
+ find.descendant(of: _row(id), matching: find.text(text));
+
+void main() {
+ group('an agent row', () {
+ testWidgets(
+ 'says in one line its state, its machine, and its model and effort',
+ (tester) async {
+ await _swarm(
+ tester,
+ agents: [
+ _agent('Atlas', 'm1'),
+ _agent('Sage', 'm2', model: 'sonnet', effort: 'medium'),
+ ],
+ tasks: [_task('Atlas', 'working')],
+ );
+ // Holding a task with no turn seen running: assigned, never claimed as working.
+ expect(
+ _line('Atlas', 'Assigned · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Sage', 'Idle · MacBook Pro · Sonnet · medium'),
+ findsOneWidget,
+ );
+ },
+ );
+
+ test('reads working only while its turn runs, and keeps the task as assigned otherwise', () async {
+ final server = ConversationServer();
+ server.state['machines'] = [_machine('m1', 'Mac Studio')];
+ server.state['agents'] = [_agent('Atlas', 'm1')];
+ (server.state['conversations'] as List).add(_task('Atlas', 'working'));
+ final c = server.controller();
+ addTearDown(c.dispose);
+ await c.refresh();
+ final atlas = c.snapshot!.agent('Atlas')!;
+ String line(HarnessActivity? activity) => superTabAgentGlance(
+ SuperTabAgentInfo(c, null, atlas, activity: activity),
+ ).line;
+ expect(
+ line(HarnessActivity.working),
+ 'Working · Mac Studio · Opus · high',
+ );
+ expect(line(HarnessActivity.idle), 'Assigned · Mac Studio · Opus · high');
+ expect(line(null), 'Assigned · Mac Studio · Opus · high');
+ });
+
+ testWidgets(
+ 'names each state in a word: waiting, lost, down, limited, stuck, in review',
+ (tester) async {
+ final until = DateTime.now().add(const Duration(hours: 2)).toLocal();
+ String two(int n) => n.toString().padLeft(2, '0');
+ await _swarm(
+ tester,
+ agents: [
+ _agent('Wren', 'm1'),
+ _agent('Lark', 'm1'),
+ _agent(
+ 'Kite',
+ 'm2',
+ extra: {'downSince': DateTime.now().toUtc().toIso8601String()},
+ ),
+ _agent(
+ 'Rook',
+ 'm2',
+ extra: {'limitedUntil': until.toUtc().toIso8601String()},
+ ),
+ _agent('Moss', 'm1'),
+ _agent('Teal', 'm1'),
+ ],
+ tasks: [
+ _task('Wren', 'needs_human'),
+ _task('Lark', 'lost'),
+ _task('Moss', 'blocked'),
+ _task('Teal', 'review'),
+ ],
+ );
+ expect(
+ _line('Moss', 'Stuck · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Teal', 'In review · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Wren', 'Waiting · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line('Lark', 'Lost · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ final tip = tester
+ .widgetList<Tooltip>(
+ find.ancestor(of: _row('Lark'), matching: find.byType(Tooltip)),
+ )
+ .single
+ .message!;
+ expect(tip, contains('Lost "Task of Lark"'));
+ expect(
+ _line('Kite', 'Down · MacBook Pro · Opus · high'),
+ findsOneWidget,
+ );
+ expect(
+ _line(
+ 'Rook',
+ 'Limited until ${two(until.hour)}:${two(until.minute)} · MacBook Pro · Opus · high',
+ ),
+ findsOneWidget,
+ );
+ },
+ );
+
+ // Builders started with opus high were stored as auto (fixed in the CLI, 2026-10-27); one stored before the fix
+ // shows what its start asked for while the start still says. An effort nobody reported is left out: the PM's row
+ // read "opus unknown" (2026-10-28), and a row says only what is known.
+ testWidgets(
+ 'shows the requested effort for an auto reading its start still names, else no effort',
+ (tester) async {
+ await _swarm(
+ tester,
+ agents: [
+ _agent('Nico', 'm1', effort: 'auto'),
+ _agent('Quinn', 'm1', effort: 'auto'),
+ _agent('Avery', 'm1', effort: null),
+ ],
+ starts: [_start('Nico', 'high')],
+ );
+ expect(
+ _line('Nico', 'Idle · Mac Studio · Opus · high'),
+ findsOneWidget,
+ );
+ expect(_line('Quinn', 'Idle · Mac Studio · Opus'), findsOneWidget);
+ expect(_line('Avery', 'Idle · Mac Studio · Opus'), findsOneWidget);
+ expect(find.textContaining('unknown'), findsNothing);
+ },
+ );
+
+ testWidgets(
+ 'names the model by its display name, with its version when reported',
+ (tester) async {
+ await _swarm(
+ tester,
+ agents: [
+ _agent('Iris', 'm1', model: 'claude-opus-5-5'),
+ _agent('Juno', 'm1', model: 'claude-sonnet-5-5', effort: null),
+ _agent(
+ 'Kai',
+ 'm2',
+ engine: 'codex',
+ model: 'gpt-5.6-sol',
+ effort: 'xhigh',
+ ),
+ ],
+ );
+ expect(
+ _line('Iris', 'Idle · Mac Studio · Opus 5.5 · high'),
+ findsOneWidget,
+ );
+ expect(_line('Juno', 'Idle · Mac Studio · Sonnet 5.5'), findsOneWidget);
+ expect(
+ _line('Kai', 'Idle · MacBook Pro · GPT-5.6 Sol · xhigh'),
+ findsOneWidget,
+ );
+ },
+ );
+
+ testWidgets('a start that asked for effort high is shown as high', (
+ tester,
+ ) async {
+ await _swarm(
+ tester,
+ agents: [_agent('Echo', 'm1')],
+ starts: [_start('Echo', 'high')],
+ );
+ expect(_line('Echo', 'Idle · Mac Studio · Opus · high'), findsOneWidget);
+ });
+ });
+
+ testWidgets('the Agents heading has no Team at a glance button', (
+ tester,
+ ) async {
+ await _swarm(tester, agents: [_agent('Atlas', 'm1')]);
+ expect(find.text('Agents'), findsOneWidget);
+ expect(find.byTooltip('Team at a glance'), findsNothing);
+ expect(find.text('Team at a glance'), findsNothing);
+ });
+}
diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dart
index 36a527e07..68defb4e2 100644
--- a/desktop/test/super_tab_chat_test.dart
+++ b/desktop/test/super_tab_chat_test.dart
@@ -315,22 +315,30 @@ void main() {
..append('The lead update')
..append('An unread workgroup update', conversationId: 'offline');
final c = await show(tester, server);
- Finder projectDot() => find.descendant(
- of: find.byKey(const ValueKey('super-group-lead')),
- matching: find.byWidgetPredicate(
- (widget) =>
- widget is Semantics && widget.properties.label == 'Unread messages',
- ),
- );
+ // Unread is the project's name in bold, with no dot (Dee, 2026-10-29).
+ final name = c.snapshot!.projects.single.name;
+ FontWeight? projectWeight() => tester
+ .widget<RichText>(
+ find.descendant(
+ of: find.byKey(const ValueKey('super-group-lead')),
+ matching: find.byWidgetPredicate(
+ (widget) =>
+ widget is RichText && widget.text.toPlainText() == name,
+ ),
+ ),
+ )
+ .text
+ .style
+ ?.fontWeight;
expect(c.unread(c.selected!), isFalse);
- expect(projectDot(), findsOneWidget);
+ expect(projectWeight(), grid.AppFont.semibold);
await tester.tap(find.byKey(const ValueKey('super-project-toggle-lead')));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const ValueKey('super-group-offline')));
await tester.pumpAndSettle();
expect(find.text('An unread workgroup update'), findsOneWidget);
expect(c.unread(c.selected!), isFalse);
- expect(projectDot(), findsNothing);
+ expect(projectWeight(), isNot(grid.AppFont.semibold));
await closeReadView(tester, c);
});
diff --git a/desktop/test/super_tab_dialog_shots_test.dart b/desktop/test/super_tab_dialog_shots_test.dart
index bc25e07cf..8df593f6a 100644
--- a/desktop/test/super_tab_dialog_shots_test.dart
+++ b/desktop/test/super_tab_dialog_shots_test.dart
@@ -1,5 +1,5 @@
-// The six Swarm dialogs Ken asked to polish (2026-10-28), photographed light and dark for review: machine details,
-// person profile, Project details, Team at a glance, Share Swarm and Add machine, over in-memory Swarms only.
+// The five Swarm dialogs Ken asked to polish (2026-10-28), photographed light and dark for review: machine details,
+// person profile, Project details, Share Swarm and Add machine, over in-memory Swarms only.
import 'dart:io';
import 'package:flutter/material.dart';
@@ -8,7 +8,6 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/machines.dart';
import 'package:harness/super_tabs/project_options.dart';
-import 'package:harness/super_tabs/roster.dart';
import 'package:harness/super_tabs/sharing.dart';
import 'package:harness/super_tabs/view.dart';
import 'package:harness/widgets/engine_identity.dart';
@@ -329,28 +328,6 @@ void main() {
await captureWindow(tester, shots, '3-project-details-$theme');
}, skip: shots == null);
- testWidgets('team at a glance ($theme)', (tester) async {
- final server = _swarm();
- final c = server.controller();
- addTearDown(c.dispose);
- await c.refresh();
- await _pump(
- tester,
- brightness,
- SuperTabRoster(
- controller: c,
- onInvite: () {},
- onOpenAgent: (_) {},
- onAddAgent: (_) {},
- onAnswer: (_) {},
- ),
- );
- await tester.tap(find.byTooltip('Team at a glance'));
- await tester.pumpAndSettle();
- await captureWindow(tester, shots, '4-team-at-a-glance-$theme');
- await tester.pumpWidget(const SizedBox());
- }, skip: shots == null);
-
testWidgets('share swarm ($theme)', (tester) async {
final server = SwarmSharingServer();
server.state['people'] = _swarm().state['people'];
diff --git a/desktop/test/super_tab_humans_test.dart b/desktop/test/super_tab_humans_test.dart
index 4af1b8a8c..7791736a4 100644
--- a/desktop/test/super_tab_humans_test.dart
+++ b/desktop/test/super_tab_humans_test.dart
@@ -15,13 +15,14 @@ import 'support/humans_fixture.dart';
import 'support/super_tab_fixture.dart';
/// The leaderboard lives in the right pane's Humans section (Dee, 2026-10-27),
-/// built to the desktop design system (2026-10-28): the team total as quiet
-/// text with a small week picker, then everyone, most points first, by display
+/// built to the desktop design system (2026-10-28): a small week picker, then
+/// everyone, most points first, by display
/// name. Each row is a bold rank in its own column, avatar, name, a quiet line
-/// of the non-zero numbers in words, and the points as the one emphasized,
-/// right-aligned number with the change against last week beside it. No emoji,
-/// cups or medal colours. A tap shows what the numbers are made of. There is
-/// no separate leaderboard view.
+/// of the non-zero numbers in words, and the points as the one number,
+/// right-aligned (Dee, 2026-10-29: one number per person, no team total line).
+/// Number one wears a crown beside their name (People are celebrated, design
+/// system); no cups, trophies or medal colours. A tap shows what the numbers
+/// are made of. There is no separate leaderboard view.
void main() {
Finder person(String id) => find.byKey(ValueKey('super-person-$id'));
@@ -99,6 +100,9 @@ void main() {
Finder within(String id, String text) =>
find.descendant(of: person(id), matching: find.text(text));
+ // Number one's name carries the crown beside it in the same line.
+ Finder nameIn(String id, String name) =>
+ find.descendant(of: person(id), matching: find.textContaining(name));
Finder part(String kind, String id) =>
find.byKey(ValueKey('leaderboard-$kind-$id'));
TextStyle styleOf(WidgetTester tester, Finder text) =>
@@ -243,36 +247,129 @@ void main() {
// The line starts where the name does.
expect(
tester.getTopLeft(part('meta', 'peer')).dx,
- tester.getTopLeft(within('peer', 'Dee')).dx,
+ tester.getTopLeft(nameIn('peer', 'Dee')).dx,
);
await close(tester, controller);
},
);
- testWidgets('draws no emoji, cups, sparkles or medal colours', (
+ Finder crown(String id) => part('crown', id);
+
+ testWidgets(
+ 'crowns number one beside their name, said in words, and no one else',
+ (tester) async {
+ final semantics = tester.ensureSemantics();
+ final controller = await show(tester, humansSwarm());
+ // Dee is first with 21.
+ expect(crown('peer'), findsOneWidget);
+ for (final id in [
+ 'owner',
+ 'tony',
+ 'scholes',
+ 'diego',
+ 'huy',
+ 'maximilian.alexander.longname',
+ ]) {
+ expect(crown(id), findsNothing, reason: id);
+ }
+ expect(
+ find.bySemanticsLabel(RegExp('Number one this week')),
+ findsOneWidget,
+ );
+ // After the name, before the points; the numeral stays.
+ expect(
+ tester.getTopLeft(crown('peer')).dx,
+ greaterThan(tester.getTopLeft(nameIn('peer', 'Dee')).dx),
+ );
+ expect(
+ tester.getTopRight(crown('peer')).dx,
+ lessThan(tester.getTopLeft(part('points', 'peer')).dx),
+ );
+ expect(
+ find.descendant(of: part('rank', 'peer'), matching: find.text('1')),
+ findsOneWidget,
+ );
+ // A crowned row is as tall as one without; the columns hold.
+ expect(
+ tester.getSize(person('peer')).height,
+ tester.getSize(person('owner')).height,
+ );
+ expect(
+ tester.getTopRight(part('points', 'peer')).dx,
+ tester.getTopRight(part('points', 'owner')).dx,
+ );
+ semantics.dispose();
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets("on a past week the crown names that week, not this one", (
tester,
) async {
- final controller = await show(tester, humansSwarm(), settle: false);
- final emoji = RegExp(
- '[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{231A}-\u{23FF}]',
- unicode: true,
- );
- final roster = find.byType(SuperTabRoster);
- final texts = [
- for (final widget in tester.widgetList<RichText>(
- find.descendant(of: roster, matching: find.byType(RichText)),
- ))
- widget.text.toPlainText(),
- ];
- expect(texts.where(emoji.hasMatch), isEmpty);
- expect(find.byIcon(AppIcons.trophy), findsNothing);
- expect(find.byIcon(AppIcons.sparkles), findsNothing);
- expect(find.byKey(const ValueKey('leaderboard-sparkle')), findsNothing);
- expect(find.byKey(const ValueKey('leaderboard-cup-peer')), findsNothing);
+ final semantics = tester.ensureSemantics();
+ final controller = await show(tester, humansSwarm());
+ await tester.tap(find.byKey(const ValueKey('leaderboard-week')));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Last week').last);
await tester.pumpAndSettle();
+ expect(crown('peer'), findsOneWidget);
+ expect(
+ find.bySemanticsLabel(RegExp('Number one last week')),
+ findsOneWidget,
+ );
+ expect(find.bySemanticsLabel(RegExp('this week')), findsNothing);
+ semantics.dispose();
await close(tester, controller);
});
+ testWidgets('crowns no one in a week where no one has points yet', (
+ tester,
+ ) async {
+ final server = humansSwarm();
+ for (final score in server.leaderboard!['people'] as List) {
+ score['points'] = 0;
+ score['rank'] = 1;
+ score['medal'] = null;
+ }
+ final controller = await show(tester, server);
+ expect(find.byKey(const ValueKey('leaderboard-crown-peer')), findsNothing);
+ expect(find.bySemanticsLabel(RegExp('Number one this week')), findsNothing);
+ await close(tester, controller);
+ });
+
+ testWidgets(
+ 'draws no emoji but the crown, and no cups, sparkles or medal colours',
+ (tester) async {
+ final controller = await show(tester, humansSwarm(), settle: false);
+ final emoji = RegExp(
+ '[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{231A}-\u{23FF}]',
+ unicode: true,
+ );
+ final roster = find.byType(SuperTabRoster);
+ // Every emoji drawn in the people and agents, the crown's placeholder
+ // aside: the crown is its own Text, the one emoji allowed.
+ final drawn = [
+ for (final widget in tester.widgetList<RichText>(
+ find.descendant(of: roster, matching: find.byType(RichText)),
+ ))
+ ...emoji
+ .allMatches(widget.text.toPlainText())
+ .map((match) => match[0]!),
+ ];
+ expect(drawn, ['\u{1F451}']);
+ expect(
+ find.descendant(of: crown('peer'), matching: find.text('\u{1F451}')),
+ findsOneWidget,
+ );
+ expect(find.byIcon(AppIcons.trophy), findsNothing);
+ expect(find.byIcon(AppIcons.sparkles), findsNothing);
+ expect(find.byKey(const ValueKey('leaderboard-sparkle')), findsNothing);
+ expect(find.byKey(const ValueKey('leaderboard-cup-peer')), findsNothing);
+ await tester.pumpAndSettle();
+ await close(tester, controller);
+ },
+ );
+
testWidgets("fills the viewer's own row as the selected row, and no other", (
tester,
) async {
@@ -325,66 +422,33 @@ void main() {
await tester.binding.setSurfaceSize(null);
});
- testWidgets('says the team total as plain metadata text above the people', (
+ testWidgets('has no team total line above the people', (tester) async {
+ final controller = await show(tester, humansSwarm());
+ expect(find.byKey(const ValueKey('leaderboard-goal')), findsNothing);
+ expect(find.textContaining('shipped this week'), findsNothing);
+ expect(find.textContaining('Team goal'), findsNothing);
+ // The people follow the heading.
+ expect(person('peer'), findsOneWidget);
+ await close(tester, controller);
+ });
+
+ testWidgets('puts the waiting line in the quiet metadata hierarchy', (
tester,
) async {
final controller = await show(tester, humansSwarm());
- final goal = find.byKey(const ValueKey('leaderboard-goal'));
- final text = find.descendant(
- of: goal,
- matching: find.text('7 shipped this week'),
- );
- expect(text, findsOneWidget);
- expect(find.textContaining('open'), findsNothing);
- expect(find.textContaining('Team goal'), findsNothing);
- // No chip: nothing drawn behind it.
- expect(
- find.descendant(of: goal, matching: find.byType(DecoratedBox)),
- findsNothing,
- );
- expect(
- tester
- .widgetList<Container>(
- find.descendant(of: goal, matching: find.byType(Container)),
- )
- .where((c) => c.decoration != null),
- isEmpty,
- );
- final style = styleOf(tester, text);
- expect(style.fontSize, grid.AppType.captionSize);
- expect(style.color, grid.AppPalette.textSecondary);
- // The week before and the median are on hover.
- expect(
- find.byTooltip('4 shipped last week\nMedian ask to ship 2 h'),
- findsOneWidget,
- );
- expect(
- tester.getTopLeft(goal).dy,
- lessThan(tester.getTopLeft(person('peer')).dy),
+ final waiting = find.byKey(const ValueKey('leaderboard-waiting'));
+ final heading = find.descendant(
+ of: waiting,
+ matching: find.text('1 agent is waiting on you'),
);
+ expect(heading, findsOneWidget);
+ expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
+ expect(styleOf(tester, heading).color, grid.AppPalette.textSecondary);
+ expect(find.textContaining('Dee 1'), findsNothing);
+ expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
await close(tester, controller);
});
- testWidgets(
- 'puts the waiting line in the same quiet hierarchy as the team total',
- (tester) async {
- final controller = await show(tester, humansSwarm());
- final waiting = find.byKey(const ValueKey('leaderboard-waiting'));
- final heading = find.descendant(
- of: waiting,
- matching: find.text('1 agent is waiting on you'),
- );
- expect(heading, findsOneWidget);
- expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
- expect(styleOf(tester, heading).color, grid.AppPalette.textSecondary);
- expect(find.textContaining('Dee 1'), findsNothing);
- expect(styleOf(tester, heading).fontSize, grid.AppType.captionSize);
- final goal = find.text('7 shipped this week');
- expect(tester.getTopLeft(heading).dx, tester.getTopLeft(goal).dx);
- await close(tester, controller);
- },
- );
-
testWidgets('says in words how many agents wait on whom, the viewer as you', (
tester,
) async {
@@ -478,7 +542,7 @@ void main() {
final controller = await show(tester, humansSwarm());
Finder within(String id, String text) =>
find.descendant(of: person(id), matching: find.text(text));
- expect(within('peer', 'Dee'), findsOneWidget);
+ expect(nameIn('peer', 'Dee'), findsOneWidget);
expect(within('owner', 'Ken'), findsOneWidget);
// A server from before names: the email's first part, as before.
expect(within('scholes', 'scholes'), findsOneWidget);
@@ -491,52 +555,28 @@ void main() {
);
testWidgets(
- 'shows an up or down arrow against last week, by shape and colour, and none when level or unknown',
+ 'shows one number per person: no arrow or change against last week',
(tester) async {
+ final semantics = tester.ensureSemantics();
final controller = await show(tester, humansSwarm());
- Finder trend(String id) => part('trend', id);
- Icon arrow(String id) => tester.widget<Icon>(
- find.descendant(of: trend(id), matching: find.byType(Icon)),
- );
- // Dee 21 from 15, Ken 13 from 20.
- expect(
- find.descendant(of: trend('peer'), matching: find.text('6')),
- findsOneWidget,
- );
- expect(find.byTooltip('Up 6 from last week'), findsOneWidget);
- expect(arrow('peer').icon, AppIcons.arrowUp);
- expect(arrow('peer').color, grid.AppPalette.online);
- expect(
- find.descendant(of: trend('owner'), matching: find.text('7')),
- findsOneWidget,
- );
- expect(find.byTooltip('Down 7 from last week'), findsOneWidget);
- expect(arrow('owner').icon, AppIcons.arrowDown);
- expect(
- arrow('owner').color,
- Theme.of(tester.element(trend('owner'))).colorScheme.error,
- );
- expect(
- tester
- .widget<Text>(
- find.descendant(of: trend('peer'), matching: find.text('6')),
- )
- .style!
- .fontFeatures,
- grid.AppFont.tabularFigures,
- );
- // The change has its own right-aligned column, just before the points.
- expect(
- tester.getTopRight(trend('peer')).dx,
- tester.getTopRight(trend('owner')).dx,
- );
- expect(
- tester.getTopRight(trend('peer')).dx,
- lessThan(tester.getTopLeft(part('points', 'peer')).dx),
- );
- // Tony level at 6; Scholes from a server without last week.
- expect(trend('tony'), findsNothing);
- expect(trend('scholes'), findsNothing);
+ // Dee 21 from 15, Ken 13 from 20: still only their points.
+ for (final id in ['peer', 'owner', 'tony', 'scholes']) {
+ expect(part('trend', id), findsNothing, reason: id);
+ expect(part('trend-column', id), findsNothing, reason: id);
+ }
+ final roster = find.byType(SuperTabRoster);
+ for (final arrow in [AppIcons.arrowUp, AppIcons.arrowDown]) {
+ expect(
+ find.descendant(of: roster, matching: find.byIcon(arrow)),
+ findsNothing,
+ );
+ }
+ expect(find.byTooltip('Up 6 from last week'), findsNothing);
+ expect(find.bySemanticsLabel(RegExp('from last week')), findsNothing);
+ // The points are the row's last column.
+ expect(within('peer', '6'), findsNothing);
+ expect(within('owner', '7'), findsNothing);
+ semantics.dispose();
await close(tester, controller);
},
);
diff --git a/desktop/test/super_tab_launch_test.dart b/desktop/test/super_tab_launch_test.dart
index 10fcedd93..3da5566c2 100644
--- a/desktop/test/super_tab_launch_test.dart
+++ b/desktop/test/super_tab_launch_test.dart
@@ -10,6 +10,7 @@ import 'package:harness/core/launch_setup.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/state/new_harness.dart';
import 'package:harness/state/harness_attachments.dart';
+import 'package:harness/state/lead_placement.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/super_tabs/launch.dart';
import 'package:harness/super_tabs/client.dart';
@@ -54,6 +55,10 @@ class SuperTabFixtureConnection extends WsConn {
bool loseCreate = false, loseJoin = false;
bool failNative = false;
WsRequestFailure? backendFailure;
+
+ /// [backendFailure] refuses only commands: an older backend still answers
+ /// reads and rejects the command it does not know.
+ bool backendFailureOnCommandsOnly = false;
bool failResume = false;
bool nativeSurface = false;
bool failFiles = false, failCreation = false, changeAccountOnUpload = false;
@@ -156,7 +161,9 @@ class SuperTabFixtureConnection extends WsConn {
);
}
- if (payload['action'] == 'backend' && backendFailure != null) {
+ if (payload['action'] == 'backend' &&
+ backendFailure != null &&
+ !(backendFailureOnCommandsOnly && payload['method'] == 'GET')) {
throw backendFailure!;
}
if (payload['action'] == 'wake') return {'ok': true};
@@ -603,12 +610,309 @@ void main() {
},
);
+ test(
+ 'New Project lists the Swarm machines for its Product Manager, best first',
+ () async {
+ final f = SuperTabLaunchFixture();
+ final now = DateTime.now().millisecondsSinceEpoch;
+ Map<String, dynamic> pool(
+ String id,
+ String name, {
+ String contributor = 'owner',
+ String device = 'Mac Studio',
+ int max = 8,
+ int running = 0,
+ int age = 0,
+ String? host,
+ List<String> repositories = const [],
+ }) => {
+ 'machineId': id,
+ 'name': name,
+ 'cwd': '/swarm/$id',
+ 'contributorId': contributor,
+ 'maxAgents': max,
+ 'paused': false,
+ 'hostMachineId': ?host,
+ 'observation': {
+ 'receivedAt': now - age,
+ 'resources': {'deviceType': device},
+ 'runningHarnessIds': [for (var i = 0; i < running; i++) 'h$i'],
+ 'readiness': {
+ 'checkouts': [
+ for (final repository in repositories)
+ {'folder': 'p1', 'repository': repository, 'git': true},
+ ],
+ },
+ },
+ };
+ (f.connection.server.state['people'] as List).add({
+ 'id': 'diego',
+ 'email': '[email protected]',
+ 'role': 'collaborator',
+ });
+ f.connection.server.state['machines'] = [
+ pool(
+ 'm',
+ 'Mac Studio',
+ max: 32,
+ running: 2,
+ repositories: ['github.com/autonomous-ai/autonomous-os'],
+ ),
+ pool('laptop', 'Ken MacBook', device: 'MacBook Pro'),
+ pool('rig', '2x 4090 Rig', contributor: 'diego', max: 16),
+ pool('rig-team', 'Rig team', contributor: 'diego', host: 'rig'),
+ pool('old', 'Old Mac', age: 10 * 60 * 1000),
+ ];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ final machines = box.integration!.leadMachines!;
+ expect(machines.map((m) => m.id), ['m', 'rig', 'laptop', 'old']);
+ final studio = machines.first;
+ expect(studio.name, 'Mac Studio');
+ expect(studio.startable, isTrue);
+ expect(studio.freeAgents, 30);
+ expect(
+ studio.has('[email protected]:autonomous-ai/autonomous-os.git'),
+ isTrue,
+ );
+ expect(studio.maySleep, isFalse);
+ expect(studio.folders, {
+ 'github.com/autonomous-ai/autonomous-os': '/swarm/m/p1',
+ });
+ expect(machines[1].unavailable, 'Another person’s machine');
+ expect(machines[2].maySleep, isTrue);
+ expect(machines[2].unavailable, 'Not connected to this computer');
+ expect(machines[3].online, isFalse);
+ expect(bestLeadMachine(machines, null)?.id, 'm');
+ },
+ );
+
+ test('New Project refuses a machine its list cannot start', () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [
+ {
+ 'machineId': 'm',
+ 'name': 'Mac Studio',
+ 'contributorId': 'owner',
+ 'maxAgents': 2,
+ 'paused': false,
+ 'observation': {
+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,
+ 'runningHarnessIds': ['a', 'b'],
+ },
+ },
+ ];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ expect(box.integration!.leadMachines!.single.startable, isFalse);
+ expect(await box.create(), NewHarnessOutcome.failed);
+ expect(box.error, 'Mac Studio has no free agents. Choose another machine.');
+ expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);
+ });
+
+ Map<String, dynamic> studioPool({
+ int available = 3,
+ int max = 8,
+ int running = 2,
+ int age = 0,
+ }) => {
+ 'machineId': 'm',
+ 'name': 'Mac Studio',
+ 'cwd': '/swarm/m',
+ 'contributorId': 'owner',
+ 'maxAgents': max,
+ 'availableSlots': available,
+ 'paused': false,
+ 'observation': {
+ 'receivedAt': DateTime.now().millisecondsSinceEpoch - age,
+ 'runningHarnessIds': [for (var i = 0; i < running; i++) 'h$i'],
+ },
+ };
+
+ test('free agents are the server’s count, not slots minus running', () async {
+ final f = SuperTabLaunchFixture();
+ // Eight slots and two running, but the server counts one free: its count
+ // includes starts still pending and the Team account sharing the Mac.
+ f.connection.server.state['machines'] = [studioPool(available: 1)];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ expect(box.integration!.leadMachines!.single.freeAgents, 1);
+ });
+
+ for (final (change, message) in [
+ ('fills up', 'Mac Studio has no free agents. Choose another machine.'),
+ ('goes offline', 'Mac Studio is offline. Choose another machine.'),
+ ]) {
+ test(
+ 'a machine that $change after the form opened is refused at submit',
+ () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [studioPool()];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ expect(box.integration!.leadMachines!.single.startable, isTrue);
+ f.connection.server.state['machines'] = [
+ change == 'fills up'
+ ? studioPool(available: 0)
+ : studioPool(age: 10 * 60 * 1000),
+ ];
+ expect(await box.create(), NewHarnessOutcome.failed);
+ expect(box.error, message);
+ expect(
+ f.connection.calls.where((c) => c.$1 == 'agent_create'),
+ isEmpty,
+ );
+ },
+ );
+ }
+
+ test('a paused Swarm lists no machine as taking work', () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [studioPool()];
+ f.connection.server.state['paused'] = true;
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ for (final machine in box.integration!.leadMachines!) {
+ expect(machine.startable, isFalse, reason: machine.id);
+ expect(machine.unavailable, 'New work is paused in this Swarm');
+ }
+ });
+
+ test(
+ 'New Project reads the open Swarm instead of loading it again',
+ () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [studioPool()];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ await (await f.app.superTabs.open(tabId)).refresh();
+ int partsReads() => f.connection.calls
+ .where((c) => '${c.$2['path']}'.endsWith('/parts'))
+ .length;
+ final before = partsReads();
+ final box = await f.box(newProject: true);
+ expect(box.integration!.leadMachines!.first.id, 'm');
+ expect(partsReads(), before);
+ },
+ );
+
+ test('the Swarm’s model list rules out what it turns off', () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [studioPool()];
+ // As GET .../routing-policy answers (backend store.ts tabPolicy).
+ f.connection.server.routingPolicy = {
+ 'policy': {
+ 'version': 1,
+ 'models': [
+ {
+ 'engine': 'claude',
+ 'model': 'opus',
+ 'effort': 'high',
+ 'quality': 3,
+ 'cost': 3,
+ 'enabled': true,
+ },
+ {
+ 'engine': 'codex',
+ 'model': 'default',
+ 'effort': 'default',
+ 'quality': 3,
+ 'cost': 2,
+ 'enabled': false,
+ },
+ {
+ 'engine': 'claude',
+ 'model': 'sonnet',
+ 'effort': 'medium',
+ 'quality': 2,
+ 'cost': 2,
+ 'enabled': true,
+ },
+ {
+ 'engine': 'claude',
+ 'model': 'haiku',
+ 'effort': 'auto',
+ 'quality': 1,
+ 'cost': 1,
+ 'enabled': false,
+ },
+ ],
+ 'floor': {'low': 1, 'medium': 2, 'high': 3},
+ 'quotaReserve': 10,
+ 'notes': '',
+ 'localModels': {'quality': 1, 'enabled': false},
+ },
+ 'warnings': <String>[],
+ 'overridden': <String>[],
+ 'override': null,
+ };
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ final list = box.integration!.leadModels!;
+ expect(list.refusal('claude', null), isNull);
+ expect(list.refusal('claude', 'opus'), isNull);
+ expect(
+ list.refusal('claude', 'haiku'),
+ 'The Swarm’s model list turns off Claude haiku.',
+ );
+ expect(
+ list.refusal('codex', null),
+ 'The Swarm’s model list has no enabled Codex model.',
+ );
+ expect(list.gridModels, isFalse);
+ });
+
+ test('without a model list nothing is ruled out', () async {
+ final f = SuperTabLaunchFixture();
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ final list = box.integration!.leadModels!;
+ expect(list.refusal('codex', null), isNull);
+ expect(list.gridModels, isTrue);
+ });
+
+ test(
+ 'a Swarm that cannot be read at submit creates nothing and says so',
+ () async {
+ final f = SuperTabLaunchFixture();
+ f.connection.server.state['machines'] = [studioPool()];
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
+ final box = await f.box(newProject: true);
+ f.connection.backendFailure = const WsRequestFailure(
+ responseType: 'super_tabs_result',
+ code: 'UNAVAILABLE',
+ detail: 'The Swarm service is unavailable.',
+ payload: {'status': 503},
+ );
+ expect(await box.create(), NewHarnessOutcome.failed);
+ expect(
+ box.error,
+ 'Couldn’t check Mac Studio for the Product Manager: The Swarm service is unavailable. Try again.',
+ );
+ expect(
+ f.connection.calls.where(
+ (c) =>
+ '${(c.$2['body'] as Map?)?['command']?['type']}' ==
+ 'project.create',
+ ),
+ isEmpty,
+ );
+ expect(f.connection.calls.where((c) => c.$1 == 'agent_create'), isEmpty);
+ },
+ );
+
+ test('a new Swarm keeps choosing among the person’s own machines', () async {
+ final f = SuperTabLaunchFixture();
+ final box = await f.box();
+ expect(box.integration!.leadMachines, isNull);
+ });
+
test(
'an unsupported project request keeps its draft and unlocks visibility',
() async {
final f = SuperTabLaunchFixture();
f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Company');
final box = await f.box(newProject: true);
+ f.connection.backendFailureOnCommandsOnly = true;
f.connection.backendFailure = const WsRequestFailure(
responseType: 'super_tabs_result',
code: 'VALIDATION_ERROR',
diff --git a/desktop/test/super_tab_leaderboard_test.dart b/desktop/test/super_tab_leaderboard_test.dart
index 3b9ed0e35..3b57ce229 100644
--- a/desktop/test/super_tab_leaderboard_test.dart
+++ b/desktop/test/super_tab_leaderboard_test.dart
@@ -118,9 +118,6 @@ void main() {
test('parses every number the column shows', () {
final board = SuperTabLeaderboard.fromJson(answer());
expect(board.week, week);
- expect(board.goal.openRequests, 7);
- expect(board.goal.thisWeek.medianAskToShipMs, 3 * hour);
- expect(board.goal.lastWeek.shipped, 12);
final ken = board.people.first;
expect(
[ken.personId, ken.points, ken.rank, ken.medal],
diff --git a/desktop/test/super_tab_sidebar_rows_test.dart b/desktop/test/super_tab_sidebar_rows_test.dart
index d11f8b9de..ef8f9a5b4 100644
--- a/desktop/test/super_tab_sidebar_rows_test.dart
+++ b/desktop/test/super_tab_sidebar_rows_test.dart
@@ -161,25 +161,124 @@ void main() {
},
);
- testWidgets('an unread project shows its dot just left of the chevron', (
+ // Unread is a bold name and nothing else drawn (Dee, 2026-10-29): no dot
+ // beside it, so nothing in the status column to line up.
+ Finder unreadDot(Finder row) => find.descendant(
+ of: row,
+ matching: find.byWidgetPredicate(
+ (w) =>
+ w is Container &&
+ w.decoration is BoxDecoration &&
+ (w.decoration! as BoxDecoration).shape == BoxShape.circle &&
+ // A dot holds nothing; an avatar holds its initial.
+ w.child == null,
+ ),
+ );
+ // What a screen reader says for the row, its children merged into it.
+ String spoken(WidgetTester tester, Finder row) =>
+ tester.getSemantics(row).getSemanticsData().label;
+ FontWeight? weightOf(WidgetTester tester, Finder row, String text) => tester
+ .widget<RichText>(
+ find
+ .descendant(
+ of: row,
+ matching: find.byWidgetPredicate(
+ (w) => w is RichText && w.text.toPlainText() == text,
+ ),
+ )
+ .first,
+ )
+ .text
+ .style
+ ?.fontWeight;
+
+ testWidgets(
+ 'an unread project and workgroup show their names in bold, with no dot',
+ (tester) async {
+ // Not "Offline editing": it waits for a person, which shows "?" there.
+ final server = humansSwarm();
+ addNumberedWorkgroups(server, 1);
+ final controller = await show(tester, server);
+ await tester.tap(toggle);
+ await tester.pumpAndSettle();
+ final g1 = find.byKey(const ValueKey('super-group-g1'));
+ final name = tester
+ .widget<RichText>(
+ find.descendant(of: g1, matching: find.byType(RichText)).first,
+ )
+ .text
+ .toPlainText();
+ // Read: the project open (medium), the workgroup in ordinary weight.
+ expect(weightOf(tester, project, 'Pilot'), isNot(grid.AppFont.semibold));
+ expect(weightOf(tester, g1, name), grid.AppFont.regular);
+
+ server.append('New work', conversationId: 'g1');
+ await controller.select('offline');
+ await controller.refresh();
+ await tester.pumpAndSettle();
+ expect(weightOf(tester, project, 'Pilot'), grid.AppFont.semibold);
+ expect(weightOf(tester, g1, name), grid.AppFont.semibold);
+ expect(unreadDot(project), findsNothing);
+ expect(unreadDot(g1), findsNothing);
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets(
+ 'a screen reader hears an unread row as unread, and a read one not',
+ (tester) async {
+ final semantics = tester.ensureSemantics();
+ final server = humansSwarm();
+ addNumberedWorkgroups(server, 2);
+ final controller = await show(tester, server);
+ await tester.tap(toggle);
+ await tester.pumpAndSettle();
+ final g1 = find.byKey(const ValueKey('super-group-g1'));
+ final g2 = find.byKey(const ValueKey('super-group-g2'));
+ expect(spoken(tester, project), isNot(contains('Unread messages')));
+ expect(spoken(tester, g1), isNot(contains('Unread messages')));
+
+ server.append('New work', conversationId: 'g1');
+ await controller.select('offline');
+ await controller.refresh();
+ await tester.pumpAndSettle();
+ expect(spoken(tester, project), contains('Unread messages'));
+ expect(spoken(tester, g1), contains('Unread messages'));
+ expect(spoken(tester, g2), isNot(contains('Unread messages')));
+ semantics.dispose();
+ await close(tester, controller);
+ },
+ );
+
+ testWidgets('an unread Buddy row is bold with no dot, and heard as unread', (
tester,
) async {
- // Not "Offline editing": it waits for a person, which shows "?" there.
- final server = humansSwarm();
- addNumberedWorkgroups(server, 1);
- final controller = await show(tester, server);
- server.append('New work', conversationId: 'g1');
- await controller.refresh();
- await tester.pumpAndSettle();
- final dot = find.descendant(
- of: project,
- matching: find.byWidgetPredicate(
- (w) => w is Semantics && w.properties.label == 'Unread messages',
+ final semantics = tester.ensureSemantics();
+ Future<void> row({required bool unread}) => tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.light),
+ home: Scaffold(
+ body: SuperTabPmChatRow(
+ key: const ValueKey('pm'),
+ agentId: null,
+ name: 'Buddy',
+ tooltip: 'Your Buddy · Pilot',
+ unread: unread,
+ onTap: () {},
+ ),
+ ),
),
);
- expect(dot, findsOneWidget);
- expect(tester.getCenter(dot).dx, lessThan(tester.getRect(toggle).left));
- await close(tester, controller);
+ final pm = find.byKey(const ValueKey('pm'));
+ final tappable = find.descendant(of: pm, matching: find.byType(InkWell));
+ await row(unread: false);
+ expect(weightOf(tester, pm, 'Buddy'), grid.AppFont.regular);
+ expect(spoken(tester, tappable), isNot(contains('Unread messages')));
+ await row(unread: true);
+ expect(weightOf(tester, pm, 'Buddy'), grid.AppFont.semibold);
+ expect(unreadDot(pm), findsNothing);
+ expect(spoken(tester, tappable), contains('Unread messages'));
+ semantics.dispose();
});
testWidgets(
diff --git a/desktop/test/super_tab_sidebar_test.dart b/desktop/test/super_tab_sidebar_test.dart
index c3b624ec1..9651dd075 100644
--- a/desktop/test/super_tab_sidebar_test.dart
+++ b/desktop/test/super_tab_sidebar_test.dart
@@ -17,10 +17,16 @@ import 'swarm_state_test.dart' show createApp;
Finder inRow(String key, Finder finder) =>
find.descendant(of: find.byKey(ValueKey(key)), matching: finder);
+/// A drawn unread dot; unread is now a bold name, heard as "Unread messages".
Finder unreadDot(String groupId) => inRow(
'super-group-$groupId',
find.byWidgetPredicate(
- (w) => w is Semantics && w.properties.label == 'Unread messages',
+ (w) =>
+ w is Container &&
+ w.decoration is BoxDecoration &&
+ (w.decoration! as BoxDecoration).shape == BoxShape.circle &&
+ // A dot holds nothing; an avatar holds its initial.
+ w.child == null,
),
);
@@ -173,16 +179,9 @@ void main() {
]) {
expect(tester.getTopLeft(label).dx, textX, reason: '$label');
}
- // A workgroup's dot is in the rows' right status column; a project's
- // chevron takes that column and its dot sits just left of it.
- expect(
- tester.getCenter(unreadDot('offline')).dx,
- tester.getCenter(toggle).dx,
- );
- expect(
- tester.getCenter(unreadDot('lead')).dx,
- tester.getCenter(toggle).dx - tester.getSize(toggle).width,
- );
+ // Unread is a bold name, with no dot in either row (Dee, 2026-10-29).
+ expect(unreadDot('offline'), findsNothing);
+ expect(unreadDot('lead'), findsNothing);
for (final row in [newProject, devices, work]) {
final bounds = tester.getRect(row);
expect(bounds.left, tester.getRect(project).left);
diff --git a/desktop/test/super_tab_team_glance_test.dart b/desktop/test/super_tab_team_glance_test.dart
deleted file mode 100644
index 8464b7b27..000000000
--- a/desktop/test/super_tab_team_glance_test.dart
+++ /dev/null
@@ -1,566 +0,0 @@
-// Team at a glance (Dee, 2026-10-27): "it's hard to monitor the team". Each agent row says, in one line, its state, the
-// machine it runs on and its model and effort; one click from the Agents heading shows every machine with its agents
-// and slots, the model and effort counts, and what looks wrong: work piled on one machine while others have room, busy
-// agents on an offline machine, and agents running another effort than their start asked for.
-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/state/harness_activity.dart';
-import 'package:harness/super_tabs/agent_details.dart';
-import 'package:harness/super_tabs/detail_dialog.dart';
-import 'package:harness/super_tabs/roster.dart';
-import 'package:harness/super_tabs/team_glance.dart';
-
-import 'support/super_tab_fixture.dart';
-
-const _offline = 10 * 60 * 1000;
-
-Map<String, dynamic> _machine(
- String id,
- String name, {
- int max = 4,
- int? free,
- int age = 0,
- bool paused = false,
- String? host,
-}) => {
- 'machineId': id,
- 'name': name,
- 'contributorId': 'owner',
- 'hostMachineId': ?host,
- 'scope': 'swarm',
- 'cwd': '/swarm',
- 'engines': ['claude', 'codex'],
- 'maxAgents': max,
- 'paused': paused,
- 'availableSlots': ?free,
- 'observation': {'receivedAt': DateTime.now().millisecondsSinceEpoch - age},
-};
-
-Map<String, dynamic> _agent(
- String id,
- String machineId, {
- String model = 'opus',
- String? effort = 'high',
- String engine = 'claude',
- Map<String, dynamic> extra = const {},
-}) => {
- 'id': id,
- 'projectId': 'lead',
- 'name': id,
- 'displayName': id,
- 'machineId': machineId,
- 'harnessId': 'h-$id',
- 'contributorId': 'owner',
- 'configuration': {'engine': engine, 'model': model, 'effort': ?effort},
- ...extra,
-};
-
-Map<String, dynamic> _task(String agentId, String status) => {
- ...conversationFixture('task-$agentId', 'Task of $agentId'),
- 'leadId': 'Lead',
- 'agentIds': ['Lead', agentId],
- 'assignment': {'id': 'as-$agentId', 'agentId': agentId, 'status': status},
-};
-
-Map<String, dynamic> _start(String agentId, String effort) => {
- 'id': 'start-$agentId',
- 'harnessId': 'h-$agentId',
- 'request': {
- 'machineId': 'm1',
- 'engine': 'claude',
- 'model': 'opus',
- 'effort': effort,
- 'name': agentId,
- },
-};
-
-/// A Swarm whose Lead runs on Mac Studio, with [agents], [machines], [tasks] and [starts] besides.
-Future<ConversationServer> _swarm(
- WidgetTester tester, {
- List<Map<String, dynamic>> agents = const [],
- List<Map<String, dynamic>>? machines,
- List<Map<String, dynamic>> tasks = const [],
- List<Map<String, dynamic>> starts = const [],
- String account = 'owner',
-}) async {
- final server = ConversationServer();
- if (account != 'owner') {
- (server.state['people'] as List).add({
- 'id': account,
- 'email': '[email protected]',
- 'role': 'collaborator',
- });
- }
- server.state['machines'] =
- machines ?? [_machine('m1', 'Mac Studio'), _machine('m2', 'MacBook Pro')];
- server.state['agents'] = [_agent('Lead', 'm1'), ...agents];
- (server.state['conversations'] as List)[0]['leadId'] = 'Lead';
- (server.state['conversations'] as List).addAll(tasks);
- server.state['starts'] = starts;
- final c = server.controller(account: account);
- await c.refresh();
- addTearDown(c.dispose);
- await tester.binding.setSurfaceSize(const Size(320, 1600));
- addTearDown(() => tester.binding.setSurfaceSize(null));
- await tester.pumpWidget(
- MaterialApp(
- theme: grid.buildAppTheme(brightness: Brightness.dark),
- home: Scaffold(
- body: SuperTabRoster(
- controller: c,
- onInvite: () {},
- onOpenAgent: (_) {},
- onAddAgent: (_) {},
- onAnswer: (_) {},
- ),
- ),
- ),
- );
- await tester.pumpAndSettle();
- return server;
-}
-
-Finder _row(String id) => find.byKey(ValueKey('super-member-$id'));
-Finder _line(String id, String text) =>
- find.descendant(of: _row(id), matching: find.text(text));
-
-/// The agents a machine lists for [state], as one row's value.
-String? _stateRow(Finder machine, String state) {
- final row = find.descendant(
- of: machine,
- matching: find.ancestor(of: find.text(state), matching: find.byType(SuperTabDetailRow)),
- );
- if (row.evaluate().isEmpty) return null;
- return (row.evaluate().first.widget as SuperTabDetailRow).value;
-}
-
-Future<void> _openGlance(WidgetTester tester) async {
- await tester.tap(find.byTooltip('Team at a glance'));
- await tester.pumpAndSettle();
-}
-
-void main() {
- group('an agent row', () {
- testWidgets(
- 'says in one line its state, its machine, and its model and effort',
- (tester) async {
- await _swarm(
- tester,
- agents: [
- _agent('Atlas', 'm1'),
- _agent('Sage', 'm2', model: 'sonnet', effort: 'medium'),
- ],
- tasks: [_task('Atlas', 'working')],
- );
- // Holding a task with no turn seen running: assigned, never claimed as working.
- expect(
- _line('Atlas', 'Assigned · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- expect(
- _line('Sage', 'Idle · MacBook Pro · Sonnet · medium'),
- findsOneWidget,
- );
- },
- );
-
- test('reads working only while its turn runs, and keeps the task as assigned otherwise', () async {
- final server = ConversationServer();
- server.state['machines'] = [_machine('m1', 'Mac Studio')];
- server.state['agents'] = [_agent('Atlas', 'm1')];
- (server.state['conversations'] as List).add(_task('Atlas', 'working'));
- final c = server.controller();
- addTearDown(c.dispose);
- await c.refresh();
- final atlas = c.snapshot!.agent('Atlas')!;
- String line(HarnessActivity? activity) => superTabAgentGlance(
- SuperTabAgentInfo(c, null, atlas, activity: activity),
- ).line;
- expect(
- line(HarnessActivity.working),
- 'Working · Mac Studio · Opus · high',
- );
- expect(line(HarnessActivity.idle), 'Assigned · Mac Studio · Opus · high');
- expect(line(null), 'Assigned · Mac Studio · Opus · high');
- });
-
- testWidgets(
- 'names each state in a word: waiting, lost, down, limited, stuck, in review',
- (tester) async {
- final until = DateTime.now().add(const Duration(hours: 2)).toLocal();
- String two(int n) => n.toString().padLeft(2, '0');
- await _swarm(
- tester,
- agents: [
- _agent('Wren', 'm1'),
- _agent('Lark', 'm1'),
- _agent(
- 'Kite',
- 'm2',
- extra: {'downSince': DateTime.now().toUtc().toIso8601String()},
- ),
- _agent(
- 'Rook',
- 'm2',
- extra: {'limitedUntil': until.toUtc().toIso8601String()},
- ),
- _agent('Moss', 'm1'),
- _agent('Teal', 'm1'),
- ],
- tasks: [
- _task('Wren', 'needs_human'),
- _task('Lark', 'lost'),
- _task('Moss', 'blocked'),
- _task('Teal', 'review'),
- ],
- );
- expect(
- _line('Moss', 'Stuck · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- expect(
- _line('Teal', 'In review · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- expect(
- _line('Wren', 'Waiting · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- expect(
- _line('Lark', 'Lost · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- final tip = tester
- .widgetList<Tooltip>(
- find.ancestor(of: _row('Lark'), matching: find.byType(Tooltip)),
- )
- .single
- .message!;
- expect(tip, contains('Lost "Task of Lark"'));
- expect(
- _line('Kite', 'Down · MacBook Pro · Opus · high'),
- findsOneWidget,
- );
- expect(
- _line(
- 'Rook',
- 'Limited until ${two(until.hour)}:${two(until.minute)} · MacBook Pro · Opus · high',
- ),
- findsOneWidget,
- );
- },
- );
-
- // Builders started with opus high were stored as auto (fixed in the CLI, 2026-10-27); one stored before the fix
- // shows what its start asked for while the start still says. An effort nobody reported is left out: the PM's row
- // read "opus unknown" (2026-10-28), and a row says only what is known.
- testWidgets(
- 'shows the requested effort for an auto reading its start still names, else no effort',
- (tester) async {
- await _swarm(
- tester,
- agents: [
- _agent('Nico', 'm1', effort: 'auto'),
- _agent('Quinn', 'm1', effort: 'auto'),
- _agent('Avery', 'm1', effort: null),
- ],
- starts: [_start('Nico', 'high')],
- );
- expect(
- _line('Nico', 'Idle · Mac Studio · Opus · high'),
- findsOneWidget,
- );
- expect(_line('Quinn', 'Idle · Mac Studio · Opus'), findsOneWidget);
- expect(_line('Avery', 'Idle · Mac Studio · Opus'), findsOneWidget);
- expect(find.textContaining('unknown'), findsNothing);
- },
- );
-
- testWidgets(
- 'names the model by its display name, with its version when reported',
- (tester) async {
- await _swarm(
- tester,
- agents: [
- _agent('Iris', 'm1', model: 'claude-opus-5-5'),
- _agent('Juno', 'm1', model: 'claude-sonnet-5-5', effort: null),
- _agent(
- 'Kai',
- 'm2',
- engine: 'codex',
- model: 'gpt-5.6-sol',
- effort: 'xhigh',
- ),
- ],
- );
- expect(
- _line('Iris', 'Idle · Mac Studio · Opus 5.5 · high'),
- findsOneWidget,
- );
- expect(_line('Juno', 'Idle · Mac Studio · Sonnet 5.5'), findsOneWidget);
- expect(
- _line('Kai', 'Idle · MacBook Pro · GPT-5.6 Sol · xhigh'),
- findsOneWidget,
- );
- },
- );
-
- testWidgets('a start that asked for effort high is shown as high', (
- tester,
- ) async {
- await _swarm(
- tester,
- agents: [_agent('Echo', 'm1')],
- starts: [_start('Echo', 'high')],
- );
- expect(_line('Echo', 'Idle · Mac Studio · Opus · high'), findsOneWidget);
- });
- });
-
- group('Team at a glance', () {
- testWidgets(
- 'opens with one click and lists each machine with its slots, state and agents',
- (tester) async {
- await _swarm(
- tester,
- machines: [
- _machine('m1', 'Mac Studio', free: 2),
- _machine('m2', 'MacBook Pro', max: 2, free: 2, age: _offline),
- ],
- agents: [_agent('Atlas', 'm1')],
- );
- await _openGlance(tester);
- final studio = find.byKey(const ValueKey('glance-machine-m1'));
- expect(
- find.descendant(of: studio, matching: find.text('Mac Studio')),
- findsOneWidget,
- );
- expect(
- find.descendant(
- of: studio,
- matching: find.text('Online · 2 of 4 slots used'),
- ),
- findsOneWidget,
- );
- // Agents by what they are doing, one row per state, as label and value (Ken, 2026-10-28).
- expect(_stateRow(studio, 'Idle'), 'Lead, Atlas');
- final laptop = find.byKey(const ValueKey('glance-machine-m2'));
- expect(
- find.descendant(
- of: laptop,
- matching: find.text('Offline · 0 of 2 slots used'),
- ),
- findsOneWidget,
- );
- expect(
- find.descendant(of: laptop, matching: find.text('No agents')),
- findsOneWidget,
- );
- },
- );
-
- testWidgets('counts agents per model and effort, most first', (
- tester,
- ) async {
- await _swarm(
- tester,
- agents: [
- _agent('Atlas', 'm1'),
- _agent('Sage', 'm2', model: 'sonnet', effort: 'medium'),
- _agent('Finn', 'm2'),
- ],
- );
- await _openGlance(tester);
- final counts = find.byKey(const ValueKey('glance-models'));
- expect(
- find.descendant(of: counts, matching: find.text('Opus · high · 3')),
- findsOneWidget,
- );
- expect(
- find.descendant(of: counts, matching: find.text('Sonnet · medium · 1')),
- findsOneWidget,
- );
- expect(
- tester.getTopLeft(find.text('Opus · high · 3')).dy,
- lessThan(tester.getTopLeft(find.text('Sonnet · medium · 1')).dy),
- );
- });
-
- testWidgets(
- 'warns when most busy agents sit on one machine while another has free slots',
- (tester) async {
- await _swarm(
- tester,
- machines: [
- _machine('m1', 'Mac Studio', free: 0),
- _machine('m2', 'MacBook Pro', free: 3),
- ],
- agents: [
- _agent('Atlas', 'm1'),
- _agent('Sage', 'm1'),
- _agent('Finn', 'm2'),
- ],
- tasks: [
- _task('Atlas', 'working'),
- _task('Sage', 'working'),
- _task('Finn', 'working'),
- ],
- );
- await _openGlance(tester);
- expect(
- find.text(
- '2 of 3 busy agents are on Mac Studio, while MacBook Pro has 3 free slots.',
- ),
- findsOneWidget,
- );
- },
- );
-
- testWidgets(
- 'does not warn about piling up when the other machines have no room or are offline',
- (tester) async {
- await _swarm(
- tester,
- machines: [
- _machine('m1', 'Mac Studio', free: 0),
- _machine('m2', 'MacBook Pro', free: 3, age: _offline),
- ],
- agents: [_agent('Atlas', 'm1'), _agent('Sage', 'm1')],
- tasks: [_task('Atlas', 'working'), _task('Sage', 'working')],
- );
- await _openGlance(tester);
- expect(find.textContaining('busy agents are on'), findsNothing);
- expect(find.text('Nothing looks wrong.'), findsOneWidget);
- },
- );
-
- // Review of #1759: a paused machine takes no new work, so its free slots are no room.
- testWidgets('does not count a paused machine as room', (tester) async {
- await _swarm(
- tester,
- machines: [
- _machine('m1', 'Mac Studio', free: 0),
- _machine('m2', 'MacBook Pro', free: 3, paused: true),
- ],
- agents: [_agent('Atlas', 'm1'), _agent('Sage', 'm1')],
- tasks: [_task('Atlas', 'working'), _task('Sage', 'working')],
- );
- await _openGlance(tester);
- expect(find.textContaining('busy agents are on'), findsNothing);
- expect(find.text('Nothing looks wrong.'), findsOneWidget);
- });
-
- // Review of #1759: a teammate reads a Mac by its Harness Team account, as the Machines view does; a stale reading
- // of the Mac's own pool beside a live Team account is not an offline machine.
- testWidgets(
- 'reads a Mac by its Team account for a teammate, as the Machines view does',
- (tester) async {
- await _swarm(
- tester,
- account: 'peer',
- machines: [
- _machine('m1', 'Mac Studio', age: _offline),
- _machine('m1-team', 'Mac Studio (team)', free: 3, host: 'm1'),
- _machine('m2', 'MacBook Pro'),
- ],
- agents: [_agent('Finn', 'm1-team')],
- tasks: [_task('Finn', 'working')],
- );
- await _openGlance(tester);
- final studio = find.byKey(const ValueKey('glance-machine-m1'));
- expect(
- find.descendant(
- of: studio,
- matching: find.text('Online · 1 of 4 slots used'),
- ),
- findsOneWidget,
- );
- expect(_stateRow(studio, 'Assigned'), 'Finn');
- expect(find.textContaining('which is offline'), findsNothing);
- expect(
- find.byKey(const ValueKey('glance-machine-m1-team')),
- findsNothing,
- );
- },
- );
-
- testWidgets('warns about a busy agent on an offline machine', (
- tester,
- ) async {
- await _swarm(
- tester,
- machines: [
- _machine('m1', 'Mac Studio'),
- _machine('m2', 'MacBook Pro', age: _offline),
- ],
- agents: [_agent('Finn', 'm2')],
- tasks: [_task('Finn', 'working')],
- );
- await _openGlance(tester);
- expect(
- find.text('Finn is busy on MacBook Pro, which is offline.'),
- findsOneWidget,
- );
- });
-
- testWidgets(
- 'warns about an agent running another effort than its start asked for, not an unknown one',
- (tester) async {
- await _swarm(
- tester,
- agents: [
- _agent('Hugo', 'm1', effort: 'xhigh'),
- _agent('Nico', 'm1', effort: 'auto'),
- _agent('Echo', 'm1'),
- ],
- starts: [
- _start('Hugo', 'high'),
- _start('Nico', 'high'),
- _start('Echo', 'high'),
- ],
- );
- await _openGlance(tester);
- expect(
- find.text('Hugo runs at xhigh effort; it was started at high.'),
- findsOneWidget,
- );
- expect(find.textContaining('Nico runs'), findsNothing);
- expect(find.textContaining('Echo runs'), findsNothing);
- },
- );
-
- testWidgets('busy agents on one offline machine are one warning, their names folded', (tester) async {
- final names = ['Milo', 'Kai', 'Iris', 'Ellis', 'Nova'];
- await _swarm(
- tester,
- machines: [_machine('m1', 'Mac Studio', max: 8), _machine('m2', 'MacBook Pro', max: 8, age: _offline)],
- agents: [for (final name in names) _agent(name, 'm2')],
- tasks: [for (final name in names) _task(name, 'working')],
- );
- await _openGlance(tester);
- expect(find.text('5 agents are busy on MacBook Pro, which is offline.'), findsOneWidget);
- expect(find.textContaining('Milo is busy'), findsNothing);
- expect(find.text('Milo, Kai, Iris and 2 more'), findsOneWidget);
- await tester.tap(find.text('Milo, Kai, Iris and 2 more'));
- await tester.pumpAndSettle();
- expect(
- find.text('Milo, Kai, Iris, Ellis, Nova'),
- findsNWidgets(2),
- reason: 'the unfolded warning, and the machine\'s Assigned row',
- );
- });
-
- testWidgets('agents on another effort than they started with are one warning, in plain words', (tester) async {
- await _swarm(
- tester,
- agents: [_agent('Robin', 'm1', effort: 'xhigh'), _agent('Sage', 'm1', effort: 'xhigh')],
- starts: [_start('Robin', 'high'), _start('Sage', 'high')],
- );
- await _openGlance(tester);
- expect(find.text('2 agents run at another effort than they were started with.'), findsOneWidget);
- expect(find.text('Robin (xhigh, started at high), Sage (xhigh, started at high)'), findsOneWidget);
- expect(find.textContaining('runs effort'), findsNothing);
- });
-});
-}
diff --git a/desktop/test/swarm_creation_form_test.dart b/desktop/test/swarm_creation_form_test.dart
index 79a100758..0b12c44db 100644
--- a/desktop/test/swarm_creation_form_test.dart
+++ b/desktop/test/swarm_creation_form_test.dart
@@ -10,7 +10,10 @@ import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/widgets/app_menu.dart';
import 'package:harness/state/harness_attachments.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/state/app_state.dart';
import 'package:harness/state/harness_launch_integration.dart';
+import 'package:harness/state/lead_placement.dart';
import 'package:harness/state/new_harness.dart';
import 'package:harness/super_tabs/project_visibility.dart';
import 'package:harness/widgets/new_harness_form.dart';
@@ -52,6 +55,9 @@ void main() {
bool attachments = true,
bool visibilityLocked = false,
bool otherRequest = false,
+ List<LeadMachine>? leadMachines,
+ LeadModelList? leadModels,
+ void Function(SuperTabLaunchFixture f)? setup,
}) async {
final oldBrightness = grid.AppTheme.brightness.value;
grid.AppTheme.brightness.value = brightness;
@@ -65,6 +71,7 @@ void main() {
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
final f = SuperTabLaunchFixture();
+ setup?.call(f);
final files = attachments ? HarnessAttachments() : null;
final box = NewHarnessController(
f.app,
@@ -72,15 +79,18 @@ void main() {
engine: 'codex',
folder: '/work/lamp-os',
attachments: files,
- integration: HarnessLaunchIntegration(
- creationId: 'swarm-form-fixture',
- actionLabel: 'New Project',
- projectVisibility: 'public',
- projectVisibilityLocked: visibilityLocked,
- prepare: (_, task) async => task,
- beforeSubmit: (_, _) async {},
- complete: (_, _) async {},
- ),
+ integration:
+ HarnessLaunchIntegration(
+ creationId: 'swarm-form-fixture',
+ actionLabel: 'New Project',
+ projectVisibility: 'public',
+ projectVisibilityLocked: visibilityLocked,
+ prepare: (_, task) async => task,
+ beforeSubmit: (_, _) async {},
+ complete: (_, _) async {},
+ )
+ ..leadMachines = leadMachines
+ ..leadModels = leadModels,
)..linkingProfile = otherRequest;
addTearDown(box.dispose);
final boundary = GlobalKey();
@@ -272,4 +282,639 @@ void main() {
},
);
}
+
+ const studio = LeadMachine(
+ id: 'm',
+ name: 'Mac Studio',
+ online: true,
+ freeAgents: 9,
+ repositories: {'github.com/autonomous-ai/autonomous-os'},
+ );
+ const rig = LeadMachine(
+ id: 'rig',
+ name: '2x 4090 Rig',
+ online: true,
+ freeAgents: 14,
+ unavailable: 'Another person’s machine',
+ );
+ const laptop = LeadMachine(
+ id: 'laptop',
+ name: 'Ken MacBook',
+ online: true,
+ freeAgents: 2,
+ maySleep: true,
+ );
+ void addLaptop(SuperTabLaunchFixture f) {
+ const machine = Machine(
+ machineId: 'laptop',
+ authMode: MachineAuthMode.remote,
+ name: 'Ken MacBook',
+ );
+ f.app.machines = [...f.app.machines, machine];
+ f.app.machineStates['laptop'] = MachineState(machine)
+ ..nodeOnline = true
+ ..connectionStatus = ConnectionStatus.connected
+ ..agentLoadStatus = AgentLoadStatus.loaded
+ ..agents = [];
+ }
+
+ final leadLine = find.byKey(const ValueKey('new-harness-lead-line'));
+ final change = find.byKey(const ValueKey('new-harness-lead-change'));
+
+ for (final brightness in Brightness.values) {
+ testWidgets(
+ 'New Project in a Swarm asks only task, repo and visibility in ${brightness.name}',
+ (tester) async {
+ final (box, boundary) = await mount(
+ tester,
+ brightness: brightness,
+ leadMachines: [studio, rig],
+ );
+ expect(
+ find.descendant(
+ of: leadLine,
+ matching: find.textContaining(
+ 'Product Manager: Mac Studio · ${box.agentLabel}',
+ ),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: _composer, matching: leadLine),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(
+ of: _composer,
+ matching: find.byKey(const ValueKey('new-harness-field-project')),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: _composer, matching: _visibility),
+ findsOneWidget,
+ );
+ for (final hidden in [
+ 'agent',
+ 'machine',
+ 'model',
+ 'worktree',
+ 'branch',
+ 'approvals',
+ 'profile',
+ ]) {
+ expect(
+ find.byKey(ValueKey('new-harness-field-$hidden')),
+ findsNothing,
+ reason: hidden,
+ );
+ }
+ expect(
+ tester.getCenter(leadLine).dy,
+ closeTo(tester.getCenter(_start).dy, 4),
+ );
+ await shot(tester, boundary, 'new-project-lead-${brightness.name}');
+
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ final studioRow = find.byKey(
+ const ValueKey('new-harness-lead-machine-m'),
+ );
+ final rigRow = find.byKey(
+ const ValueKey('new-harness-lead-machine-rig'),
+ );
+ expect(studioRow, findsOneWidget);
+ expect(rigRow, findsOneWidget);
+ expect(
+ find.descendant(
+ of: studioRow,
+ matching: find.text('Online · 9 agents free · Has repo'),
+ ),
+ findsNothing,
+ reason: 'has repo is only known for a known repository',
+ );
+ expect(
+ find.descendant(
+ of: studioRow,
+ matching: find.textContaining('Online · 9 agents free'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: studioRow, matching: find.byIcon(AppIcons.check)),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(
+ of: rigRow,
+ matching: find.text('Another person’s machine'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ tester
+ .widget<Semantics>(
+ find
+ .descendant(of: rigRow, matching: find.byType(Semantics))
+ .first,
+ )
+ .properties
+ .enabled,
+ isFalse,
+ );
+ await shot(
+ tester,
+ boundary,
+ 'new-project-lead-${brightness.name}-change',
+ );
+
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-advanced')),
+ );
+ await tester.pumpAndSettle();
+ expect(
+ find.byKey(const ValueKey('new-harness-field-agent')),
+ findsOneWidget,
+ );
+ expect(
+ find.byKey(const ValueKey('new-harness-field-model')),
+ findsOneWidget,
+ );
+ expect(find.text('Engine'), findsOneWidget);
+ expect(find.text('Model'), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('new-harness-field-worktree')),
+ findsNothing,
+ );
+ await shot(
+ tester,
+ boundary,
+ 'new-project-lead-${brightness.name}-advanced',
+ );
+ expect(tester.takeException(), isNull);
+ await unmount(tester);
+ },
+ );
+ }
+
+ testWidgets('The Swarm places the Product Manager on the best machine', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: addLaptop,
+ leadMachines: rankLeadMachines([laptop, rig], null),
+ );
+ expect(box.machineId, 'laptop');
+ expect(
+ find.descendant(
+ of: leadLine,
+ matching: find.textContaining('Product Manager: Ken MacBook'),
+ ),
+ findsOneWidget,
+ );
+ await unmount(tester);
+ });
+
+ testWidgets('Choosing another of your machines moves the Product Manager', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: addLaptop,
+ leadMachines: [studio, laptop, rig],
+ );
+ expect(box.machineId, 'm');
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-rig')),
+ );
+ await tester.pumpAndSettle();
+ expect(
+ box.machineId,
+ 'm',
+ reason: 'another person’s machine is not a choice',
+ );
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-laptop')),
+ );
+ await tester.pumpAndSettle();
+ expect(box.machineId, 'laptop');
+ expect(
+ find.descendant(
+ of: leadLine,
+ matching: find.textContaining('Product Manager: Ken MacBook'),
+ ),
+ findsOneWidget,
+ );
+ await unmount(tester);
+ });
+
+ for (final brightness in Brightness.values) {
+ testWidgets(
+ 'With no machine free New Project says so and waits in ${brightness.name}',
+ (tester) async {
+ final (box, boundary) = await mount(
+ tester,
+ brightness: brightness,
+ leadMachines: [
+ const LeadMachine(
+ id: 'm',
+ name: 'Mac Studio',
+ online: true,
+ freeAgents: 0,
+ ),
+ rig,
+ ],
+ );
+ expect(
+ find.text(
+ 'No machine of yours in this Swarm is free. New Project can start once one is.',
+ ),
+ findsOneWidget,
+ );
+ expect(tester.widget<FilledButton>(_start).onPressed, isNull);
+ box.setTask('Plan the launch');
+ await tester.pump();
+ expect(tester.widget<FilledButton>(_start).onPressed, isNull);
+ await shot(
+ tester,
+ boundary,
+ 'new-project-lead-${brightness.name}-waiting',
+ );
+ await unmount(tester);
+ },
+ );
+ }
+
+ testWidgets(
+ 'The Product Manager line stays usable at 2x text in a compact window',
+ (tester) async {
+ final (_, boundary) = await mount(
+ tester,
+ width: 420,
+ textScale: 2,
+ leadMachines: [studio, rig],
+ );
+ expect(tester.takeException(), isNull);
+ expect(
+ tester.getRect(_start).right,
+ lessThanOrEqualTo(tester.getRect(_composer).right),
+ );
+ expect(
+ tester.getRect(_visibility).right,
+ lessThanOrEqualTo(tester.getRect(_composer).right),
+ );
+ // Too narrow to share a line: the Product Manager line gets its own.
+ expect(
+ tester.getRect(leadLine).bottom,
+ lessThanOrEqualTo(tester.getRect(_start).top),
+ );
+ expect(
+ tester.getSize(leadLine).width,
+ greaterThan(tester.getSize(_composer).width / 2),
+ );
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ await shot(tester, boundary, 'new-project-lead-compact');
+ await unmount(tester);
+ },
+ );
+
+ void agentIn(
+ SuperTabLaunchFixture f, {
+ String? model,
+ String remote = '[email protected]:autonomous-ai/lamp-os.git',
+ }) => f.app.machineStates['m']!.agents = [
+ Agent(
+ id: 'earlier',
+ name: 'Earlier',
+ engine: 'codex',
+ modelName: model,
+ terminalAvailable: true,
+ project: AgentProject(
+ name: 'lamp-os',
+ cwd: '/work/lamp-os',
+ root: '/work/lamp-os',
+ remote: remote,
+ ),
+ ),
+ ];
+
+ testWidgets('The line never guesses the model from other agents', (
+ tester,
+ ) async {
+ await mount(
+ tester,
+ leadMachines: [studio],
+ setup: (f) => agentIn(f, model: 'GPT-5.5'),
+ );
+ final line = find.descendant(of: leadLine, matching: find.byType(Text));
+ expect(
+ tester.widget<Text>(line.first).data,
+ 'Product Manager: Mac Studio · Codex · Default model',
+ );
+ await unmount(tester);
+ });
+
+ testWidgets('A saved “no worktree” still gives the PM its own worktree', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ leadMachines: [studio],
+ setup: (f) {
+ f.app.agentPreference.successfulWorktree = false;
+ f.app.gitProjectReaderForTest = (_, _) async => {
+ 'isGit': true,
+ 'branch': 'main',
+ 'branches': [
+ {'ref': 'refs/heads/main', 'name': 'main'},
+ ],
+ };
+ },
+ );
+ await tester.pumpAndSettle();
+ expect(box.isGitProject, isTrue);
+ expect(box.worktree, isTrue);
+ // Forced for the PM, so not saved over the person's own setting.
+ expect(box.worktreeToRemember, isNull);
+ await unmount(tester);
+ });
+
+ testWidgets('An ordinary launch still saves its worktree setting', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: (f) => f.app.gitProjectReaderForTest = (_, _) async => {
+ 'isGit': true,
+ 'branch': 'main',
+ 'branches': [
+ {'ref': 'refs/heads/main', 'name': 'main'},
+ ],
+ },
+ );
+ await tester.pumpAndSettle();
+ expect(box.placesLead, isFalse);
+ expect(box.worktreeToRemember, box.worktree);
+ box.toggleWorktree();
+ expect(box.worktreeToRemember, box.worktree);
+ await unmount(tester);
+ });
+
+ testWidgets('Moving the PM reads the new machine’s branches', (tester) async {
+ final reads = <(String, String)>[];
+ final (box, _) = await mount(
+ tester,
+ setup: (f) {
+ addLaptop(f);
+ agentIn(f);
+ f.app.gitProjectReaderForTest = (machine, folder) async {
+ reads.add((machine, folder));
+ return {
+ 'isGit': true,
+ 'branch': 'main',
+ 'branches': [
+ {'ref': 'refs/heads/main', 'name': 'main'},
+ {'ref': 'refs/heads/$machine-only', 'name': '$machine-only'},
+ ],
+ };
+ };
+ },
+ leadMachines: [
+ studio,
+ const LeadMachine(
+ id: 'laptop',
+ name: 'Ken MacBook',
+ online: true,
+ freeAgents: 2,
+ maySleep: true,
+ folders: {
+ 'github.com/autonomous-ai/lamp-os': '/Users/ken/swarm/lamp-os',
+ },
+ ),
+ ],
+ );
+ await tester.pumpAndSettle();
+ box.focusField(NewHarnessField.branch);
+ box.accept(box.options.firstWhere((o) => o.id == 'refs/heads/m-only'));
+ expect(box.branchRef, 'refs/heads/m-only');
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-laptop')),
+ );
+ await tester.pumpAndSettle();
+ expect(reads.last, ('laptop', '/Users/ken/swarm/lamp-os'));
+ expect(box.branchRef, isNot('refs/heads/m-only'));
+ // Start from offers that machine's branches, not the other one's.
+ box.focusField(NewHarnessField.branch);
+ await tester.pumpAndSettle();
+ final offered = box.options.map((o) => o.id).toSet();
+ expect(offered, contains('refs/heads/laptop-only'));
+ expect(offered, isNot(contains('refs/heads/m-only')));
+ await unmount(tester);
+ });
+
+ testWidgets('Moving the PM drops a branch of the old machine, repo unknown', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: (f) {
+ addLaptop(f);
+ f.app.gitProjectReaderForTest = (machine, folder) async => {
+ 'isGit': true,
+ 'branch': 'main',
+ 'branches': [
+ {'ref': 'refs/heads/main', 'name': 'main'},
+ {'ref': 'refs/heads/$machine-only', 'name': '$machine-only'},
+ ],
+ };
+ },
+ leadMachines: [studio, laptop],
+ );
+ await tester.pumpAndSettle();
+ box.focusField(NewHarnessField.branch);
+ box.accept(box.options.firstWhere((o) => o.id == 'refs/heads/m-only'));
+ expect(box.branchRef, 'refs/heads/m-only');
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-laptop')),
+ );
+ await tester.pumpAndSettle();
+ expect(box.machineId, 'laptop');
+ expect(box.branchRef, isNot('refs/heads/m-only'));
+ await unmount(tester);
+ });
+
+ testWidgets('The model list disables an engine it turns off, with why', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ leadMachines: [studio],
+ leadModels: const LeadModelList(disabledEngines: {'codex'}),
+ );
+ box.focusField(NewHarnessField.agent);
+ final codex = box.options.where((o) => o.id == 'codex').single;
+ expect(codex.enabled, isFalse);
+ expect(codex.why, 'The Swarm’s model list has no enabled Codex model.');
+ expect(box.options.where((o) => o.id == 'claude').single.enabled, isTrue);
+ await unmount(tester);
+ });
+
+ testWidgets('A paused Swarm gives the pause as the reason', (tester) async {
+ final (_, _) = await mount(
+ tester,
+ leadMachines: [
+ const LeadMachine(
+ id: 'm',
+ name: 'Mac Studio',
+ online: true,
+ freeAgents: 9,
+ unavailable: kLeadSwarmPaused,
+ ),
+ ],
+ );
+ expect(
+ find.text(
+ 'New work is paused in this Swarm. New Project can start once it resumes.',
+ ),
+ findsOneWidget,
+ );
+ expect(tester.widget<FilledButton>(_start).onPressed, isNull);
+ await unmount(tester);
+ });
+
+ testWidgets('A ruled-out engine keeps New Project waiting with the rule', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ leadMachines: [studio],
+ leadModels: const LeadModelList(disabledEngines: {'codex'}),
+ );
+ expect(box.engine, 'codex');
+ expect(
+ box.leadBlocked,
+ 'The Swarm’s model list has no enabled Codex model. Choose another engine under Advanced.',
+ );
+ expect(tester.widget<FilledButton>(_start).onPressed, isNull);
+ await unmount(tester);
+ });
+
+ testWidgets('With no model reported the line says the default model', (
+ tester,
+ ) async {
+ await mount(tester, leadMachines: [studio]);
+ final line = find.descendant(of: leadLine, matching: find.byType(Text));
+ expect(
+ tester.widget<Text>(line.first).data,
+ 'Product Manager: Mac Studio · Codex · Default model',
+ );
+ await unmount(tester);
+ });
+
+ testWidgets('Switching machines keeps the repo, found by its remote', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: (f) {
+ addLaptop(f);
+ agentIn(f);
+ },
+ leadMachines: [
+ studio,
+ const LeadMachine(
+ id: 'laptop',
+ name: 'Ken MacBook',
+ online: true,
+ freeAgents: 2,
+ maySleep: true,
+ repositories: {'github.com/autonomous-ai/lamp-os'},
+ folders: {
+ 'github.com/autonomous-ai/lamp-os': '/Users/ken/swarm/lamp-os',
+ },
+ ),
+ ],
+ );
+ expect(box.project.folder, '/work/lamp-os');
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-laptop')),
+ );
+ await tester.pumpAndSettle();
+ expect(box.machineId, 'laptop');
+ expect(box.project.folder, '/Users/ken/swarm/lamp-os');
+ expect(find.textContaining('will be cloned there'), findsNothing);
+ await unmount(tester);
+ });
+
+ testWidgets('A machine without the repo will clone it, and says so', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ setup: (f) {
+ addLaptop(f);
+ agentIn(f);
+ },
+ leadMachines: [studio, laptop],
+ );
+ await tester.tap(change);
+ await tester.pumpAndSettle();
+ await tester.tap(
+ find.byKey(const ValueKey('new-harness-lead-machine-laptop')),
+ );
+ await tester.pumpAndSettle();
+ expect(box.machineId, 'laptop');
+ // Cloned by the address the person's own checkout uses.
+ expect(
+ box.project.repository?.url,
+ '[email protected]:autonomous-ai/lamp-os.git',
+ );
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('new-harness-field-project')),
+ matching: find.text('lamp-os'),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(
+ of: leadLine,
+ matching: find.textContaining('lamp-os will be cloned there'),
+ ),
+ findsOneWidget,
+ );
+ await unmount(tester);
+ });
+
+ testWidgets('The Product Manager always starts in its own worktree', (
+ tester,
+ ) async {
+ final (box, _) = await mount(
+ tester,
+ leadMachines: [studio],
+ setup: (f) => f.app.gitProjectReaderForTest = (_, _) async => {
+ 'isGit': true,
+ 'branch': 'main',
+ 'branches': [
+ {'ref': 'refs/heads/main', 'name': 'main'},
+ ],
+ },
+ );
+ await tester.pumpAndSettle();
+ expect(box.isGitProject, isTrue);
+ box.toggleWorktree();
+ expect(box.worktree, isTrue);
+ await unmount(tester);
+ });
}
diff --git a/desktop/tool/super_tab_local_review.dart b/desktop/tool/super_tab_local_review.dart
index 0d0581026..e42900d26 100644
--- a/desktop/tool/super_tab_local_review.dart
+++ b/desktop/tool/super_tab_local_review.dart
@@ -4,7 +4,7 @@
/// loopback origin that passes `/api/` to the local backend of the local
/// backend recipe (fake SSO tokens, local MongoDB and Redis). Open it with
/// `?tab=<id>&as=owner|peer` and optionally `&open=pm` (that person's Chat
-/// with PM, created on first use) or `&group=<id>`, and `&glance=1` to open Team at a glance. It refuses any origin but
+/// with PM, created on first use) or `&group=<id>`. It refuses any origin but
/// 127.0.0.1 and knows only the recipe's two fake test tokens: it never
/// reaches a real account or production data.
library;
@@ -17,7 +17,6 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/color_palette.dart';
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/model.dart';
-import 'package:harness/super_tabs/team_glance_panel.dart';
import 'package:harness/super_tabs/view.dart';
import 'package:web/web.dart' as web;
@@ -130,10 +129,4 @@ Future<void> _review() async {
),
),
);
- if (query['glance'] == '1') {
- WidgetsBinding.instance.addPostFrameCallback(
- (_) =>
- showSuperTabTeamGlance(navigator.currentContext!, controller, null),
- );
- }
}