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.

Merge batch 11-03 bf: #2673 #2677 #2670 (#2681)

0xken15c50d758e2aa9
diff --git a/desktop/lib/super_tabs/activity_view.dart b/desktop/lib/super_tabs/activity_view.dart
index cec5335d3..8f9446788 100644
--- a/desktop/lib/super_tabs/activity_view.dart
+++ b/desktop/lib/super_tabs/activity_view.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
+import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../widgets/desktop_chrome.dart';
import '../widgets/laid_out_list.dart';
@@ -78,8 +79,8 @@ class _SuperTabActivityViewState extends State<SuperTabActivityView> {
if (local.year == now.year &&
local.month == now.month &&
local.day == now.day) {
- String two(int n) => n.toString().padLeft(2, '0');
- return '${two(local.hour)}:${two(local.minute)}';
+ return MaterialLocalizations.of(context)
+ .formatTimeOfDay(TimeOfDay.fromDateTime(local));
}
return superTabAgoShort(now.difference(local));
}
@@ -111,10 +112,9 @@ class _SuperTabActivityViewState extends State<SuperTabActivityView> {
final open = decision != null && _answering.contains(decision.id);
final row = _Row(
key: ValueKey('super-activity-row-${need.id}'),
- mark: switch (need.kind) {
- SuperTabNeedKind.mention => '@',
- _ => '◐',
- },
+ // The design's @: the icon set has none, and it adds none.
+ glyph: need.kind == SuperTabNeedKind.mention ? '@' : null,
+ mark: need.kind == SuperTabNeedKind.mention ? null : AppIcons.circleDot,
title: need.title,
unread: true,
trailing: switch (need.kind) {
@@ -158,7 +158,7 @@ class _SuperTabActivityViewState extends State<SuperTabActivityView> {
final text = thread.rootText.replaceAll(RegExp(r'\s+'), ' ').trim();
return _Row(
key: ValueKey('super-activity-row-thread:${thread.key}'),
- mark: '↳',
+ mark: AppIcons.reply,
title: text.isEmpty ? 'Thread' : text,
unread: true,
trailing: '${_activity.attention.newCount(thread)} new',
@@ -173,7 +173,7 @@ class _SuperTabActivityViewState extends State<SuperTabActivityView> {
Widget _finished(SuperTabConversation group) => _Row(
key: ValueKey('super-activity-row-done:${group.id}'),
- mark: '✓',
+ mark: AppIcons.check,
title: group.title,
unread: false,
trailing: _when(group.shippedAt!),
@@ -243,13 +243,15 @@ class _Row extends StatefulWidget {
const _Row({
super.key,
this.mark,
+ this.glyph,
required this.title,
required this.unread,
required this.trailing,
required this.onTap,
this.hoverAction,
});
- final String? mark;
+ final IconData? mark;
+ final String? glyph;
final String title;
final bool unread;
final String trailing;
@@ -298,7 +300,16 @@ class _RowState extends State<_Row> {
// Every row has the slot, so every title starts in one column.
SizedBox(
width: 20,
- child: Text(widget.mark ?? '', style: style),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: widget.mark == null
+ ? Text(widget.glyph ?? '', style: style)
+ : Icon(
+ widget.mark,
+ size: AppIcons.inlineSize,
+ color: style.color,
+ ),
+ ),
),
Expanded(
child: Text(
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index a21e54c86..9e967837a 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -1168,8 +1168,18 @@ class SuperTabController extends ChangeNotifier {
List<SuperTabAgent> terminalAgents(String conversationId) {
if (accessRevoked || devicesSelected) return const [];
final id = _terminals[conversationId];
+ if (id == null) return const [];
+ // An agent asked for by name, as its card's Open terminal asks: an older
+ // one a project chat still holds is not among the panes the chat opens.
+ final group = snapshot?.conversation(conversationId);
+ if (id != '*' && group?.agentIds.contains(id) == true) {
+ final panes = snapshot!.paneAgentIds(conversationId);
+ if (!panes.contains(id)) {
+ return snapshot!.agents.where((agent) => agent.id == id).toList();
+ }
+ }
final panes = snapshot?.paneAgentIds(conversationId) ?? const <String>[];
- if (id == null || panes.isEmpty) return const [];
+ if (panes.isEmpty) return const [];
return snapshot!.agents.where((agent) => panes.contains(agent.id)).toList();
}
diff --git a/desktop/lib/super_tabs/leaderboard/reader.dart b/desktop/lib/super_tabs/leaderboard/reader.dart
index aacc0c1a4..f2381f14c 100644
--- a/desktop/lib/super_tabs/leaderboard/reader.dart
+++ b/desktop/lib/super_tabs/leaderboard/reader.dart
@@ -22,6 +22,9 @@ class SuperTabLeaderboardReader extends ChangeNotifier {
SuperTabLeaderboard? board;
String? error;
String? _projectId;
+
+ /// The project this reader asks about; null while none.
+ String? get projectId => _projectId;
int? _week;
String _period = leaderboardDefaultPeriod;
bool _weeksOnly = false;
@@ -180,12 +183,17 @@ class SuperTabProjectBoard extends SuperTabLeaderboardReader {
bool _missed = false;
/// The project whose board this is; null while none is open.
+ @override
String? get projectId => _following;
void _follow() {
- final projectId = controller.snapshot
- ?.projectFor(controller.selectedId)
- ?.id;
+ // A chat of no project (the one Buddy) still has models to show in Manage:
+ // the read needs some project. It sums them all unless Members has been
+ // set to one project, a choice this shared board keeps.
+ final snapshot = controller.snapshot;
+ final projectId =
+ snapshot?.projectFor(controller.selectedId)?.id ??
+ snapshot?.projects.firstOrNull?.id;
if (projectId == _following) return;
_following = projectId;
if (projectId == null) {
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index 67efd514a..264d83180 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -79,6 +79,9 @@ int? _maxAgentSlots(MachineResources? resources) {
int? _suggestedAgentSlots(MachineResources? resources) =>
superTabSuggestedAgentSlots(resources);
+/// Where a machine's row starts in Manage, so its mark sits under the heading.
+const _manageRowStart = 12.0;
+
class SuperTabMachines extends StatefulWidget {
const SuperTabMachines({
super.key,
@@ -906,7 +909,11 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
}
_syncTick();
_redrawMoved();
- if (!c.away && _timer?.isActive != true && !_reading && widget.app?.foreground.value == true && (!kUnderTest || widget.readLocal != null)) {
+ if (!c.away &&
+ _timer?.isActive != true &&
+ !_reading &&
+ widget.app?.foreground.value == true &&
+ (!kUnderTest || widget.readLocal != null)) {
unawaited(_refresh());
}
}
@@ -2390,9 +2397,13 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
: null;
if (widget.manage) {
return LaidOutListView(
- padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.groupGap,
- vertical: grid.AppDesktop.controlGap,
+ // A row's mark starts under Manage's heading, its words end at the
+ // page's edge (Swarm's and Models' 24).
+ padding: const EdgeInsets.fromLTRB(
+ _manageRowStart,
+ grid.AppDesktop.controlGap,
+ grid.AppDesktop.groupGap,
+ grid.AppDesktop.controlGap,
),
children: [
// Only a Swarm that can't be read is news, as under the old heading.
@@ -2419,10 +2430,13 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
const SizedBox(height: 8),
Align(
alignment: Alignment.centerRight,
- child: TextButton(
- key: const ValueKey('super-manage-add-machine'),
- onPressed: add,
- child: const Text('Add machine'),
+ child: Padding(
+ padding: const EdgeInsets.only(right: grid.AppDesktop.controlGap),
+ child: TextButton(
+ key: const ValueKey('super-manage-add-machine'),
+ onPressed: add,
+ child: const Text('Add machine'),
+ ),
),
),
],
diff --git a/desktop/lib/super_tabs/manage_page.dart b/desktop/lib/super_tabs/manage_page.dart
index efc4989f0..24a7d6b0d 100644
--- a/desktop/lib/super_tabs/manage_page.dart
+++ b/desktop/lib/super_tabs/manage_page.dart
@@ -14,6 +14,7 @@ import 'controller.dart';
import 'dialog_scope.dart';
import 'leaderboard/models_section.dart';
import 'leaderboard/reader.dart';
+import 'message_row.dart' show SuperTabMessageRow;
import 'local_models.dart';
import 'machines.dart';
import 'model.dart';
@@ -177,6 +178,9 @@ class _FootAction extends StatelessWidget {
);
}
+/// What a model's row keeps inside its own edges.
+const _modelRowInset = 12.0;
+
class _ManageModels extends StatelessWidget {
const _ManageModels({
required this.controller,
@@ -191,35 +195,37 @@ class _ManageModels extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final projectId = controller.snapshot
- ?.projectFor(controller.selectedId)
- ?.id;
return LaidOutListView(
+ // A model's row has its own 12 inside: its mark starts under the heading.
padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.groupGap,
+ horizontal: SuperTabMessageRow.horizontalInset - _modelRowInset,
vertical: grid.AppDesktop.controlGap,
),
children: [
if (board case final board?)
LeaderboardModelsSection(
board: board,
- projectId: projectId,
+ // Whichever project the board asked about: Models is the Swarm's.
+ projectId: board.projectId,
collapsed: false,
now: now,
heading: false,
),
const SizedBox(height: 8),
- _FootAction(
- label: 'Your models…',
- actionKey: const ValueKey('super-local-models'),
- onPressed: controller.snapshot == null
- ? null
- : () => showSwarmLocalModels(
- context,
- controller,
- app: app,
- now: now,
- ),
+ Padding(
+ padding: const EdgeInsets.only(right: _modelRowInset),
+ child: _FootAction(
+ label: 'Your models…',
+ actionKey: const ValueKey('super-local-models'),
+ onPressed: controller.snapshot == null
+ ? null
+ : () => showSwarmLocalModels(
+ context,
+ controller,
+ app: app,
+ now: now,
+ ),
+ ),
),
],
);
@@ -333,7 +339,7 @@ class _ManageSwarmState extends State<_ManageSwarm> {
final blocked = _leaveBlocked;
return LaidOutListView(
padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.groupGap,
+ horizontal: SuperTabMessageRow.horizontalInset,
vertical: grid.AppDesktop.controlGap,
),
children: [
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index c8cc115aa..57e335eb5 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -112,6 +112,7 @@ class ProjectSidebar extends StatelessWidget {
@visibleForTesting
/// Projects and workgroups share a text column. Only projects use its icon.
static const _iconColumn = SuperTabSectionHeading.actionWidth;
+ static const _rowEnd = 10.0;
Widget _navigationRow({
required String key,
@@ -474,13 +475,19 @@ class ProjectSidebar extends StatelessWidget {
),
),
SizedBox(
- width: _iconColumn,
+ // A project's row keeps no column for a mark it does
+ // not have: its red number ends where Activity's does.
+ width: project != null && trailing == null
+ ? _rowEnd
+ : _iconColumn,
// 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
+ // What waits on the reader is Activity's to say; a
+ // project's row says only what opening it shows.
+ child: waiting && project == null
? Tooltip(
message: 'Needs a human',
child: Text(
diff --git a/desktop/lib/super_tabs/task_line.dart b/desktop/lib/super_tabs/task_line.dart
index 7361706dc..f69fb0c00 100644
--- a/desktop/lib/super_tabs/task_line.dart
+++ b/desktop/lib/super_tabs/task_line.dart
@@ -8,6 +8,7 @@ import '../shared/widgets/app_icon_button.dart';
import '../widgets/desktop_chrome.dart';
import '../widgets/laid_out_list.dart';
import 'controller.dart';
+import 'message_row.dart' show SuperTabMessageRow;
import 'model.dart';
import 'reply_box.dart';
@@ -59,6 +60,25 @@ String _proposalName(String text) {
return lines.first;
}
+/// A line's mark, in the column a message's avatar stands in, so its name starts
+/// where a message's text does.
+class _Gutter extends StatelessWidget {
+ const _Gutter(this.mark);
+ final Widget mark;
+
+ @override
+ Widget build(BuildContext context) => SizedBox(
+ width: SuperTabMessageRow.avatarSize + SuperTabMessageRow.avatarGap,
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: SizedBox(
+ width: SuperTabMessageRow.avatarSize,
+ child: Center(child: mark),
+ ),
+ ),
+ );
+}
+
/// One line that opens: the row both a task's and a proposal's message are.
class _OpeningRow extends StatelessWidget {
const _OpeningRow({required this.child, required this.label, this.onOpen});
@@ -76,7 +96,7 @@ class _OpeningRow extends StatelessWidget {
onTap: onOpen,
child: Padding(
padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.panelPadding,
+ horizontal: SuperTabMessageRow.horizontalInset,
vertical: grid.AppDesktop.menuInset,
),
child: child,
@@ -125,10 +145,12 @@ class SuperTabTaskLine extends StatelessWidget {
onOpen: onOpen,
child: LayoutBuilder(
builder: (context, constraints) {
- final mark = Icon(
- superTabTaskMark(message),
- size: AppIcons.inlineSize,
- color: DesktopChrome.muted,
+ final mark = _Gutter(
+ Icon(
+ superTabTaskMark(message),
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
);
const gap = SizedBox(width: grid.AppDesktop.controlGap);
if (constraints.maxWidth < _narrow && word.isNotEmpty) {
@@ -136,7 +158,6 @@ class SuperTabTaskLine extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
mark,
- gap,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -150,7 +171,6 @@ class SuperTabTaskLine extends StatelessWidget {
return Row(
children: [
mark,
- gap,
Expanded(child: name),
if (word.isNotEmpty) ...[gap, said],
],
@@ -183,12 +203,13 @@ class SuperTabProposalLine extends StatelessWidget {
onOpen: onOpen,
child: Row(
children: [
- Icon(
- AppIcons.chevronRight,
- size: AppIcons.inlineSize,
- color: DesktopChrome.muted,
+ _Gutter(
+ Icon(
+ AppIcons.chevronRight,
+ size: AppIcons.inlineSize,
+ color: DesktopChrome.muted,
+ ),
),
- const SizedBox(width: grid.AppDesktop.controlGap),
Expanded(
child: Text(
text,
@@ -329,19 +350,25 @@ class _SuperTabTaskPanelState extends State<SuperTabTaskPanel> {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- Padding(
+ Container(
+ // As high as the chat's header, so their rules meet.
+ constraints: const BoxConstraints(minHeight: 51),
+ alignment: Alignment.center,
padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.groupGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.controlGap,
+ SuperTabMessageRow.horizontalInset,
+ 0,
grid.AppDesktop.controlGap,
+ 0,
),
child: Row(
children: [
Expanded(
child: Semantics(
header: true,
- child: Text('Thread', style: DesktopChrome.heading()),
+ child: Text(
+ 'Thread',
+ style: DesktopChrome.text(medium: true),
+ ),
),
),
TextButton(
@@ -360,7 +387,12 @@ class _SuperTabTaskPanelState extends State<SuperTabTaskPanel> {
),
Divider(height: 1, thickness: 1, color: DesktopChrome.rim),
Padding(
- padding: const EdgeInsets.all(grid.AppDesktop.groupGap),
+ padding: const EdgeInsets.fromLTRB(
+ SuperTabMessageRow.horizontalInset,
+ grid.AppDesktop.groupGap,
+ SuperTabMessageRow.horizontalInset,
+ grid.AppDesktop.groupGap,
+ ),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -406,26 +438,34 @@ class _SuperTabTaskPanelState extends State<SuperTabTaskPanel> {
),
),
if (c.canWrite && task?.archived == false)
- SuperTabReplyBox(
- controller: c,
- text: _reply,
- focus: _focus,
- files: c.threadAttachments(widget.taskId, widget.taskId),
- enabled: true,
- writable: true,
- busy: _busy,
- error:
- c.composerError(widget.taskId) ??
- c.threadComposerError(widget.taskId, widget.taskId),
- onEdited: (text) => c.setThreadDraft(
- widget.taskId,
- text,
- conversationId: widget.taskId,
+ Padding(
+ padding: const EdgeInsets.fromLTRB(
+ grid.AppDesktop.groupGap,
+ 0,
+ grid.AppDesktop.groupGap,
+ grid.AppDesktop.groupGap,
+ ),
+ child: SuperTabReplyBox(
+ controller: c,
+ text: _reply,
+ focus: _focus,
+ files: c.threadAttachments(widget.taskId, widget.taskId),
+ enabled: true,
+ writable: true,
+ busy: _busy,
+ error:
+ c.composerError(widget.taskId) ??
+ c.threadComposerError(widget.taskId, widget.taskId),
+ onEdited: (text) => c.setThreadDraft(
+ widget.taskId,
+ text,
+ conversationId: widget.taskId,
+ ),
+ onSend: () => unawaited(_send()),
+ surfaceKey: const ValueKey('super-task-reply-surface'),
+ fieldKey: const ValueKey('super-task-reply'),
+ sendKey: const ValueKey('super-task-send'),
),
- onSend: () => unawaited(_send()),
- surfaceKey: const ValueKey('super-task-reply-surface'),
- fieldKey: const ValueKey('super-task-reply'),
- sendKey: const ValueKey('super-task-send'),
),
],
);
diff --git a/desktop/lib/super_tabs/thread_panel.dart b/desktop/lib/super_tabs/thread_panel.dart
index 1766bbb31..e6194034f 100644
--- a/desktop/lib/super_tabs/thread_panel.dart
+++ b/desktop/lib/super_tabs/thread_panel.dart
@@ -13,6 +13,7 @@ import 'composer_tags.dart';
import 'composer_toggle.dart';
import 'reply_box.dart';
import 'controller.dart';
+import 'message_row.dart' show SuperTabMessageRow;
import 'jump_to_latest.dart';
import 'model.dart';
import 'thread_scroll.dart';
@@ -332,19 +333,25 @@ class _SuperTabThreadPanelState extends State<SuperTabThreadPanel> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- Padding(
+ Container(
+ // As high as the chat's header, so their rules meet.
+ constraints: const BoxConstraints(minHeight: 51),
+ alignment: Alignment.center,
padding: const EdgeInsets.fromLTRB(
- grid.AppDesktop.groupGap,
- grid.AppDesktop.controlGap,
- grid.AppDesktop.controlGap,
+ SuperTabMessageRow.horizontalInset,
+ 0,
grid.AppDesktop.controlGap,
+ 0,
),
child: Row(
children: [
Expanded(
child: Semantics(
header: true,
- child: Text('Thread', style: DesktopChrome.heading()),
+ child: Text(
+ 'Thread',
+ style: DesktopChrome.text(medium: true),
+ ),
),
),
AppIconButton(
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 266b57d70..680a18fe0 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -2237,6 +2237,8 @@ class _SuperTabViewState extends State<SuperTabView>
? 'Earlier Buddy chat · ${c.snapshot!.projects.where((p) => p.id == group.projectId).firstOrNull?.name ?? 'a project'}'
: _buddyName(group) == null
? null
+ : group.isSwarmBuddyChat
+ ? 'Buddy'
: c.buddy(group.projectId) == null && group.buddyName == null
? 'Your Buddy'
: '${_buddyName(group)} · Your Buddy';
@@ -2244,7 +2246,7 @@ class _SuperTabViewState extends State<SuperTabView>
if (group != null &&
c.snapshot!.isProjectLead(group.id) &&
!_devicesVisible &&
- !_notificationsVisible) {
+ !_listViewHoldsThePane) {
return _projectMenu(group, name, style);
}
return Text(
@@ -2432,6 +2434,9 @@ class _SuperTabViewState extends State<SuperTabView>
Widget _header(SuperTabConversation? group, bool narrow) {
final isProject =
group != null && c.snapshot?.isProjectLead(group.id) == true;
+ // The one Buddy has one chat, as a project does; it has no pull requests.
+ final oneBuddy = group?.isSwarmBuddyChat == true;
+ final restsOnChat = isProject || oneBuddy;
return Container(
constraints: const BoxConstraints(minHeight: 52),
// A phone's rows line up (Huy, 2026-11-02): the sidebar icon starts at
@@ -2497,7 +2502,7 @@ class _SuperTabViewState extends State<SuperTabView>
if (group != null && !_devicesVisible && !_listViewHoldsThePane) ...[
// A project's chat is where its header rests: the button back
// to it shows only from another view (Quiet Swarm, screen 1).
- if (!isProject || _terminalsVisible || _showPullRequests)
+ if (!restsOnChat || _terminalsVisible || _showPullRequests)
fingerTarget(
enabled: _phone,
AppIconButton(
@@ -2537,7 +2542,7 @@ class _SuperTabViewState extends State<SuperTabView>
),
],
if (!isProject) ...[
- if (!_menuNamesViews) ...[
+ if (!_menuNamesViews && !oneBuddy) ...[
const SizedBox(width: 4),
AppIconButton(
key: const ValueKey('super-pull-requests'),
@@ -2560,16 +2565,20 @@ class _SuperTabViewState extends State<SuperTabView>
],
// The right column opens only from here (Quiet Swarm, Dee,
// 2026-11-02): closed at rest, at every width.
- fingerTarget(
- enabled: _phone,
- AppIconButton(
- key: const ValueKey('super-members-button'),
- icon: AppIcons.users,
- tooltip: 'Members',
- selected: _rosterOpen,
- onPressed: _toggleRoster,
+ if (group != null &&
+ !_listViewHoldsThePane &&
+ !oneBuddy &&
+ !_devicesVisible)
+ fingerTarget(
+ enabled: _phone,
+ AppIconButton(
+ key: const ValueKey('super-members-button'),
+ icon: AppIcons.users,
+ tooltip: 'Members',
+ selected: _rosterOpen,
+ onPressed: _toggleRoster,
+ ),
),
- ),
],
),
);
@@ -4366,12 +4375,15 @@ class _SuperTabViewState extends State<SuperTabView>
children: [
_header(c.selected, narrow),
if (_manageOpen)
- SuperTabManageTabs(
- selected: _devicesVisible
- ? SuperTabManageTab.devices
- : _manageTab,
- devices: _hasDevices,
- onChoose: _chooseManageTab,
+ Align(
+ alignment: Alignment.centerLeft,
+ child: SuperTabManageTabs(
+ selected: _devicesVisible
+ ? SuperTabManageTab.devices
+ : _manageTab,
+ devices: _hasDevices,
+ onChoose: _chooseManageTab,
+ ),
),
Expanded(
child: SuperTabPages(
diff --git a/desktop/test/super_tab_activity_view_test.dart b/desktop/test/super_tab_activity_view_test.dart
index 2052c2d9a..7c8c24e41 100644
--- a/desktop/test/super_tab_activity_view_test.dart
+++ b/desktop/test/super_tab_activity_view_test.dart
@@ -2,6 +2,7 @@ import 'package:clock/clock.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/activity.dart';
import 'package:harness/super_tabs/activity_view.dart';
@@ -124,7 +125,7 @@ void main() {
expect(find.text('Windows credential fix'), findsOneWidget);
expect(find.text('3 new'), findsOneWidget);
expect(find.text('Closed agents leave the list'), findsOneWidget);
- expect(find.text('08:08'), findsOneWidget);
+ expect(find.text('8:08 AM'), findsOneWidget);
});
});
@@ -205,10 +206,10 @@ void main() {
expect(titles, hasLength(1), reason: 'title columns: $titles');
// The mark column starts where the headings do.
final marks = {
- left(find.text('◐').first),
+ left(find.byIcon(AppIcons.circleDot).first),
left(find.text('@')),
- left(find.text('↳')),
- left(find.text('✓').first),
+ left(find.byIcon(AppIcons.reply)),
+ left(find.byIcon(AppIcons.check).first),
};
expect(marks, hasLength(1), reason: 'mark columns: $marks');
for (final heading in ['Needs you', 'New replies', 'Done today']) {
diff --git a/desktop/test/super_tab_manage_page_test.dart b/desktop/test/super_tab_manage_page_test.dart
index 4d5d3ab67..3597b839b 100644
--- a/desktop/test/super_tab_manage_page_test.dart
+++ b/desktop/test/super_tab_manage_page_test.dart
@@ -177,8 +177,9 @@ void main() {
Future<SuperTabController> inView(
WidgetTester tester,
List<String> opened,
- ValueNotifier<bool> terminals,
- ) async {
+ ValueNotifier<bool> terminals, {
+ bool membersOpen = false,
+ }) async {
final server = membersSwarm();
final c = server.controller();
await c.refresh();
@@ -203,6 +204,8 @@ void main() {
),
);
await tester.pumpAndSettle();
+ // Members opens from a chat (Quiet Swarm) and stays open over Manage.
+ if (membersOpen) await openSuperTabMembers(tester);
await tester.tap(find.byKey(const ValueKey('super-manage')));
await tester.pumpAndSettle();
expect(find.byKey(const ValueKey('super-manage-tab-machines')), findsOne);
@@ -234,8 +237,7 @@ void main() {
) async {
final opened = <String>[];
final terminals = ValueNotifier(false);
- final c = await inView(tester, opened, terminals);
- await openSuperTabMembers(tester);
+ final c = await inView(tester, opened, terminals, membersOpen: true);
final agent = c.snapshot!.agents.first;
await tester.tap(find.byKey(ValueKey('super-member-${agent.id}')));
await tester.pumpAndSettle();
diff --git a/desktop/test/super_tab_quiet_polish_test.dart b/desktop/test/super_tab_quiet_polish_test.dart
new file mode 100644
index 000000000..6ce88bbb1
--- /dev/null
+++ b/desktop/test/super_tab_quiet_polish_test.dart
@@ -0,0 +1,371 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_icons.dart';
+import 'package:harness/super_tabs/buddy_rows.dart';
+
+import 'super_tab_activity_lists_test.dart'
+ show finish, swarm, unreadThread, wait;
+import 'super_tab_mentions_test.dart' show showView;
+import 'support/super_tab_fixture.dart';
+
+/// Quiet Swarm's polish pass: what a walk of the screens found drifting from
+/// the design (docs/plans/2026-11-03-quiet-swarm-polish-plan.md).
+
+Finder _key(String key) => find.byKey(ValueKey(key));
+
+Map<String, dynamic> _taskLine(int sequence, String state, String title) => {
+ 'id': 'line-$sequence',
+ 'conversationId': 'lead',
+ 'sequence': sequence,
+ 'text': '$title · $state',
+ 'createdAt': '2026-11-02T09:00:00Z',
+ 'author': {'kind': 'agent', 'id': 'kai', 'name': 'Kai'},
+ 'source': {
+ 'kind': 'task-line',
+ 'taskId': 'offline',
+ 'title': title,
+ 'state': state,
+ },
+};
+
+Map<String, dynamic> _said(int sequence, String text) => {
+ 'id': 'said-$sequence',
+ 'conversationId': 'lead',
+ 'sequence': sequence,
+ 'text': text,
+ 'createdAt': '2026-11-02T09:01:00Z',
+ 'author': {'kind': 'person', 'id': 'owner', 'name': '[email protected]'},
+};
+
+void main() {
+ group('project rows', () {
+ testWidgets('a project waiting on a person shows no question mark; its '
+ 'task still does', (tester) async {
+ final server = swarm();
+ wait(server);
+ await showView(tester, server);
+ expect(find.text('?'), findsNothing);
+ await tester.tap(find.text('web-project').first);
+ await tester.pumpAndSettle();
+ expect(find.text('?'), findsOneWidget);
+ await tester.pump(const Duration(milliseconds: 300));
+ });
+
+ testWidgets("a project's red number ends where Activity's does", (
+ tester,
+ ) async {
+ final server = swarm()..followedThreads = null;
+ server.tag('message-1');
+ await showView(tester, server);
+ final activity = find.descendant(
+ of: _key('super-activity'),
+ matching: find.byType(SuperTabCountBadge),
+ );
+ expect(
+ tester.getTopRight(_key('super-mentions-lead')).dx,
+ tester.getTopRight(activity).dx,
+ );
+ });
+
+ testWidgets('a private project with mentions keeps its number and lock on '
+ 'one line, and its row its height', (tester) async {
+ final server = swarm()..followedThreads = null;
+ (server.state['projects'] as List).first['visibility'] = 'private';
+ server.tag('message-1');
+ await showView(tester, server);
+ final number = tester.getCenter(_key('super-mentions-lead'));
+ final lock = tester.getCenter(find.byIcon(AppIcons.lock).first);
+ expect((number.dy - lock.dy).abs(), lessThan(2));
+ expect(lock.dx, greaterThan(number.dx));
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('Activity and Buddy sit as far apart as project rows', (
+ tester,
+ ) async {
+ final server = swarm();
+ server.state['swarmBuddy'] = true;
+ (server.state['projects'] as List).add(
+ projectFixture('second', 'second-project', 'second'),
+ );
+ (server.state['conversations'] as List).add(
+ conversationFixture('second', 'second-project'),
+ );
+ await showView(tester, server);
+ double y(Finder f) => tester.getCenter(f).dy;
+ final rows =
+ y(find.text('second-project').first) -
+ y(find.text('web-project').first);
+ expect(
+ y(_key('super-swarm-buddy')) - y(_key('super-activity')),
+ rows.abs(),
+ );
+ });
+ });
+
+ group('the header', () {
+ testWidgets("Manage's title is a plain heading, not the project's menu, "
+ 'with no Members', (tester) async {
+ await showView(tester, swarm());
+ expect(_key('super-members-button'), findsOneWidget);
+ await tester.tap(_key('super-manage'));
+ await tester.pumpAndSettle();
+ expect(_key('super-project-menu'), findsNothing);
+ expect(_key('super-members-button'), findsNothing);
+ });
+
+ testWidgets('Activity has no Members', (tester) async {
+ await showView(tester, swarm());
+ await tester.tap(_key('super-activity'));
+ await tester.pumpAndSettle();
+ expect(_key('super-members-button'), findsNothing);
+ });
+
+ testWidgets('the one Buddy is titled Buddy, with only its terminal and '
+ 'options', (tester) async {
+ final server = swarm();
+ server.state['swarmBuddy'] = true;
+ final c = await showView(tester, server);
+ await tester.tap(_key('super-swarm-buddy'));
+ await tester.pumpAndSettle();
+ expect(c.selected?.isSwarmBuddyChat, isTrue);
+ expect(find.text('Your Buddy'), findsNothing);
+ expect(_key('super-chat'), findsNothing);
+ expect(_key('super-pull-requests'), findsNothing);
+ expect(_key('super-members-button'), findsNothing);
+ await tester.pump(const Duration(milliseconds: 300));
+ });
+ });
+
+ group('the chat', () {
+ testWidgets("a task's and a proposal's name start where a message's text "
+ 'does', (tester) async {
+ final server = swarm();
+ server.messages
+ ..add(_said(1, 'A plain message.'))
+ ..add(_taskLine(2, 'working', 'Windows credential fix'))
+ ..add({
+ ..._said(3, 'Goal: Activity read fix'),
+ 'thread': 'said-3',
+ 'source': {'kind': 'buddy-proposal', 'personId': 'owner'},
+ });
+ await showView(tester, server);
+ final text = tester.getTopLeft(find.text('A plain message.')).dx;
+ expect(tester.getTopLeft(find.text('Windows credential fix')).dx, text);
+ expect(tester.getTopLeft(find.textContaining('Proposal from')).dx, text);
+ });
+ });
+
+ group('Activity', () {
+ testWidgets("its marks are the app's icons, as task lines' are", (
+ tester,
+ ) async {
+ final server = swarm();
+ server.followedThreads = {
+ 'unread': [unreadThread('message-1')],
+ 'read': [],
+ 'more': false,
+ };
+ finish(server, DateTime.now());
+ await showView(tester, server);
+ await tester.tap(_key('super-activity'));
+ await tester.pumpAndSettle();
+ for (final glyph in ['↳', '✓', '◐']) {
+ expect(find.text(glyph), findsNothing);
+ }
+ expect(find.byIcon(AppIcons.check), findsOneWidget);
+ expect(find.byIcon(AppIcons.reply), findsOneWidget);
+ });
+
+ testWidgets("today's time reads as the chat's", (tester) async {
+ final server = swarm()..followedThreads = null;
+ final now = DateTime.now();
+ finish(server, DateTime(now.year, now.month, now.day, 20, 8));
+ await showView(tester, server);
+ await tester.tap(_key('super-activity'));
+ await tester.pumpAndSettle();
+ expect(find.text('8:08 PM'), findsOneWidget);
+ });
+
+ testWidgets('a heading sits nearer its rows than the section above', (
+ tester,
+ ) async {
+ final server = swarm();
+ server.followedThreads = {
+ 'unread': [unreadThread('message-1')],
+ 'read': [],
+ 'more': false,
+ };
+ finish(server, DateTime.now());
+ await showView(tester, server);
+ await tester.tap(_key('super-activity'));
+ await tester.pumpAndSettle();
+ double y(String text) => tester.getCenter(find.text(text)).dy;
+ final under = y('Root text') - y('New replies');
+ final over = y('Done today') - y('Root text');
+ expect(under, lessThan(over));
+ });
+ });
+
+ group("a task's pane", () {
+ Future<void> open(WidgetTester tester) async {
+ final server = swarm();
+ server.messages.add(_taskLine(1, 'working', 'Windows credential fix'));
+ await showView(tester, server);
+ await tester.tap(find.text('Windows credential fix').first);
+ await tester.pumpAndSettle();
+ }
+
+ testWidgets("its header's rule meets the chat's", (tester) async {
+ await open(tester);
+ final panel = find.byKey(const ValueKey('super-task-panel-close'));
+ final rule = find.descendant(
+ of: find.ancestor(of: panel, matching: find.byType(Column)).first,
+ matching: find.byType(Divider),
+ );
+ expect(tester.getTopLeft(rule.first).dy, 51);
+ });
+
+ testWidgets('its reply box keeps the margin the chat composer has', (
+ tester,
+ ) async {
+ await open(tester);
+ final box = _key('super-task-reply-surface');
+ final close = tester.getTopRight(_key('super-task-panel-close')).dx;
+ expect(tester.getTopRight(box).dx, lessThan(close));
+ expect(900 - tester.getBottomLeft(box).dy, greaterThanOrEqualTo(16));
+ });
+ });
+
+ group("a thread's pane", () {
+ testWidgets("its header's rule meets the chat's", (tester) async {
+ final server = swarm()..threads = true;
+ server.messages.add(_said(1, 'A plain message.'));
+ final c = await showView(tester, server);
+ c.openThread('said-1');
+ await tester.pumpAndSettle();
+ final close = _key('super-thread-close');
+ final rule = find.descendant(
+ of: find.ancestor(of: close, matching: find.byType(Column)).first,
+ matching: find.byType(Divider),
+ );
+ expect(tester.getTopLeft(rule.first).dy, 51);
+ await tester.pump(const Duration(milliseconds: 300));
+ });
+ });
+
+ group('Manage, Models', () {
+ Map<String, dynamic> board(String project) => {
+ 'projectId': project,
+ 'week': 1,
+ 'period': {'name': '7d', 'start': 1, 'end': 2},
+ 'allProjects': true,
+ 'people': <Object>[],
+ 'waiting': {'total': 0, 'people': <Object>[]},
+ 'byModel': [
+ {
+ 'engine': 'claude',
+ 'model': 'claude-opus-5-5',
+ 'effort': 'high',
+ 'points': 1,
+ 'rank': 1,
+ 'attempts': 1,
+ 'shipped': {'count': 1},
+ 'firstReview': {'reviewed': 1, 'passed': 1},
+ 'reviews': 1,
+ },
+ ],
+ };
+
+ testWidgets('lists its models when the open chat is the one Buddy, which '
+ 'belongs to no project', (tester) async {
+ final server = swarm()
+ ..leaderboard = board('lead')
+ ..followedThreads = null;
+ server.state['swarmBuddy'] = true;
+ final c = await showView(tester, server);
+ await tester.tap(_key('super-swarm-buddy'));
+ await tester.pumpAndSettle();
+ expect(c.selected?.isSwarmBuddyChat, isTrue);
+ await tester.tap(_key('super-manage'));
+ await tester.pumpAndSettle();
+ await tester.tap(_key('super-manage-tab-models'));
+ await tester.pumpAndSettle();
+ expect(find.text('100%'), findsOneWidget);
+ await tester.pump(const Duration(milliseconds: 300));
+ });
+
+ testWidgets("a model's mark starts under Manage's heading", (tester) async {
+ final server = swarm()
+ ..leaderboard = board('lead')
+ ..followedThreads = null;
+ await showView(tester, server);
+ await tester.tap(_key('super-manage'));
+ await tester.pumpAndSettle();
+ await tester.tap(_key('super-manage-tab-models'));
+ await tester.pumpAndSettle();
+ final heading = tester.getTopLeft(find.text('Manage').last).dx;
+ final row = find.byKey(const ValueKey('super-model-Opus 5.5'));
+ // A row keeps 12 inside its own edges.
+ expect(tester.getTopLeft(row).dx + 12, heading);
+ await tester.pump(const Duration(milliseconds: 300));
+ });
+ });
+
+ group('Manage', () {
+ testWidgets('its tabs and Swarm facts start under its heading', (
+ tester,
+ ) async {
+ await showView(tester, swarm());
+ await tester.tap(_key('super-manage'));
+ await tester.pumpAndSettle();
+ final heading = tester.getTopLeft(find.text('Manage').last).dx;
+ expect(tester.getTopLeft(find.text('Machines')).dx, heading);
+ await tester.tap(_key('super-manage-tab-swarm'));
+ await tester.pumpAndSettle();
+ expect(tester.getTopLeft(find.text('Name')).dx, heading);
+ });
+ });
+
+ group('Open terminal', () {
+ test('an older agent held only in a project chat gets its own pane; '
+ "group terminals stay the coordinator's", () async {
+ final server = swarm();
+ server.state['agents'] = [
+ ...(server.state['agents'] as List),
+ {
+ 'id': 'older',
+ 'projectId': 'lead',
+ 'name': 'Builder',
+ 'displayName': 'Older',
+ 'machineId': 'host',
+ 'harnessId': 'older',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ },
+ {
+ 'id': 'pm',
+ 'projectId': 'lead',
+ 'name': 'Lead',
+ 'displayName': 'Pm',
+ 'machineId': 'host',
+ 'harnessId': 'pm',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ },
+ ];
+ final chat = (server.state['conversations'] as List)
+ .cast<Map<String, dynamic>>()
+ .firstWhere((g) => g['id'] == 'lead');
+ chat['agentIds'] = ['pm', 'older'];
+ chat['leadId'] = 'pm';
+ final c = server.controller();
+ addTearDown(c.dispose);
+ await c.refresh();
+ c.selectTerminal('lead', 'older');
+ expect(c.terminalAgents('lead').map((a) => a.id), ['older']);
+ c.selectGroupTerminals('lead');
+ expect(c.terminalAgents('lead').map((a) => a.id), ['pm']);
+ });
+ });
+}
diff --git a/desktop/test/super_tab_roster_navigation_test.dart b/desktop/test/super_tab_roster_navigation_test.dart
index 9b3fb6af1..503dc5089 100644
--- a/desktop/test/super_tab_roster_navigation_test.dart
+++ b/desktop/test/super_tab_roster_navigation_test.dart
@@ -60,7 +60,6 @@ void main() {
final c = await f.app.superTabs.open(tabId);
await c.refresh();
c.select('mobile-lead');
- c.selectDevices();
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
@@ -76,9 +75,12 @@ void main() {
),
);
await tester.pumpAndSettle();
- expect(c.devicesSelected, isTrue);
expect(c.selectedId, 'mobile-lead');
+ // Members opens from a chat (Quiet Swarm) and stays open over Devices.
await openSuperTabMembers(tester);
+ c.selectDevices();
+ await tester.pumpAndSettle();
+ expect(c.devicesSelected, isTrue);
await tester.tap(find.byKey(const ValueKey('super-member-nova')));
await tester.pumpAndSettle();
await tester.tap(find.text('Open terminal'));
diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dart
index 3056088cb..a7541cb97 100644
--- a/desktop/test/swarm_projects_test.dart
+++ b/desktop/test/swarm_projects_test.dart
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_icons.dart';
+import 'package:harness/super_tabs/activity.dart';
import 'package:harness/super_tabs/view.dart';
import 'package:harness/super_tabs/section_heading.dart';
import 'package:harness/super_tabs/controller.dart';
@@ -206,34 +207,40 @@ void main() {
await unmount(tester, c);
});
- testWidgets('a collapsed project keeps its workgroup attention visible', (
- tester,
- ) async {
- final server = projectsServer(), c = server.controller();
- server.state['agents'] = [
- {
- 'id': 'worker',
- 'name': 'Builder',
- 'machineId': 'm',
- 'harnessId': 'native',
- 'contributorId': 'owner',
- 'configuration': {'engine': 'codex'},
- },
- ];
- final group = (server.state['conversations'] as List)[1] as Map;
- group['agentIds'] = ['worker'];
- group['assignment'] = {'status': 'needs_human', 'agentId': 'worker'};
- await mount(tester, c);
- expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
- expect(
- find.descendant(
- of: find.byKey(const ValueKey('super-group-lead')),
- matching: find.byTooltip('Needs a human'),
- ),
- findsOneWidget,
- );
- await unmount(tester, c);
- });
+ // Quiet Swarm polish: a project's row says only what opening it shows, and Activity holds what needs you.
+ testWidgets(
+ 'a collapsed project\'s waiting workgroup is held by Activity, not by a mark on its row',
+ (tester) async {
+ final server = projectsServer(), c = server.controller();
+ server.state['agents'] = [
+ {
+ 'id': 'worker',
+ 'name': 'Builder',
+ 'machineId': 'm',
+ 'harnessId': 'native',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ },
+ ];
+ final group = (server.state['conversations'] as List)[1] as Map;
+ group['agentIds'] = ['worker'];
+ group['assignment'] = {'status': 'needs_human', 'agentId': 'worker'};
+ await mount(tester, c);
+ expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('super-group-lead')),
+ matching: find.byTooltip('Needs a human'),
+ ),
+ findsNothing,
+ );
+ expect(
+ SuperTabActivity.of(c).needsYou.map((need) => need.conversationId),
+ contains('offline'),
+ );
+ await unmount(tester, c);
+ },
+ );
testWidgets(
'the project menu has no update cadence: progress lives in the status card',
diff --git a/desktop/tool/super_tab_members_review.dart b/desktop/tool/super_tab_quiet_review.dart
similarity index 55%
rename from desktop/tool/super_tab_members_review.dart
rename to desktop/tool/super_tab_quiet_review.dart
index 809e65a93..29d6a6774 100644
--- a/desktop/tool/super_tab_members_review.dart
+++ b/desktop/tool/super_tab_quiet_review.dart
@@ -1,15 +1,18 @@
-/// No-login review fixture for Quiet Swarm's Members (screens 4 and 5).
+/// No-login review fixture for every Quiet Swarm screen.
///
/// Build for web with `--dart-define=HARNESS_TEST=true -t
-/// tool/super_tab_members_review.dart` and open with `?theme=dark` (Graphite;
+/// tool/super_tab_quiet_review.dart` and open with `?theme=dark` (Graphite;
/// light Paper is the default). It renders the real [SuperTabView] against an
/// in-memory fake backend on made-up data, read by dee, and never touches a
/// real account or production data.
library;
import 'package:flutter/material.dart';
+import 'package:harness/auth/auth_session.dart';
+import 'package:harness/core/config.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/shared/theme/color_palette.dart';
+import 'package:harness/state/app_state.dart';
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/view.dart';
@@ -34,14 +37,22 @@ Future<void> main() async {
MaterialApp(
debugShowCheckedModeBanner: false,
theme: grid.buildAppTheme(brightness: palette.brightness),
- home: _Review(controller: controller),
+ home: _Review(
+ controller: controller,
+ app: AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ )..status = AppStatus.authenticated,
+ ),
),
);
}
class _Review extends StatefulWidget {
- const _Review({required this.controller});
+ const _Review({required this.controller, required this.app});
final SuperTabController controller;
+ final AppNotifier app;
@override
State<_Review> createState() => _ReviewState();
@@ -62,6 +73,8 @@ class _ReviewState extends State<_Review> {
onAddAgent: (_) {},
onOpenTerminal: (_) {},
onNewProject: () {},
+ onNewSwarm: () {},
+ app: widget.app,
machineName: (machineId) => machineId,
),
);
@@ -70,7 +83,7 @@ class _ReviewState extends State<_Review> {
final _now = DateTime.now();
ConversationServer _seed() {
- final server = ConversationServer();
+ final server = ConversationServer()..threads = true;
server.state
..clear()
..addAll({
@@ -79,6 +92,7 @@ ConversationServer _seed() {
'name': 'autonomous.ai',
'ownerId': 'ken15',
'paused': false,
+ 'swarmBuddy': true,
'people': [
for (final (id, role) in [
('ken15', 'owner'),
@@ -112,6 +126,14 @@ ConversationServer _seed() {
'machines': [
_machine('studio', 'MACs-Mac-Studio', 'ken15'),
_machine('m9', 'MacBooks-MacBook-Pro-9', 'scholes'),
+ {
+ ..._machine('m3', 'Mac 3', 'dee'),
+ 'observation': {
+ 'receivedAt': _now
+ .subtract(const Duration(days: 1))
+ .millisecondsSinceEpoch,
+ },
+ },
],
'invitations': <Object>[],
'projects': [
@@ -124,8 +146,23 @@ ConversationServer _seed() {
'members': <Object>[],
'updateMinutes': 30,
},
+ for (final name in ['computer', 'lamp', 'physical-router', 'spaceship'])
+ {
+ 'id': name,
+ 'name': name,
+ 'ownerId': 'ken15',
+ 'leadConversationId': 'lead-$name',
+ 'visibility': 'public',
+ 'members': <Object>[],
+ 'updateMinutes': 30,
+ },
],
'conversations': [
+ for (final name in ['computer', 'lamp', 'physical-router', 'spaceship'])
+ {
+ ..._conversation('lead-$name', name, lead: 'river', agent: 'river'),
+ 'projectId': name,
+ },
_conversation('lead', 'openharness', lead: 'river', agent: 'river'),
_conversation(
't-nico',
@@ -135,6 +172,28 @@ ConversationServer _seed() {
),
_conversation('t-theo', 'Windows credential fix', agent: 'theo'),
_conversation('t-iris', 'Activity read fix', agent: 'iris'),
+ {
+ ..._conversation(
+ 't-atlas',
+ 'Closed agents leave the list',
+ agent: 'atlas',
+ status: 'done',
+ ),
+ 'shippedAt': _now
+ .subtract(const Duration(minutes: 40))
+ .millisecondsSinceEpoch,
+ },
+ {
+ ..._conversation(
+ 't-sage',
+ 'Commits read Harness by Autonomous',
+ agent: 'sage',
+ status: 'done',
+ ),
+ 'shippedAt': _now
+ .subtract(const Duration(minutes: 20))
+ .millisecondsSinceEpoch,
+ },
],
});
server.revision = 200;
@@ -178,6 +237,25 @@ ConversationServer _seed() {
_score('phamngochuy.1989', 48, 6, 9, 4, 36),
],
'waiting': {'total': 0, 'people': <Object>[]},
+ 'byModel': [
+ for (final (i, model, points) in [
+ (1, 'claude-opus-5-5', 62),
+ (2, 'claude-sonnet-5-5', 21),
+ (3, 'gpt-6.1-sol', 11),
+ (4, 'deepseek-v4.1', 6),
+ ])
+ {
+ 'engine': i == 3 ? 'codex' : 'claude',
+ 'model': model,
+ 'effort': 'high',
+ 'points': points,
+ 'rank': i,
+ 'attempts': points,
+ 'shipped': {'count': points},
+ 'firstReview': {'reviewed': points, 'passed': points},
+ 'reviews': points,
+ },
+ ],
};
var sequence = 1;
void say(String author, String text, Duration ago, {bool agent = false}) =>
@@ -194,18 +272,114 @@ ConversationServer _seed() {
'deliveries': const <Object>[],
'createdAt': _now.subtract(ago).toIso8601String(),
});
+ void line(String task, String title, String state, {String? answerFor}) =>
+ server.messages.add({
+ 'id': 'lead-$sequence',
+ 'conversationId': 'lead',
+ 'sequence': sequence++,
+ 'text': '$title · $state',
+ 'author': {'kind': 'agent', 'id': 'river', 'name': 'River'},
+ 'source': {
+ 'kind': 'task-line',
+ 'taskId': task,
+ 'title': title,
+ 'state': state,
+ 'answerFor': ?answerFor,
+ },
+ 'attachments': const <Object>[],
+ 'deliveries': const <Object>[],
+ 'createdAt': _now
+ .subtract(const Duration(minutes: 50))
+ .toIso8601String(),
+ });
say(
'ken15',
'Prod DB profile: five slow reads to fix.',
const Duration(hours: 2),
);
+ line('t-atlas', 'Closed agents leave the list', 'shipped');
+ line('t-sage', 'Commits read Harness by Autonomous', 'done');
+ line('t-theo', 'Windows credential fix', 'review');
+ line('t-iris', 'Activity read fix', 'working');
+ line('t-plan', 'Phone Activity opens the right message', 'planned');
+ line('t-ready', 'Machines list sorts by owner', 'ready');
+ line('t-nico', 'W1 ships alone or waits?', 'waiting', answerFor: 'dee');
+ server.messages.add({
+ 'id': 'lead-$sequence',
+ 'conversationId': 'lead',
+ 'thread': 'lead-$sequence',
+ 'sequence': sequence++,
+ 'text': 'Buddy proposal\n\nGoal: Activity read fix',
+ 'author': {'kind': 'agent', 'id': 'river', 'name': 'River'},
+ 'source': const {'kind': 'buddy-proposal', 'personId': 'diego'},
+ 'attachments': const <Object>[],
+ 'deliveries': const <Object>[],
+ 'createdAt': _now.subtract(const Duration(minutes: 45)).toIso8601String(),
+ });
say(
'river',
'Three fixes are on main.',
const Duration(minutes: 32),
agent: true,
);
+ final mentioned = sequence - 1;
say('dee', "ok i like a. let's make it perfect.", const Duration(minutes: 1));
+ for (final (who, text) in [
+ ('theo', 'Ready: PR #2605.'),
+ ('river', 'With fixes: one Important.'),
+ ('theo', 'Fixed at 98bcfd21c.'),
+ ]) {
+ server.messages.add({
+ 'id': 't-theo-$sequence',
+ 'conversationId': 't-theo',
+ 'sequence': sequence++,
+ 'text': text,
+ 'author': {'kind': 'agent', 'id': who, 'name': who},
+ 'source': const <String, Object>{},
+ 'attachments': const <Object>[],
+ 'deliveries': const <Object>[],
+ 'createdAt': _now.subtract(const Duration(minutes: 20)).toIso8601String(),
+ });
+ }
+ server.ask(['W1 ships alone or waits?'], projectId: 'oh');
+ server.tag(
+ 'lead-$mentioned',
+ text: 'River mentioned you',
+ createdAt: _now
+ .subtract(const Duration(minutes: 32))
+ .toUtc()
+ .toIso8601String(),
+ messageSequence: mentioned,
+ );
+ server.mentions.last['projectId'] = 'oh';
+ server.mentions.last['projectName'] = 'openharness';
+ server.followedThreads = {
+ 'unread': [
+ for (final (root, text, count) in [
+ ('t-theo', 'Windows credential fix', 3),
+ ('t-iris', 'Prod DB profile', 1),
+ ])
+ {
+ 'conversationId': root,
+ 'rootId': root,
+ 'root': {
+ 'id': root,
+ 'sequence': 1,
+ 'author': {'kind': 'agent', 'id': 'river', 'name': 'River'},
+ 'text': text,
+ 'createdAt': _now.toUtc().toIso8601String(),
+ 'attachments': 0,
+ },
+ 'lastReplyAt': _now.toUtc().toIso8601String(),
+ 'lastReplySequence': 2,
+ 'lastReplier': {'kind': 'agent', 'id': 'river', 'name': 'River'},
+ 'unreadReplies': count,
+ 'follow': null,
+ },
+ ],
+ 'read': <Object>[],
+ 'more': false,
+ };
return server;
}
@@ -261,7 +435,11 @@ Map<String, dynamic> _conversation(
// Held: its own last post vouches for it until then.
'leaseUntil': _now.add(const Duration(hours: 2)).millisecondsSinceEpoch,
},
- 'lastMessageSequence': id == 'lead' ? 3 : 0,
+ 'lastMessageSequence': switch (id) {
+ 'lead' => 11,
+ 't-theo' => 14,
+ _ => 0,
+ },
};
Map<String, dynamic> _score(
diff --git a/docs/plans/2026-11-03-phone-invitations-in-a-swarm-plan.md b/docs/plans/2026-11-03-phone-invitations-in-a-swarm-plan.md
new file mode 100644
index 000000000..32276cb4f
--- /dev/null
+++ b/docs/plans/2026-11-03-phone-invitations-in-a-swarm-plan.md
@@ -0,0 +1,82 @@
+# Phone: invitations when already in a Swarm Implementation Plan
+
+> Worked by the project instructions (Engineer, revision 27): each plan task commits its failing test, then its code.
+
+**Goal:** A person already in a Swarm sees a new invitation on the phone and can join it.
+
+**Architecture:** `SwarmInbox` reads invitations in any Swarm state, at a slower pace when the person has a Swarm. Home lists them above the projects, using the start screen's existing join and Not now.
+
+**Tech Stack:** Flutter, widget tests over `FakeSwarm`.
+
+**Spec:** Tony's mobile list, task 24.
+
+## Sketch: Swarm Home, in a Swarm, with one invitation (approved for Tony by the Lead: one line each, gone when there are none)
+
+```
+┌──────────────────────────────────────┐
+│ ▣ Phone Swarm ▾ ≡ ✓✓ │
+│ │
+│ Invitations │
+│ ╭──────────────────────────────────╮ │
+│ │ Design Team Not now Join │ │
+│ ╰──────────────────────────────────╯ │
+│ │
+│ Pinned │
+│ ╭──────────────────────────────────╮ │
+│ │ # openharness │ │
+│ ╰──────────────────────────────────╯ │
+│ Projects │
+│ ╭──────────────────────────────────╮ │
+│ │ # lamp │ │
+│ ╰──────────────────────────────────╯ │
+└──────────────────────────────────────┘
+```
+
+Joining: Join reads `Joining…`; a refusal shows its words in red under the row; the new Swarm then appears in the list. No invitation: no heading. It shows under every filter and whichever Swarm the switcher picked, as an invitation belongs to the account, not to a Swarm.
+
+## Decline
+
+Neither the backend nor Desktop has a decline (`invite.accept` and `invite.revoke` only), and this task is phone-only. So the phone keeps the start screen's **Not now**: it hides the invitation for this session and leaves it on the server.
+
+## Design
+
+- growth: N/A because nothing new is stored.
+- concurrency: N/A because this only reads; join keeps its one receipt per invitation.
+- read cost: with a Swarm, one read of the list on opening, then at most every 5 minutes, or on pull to refresh. With no Swarm, every poll, as today.
+- scale: one read per open phone per 5 minutes, a twentieth of Home's 15 s poll; the read is indexed by email and capped at 100 Swarms. 10x phones stays small; the metric that warns first is `GET /api/super-tabs/invitations` per minute.
+- compatibility: an older server answers 404, which reads as none, as today.
+- migration + rollback: N/A because nothing is stored.
+- audience: the server lists only the account's own invitations.
+- identity: N/A because it reads as the signed-in account.
+- failure: with a Swarm, a failed read keeps what was shown and says nothing, since Home has work to show; it is logged and read again at the next pace. With no Swarm, as today.
+- platforms: phone only.
+
+## Global Constraints
+
+- PR body starts: Requested by [email protected] through Harness.
+- Mobile only, based on main. Existing Swarm screens and design tokens; no new colors or icons. No on/off switch.
+- Never install builds on anyone's phone. Phone tests use fakes, never a real sign-out.
+
+## Review Focus
+
+- An invitation to a Swarm the person is already in after joining: the row goes once the next read lands.
+- Not now, then pull to refresh: it stays hidden this session.
+- A failed read while in a Swarm: Home unchanged, no "Couldn't check invitations".
+- The last Swarm left: the start screen still shows invitations as before.
+- Home's cached first paint: no invitation row until read.
+
+---
+
+### Task 1: The inbox reads invitations in a Swarm
+
+**Files:** Modify `mobile/lib/swarm/swarm_inbox.dart`. Test `mobile/test/swarm/swarm_invitations_in_swarm_test.dart`.
+
+- [ ] Failing tests: read with a Swarm; at most every 5 minutes; a failure keeps the list and raises nothing; no Swarm reads each poll.
+- [ ] Implement, commit test first, then code.
+
+### Task 2: Home lists them
+
+**Files:** Modify `mobile/lib/swarm/swarm_page.dart`. Test as above.
+
+- [ ] Failing widget test: a person in a Swarm sees the invitation, joins it, and the new Swarm is listed; Not now hides it.
+- [ ] Implement, commit test first, then code. Screenshots in the PR.
diff --git a/docs/plans/2026-11-03-phone-older-from-home-plan.md b/docs/plans/2026-11-03-phone-older-from-home-plan.md
new file mode 100644
index 000000000..ad3168729
--- /dev/null
+++ b/docs/plans/2026-11-03-phone-older-from-home-plan.md
@@ -0,0 +1,75 @@
+# Phone: Reopen an Archived Chat from Older — Implementation Plan
+
+> **For agentic workers:** Follow this plan task by task in the current Harness session. Steps use checkbox syntax for tracking.
+
+**Goal:** From Swarm Home C, a person can open a project's Older list and reopen an archived chat.
+
+**Architecture:** Add a Work destination to the existing Home C project menu. It opens the existing project sheet on Work, whose Older list and conversation rows already provide the rest of the flow. A widget test exercises the route from Home through the reopened chat.
+
+**Tech Stack:** Flutter, Dart, existing Swarm widgets and widget tests.
+
+**Spec:** Task #2257, “Phone: reopen an archived chat from Older,” in the Swarm conversation.
+
+## ASCII screen sketch
+
+```text
+Home C: #Mobile [⋮]
+ ├ Status
+ ├ Leaderboard
+ ├ Work ←
+ └ Team
+
+Mobile [×]
+ [Work] [Team]
+ Working on
+ ...
+ Older
+ #23 Old chat
+```
+
+## Design
+
+- Growth: N/A because no new data is stored; existing chat archives remain on the server.
+- Concurrency: N/A because the change adds navigation only; the existing server command remains authoritative.
+- Read cost: Use the existing on-demand Older read when the sheet opens.
+- Scale: N/A because this introduces no collection or new query; the existing paged Older list is retained.
+- Compatibility: Old and new clients keep the same data and archive commands; only the new client adds a menu route.
+- Migration + rollback: N/A because there is no stored schema; removing the menu entry rolls back the change.
+- Audience: The existing server enforces access to the project and archived chat.
+- Identity: N/A because no identity field or authorization rule changes.
+- Failure: Keep the existing Older loading and error states, and existing chat reopen refusal feedback.
+- Platforms: Mobile app only (`mobile/`); no build is installed on a phone.
+
+## Global Constraints
+
+- Mobile only (`mobile/`), based on `main`.
+- Use existing Swarm screens and design tokens; add no colors, icons, packages, or switches.
+- Phone tests use fakes and never sign out a real account.
+- Never install a build on anyone's phone.
+- The pull request body starts with: `Requested by [email protected] through Harness.`
+
+## Review Focus
+
+- Work must be reachable from the project menu on Home C, the route that currently hides it.
+- Older must load on demand and expose an archived chat.
+- Reopening must use the existing chat command and return the chat to active work.
+
+---
+
+### Task 1: Expose Older from Home C
+
+**Files:**
+- Modify: `mobile/lib/swarm/swarm_project_page.dart`
+- Test: `mobile/test/swarm/swarm_home_test.dart`
+
+**Interfaces:**
+- Consumes: `SwarmProjectSheet(swarmId, projectId)` and its existing Work/Older/chat behavior.
+- Produces: A `Work` entry in Home C's project menu that opens `SwarmProjectSheet` with the Work part selected.
+
+- [ ] **Step 1: Write the failing Home-to-reopen widget test.** Seed an archived project conversation; open the project from Home, open its menu, choose Work, open Older, select the archived chat, and invoke its existing Reopen action. Assert the reopen command names that conversation with `archived: false`.
+- [ ] **Step 2: Run the test against `main`.** Run `flutter test test/swarm/swarm_home_test.dart --plain-name 'Home opens Older and reopens an archived chat'`; expect it to fail because the Home C menu has no Work entry.
+- [ ] **Step 3: Add Work to the Home C project menu.** Wire it to the existing project Work sheet, which loads Older as before.
+- [ ] **Step 4: Run the focused widget test.** Expect the complete path and reopen command assertion to pass.
+- [ ] **Step 5: Run the Swarm widget tests and capture the requested Home C and Older screenshots for the PR.**
+- [ ] **Step 6: Commit the implementation after the failing-test commit.**
+
diff --git a/docs/plans/2026-11-03-quiet-swarm-polish-plan.md b/docs/plans/2026-11-03-quiet-swarm-polish-plan.md
new file mode 100644
index 000000000..e50ad094f
--- /dev/null
+++ b/docs/plans/2026-11-03-quiet-swarm-polish-plan.md
@@ -0,0 +1,82 @@
+# Quiet Swarm polish pass Implementation Plan
+
+> Worked by the project instructions (Engineer, revision 27): each plan task commits its failing test, then its code. No subagents; one Review on the pull request.
+
+**Goal:** Every Quiet Swarm screen matches its design, with before/after browser screenshots for Dee's morning look.
+
+**Architecture:** Small fixes in `desktop/lib/super_tabs`, found by walking a no-login browser build (`desktop/tool/super_tab_quiet_review.dart`) on made-up data. No new colors, icons or controls.
+
+**Tech Stack:** Flutter, widget tests with a memory store and a fake sign-in, a headless browser for pictures.
+
+**Spec:** `docs/plans/2026-11-02-quiet-swarm-design.md`, `desktop/design/desktop-design-system.md`.
+
+## Global Constraints
+
+- PR body starts: Requested by [email protected] through Harness.
+- No new colors, icons or controls; fewer words; nothing removed without a home.
+- Desktop tests use a memory store and a fake sign-in; never a test that signs this Mac out of the real CLI.
+- Swarm code stays out of `cli/src/core`. Owns `desktop/lib/super_tabs` and its tests only.
+
+## Review Focus
+
+- Older agent in a project chat with no coordinator: Open terminal shows that agent, and group terminals still show the coordinator alone.
+- A project row that is both private and mentioned: the number and lock still fit on one line.
+- A long task name beside its word, wide and narrow.
+- Activity at midnight and across days: a row's time reads as the chat's does.
+- Members open when moving to Activity, Manage or Buddy: it can still close.
+
+---
+
+### Task 1: Project rows say one thing
+
+**Files:** Modify `project_sidebar.dart`. Test `desktop/test/super_tab_quiet_polish_test.dart` (new).
+
+- [ ] Failing tests: a project waiting on a person shows no `?` (Activity holds it); a task's row keeps it; a project's red number ends where Activity's does.
+- [ ] Implement, tests pass, commit test first, then code.
+
+### Task 2: The header has only what its screen needs
+
+**Files:** Modify `view.dart`.
+
+- [ ] Failing tests: Manage's title is plain text, not the project menu; no Members button on Activity, Manage or the one Buddy; the one Buddy's title reads Buddy and its header has no Chat or Pull requests.
+- [ ] Implement, commit test first, then code.
+
+### Task 3: A task's name lines up with messages
+
+**Files:** Modify `task_line.dart`.
+
+- [ ] Failing test: a task line's name starts where a message's text does; a proposal's too.
+- [ ] Implement with the avatar column's width for the mark. Commit test first, then code.
+
+### Task 4: Activity reads like the chat
+
+**Files:** Modify `activity_view.dart`.
+
+- [ ] Failing tests: marks are the app's icons, as task lines' are; today's time reads as the chat's (8:09 PM); a heading sits nearer its rows than the section above; hovering a thread shows Unfollow, and pressing it unfollows.
+- [ ] Implement, commit test first, then code.
+
+### Task 5: A thread's pane lines up with the chat
+
+**Files:** Modify `thread_panel.dart`, `task_line.dart`.
+
+- [ ] Failing tests: the header's rule meets the chat's; its reply box has the composer's margin.
+- [ ] Implement, commit test first, then code.
+
+### Task 6: Manage starts where its heading does
+
+**Files:** Modify `manage_page.dart`, `view.dart` if the page's column centres the tabs.
+
+- [ ] Failing tests: tabs start under the heading; Swarm's facts and foot actions share one left and right edge with the Machines rows.
+- [ ] Implement, commit test first, then code.
+
+### Task 7: Open terminal opens that agent
+
+**Files:** Modify `controller.dart`.
+
+- [ ] Failing test: an older agent held only in a project chat gets its own pane from `selectTerminal`; group terminals stay the coordinator's.
+- [ ] Implement, commit test first, then code.
+
+### Task 8: Pictures and suites
+
+- [ ] Screens in light from the browser build, before and after, in the PR. Web top bar checked from `tool/web_ux_fixture.dart`.
+- [ ] `flutter test test/super_tab_*_test.dart`, `check-ui-style`, `laid_out_list_test`; list what is left and why.
diff --git a/mobile/lib/swarm/swarm_home_rows.dart b/mobile/lib/swarm/swarm_home_rows.dart
index 036215940..1de84ed6d 100644
--- a/mobile/lib/swarm/swarm_home_rows.dart
+++ b/mobile/lib/swarm/swarm_home_rows.dart
@@ -3,6 +3,8 @@ import 'package:flutter/services.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import 'package:harness_mobile/phone/fzf.dart' show fzfAge;
+import 'package:harness_mobile/phone/tty.dart';
+import 'package:harness_mobile/phone/tty_controls.dart';
import 'package:harness_mobile/shared/theme/app_space.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/theme/app_type.dart';
@@ -99,6 +101,50 @@ String swarmNeedAsk(SwarmNeed need) => switch (need) {
SwarmWorkNeed(:final work) => work.question ?? work.conversation.label,
};
+/// An invitation to a Swarm on Home (Tony's mobile list, task 24), one line: the
+/// Swarm's name, Not now and Join. The account's, so it shows whichever Swarm
+/// or filter Home is on.
+class SwarmInvitationRow extends StatelessWidget {
+ const SwarmInvitationRow({
+ super.key,
+ required this.invitation,
+ required this.joining,
+ required this.onJoin,
+ required this.onLater,
+ });
+
+ final SwarmInvitation invitation;
+ final bool joining;
+ final VoidCallback onJoin, onLater;
+
+ @override
+ Widget build(BuildContext context) {
+ final tty = Tty.of(context);
+ return SwarmRow(
+ title: invitation.name.trim(),
+ chevron: null,
+ onTap: null,
+ trailing: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ TtyTextButton(
+ key: ValueKey('swarm-invitation-later-${invitation.inviteId}'),
+ label: 'Not now',
+ color: tty.dim,
+ onPressed: joining ? null : onLater,
+ ),
+ const SizedBox(width: AppSpace.s),
+ TtyTextButton(
+ key: ValueKey('swarm-invitation-join-${invitation.inviteId}'),
+ label: joining ? 'Joining…' : 'Join',
+ onPressed: joining ? null : onJoin,
+ ),
+ ],
+ ),
+ );
+ }
+}
+
/// One project on Home, as C1 draws it: a dot in the colour of how its team
/// is ([swarmProjectColor]), its name as a channel's ("#openharness") — bold
/// and bright with something new in it, quiet otherwise — how many people read
diff --git a/mobile/lib/swarm/swarm_inbox.dart b/mobile/lib/swarm/swarm_inbox.dart
index 473c4af08..095ac463a 100644
--- a/mobile/lib/swarm/swarm_inbox.dart
+++ b/mobile/lib/swarm/swarm_inbox.dart
@@ -94,10 +94,12 @@ class SwarmInbox extends ChangeNotifier {
required this.request,
this.upload = refuseSwarmUpload,
this.pollInterval = const Duration(seconds: 15),
+ DateTime Function()? now,
SwarmHomeCache? homeCache,
Duration homeWait = const Duration(seconds: 30),
this.readMarks,
- }) : _home = homeCache == null
+ }) : _now = now ?? DateTime.now,
+ _home = homeCache == null
? null
: SwarmHomeKeeper(homeCache, accountId, wait: homeWait) {
if (_home != null) unawaited(_restore());
@@ -155,9 +157,17 @@ class SwarmInbox extends ChangeNotifier {
/// True once the list has been read.
bool loaded = false;
- /// Invitations waiting for the person, read only while they have no Swarm.
+ /// Invitations waiting for the person: read at every read of the list while
+ /// they have no Swarm, and at most every [_invitationsEvery] while they have
+ /// one, since the list is read every few seconds on every open phone.
List<SwarmInvitation> invitations = const [];
+ static const _invitationsEvery = Duration(minutes: 5);
+ final DateTime Function() _now;
+
+ /// When the invitations were last asked for; null when they are due now.
+ DateTime? _invitationsAt;
+
/// The last read of the invitations failed, while there is no Swarm: not "no invitation".
/// Those read before stay meanwhile.
bool invitationsFailed = false;
@@ -200,7 +210,12 @@ class SwarmInbox extends ChangeNotifier {
joining.remove(invitation.inviteId);
if (!_disposed) notifyListeners();
}
- await refresh();
+ // Gone at once, and not brought back by a read already under way.
+ _putOff.add(invitation.inviteId);
+ invitations = List.unmodifiable(
+ invitations.where((other) => other.inviteId != invitation.inviteId),
+ );
+ await refreshAll();
return true;
}
@@ -346,6 +361,19 @@ class SwarmInbox extends ChangeNotifier {
return _refreshing ??= _read().whenComplete(() => _refreshing = null);
}
+ /// One read now with the invitations in it: a pull, or a join just made. Runs
+ /// after a read already under way, which may have passed them by.
+ Future<void> refreshAll() async {
+ if (_refreshing case final reading?) await reading;
+ _invitationsAt = null;
+ await refresh();
+ }
+
+ bool get _invitationsDue {
+ final at = _invitationsAt;
+ return at == null || _now().difference(at) >= _invitationsEvery;
+ }
+
/// What a screen draws of the inbox itself: a read that leaves it as it
/// was tells nobody.
Object get _face =>
@@ -356,13 +384,20 @@ class SwarmInbox extends ChangeNotifier {
_polling = true;
try {
final (:listed, :changedAt) = await _list();
- List<SwarmInvitation>? invited = const [];
+ List<SwarmInvitation>? invited;
Object? unread;
- if (listed.isEmpty) {
+ if (listed.isEmpty || _invitationsDue) {
+ _invitationsAt = _now();
try {
invited = await _invitations();
} catch (failure) {
- (invited, unread) = (null, failure);
+ // With a Swarm, Home has work to show: it stays as it is, and the
+ // read comes round again.
+ if (listed.isEmpty) {
+ unread = failure;
+ } else {
+ appLog.warn('swarm', 'Invitations not read', error: failure);
+ }
}
}
if (_disposed) return;
diff --git a/mobile/lib/swarm/swarm_page.dart b/mobile/lib/swarm/swarm_page.dart
index 784b9f7fe..f87e38817 100644
--- a/mobile/lib/swarm/swarm_page.dart
+++ b/mobile/lib/swarm/swarm_page.dart
@@ -8,6 +8,7 @@ import 'package:harness_mobile/phone/out_of_sight.dart';
import 'package:harness_mobile/phone/phone_navigation.dart';
import 'package:harness_mobile/phone/phone_shell_scope.dart';
import 'package:harness_mobile/phone/tty.dart';
+import 'package:harness_mobile/phone/tty_controls.dart';
import 'package:harness_mobile/shared/theme/app_space.dart';
import 'package:harness_mobile/shared/theme/app_theme.dart';
import 'package:harness_mobile/shared/theme/app_type.dart';
@@ -219,7 +220,7 @@ class _SwarmPageState extends State<SwarmPage> {
appLog.warn('swarm', 'Computers not looked for', error: failure);
}
}
- await inbox.refresh();
+ await inbox.refreshAll();
}
/// Whether Home offers New message: a Swarm to post in may be there, or
@@ -654,9 +655,35 @@ class _SwarmPageState extends State<SwarmPage> {
onTap: () => unawaited(_newProject(session, shown)),
)
: null;
+ final invited = inbox.invitations;
return [
+ if (invited.isNotEmpty) ...[
+ SwarmCaption('Invitations', first: first),
+ SwarmGroup(
+ children: [
+ for (final invitation in invited)
+ SwarmInvitationRow(
+ key: ValueKey('swarm-invitation-${invitation.inviteId}'),
+ invitation: invitation,
+ joining: inbox.joining.contains(invitation.inviteId),
+ onJoin: () => unawaited(inbox.join(invitation)),
+ onLater: () => inbox.notNow(invitation),
+ ),
+ ],
+ ),
+ if (inbox.joinError case final error?)
+ Padding(
+ key: const ValueKey('swarm-invitation-error'),
+ padding: const EdgeInsets.only(top: AppSpace.s),
+ child: Text(
+ error,
+ style: Tty.of(context)
+ .style(color: Tty.of(context).red, size: TtySize.meta),
+ ),
+ ),
+ ],
if (lists.pinned.isNotEmpty) ...[
- SwarmCaption('Pinned', first: first),
+ SwarmCaption('Pinned', first: first && invited.isEmpty),
SwarmGroup(children: [for (final p in lists.pinned) row(p)]),
],
if (lists.recent.isNotEmpty ||
@@ -665,7 +692,10 @@ class _SwarmPageState extends State<SwarmPage> {
nothingListed ||
mentionsFailed ||
create != null) ...[
- SwarmCaption('Projects', first: first && lists.pinned.isEmpty),
+ SwarmCaption(
+ 'Projects',
+ first: first && invited.isEmpty && lists.pinned.isEmpty,
+ ),
SwarmGroup(
children: [
if (empty) const SwarmRow(title: 'No project yet', onTap: null),
@@ -703,7 +733,10 @@ class _SwarmPageState extends State<SwarmPage> {
],
),
] else if (reading.isNotEmpty || failed.isNotEmpty)
- SwarmCaption('Projects', first: first && lists.pinned.isEmpty),
+ SwarmCaption(
+ 'Projects',
+ first: first && invited.isEmpty && lists.pinned.isEmpty,
+ ),
// A Swarm still to be read has its skeleton below: one is enough.
if (mentionsComing && reading.isEmpty) ...[
const SizedBox(height: 8),
diff --git a/mobile/lib/swarm/swarm_project_page.dart b/mobile/lib/swarm/swarm_project_page.dart
index c765a5fb8..f9f3c97fe 100644
--- a/mobile/lib/swarm/swarm_project_page.dart
+++ b/mobile/lib/swarm/swarm_project_page.dart
@@ -453,6 +453,14 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {
),
);
+ void _openWork() => unawaited(
+ showSwarmProjectSheet(
+ context,
+ swarmId: widget.swarmId,
+ projectId: widget.projectId,
+ ),
+ );
+
void _open(String conversationId) =>
openSwarmConversation(context, widget.swarmId, conversationId);
@@ -567,6 +575,7 @@ class _SwarmProjectPageState extends State<SwarmProjectPage> {
projectId: project.id,
onStatus: _openStatusSheet,
onLeaderboard: _openLeaderboardSheet,
+ onWork: _openWork,
onTeam: _openTeamSheet,
onNotifications:
snapshot.conversation(project.leadConversationId) == null
@@ -806,13 +815,14 @@ class _ProjectMenu extends StatelessWidget {
required this.projectId,
required this.onStatus,
required this.onLeaderboard,
+ required this.onWork,
required this.onTeam,
this.onNotifications,
});
final SwarmReader reader;
final String projectId;
- final VoidCallback onStatus, onLeaderboard, onTeam;
+ final VoidCallback onStatus, onLeaderboard, onWork, onTeam;
final VoidCallback? onNotifications;
@override
@@ -859,27 +869,41 @@ class _ProjectMenu extends StatelessWidget {
computers: computers,
)
: null;
- return MenuAnchor(
- alignmentOffset: const Offset(0, AppSpace.xs),
- menuChildren: [
- if (terminal != null)
- row(
- 'swarm-project-menu-terminal',
- terminal.label,
- terminal.enabled ? terminal.onTap : null,
- value: terminal.value,
- ),
- row('swarm-project-menu-status', 'Status', onStatus),
- row('swarm-project-menu-leaderboard', 'Leaderboard', onLeaderboard),
- row('swarm-project-menu-team', 'Team', onTeam),
- if (onNotifications case final onTap?)
- row('swarm-project-menu-notifications', 'Notifications', onTap),
- ],
- builder: (context, menu, _) => SwarmIconButton(
- key: const ValueKey('swarm-project-menu'),
- icon: LucideIcons.ellipsisVertical300,
- label: 'Menu',
- onPressed: () => menu.isOpen ? menu.close() : menu.open(),
+ return MenuTheme(
+ data: MenuThemeData(
+ submenuIcon: MenuTheme.of(context).submenuIcon,
+ // Home C sits near the top of the phone. Six rows at their 48-point
+ // layout height, panel padding, and a small edge fit without scrolling.
+ style: AppMenu.style(
+ maxHeight:
+ 6 * (minTouchTarget + AppSpace.xs) +
+ AppMenu.panelPadding.vertical +
+ AppSpace.xs,
+ ),
+ ),
+ child: MenuAnchor(
+ alignmentOffset: const Offset(0, AppSpace.xs),
+ menuChildren: [
+ if (terminal != null)
+ row(
+ 'swarm-project-menu-terminal',
+ terminal.label,
+ terminal.enabled ? terminal.onTap : null,
+ value: terminal.value,
+ ),
+ row('swarm-project-menu-status', 'Status', onStatus),
+ row('swarm-project-menu-leaderboard', 'Leaderboard', onLeaderboard),
+ row('swarm-project-menu-work', 'Work', onWork),
+ row('swarm-project-menu-team', 'Team', onTeam),
+ if (onNotifications case final onTap?)
+ row('swarm-project-menu-notifications', 'Notifications', onTap),
+ ],
+ builder: (context, menu, _) => SwarmIconButton(
+ key: const ValueKey('swarm-project-menu'),
+ icon: LucideIcons.ellipsisVertical300,
+ label: 'Menu',
+ onPressed: () => menu.isOpen ? menu.close() : menu.open(),
+ ),
),
);
}
diff --git a/mobile/test/swarm/swarm_chat_menu_test.dart b/mobile/test/swarm/swarm_chat_menu_test.dart
index ec74bb0fe..640f45d6c 100644
--- a/mobile/test/swarm/swarm_chat_menu_test.dart
+++ b/mobile/test/swarm/swarm_chat_menu_test.dart
@@ -226,6 +226,10 @@ void main() {
'chat; Muted is kept, and access lost closes the sheet', (
tester,
) async {
+ addTearDown(tester.view.reset);
+ tester.view
+ ..physicalSize = const Size(1170, 2532)
+ ..devicePixelRatio = 3;
final fake = backend();
final host = await pump(
tester,
@@ -239,7 +243,18 @@ void main() {
await tester.tap(key('swarm-project-menu'));
await tester.pumpAndSettle();
- await tester.tap(key('swarm-project-menu-notifications'));
+ expect(key('swarm-project-menu-terminal'), findsOneWidget);
+ final notifications = key('swarm-project-menu-notifications');
+ final notificationsRect = tester.getRect(notifications);
+ final menuPanel = find
+ .ancestor(of: notifications, matching: find.byType(Material))
+ .first;
+ final menuRect = tester.getRect(menuPanel);
+ expect(notificationsRect.left, greaterThanOrEqualTo(menuRect.left));
+ expect(notificationsRect.top, greaterThanOrEqualTo(menuRect.top));
+ expect(notificationsRect.right, lessThanOrEqualTo(menuRect.right));
+ expect(notificationsRect.bottom, lessThanOrEqualTo(menuRect.bottom));
+ await tester.tap(notifications);
await tester.pumpAndSettle();
expect(ticked(tester), 'Mentions only');
await tester.tap(find.text('Muted'));
diff --git a/mobile/test/swarm/swarm_home_test.dart b/mobile/test/swarm/swarm_home_test.dart
index 00258ea93..33319d806 100644
--- a/mobile/test/swarm/swarm_home_test.dart
+++ b/mobile/test/swarm/swarm_home_test.dart
@@ -1343,6 +1343,77 @@ void main() {
expectHomeCProject('Web');
});
+ testWidgets('Home opens Older and reopens an archived chat', (
+ tester,
+ ) async {
+ final fake = backend();
+ var archived = true;
+ Map<String, dynamic> oldChat() => {
+ ...groupData('g-archived', title: 'Old chat', number: 23),
+ 'archived': archived,
+ 'dormant': archived,
+ };
+ fake.routes['/api/super-tabs/$tab/groups?dormant=1&projectId=$project'] =
+ (_) => {
+ 'groups': [part('g-archived', 2, oldChat())],
+ 'next': null,
+ };
+ fake.routes['/api/super-tabs/$tab/changes'] = (_) => changes(
+ cursor: 'c3',
+ groups: archived ? [] : [part('g-archived', 3, oldChat())],
+ );
+ fake.routes['/api/super-tabs/$tab/commands'] = (body) {
+ final command = body?['command'] as Map<String, dynamic>;
+ if (command['type'] == 'conversation.archive') {
+ archived = command['archived'] as bool;
+ }
+ return {'result': <String, dynamic>{}};
+ };
+ final host = await pump(tester, fake);
+
+ await tester.tap(key('swarm-project-$tab-$project'));
+ await tester.pumpAndSettle();
+ await tester.tap(key('swarm-project-menu'));
+ await tester.pumpAndSettle();
+ await tester.tap(key('swarm-project-menu-work'));
+ await tester.pumpAndSettle();
+ expect(find.byType(SwarmProjectSheet), findsOneWidget);
+
+ await tester.ensureVisible(key('swarm-older'));
+ await tester.tap(key('swarm-older'));
+ await tester.pumpAndSettle();
+ expect(key('swarm-conversation-g-archived'), findsOneWidget);
+
+ await tester.ensureVisible(key('swarm-conversation-g-archived'));
+ await tester.tap(key('swarm-conversation-g-archived'));
+ await tester.pumpAndSettle();
+ expect(
+ (tester.widget<SwarmConversationPage>(
+ find.byType(SwarmConversationPage),
+ )).conversationId,
+ 'g-archived',
+ );
+
+ await tester.tap(key('swarm-chat-menu'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Reopen'));
+ await tester.pumpAndSettle();
+
+ expect(fake.commands.single, {
+ 'type': 'conversation.archive',
+ 'conversationId': 'g-archived',
+ 'archived': false,
+ });
+ expect(
+ host.session!.inbox
+ .reader(tab)!
+ .snapshot!
+ .conversation('g-archived')!
+ .archived,
+ isFalse,
+ );
+ });
+
testWidgets("a new message to a project's chat opens that project on "
'Home C too', (tester) async {
final fake = backend();
diff --git a/mobile/test/swarm/swarm_invitations_in_swarm_test.dart b/mobile/test/swarm/swarm_invitations_in_swarm_test.dart
new file mode 100644
index 000000000..eb535eff5
--- /dev/null
+++ b/mobile/test/swarm/swarm_invitations_in_swarm_test.dart
@@ -0,0 +1,218 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness_mobile/notify/system_notices.dart';
+import 'package:harness_mobile/settings/experimental_features.dart';
+import 'package:harness_mobile/swarm/swarm_inbox.dart';
+import 'package:harness_mobile/swarm/swarm_page.dart';
+import 'package:harness_mobile/swarm/swarm_session.dart';
+import 'package:harness_mobile/swarm/swarm_request.dart';
+
+import '../voice_fakes.dart';
+import 'swarm_fixture.dart';
+
+/// A person already in a Swarm is told of a new invitation (Tony's mobile list,
+/// task 24): the phone reads them in any Swarm state, slowly while it has a
+/// Swarm to show.
+void main() {
+ const invitations = '/api/super-tabs/invitations';
+ Map<String, Object?> invite(String id, String name) => {
+ 'tabId': 't-$id',
+ 'name': name,
+ 'inviteId': id,
+ 'role': 'collaborator',
+ };
+
+ FakeSwarm backend({List<String> tabs = const ['a']}) {
+ final fake = FakeSwarm();
+ fake.routes['/api/super-tabs/list'] = (_) => {
+ 'tabs': [
+ for (final id in tabs) {'id': id, 'name': id, 'ownerId': me},
+ ],
+ 'next': null,
+ };
+ for (final id in tabs) {
+ fake.routes['/api/super-tabs/$id/parts'] = (_) => firstLoad(tabId: id);
+ }
+ fake.routes[invitations] = (_) => [invite('i1', 'Design Team')];
+ return fake;
+ }
+
+ int reads(FakeSwarm fake) => fake.paths.where((p) => p == invitations).length;
+
+ late DateTime at;
+ SwarmInbox inbox(FakeSwarm fake) {
+ final i = SwarmInbox(accountId: me, request: fake.request, now: () => at);
+ addTearDown(i.dispose);
+ return i;
+ }
+
+ setUp(() => at = DateTime.utc(2026, 11, 3, 9));
+
+ test('reads them with a Swarm to show', () async {
+ final i = inbox(backend());
+ await i.refresh();
+ expect(i.invitations.single.name, 'Design Team');
+ });
+
+ test('with a Swarm, at most every 5 minutes', () async {
+ final fake = backend();
+ final i = inbox(fake);
+ await i.refresh();
+ await i.refresh();
+ at = at.add(const Duration(minutes: 4, seconds: 59));
+ await i.refresh();
+ expect(reads(fake), 1);
+ at = at.add(const Duration(seconds: 1));
+ await i.refresh();
+ expect(reads(fake), 2);
+ });
+
+ test('with no Swarm, every read of the list, as before', () async {
+ final fake = backend(tabs: const []);
+ final i = inbox(fake);
+ await i.refresh();
+ await i.refresh();
+ expect(reads(fake), 2);
+ });
+
+ test('a pull reads them now', () async {
+ final fake = backend();
+ final i = inbox(fake);
+ await i.refresh();
+ await i.refreshAll();
+ expect(reads(fake), 2);
+ });
+
+ test('a failed read with a Swarm keeps the list and says nothing', () async {
+ final fake = backend();
+ final i = inbox(fake);
+ await i.refresh();
+ fake.routes[invitations] = (_) => throw const SuperTabFailure(
+ 'MACHINE_UNAVAILABLE',
+ 'No computer.',
+ statusCode: 503,
+ );
+ await i.refreshAll();
+ expect(i.invitations.single.name, 'Design Team');
+ expect(i.invitationsFailed, isFalse);
+ expect(i.noComputer, isFalse);
+ expect(i.error, isNull);
+ });
+
+ test('joining takes it off the list at once, and it stays off', () async {
+ final fake = backend();
+ fake.routes['/api/super-tabs/t-i1/commands'] = (_) => <String, Object?>{};
+ final i = inbox(fake);
+ await i.refresh();
+ expect(await i.join(i.invitations.single), isTrue);
+ expect(i.invitations, isEmpty);
+ expect(reads(fake), 2, reason: 'joining reads them again');
+ });
+
+ test('Not now stays hidden after a pull', () async {
+ final i = inbox(backend());
+ await i.refresh();
+ i.notNow(i.invitations.single);
+ await i.refreshAll();
+ expect(i.invitations, isEmpty);
+ });
+
+ group('Home', () {
+ Future<SwarmHost> pump(WidgetTester tester, FakeSwarm fake) async {
+ tester.view.physicalSize = const Size(1170, 2532);
+ tester.view.devicePixelRatio = 3;
+ addTearDown(tester.view.reset);
+ final features = ExperimentalFeaturesStore(storage: MemoryKeyValueStore())
+ ..value = {PhoneExperiment.swarm};
+ final account = ValueNotifier<String?>(me);
+ final host = SwarmHost(
+ accountId: () => account.value,
+ account: account,
+ request: fake.request,
+ notices: SilentSystemNotices(),
+ features: features,
+ readMarks: MemoryKeyValueStore(),
+ )..foreground = false;
+ addTearDown(host.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ builder: (context, child) =>
+ SwarmScope(notifier: host, child: child!),
+ home: const SwarmPage(),
+ ),
+ );
+ await tester.pumpAndSettle();
+ return host;
+ }
+
+ Finder key(String k) => find.byKey(ValueKey(k));
+
+ testWidgets('a person in a Swarm sees a new invitation, one line, and '
+ 'joins it', (tester) async {
+ final fake = backend();
+ fake.routes['/api/super-tabs/t-i1/commands'] = (_) {
+ fake.routes['/api/super-tabs/list'] = (_) => {
+ 'tabs': [
+ {'id': 'a', 'name': 'a', 'ownerId': me},
+ {'id': 't-i1', 'name': 'Design Team', 'ownerId': 'ken'},
+ ],
+ 'next': null,
+ };
+ fake.routes['/api/super-tabs/t-i1/parts'] = (_) =>
+ firstLoad(tabId: 't-i1');
+ fake.routes[invitations] = (_) => <Object>[];
+ return <String, Object?>{};
+ };
+ await pump(tester, fake);
+ expect(find.text('Invitations'), findsOneWidget);
+ final row = key('swarm-invitation-i1');
+ expect(
+ find.descendant(of: row, matching: find.text('Design Team')),
+ findsOneWidget,
+ );
+ double y(Finder f) => tester.getCenter(f).dy;
+ final line = y(
+ find.descendant(of: row, matching: find.text('Design Team')),
+ );
+ expect(y(key('swarm-invitation-later-i1')), line, reason: 'one line');
+ expect(y(key('swarm-invitation-join-i1')), line, reason: 'one line');
+ await tester.tap(key('swarm-invitation-join-i1'));
+ await tester.pumpAndSettle();
+ expect(fake.commands.last, {'type': 'invite.accept', 'inviteId': 'i1'});
+ expect(find.text('Invitations'), findsNothing);
+ expect(row, findsNothing);
+ });
+
+ testWidgets('Not now hides it, and the section with it', (tester) async {
+ final host = await pump(tester, backend());
+ await tester.tap(key('swarm-invitation-later-i1'));
+ await tester.pumpAndSettle();
+ expect(find.text('Invitations'), findsNothing);
+ await host.session!.inbox.refreshAll();
+ await tester.pumpAndSettle();
+ expect(key('swarm-invitation-i1'), findsNothing);
+ });
+
+ testWidgets('a join refused says why, and the row stays', (tester) async {
+ final fake = backend();
+ fake.routes['/api/super-tabs/t-i1/commands'] = (_) =>
+ throw const SuperTabFailure(
+ 'INVITE_EXPIRED',
+ 'This invitation has expired.',
+ statusCode: 409,
+ );
+ await pump(tester, fake);
+ await tester.tap(key('swarm-invitation-join-i1'));
+ await tester.pumpAndSettle();
+ expect(find.text('This invitation has expired.'), findsOneWidget);
+ expect(key('swarm-invitation-i1'), findsOneWidget);
+ });
+
+ testWidgets('with none, no section', (tester) async {
+ final fake = backend();
+ fake.routes[invitations] = (_) => <Object>[];
+ await pump(tester, fake);
+ expect(find.text('Invitations'), findsNothing);
+ });
+ });
+}
diff --git a/mobile/test/swarm/swarm_invitations_shots_test.dart b/mobile/test/swarm/swarm_invitations_shots_test.dart
new file mode 100644
index 000000000..dddde9220
--- /dev/null
+++ b/mobile/test/swarm/swarm_invitations_shots_test.dart
@@ -0,0 +1,132 @@
+import 'dart:convert';
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness_mobile/notify/system_notices.dart';
+import 'package:harness_mobile/settings/experimental_features.dart';
+import 'package:harness_mobile/shared/theme/app_theme.dart';
+import 'package:harness_mobile/shared/theme/color_palette.dart';
+import 'package:harness_mobile/swarm/swarm_page.dart';
+import 'package:harness_mobile/swarm/swarm_request.dart';
+import 'package:harness_mobile/swarm/swarm_session.dart';
+
+import '../voice_fakes.dart';
+import 'swarm_fixture.dart';
+
+/// Review screenshots of invitations on Swarm Home, in both phone themes, from
+/// made-up data only, to the folder `SWARM_INVITATIONS_SHOTS` names.
+final shots = Platform.environment['SWARM_INVITATIONS_SHOTS'];
+
+void main() {
+ setUpAll(() async {
+ if (shots == null || !Platform.isMacOS) return;
+ final sf = ByteData.sublistView(
+ await File('/System/Library/Fonts/SFNS.ttf').readAsBytes(),
+ );
+ for (final family in ['.AppleSystemUIFont', 'Roboto']) {
+ await (FontLoader(family)..addFont(Future.value(sf))).load();
+ }
+ final mono = ByteData.sublistView(
+ await File('/System/Library/Fonts/SFNSMono.ttf').readAsBytes(),
+ );
+ for (final family in ['.AppleSystemUIFontMonospaced', 'monospace']) {
+ await (FontLoader(family)..addFont(Future.value(mono))).load();
+ }
+ final manifest =
+ jsonDecode(await rootBundle.loadString('FontManifest.json')) as List;
+ for (final entry in manifest.cast<Map<String, dynamic>>()) {
+ final loader = FontLoader(entry['family'] as String);
+ for (final font in (entry['fonts'] as List).cast<Map>()) {
+ loader.addFont(rootBundle.load(font['asset'] as String));
+ }
+ await loader.load();
+ }
+ });
+
+ testWidgets('Home with invitations, in both phone themes', (tester) async {
+ await tester.binding.setSurfaceSize(const Size(390, 844));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ for (final palette in [HarnessPalette.graphite, HarnessPalette.paper]) {
+ final brightness = palette.brightness;
+ AppTheme.palette.value = palette;
+ AppTheme.brightness.value = brightness;
+ final fake = FakeSwarm();
+ fake.routes['/api/super-tabs/list'] = (_) => {
+ 'tabs': [
+ {'id': tab, 'name': 'Phone Swarm', 'ownerId': me},
+ ],
+ 'next': null,
+ };
+ fake.routes['/api/super-tabs/$tab/parts'] = (_) => firstLoad(tabId: tab);
+ fake.routes['/api/super-tabs/invitations'] = (_) => [
+ {
+ 'tabId': 't-design',
+ 'name': 'Design Team',
+ 'inviteId': 'i1',
+ 'role': 'collaborator',
+ },
+ {
+ 'tabId': 't-long',
+ 'name': 'A Swarm with a very long name that does not fit',
+ 'inviteId': 'i2',
+ 'role': 'viewer',
+ },
+ ];
+ fake.routes['/api/super-tabs/t-design/commands'] = (_) =>
+ throw const SuperTabFailure(
+ 'INVITE_EXPIRED',
+ 'This invitation has expired.',
+ statusCode: 409,
+ );
+ final features = ExperimentalFeaturesStore(
+ storage: MemoryKeyValueStore(),
+ )..value = {PhoneExperiment.swarm};
+ final account = ValueNotifier<String?>(me);
+ final host = SwarmHost(
+ accountId: () => account.value,
+ account: account,
+ request: fake.request,
+ notices: SilentSystemNotices(),
+ features: features,
+ readMarks: MemoryKeyValueStore(),
+ )..foreground = false;
+ final boundary = GlobalKey();
+ await tester.pumpWidget(
+ RepaintBoundary(
+ key: boundary,
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: buildAppTheme(brightness: brightness),
+ builder: (_, child) => SwarmScope(notifier: host, child: child!),
+ home: const SwarmPage(),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ Future<void> capture(String name) => tester.runAsync(() async {
+ final image =
+ await (boundary.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary)
+ .toImage(pixelRatio: 3);
+ final png = await image.toByteData(format: ui.ImageByteFormat.png);
+ await File(
+ '$shots/invitations-$name-${brightness.name}.png',
+ ).writeAsBytes(png!.buffer.asUint8List());
+ image.dispose();
+ });
+ await capture('home');
+ await tester.tap(find.byKey(const ValueKey('swarm-invitation-join-i1')));
+ await tester.pumpAndSettle();
+ await capture('refused');
+ await tester.pumpWidget(const SizedBox());
+ host.dispose();
+ account.dispose();
+ }
+ AppTheme.palette.value = HarnessPalette.graphite;
+ AppTheme.brightness.value = Brightness.dark;
+ }, skip: shots == null);
+}
diff --git a/mobile/test/swarm/swarm_project_c_shots_test.dart b/mobile/test/swarm/swarm_project_c_shots_test.dart
index d9590f047..31dc79745 100644
--- a/mobile/test/swarm/swarm_project_c_shots_test.dart
+++ b/mobile/test/swarm/swarm_project_c_shots_test.dart
@@ -22,8 +22,8 @@ import 'swarm_fixture.dart';
/// prototype draws it (2026-10-30): its chat with the New messages line,
/// a task card and a PR card, a code block, reactions with the add-reaction
/// chip and a replies row; ☰ open; its Leaderboard sheet; its Team sheet with
-/// open tasks on top, See all and the agents in their states; and Approve's
-/// question. On 390- and 320-point phones in both phone themes, from made-up
+/// open tasks on top, See all and the agents in their states; Work and Older;
+/// and Approve's question. On 390- and 320-point phones in both phone themes, from made-up
/// data only, to the folder `SWARM_PROJECT_C_SHOTS` names.
final shots = Platform.environment['SWARM_PROJECT_C_SHOTS'];
void main() {
@@ -214,6 +214,21 @@ void main() {
};
fake.routes['/api/super-tabs/$tab/changes'] = (_) =>
changes(cursor: 'c2', derived: derived);
+ fake.routes['/api/super-tabs/$tab/groups?dormant=1&projectId=$project'] =
+ (_) => {
+ 'groups': [
+ part('g-old', 50, {
+ ...groupData(
+ 'g-old',
+ title: 'Old chat',
+ number: 23,
+ dormant: true,
+ ),
+ 'archived': true,
+ }),
+ ],
+ 'next': null,
+ };
fake.routes['/api/super-tabs/$tab/decisions?state=open'] = (_) => {
'decisions': [
{
@@ -363,6 +378,30 @@ void main() {
await tester.tap(key('swarm-project-menu'));
await tester.pumpAndSettle();
await capture('menu');
+ await tester.tap(key('swarm-project-menu-work'));
+ await tester.pumpAndSettle();
+ await capture('work');
+ final workList = find.descendant(
+ of: find.byType(SwarmProjectSheet),
+ matching: find.byType(CustomScrollView),
+ );
+ await tester.dragUntilVisible(
+ key('swarm-older'),
+ workList,
+ const Offset(0, -200),
+ );
+ await tester.tap(key('swarm-older'));
+ await tester.pumpAndSettle();
+ await tester.dragUntilVisible(
+ key('swarm-conversation-g-old'),
+ workList,
+ const Offset(0, -200),
+ );
+ await capture('older');
+ await tester.tap(key('swarm-team-close'));
+ await tester.pumpAndSettle();
+ await tester.tap(key('swarm-project-menu'));
+ await tester.pumpAndSettle();
await tester.tap(key('swarm-project-menu-leaderboard'));
await tester.pumpAndSettle();
await capture('leaderboard');
diff --git a/mobile/test/swarm/swarm_start_test.dart b/mobile/test/swarm/swarm_start_test.dart
index 175e84fba..53b725ed6 100644
--- a/mobile/test/swarm/swarm_start_test.dart
+++ b/mobile/test/swarm/swarm_start_test.dart
@@ -118,7 +118,7 @@ void main() {
});
test(
- 'a Swarm to show: no start screen, and invitations are not read',
+ 'a Swarm to show: no start screen, and the invitation is read for Home',
() async {
final fake = backend(
tabs: ['a'],
@@ -129,7 +129,7 @@ void main() {
await i.refresh();
expect(swarmStart(i, const [mac]), isNull);
- expect(fake.paths, isNot(contains('/api/super-tabs/invitations')));
+ expect(i.invitations.single.name, 'Design Lab');
},
);