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.

Polish Swarm navigation, resources and chat (#1466)

Deefb919d1f1d78
diff --git a/desktop/design/review/2026-10-20-swarm-ui-polish/dark.png b/desktop/design/review/2026-10-20-swarm-ui-polish/dark.png
new file mode 100644
index 000000000..0ed7d9e96
Binary files /dev/null and b/desktop/design/review/2026-10-20-swarm-ui-polish/dark.png differ
diff --git a/desktop/design/review/2026-10-20-swarm-ui-polish/light.png b/desktop/design/review/2026-10-20-swarm-ui-polish/light.png
new file mode 100644
index 000000000..2efde9451
Binary files /dev/null and b/desktop/design/review/2026-10-20-swarm-ui-polish/light.png differ
diff --git a/desktop/design/review/2026-10-20-swarm-ui-polish/native.png b/desktop/design/review/2026-10-20-swarm-ui-polish/native.png
new file mode 100644
index 000000000..15fb21727
Binary files /dev/null and b/desktop/design/review/2026-10-20-swarm-ui-polish/native.png differ
diff --git a/desktop/lib/super_tabs/machines.dart b/desktop/lib/super_tabs/machines.dart
index d92d3cdfb..752f7a34d 100644
--- a/desktop/lib/super_tabs/machines.dart
+++ b/desktop/lib/super_tabs/machines.dart
@@ -5,10 +5,8 @@ import 'package:flutter/material.dart';
import '../core/machine_resources.dart';
import '../core/models.dart';
import '../core/test_run.dart';
-import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
-import '../shared/widgets/app_icon_button.dart';
import '../state/app_state.dart';
import '../usage/models_menu_controller.dart';
import '../widgets/desktop_chrome.dart';
@@ -19,6 +17,7 @@ import 'controller.dart';
import 'dialog_scope.dart';
import 'identity.dart';
import 'model.dart';
+import 'section_heading.dart';
class SuperTabMachines extends StatefulWidget {
const SuperTabMachines({
@@ -26,9 +25,11 @@ class SuperTabMachines extends StatefulWidget {
required this.controller,
required this.onAddAgent,
this.app,
+ this.embedded = false,
});
final SuperTabController controller;
final AppNotifier? app;
+ final bool embedded;
final ValueChanged<SuperTabConversation> onAddAgent;
@override
State<SuperTabMachines> createState() => _SuperTabMachinesState();
@@ -536,7 +537,7 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
.replaceAll(' TB', 'T')
.replaceAll(' MB', 'M');
return Padding(
- padding: const EdgeInsets.fromLTRB(16, 12, 16, 16),
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -612,28 +613,62 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
],
),
),
- child: Text(
- [
- name,
- if (person != null) superTabPersonName(person.email),
- paused
- ? 'Paused'
- : !online
- ? 'Offline'
- : '$running ${running == 1 ? 'agent' : 'agents'}',
- ].join(' '),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(medium: true),
+ child: Tooltip(
+ message: [name, if (person != null) person.email].join('\n'),
+ child: Row(
+ children: [
+ Flexible(
+ flex: 3,
+ child: Text(
+ name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(medium: true),
+ ),
+ ),
+ if (person != null) ...[
+ const SizedBox(width: 8),
+ Flexible(
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 64),
+ child: Text(
+ superTabPersonName(person.email),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ ),
+ ),
+ ),
+ ],
+ const SizedBox(width: 8),
+ Text(
+ paused
+ ? 'Paused'
+ : !online
+ ? 'Offline'
+ : '$running ${running == 1 ? 'agent' : 'agents'}',
+ style: DesktopChrome.metadata(),
+ ),
+ ],
+ ),
),
),
const SizedBox(height: 4),
Tooltip(
message:
'Available capacity\nCPU and GPU: idle percentage at the latest reading\nRAM: ${resourceBytes(memoryFree?.toDouble())} free of ${resourceBytes(value?.memoryTotalBytes)}\nSSD: ${resourceBytes(diskFree)} free of ${resourceBytes(diskTotal)}',
- child: Text(
- 'CPU ${available(value?.cpuPercent)} GPU ${available(value?.busiestGpu?.utilizationPercent)} RAM ${compactBytes(memoryFree)} SSD ${compactBytes(diskFree)}',
- style: DesktopChrome.metadata(),
+ child: Wrap(
+ spacing: 8,
+ runSpacing: 4,
+ children: [
+ for (final metric in [
+ 'CPU ${available(value?.cpuPercent)}',
+ 'GPU ${available(value?.busiestGpu?.utilizationPercent)}',
+ 'RAM ${compactBytes(memoryFree)}',
+ 'SSD ${compactBytes(diskFree)}',
+ ])
+ Text(metric, style: DesktopChrome.metadata()),
+ ],
),
),
const SizedBox(height: 4),
@@ -672,52 +707,32 @@ class _SuperTabMachinesState extends State<SuperTabMachines> {
}
@override
- Widget build(BuildContext context) => Column(
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 8, 12, 0),
- child: Row(
- children: [
- Expanded(
- child: Text(
- 'Machines',
- style: DesktopChrome.metadata().copyWith(
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- if (c.canWrite && widget.app != null)
- AppIconButton(
- icon: AppIcons.plus,
- tooltip: 'Add machine',
- onPressed: () => unawaited(_contribute()),
- ),
- ],
- ),
+ Widget build(BuildContext context) {
+ final children = [
+ SuperTabSectionHeading(
+ 'Machines',
+ onAdd: c.canWrite && widget.app != null
+ ? () => unawaited(_contribute())
+ : null,
+ addTooltip: 'Add machine',
),
- Expanded(
- child: _ids.isEmpty
- ? Center(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Text(
- 'Add a machine for the lead to use.',
- textAlign: TextAlign.center,
- style: DesktopChrome.metadata(),
- ),
- ),
- )
- : ListView.separated(
- itemCount: _ids.length,
- separatorBuilder: (_, _) => Divider(
- height: 1,
- indent: 16,
- endIndent: 16,
- color: DesktopChrome.rim,
- ),
- itemBuilder: (_, i) => _machine(_ids.elementAt(i)),
- ),
- ),
- ],
- );
+ if (_ids.isEmpty)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
+ child: Text(
+ 'Add a machine for the lead to use.',
+ style: DesktopChrome.metadata(),
+ ),
+ )
+ else
+ for (final id in _ids) _machine(id),
+ ];
+ return widget.embedded
+ ? Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisSize: MainAxisSize.min,
+ children: children,
+ )
+ : ListView(children: children);
+ }
}
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index 4e6a35276..10a595486 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -182,7 +182,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
child: Stack(
children: [
Padding(
- padding: const EdgeInsets.fromLTRB(20, 6, 20, 6),
+ padding: const EdgeInsets.fromLTRB(24, 6, 24, 6),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -273,10 +273,15 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
style: DesktopChrome.metadata(),
),
),
- SuperTabMessageText(
- message.text,
- references: widget.references,
- onOpenGroup: widget.onOpenGroup,
+ ConstrainedBox(
+ constraints: const BoxConstraints(
+ maxWidth: 960,
+ ),
+ child: SuperTabMessageText(
+ message.text,
+ references: widget.references,
+ onOpenGroup: widget.onOpenGroup,
+ ),
),
SuperTabPullRequestLinks(message.text),
...widget.receipts,
diff --git a/desktop/lib/super_tabs/message_text.dart b/desktop/lib/super_tabs/message_text.dart
index 3b512e7bb..ccaf2216c 100644
--- a/desktop/lib/super_tabs/message_text.dart
+++ b/desktop/lib/super_tabs/message_text.dart
@@ -37,8 +37,9 @@ class SuperTabMessageText extends StatelessWidget {
data: text,
selectable: false,
softLineBreak: true,
- inlineSyntaxes: [_WorkgroupReference(references)],
+ inlineSyntaxes: [_WebAutolink(), _WorkgroupReference(references)],
builders: {'pre': _WrappedCode()},
+ paddingBuilders: {'a': _CompactLinkLabel()},
styleSheet: MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
p: body,
a: TextStyle(
@@ -104,6 +105,63 @@ class SuperTabMessageText extends StatelessWidget {
}
}
+/// GFM encodes '%' again in bare URLs. Keep the original URL, including encoded
+/// query parameters, while using its parser for punctuation and parentheses.
+/// This syntax never runs on Markdown link destinations or inside code.
+class _WebAutolink extends md.AutolinkExtensionSyntax {
+ @override
+ bool onMatch(md.InlineParser parser, Match match) {
+ final source = match[0]!;
+ if (!source.toLowerCase().startsWith('http')) {
+ return super.onMatch(parser, match);
+ }
+ final nodes = md.Document(
+ extensionSet: md.ExtensionSet.gitHubFlavored,
+ encodeHtml: false,
+ ).parseInline(source);
+ final anchor = nodes.firstOrNull;
+ if (anchor is! md.Element ||
+ anchor.tag != 'a' ||
+ SuperTabMessageText.webLink(anchor.textContent) == null) {
+ return super.onMatch(parser, match);
+ }
+ anchor.attributes['href'] = anchor.textContent;
+ parser
+ ..addNode(anchor)
+ ..consume(anchor.textContent.length);
+ return true;
+ }
+}
+
+/// Use the pre-render hook without replacing Markdown's link renderer: selection,
+/// the full destination and link handling keep their standard behavior.
+class _CompactLinkLabel extends MarkdownPaddingBuilder {
+ @override
+ void visitElementBefore(md.Element element) {
+ final label = element.textContent;
+ final href = element.attributes['href'];
+ final uri = SuperTabMessageText.webLink(href);
+ if (uri == null ||
+ label.length <= 96 ||
+ (label != href && Uri.encodeFull(label) != href)) {
+ return;
+ }
+ final path = uri.path.length > 64
+ ? '${uri.path.substring(0, 56)}…'
+ : uri.path;
+ final port = uri.hasPort ? ':${uri.port}' : '';
+ element.children!
+ ..clear()
+ ..add(
+ md.Text(
+ '${uri.host}$port$path'
+ '${uri.hasQuery ? '?…' : ''}'
+ '${uri.hasFragment ? '#…' : ''}',
+ ),
+ );
+ }
+}
+
/// Parsed as inline Markdown, so code and fenced blocks remain literal.
class _WorkgroupReference extends md.InlineSyntax {
_WorkgroupReference(this.references)
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index bad85715a..3980da2c2 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -29,69 +29,105 @@ class ProjectSidebar extends StatelessWidget {
);
final waiting = groups.any((g) => needsHuman(g) > 0);
final unread = groups.any(controller.unread);
- return Semantics(
- selected: selected,
- child: ListTile(
- key: ValueKey('super-group-${group.id}'),
- dense: true,
- contentPadding: const EdgeInsets.symmetric(horizontal: 10),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
- ),
- selected: selected,
- selectedTileColor: DesktopChrome.activeSelection,
- title: Row(
+ final expanded = controller.expandedProjects.contains(project?.id);
+ final hasChildren =
+ project != null &&
+ groups.any((g) => g.id != project.leadConversationId);
+ return Padding(
+ padding: EdgeInsets.only(left: project == null ? 40 : 0, bottom: 2),
+ child: Material(
+ color: selected ? grid.AppSurface.selectedFill : Colors.transparent,
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ clipBehavior: Clip.antiAlias,
+ child: Row(
children: [
- if (project?.isPrivate == true) ...[
- Icon(
- AppIcons.lock,
- size: 14,
- color: selected
- ? DesktopChrome.onSelection
- : DesktopChrome.muted,
- ),
- const SizedBox(width: 6),
- ],
+ if (project != null && hasChildren)
+ AppIconButton(
+ key: ValueKey('super-project-expand-${project.id}'),
+ icon: expanded ? AppIcons.chevronDown : AppIcons.chevronRight,
+ tooltip: '${expanded ? 'Collapse' : 'Expand'} ${project.name}',
+ onPressed: () => controller.toggleProject(project.id),
+ )
+ else if (project != null)
+ const SizedBox(width: 32),
Expanded(
- child: Text(
- project?.name ?? group.label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(
- medium: project != null || unread,
- color: selected ? DesktopChrome.onSelection : null,
+ child: Semantics(
+ label: project?.isPrivate == true ? 'Private project' : null,
+ selected: selected,
+ child: Tooltip(
+ message: project?.name ?? group.label,
+ child: InkWell(
+ key: ValueKey('super-group-${group.id}'),
+ onTap: () => onSelect(group.id),
+ hoverColor: grid.AppSurface.hoverFill,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 36),
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ project == null ? 12 : 4,
+ 8,
+ 12,
+ 8,
+ ),
+ child: Row(
+ children: [
+ if (project?.isPrivate == true) ...[
+ Icon(
+ AppIcons.lock,
+ size: 14,
+ color: DesktopChrome.muted,
+ ),
+ const SizedBox(width: 6),
+ ],
+ Expanded(
+ child: Text(
+ project?.name ?? group.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(
+ medium: project != null || unread || selected,
+ color: selected || unread || project != null
+ ? DesktopChrome.foreground
+ : DesktopChrome.muted,
+ ),
+ ),
+ ),
+ if (waiting) ...[
+ const SizedBox(width: 8),
+ Tooltip(
+ message: 'Needs a human',
+ child: Text(
+ '?',
+ style: DesktopChrome.control(
+ color: grid.AppPalette.warn,
+ medium: true,
+ ),
+ ),
+ ),
+ ] else if (unread) ...[
+ const SizedBox(width: 8),
+ Semantics(
+ label: 'Unread messages',
+ child: Container(
+ width: 6,
+ height: 6,
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ color: DesktopChrome.accent,
+ ),
+ ),
+ ),
+ ],
+ ],
+ ),
+ ),
+ ),
+ ),
),
),
),
],
),
- trailing: waiting
- ? Tooltip(
- message: 'Needs a human',
- child: Text(
- '?',
- style: DesktopChrome.control(
- color: grid.AppPalette.warn,
- medium: true,
- ),
- ),
- )
- : unread
- ? Semantics(
- label: 'Unread messages',
- child: Container(
- width: 6,
- height: 6,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: selected
- ? DesktopChrome.onSelection
- : DesktopChrome.accent,
- ),
- ),
- )
- : null,
- onTap: () => onSelect(group.id),
),
);
}
@@ -103,9 +139,21 @@ class ProjectSidebar extends StatelessWidget {
color: DesktopChrome.surface,
child: Column(
children: [
+ Padding(
+ padding: const EdgeInsets.fromLTRB(16, 18, 16, 12),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Text(
+ 'Projects',
+ style: DesktopChrome.metadata().copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ ),
Expanded(
child: ListView(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
children: [
for (final project
in snapshot?.projects ?? const <SuperTabProject>[])
@@ -114,52 +162,44 @@ class ProjectSidebar extends StatelessWidget {
Column(
mainAxisSize: MainAxisSize.min,
children: [
- Row(
- children: [
- AppIconButton(
- key: ValueKey(
- 'super-project-expand-${project.id}',
- ),
- icon:
- controller.expandedProjects.contains(
- project.id,
- )
- ? AppIcons.chevronDown
- : AppIcons.chevronRight,
- tooltip:
- '${controller.expandedProjects.contains(project.id) ? 'Collapse' : 'Expand'} ${project.name}',
- onPressed: () =>
- controller.toggleProject(project.id),
- ),
- Expanded(child: _row(lead, project: project)),
- ],
- ),
+ _row(lead, project: project),
if (controller.expandedProjects.contains(project.id))
for (final group in snapshot!.conversations)
if (group.projectId == project.id &&
group.id != project.leadConversationId &&
!group.archived)
- Padding(
- padding: const EdgeInsets.only(
- left: 32,
- bottom: 2,
- ),
- child: _row(group),
- ),
+ _row(group),
],
),
],
),
),
Padding(
- padding: const EdgeInsets.fromLTRB(12, 8, 12, 12),
- child: Align(
- alignment: Alignment.centerLeft,
- child: TextButton.icon(
- key: const ValueKey('super-new-project'),
- onPressed: controller.canWrite ? onNewProject : null,
- icon: const Icon(AppIcons.plus, size: 16),
- label: const Text('Project'),
+ padding: const EdgeInsets.fromLTRB(8, 8, 8, 16),
+ child: TextButton(
+ key: const ValueKey('super-new-project'),
+ onPressed: controller.canWrite ? onNewProject : null,
+ style: TextButton.styleFrom(
+ foregroundColor: DesktopChrome.muted,
+ backgroundColor: Colors.transparent,
+ disabledBackgroundColor: Colors.transparent,
+ alignment: Alignment.centerLeft,
+ side: BorderSide.none,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 10,
+ ),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),
+ ),
+ textStyle: DesktopChrome.control(),
+ ),
+ child: const Row(
+ children: [
+ Icon(AppIcons.plus, size: 16),
+ SizedBox(width: 8),
+ Flexible(child: Text('New project')),
+ ],
),
),
),
diff --git a/desktop/lib/super_tabs/recording_notice.dart b/desktop/lib/super_tabs/recording_notice.dart
new file mode 100644
index 000000000..13ba8cdb9
--- /dev/null
+++ b/desktop/lib/super_tabs/recording_notice.dart
@@ -0,0 +1,113 @@
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_icons.dart';
+import '../widgets/desktop_chrome.dart';
+import 'model.dart';
+
+bool _recordingGap(SuperTabMessage message) =>
+ message.fromTerminal &&
+ message.source['phase'] == 'gap' &&
+ message.replyTo == null &&
+ message.deliveries.isEmpty;
+
+/// Only coalesce identical, adjacent recording diagnostics from the same session.
+/// Ordinary posts, source messages and their IDs remain untouched.
+List<({SuperTabMessage message, int interruptions})> superTabTranscriptEntries(
+ List<SuperTabMessage> messages,
+) {
+ final entries = <({SuperTabMessage message, int interruptions})>[];
+ for (final message in messages) {
+ final previous = entries.lastOrNull;
+ final first = previous?.message;
+ if (_recordingGap(message) &&
+ previous != null &&
+ previous.interruptions > 0 &&
+ first!.authorId == message.authorId &&
+ first.author['kind'] == message.author['kind'] &&
+ first.conversationId == message.conversationId &&
+ first.author['membershipGeneration'] ==
+ message.author['membershipGeneration'] &&
+ first.authorName == message.authorName &&
+ first.text == message.text &&
+ first.createdAt != null &&
+ message.createdAt != null &&
+ DateUtils.isSameDay(
+ first.createdAt!.toLocal(),
+ message.createdAt!.toLocal(),
+ ) &&
+ !message.createdAt!.difference(first.createdAt!).isNegative &&
+ message.createdAt!.difference(first.createdAt!) <=
+ const Duration(minutes: 5)) {
+ entries[entries.length - 1] = (
+ message: first,
+ interruptions: previous.interruptions + 1,
+ );
+ } else {
+ entries.add((
+ message: message,
+ interruptions: _recordingGap(message) ? 1 : 0,
+ ));
+ }
+ }
+ return entries;
+}
+
+class SuperTabRecordingNotice extends StatelessWidget {
+ const SuperTabRecordingNotice({
+ super.key,
+ required this.author,
+ required this.count,
+ this.onOpenTerminal,
+ });
+
+ final String author;
+ final int count;
+ final VoidCallback? onOpenTerminal;
+
+ @override
+ Widget build(BuildContext context) => Padding(
+ padding: const EdgeInsets.fromLTRB(24, 12, 24, 12),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(top: 5),
+ child: Icon(AppIcons.terminal, size: 16, color: DesktopChrome.muted),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: Tooltip(
+ message:
+ 'Some terminal activity could not be recorded. '
+ 'Open the terminal for the full conversation.',
+ child: Wrap(
+ crossAxisAlignment: WrapCrossAlignment.center,
+ spacing: 6,
+ children: [
+ Text(
+ '$author’s terminal recording was interrupted'
+ '${count > 1 ? ' $count times' : ''}.',
+ style: DesktopChrome.metadata(),
+ ),
+ if (onOpenTerminal != null)
+ TextButton(
+ onPressed: onOpenTerminal,
+ style: TextButton.styleFrom(
+ foregroundColor: DesktopChrome.accent,
+ backgroundColor: Colors.transparent,
+ side: BorderSide.none,
+ minimumSize: const Size(0, 28),
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ textStyle: DesktopChrome.metadata(),
+ ),
+ child: const Text('Open terminal'),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+}
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index d247057ca..4e49a8bd3 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -3,10 +3,8 @@ import 'dart:async';
import 'package:flutter/material.dart';
import '../core/models.dart' show Agent;
-import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/widgets/app_dialog.dart';
-import '../shared/widgets/app_icon_button.dart';
import '../state/app_state.dart';
import '../widgets/desktop_chrome.dart';
import '../widgets/engine_identity.dart';
@@ -14,6 +12,7 @@ import 'controller.dart';
import 'identity.dart';
import 'machines.dart';
import 'model.dart';
+import 'section_heading.dart';
/// Tab-wide membership above tab-wide execution capacity. Group selection does
/// not change who appears here or what machines the team has contributed.
@@ -36,7 +35,6 @@ class SuperTabRoster extends StatefulWidget {
}
class _SuperTabRosterState extends State<SuperTabRoster> {
- double _membersFraction = .56;
SuperTabController get c => widget.controller;
Agent? _native(SuperTabAgent agent) => widget.app
@@ -118,34 +116,14 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
);
- Widget _heading(String text, {VoidCallback? add, String? tooltip}) => Padding(
- padding: const EdgeInsets.fromLTRB(16, 14, 12, 6),
- child: Row(
- children: [
- Expanded(
- child: Text(
- text,
- style: DesktopChrome.metadata().copyWith(
- fontWeight: FontWeight.w600,
- ),
- ),
- ),
- if (add != null)
- AppIconButton(
- icon: AppIcons.plus,
- tooltip: tooltip ?? text,
- onPressed: add,
- ),
- ],
- ),
- );
-
Widget _agent(SuperTabAgent agent) {
final name = c.snapshot!.agentName(agent.id), activity = _activity(agent);
final project = c.snapshot!.projects
.where((p) => p.id == agent.projectId)
.firstOrNull;
final waiting = activity == 'Needs you';
+ final otherProject = project != null && project.id != c.selected?.projectId;
+ final subtitle = otherProject ? '$activity ${project.name}' : activity;
return GestureDetector(
onSecondaryTapUp: (event) async {
final choice = await showMenu<String>(
@@ -171,11 +149,14 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
title: Row(
children: [
Flexible(
- child: Text(
- name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(medium: true),
+ child: Tooltip(
+ message: name,
+ child: Text(
+ name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(medium: true),
+ ),
),
),
const SizedBox(width: 6),
@@ -185,12 +166,15 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
],
),
- subtitle: Text(
- '${project?.name ?? ''} $activity'.trim(),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(
- color: waiting ? grid.AppPalette.warn : null,
+ subtitle: Tooltip(
+ message: [if (project != null) project.name, activity].join('\n'),
+ child: Text(
+ subtitle,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(
+ color: waiting ? grid.AppPalette.warn : null,
+ ),
),
),
onTap: () => widget.onOpenAgent(agent),
@@ -199,7 +183,7 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
);
}
- Widget _members() {
+ List<Widget> _members() {
final state = c.snapshot;
final leads =
state?.agents.where((a) => state.isLead(a.id)).toList() ??
@@ -207,59 +191,61 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
final agents =
state?.agents.where((a) => !state.isLead(a.id)).toList() ??
const <SuperTabAgent>[];
- return ListView(
- padding: const EdgeInsets.only(bottom: 12),
- children: [
- _heading(
- 'Humans',
- add: c.isOwner ? widget.onInvite : null,
- tooltip: 'Invite people',
- ),
- for (final person in state?.people ?? const <SuperTabPerson>[])
- ListTile(
- dense: true,
- horizontalTitleGap: 10,
- leading: SuperTabAvatar(
- identity: 'person:${person.id}',
- name: superTabPersonName(person.email),
- ),
- title: Text(
+ return [
+ SuperTabSectionHeading(
+ 'Humans',
+ onAdd: c.isOwner ? widget.onInvite : null,
+ addTooltip: 'Invite people',
+ ),
+ for (final person in state?.people ?? const <SuperTabPerson>[])
+ ListTile(
+ dense: true,
+ contentPadding: const EdgeInsets.symmetric(horizontal: 16),
+ horizontalTitleGap: 10,
+ leading: SuperTabAvatar(
+ identity: 'person:${person.id}',
+ name: superTabPersonName(person.email),
+ ),
+ title: Tooltip(
+ message: person.email,
+ child: Text(
superTabPersonName(person.email),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: DesktopChrome.control(),
),
- onTap: () => showAppDialog<void>(
- context: context,
- builder: (context) => AlertDialog(
- title: Text(superTabPersonName(person.email)),
- content: Text('${person.email}\n${person.role}'),
- actions: [
- TextButton(
- onPressed: () {
- Navigator.pop(context);
- widget.onInvite();
- },
- child: const Text('Manage people'),
- ),
- TextButton(
- onPressed: () => Navigator.pop(context),
- child: const Text('Close'),
- ),
- ],
- ),
+ ),
+ onTap: () => showAppDialog<void>(
+ context: context,
+ builder: (context) => AlertDialog(
+ title: Text(superTabPersonName(person.email)),
+ content: Text('${person.email}\n${person.role}'),
+ actions: [
+ TextButton(
+ onPressed: () {
+ Navigator.pop(context);
+ widget.onInvite();
+ },
+ child: const Text('Manage people'),
+ ),
+ TextButton(
+ onPressed: () => Navigator.pop(context),
+ child: const Text('Close'),
+ ),
+ ],
),
),
- _heading(
- 'Agents',
- add: c.canWrite && c.selected != null
- ? () => widget.onAddAgent(c.selected!)
- : null,
- tooltip: 'Add agent',
),
- for (final agent in [...leads, ...agents]) _agent(agent),
- ],
- );
+ const SizedBox(height: 20),
+ SuperTabSectionHeading(
+ 'Agents',
+ onAdd: c.canWrite && c.selected != null
+ ? () => widget.onAddAgent(c.selected!)
+ : null,
+ addTooltip: 'Add agent',
+ ),
+ for (final agent in [...leads, ...agents]) _agent(agent),
+ ];
}
@override
@@ -267,37 +253,19 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
color: DesktopChrome.surface,
child: ListenableBuilder(
listenable: Listenable.merge([c, if (widget.app != null) widget.app!]),
- builder: (context, _) => LayoutBuilder(
- builder: (context, size) => Column(
- children: [
- SizedBox(
- height: (size.maxHeight - 9) * _membersFraction,
- child: _members(),
- ),
- Semantics(
- label: 'Resize members and machines',
- child: MouseRegion(
- cursor: SystemMouseCursors.resizeRow,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onVerticalDragUpdate: (event) => setState(
- () => _membersFraction =
- (_membersFraction + event.delta.dy / size.maxHeight)
- .clamp(.25, .75),
- ),
- child: const SizedBox(height: 9),
- ),
- ),
- ),
- Expanded(
- child: SuperTabMachines(
- controller: c,
- app: widget.app,
- onAddAgent: widget.onAddAgent,
- ),
- ),
- ],
- ),
+ builder: (context, _) => ListView(
+ key: PageStorageKey('super-tab-resources-${c.tabId}'),
+ padding: const EdgeInsets.symmetric(vertical: 12),
+ children: [
+ ..._members(),
+ const SizedBox(height: 20),
+ SuperTabMachines(
+ controller: c,
+ app: widget.app,
+ onAddAgent: widget.onAddAgent,
+ embedded: true,
+ ),
+ ],
),
),
);
diff --git a/desktop/lib/super_tabs/section_heading.dart b/desktop/lib/super_tabs/section_heading.dart
new file mode 100644
index 000000000..c40f9b3c9
--- /dev/null
+++ b/desktop/lib/super_tabs/section_heading.dart
@@ -0,0 +1,45 @@
+import 'package:flutter/material.dart';
+
+import '../shared/theme/app_icons.dart';
+import '../shared/widgets/app_icon_button.dart';
+import '../widgets/desktop_chrome.dart';
+
+/// Keeps resource headings aligned whether their add action is available or not.
+class SuperTabSectionHeading extends StatelessWidget {
+ const SuperTabSectionHeading(
+ this.title, {
+ super.key,
+ this.onAdd,
+ this.addTooltip,
+ });
+
+ final String title;
+ final VoidCallback? onAdd;
+ final String? addTooltip;
+
+ @override
+ Widget build(BuildContext context) => Padding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 12, 4),
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(minHeight: 32),
+ child: Row(
+ children: [
+ Expanded(
+ child: Text(
+ title,
+ style: DesktopChrome.metadata().copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ if (onAdd != null)
+ AppIconButton(
+ icon: AppIcons.plus,
+ tooltip: addTooltip ?? title,
+ onPressed: onAdd,
+ ),
+ ],
+ ),
+ ),
+ );
+}
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 17ecd3630..3cda755ae 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -10,6 +10,7 @@ import '../shared/widgets/app_icon_button.dart';
import '../widgets/desktop_chrome.dart';
import '../state/app_state.dart';
import 'roster.dart';
+import 'recording_notice.dart';
import 'pull_requests.dart';
import 'controller.dart';
import 'dialog_scope.dart';
@@ -500,7 +501,7 @@ class _SuperTabViewState extends State<SuperTabView> {
Widget _header(SuperTabConversation? group, bool narrow, bool showRoster) =>
Container(
constraints: const BoxConstraints(minHeight: 52),
- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: DesktopChrome.rim)),
),
@@ -822,7 +823,7 @@ class _SuperTabViewState extends State<SuperTabView> {
}
Widget _date(DateTime time) => Padding(
- padding: const EdgeInsets.fromLTRB(20, 20, 20, 4),
+ padding: const EdgeInsets.fromLTRB(24, 20, 24, 4),
child: Row(
children: [
Expanded(child: Divider(color: DesktopChrome.rim)),
@@ -841,6 +842,7 @@ class _SuperTabViewState extends State<SuperTabView> {
Widget _conversation(bool narrow) {
final group = c.selected;
final messages = c.messages(c.selectedId);
+ final entries = superTabTranscriptEntries(messages);
final byId = {for (final message in messages) message.id: message};
final grouped = SuperTabMessageRow.consecutiveUpdates(messages);
final newAfter = _newAfter[c.selectedId];
@@ -912,7 +914,7 @@ class _SuperTabViewState extends State<SuperTabView> {
'super-messages-${c.tabId}-${c.selectedId}',
),
padding: const EdgeInsets.symmetric(vertical: 8),
- itemCount: messages.length + 1,
+ itemCount: entries.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return c.hasOlder(c.selectedId)
@@ -924,9 +926,13 @@ class _SuperTabViewState extends State<SuperTabView> {
)
: const SizedBox.shrink();
}
- final message = messages[index - 1];
+ final entry = entries[index - 1];
+ final message = entry.message;
+ final agent = message.fromAgent
+ ? c.snapshot?.agent(message.authorId)
+ : null;
final previous = index > 1
- ? messages[index - 2]
+ ? entries[index - 2].message
: null;
final time = message.createdAt;
return Column(
@@ -938,11 +944,23 @@ class _SuperTabViewState extends State<SuperTabView> {
previous?.createdAt?.toLocal(),
))
_date(time),
- _message(
- message,
- grouped.contains(message.id),
- byId,
- ),
+ if (entry.interruptions > 0)
+ SuperTabRecordingNotice(
+ key: ValueKey(
+ 'super-message-${message.id}',
+ ),
+ author: _shownAuthor(c, message),
+ count: entry.interruptions,
+ onOpenTerminal: agent == null
+ ? null
+ : () => _openAgent(agent),
+ )
+ else
+ _message(
+ message,
+ grouped.contains(message.id),
+ byId,
+ ),
],
);
},
@@ -1010,7 +1028,7 @@ class _SuperTabViewState extends State<SuperTabView> {
if (group != null)
for (final agent in _needsHuman(group))
Padding(
- padding: const EdgeInsets.fromLTRB(20, 6, 20, 0),
+ padding: const EdgeInsets.fromLTRB(24, 6, 24, 0),
child: ListTile(
key: ValueKey('super-needs-human-${agent.id}'),
dense: true,
@@ -1033,7 +1051,7 @@ class _SuperTabViewState extends State<SuperTabView> {
),
if (mentions.isNotEmpty)
Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
+ padding: const EdgeInsets.symmetric(horizontal: 24),
child: Material(
color: DesktopChrome.surface,
child: Column(
@@ -1055,7 +1073,7 @@ class _SuperTabViewState extends State<SuperTabView> {
),
),
Padding(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 20),
+ padding: const EdgeInsets.fromLTRB(24, 12, 24, 16),
child: Focus(
onKeyEvent: (node, event) {
final keys = HardwareKeyboard.instance;
@@ -1118,7 +1136,7 @@ class _SuperTabViewState extends State<SuperTabView> {
border: Border.all(color: DesktopChrome.rim),
),
child: Padding(
- padding: const EdgeInsets.fromLTRB(14, 8, 8, 8),
+ padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@@ -1137,6 +1155,10 @@ class _SuperTabViewState extends State<SuperTabView> {
keyboardType: TextInputType.multiline,
style: DesktopChrome.text(),
decoration: InputDecoration(
+ isDense: true,
+ contentPadding: const EdgeInsets.symmetric(
+ vertical: 6,
+ ),
hintText: group == null
? 'Loading conversation…'
: c.canWrite
diff --git a/desktop/test/super_tab_polish_test.dart b/desktop/test/super_tab_polish_test.dart
new file mode 100644
index 000000000..4d31fc6c2
--- /dev/null
+++ b/desktop/test/super_tab_polish_test.dart
@@ -0,0 +1,402 @@
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/core/open_in_browser.dart';
+import 'package:harness/super_tabs/message_text.dart';
+import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/recording_notice.dart';
+import 'package:harness/super_tabs/view.dart';
+
+import 'support/super_tab_fixture.dart';
+
+const gapText =
+ 'Some terminal activity could not be recorded. '
+ 'Check the native session for the full conversation.';
+final longUrl =
+ 'https://github.com/example/lamp/compare/main...offline?body='
+ '${Uri.encodeComponent('Checked reconnect and local edits. ' * 40)}';
+
+void gap(ConversationServer server, {String author = 'lead-agent'}) {
+ server.append(gapText);
+ server.messages.last
+ ..['author'] = <String, dynamic>{
+ 'kind': 'agent',
+ 'id': author,
+ 'name': 'Lead',
+ }
+ ..['source'] = {'kind': 'native', 'phase': 'gap'};
+}
+
+ConversationServer polishFixture() {
+ final server = ConversationServer();
+ server.state['projects'] = [
+ projectFixture('lead', 'Lamp OS', 'lead'),
+ projectFixture(
+ 'design',
+ 'Design system',
+ 'design-lead',
+ visibility: 'private',
+ ),
+ projectFixture('long', 'claude-2026-10-20-14-13', 'long-lead'),
+ ];
+ server.state['people'] = [
+ {'id': 'owner', 'email': '[email protected]', 'role': 'owner'},
+ {'id': 'leo', 'email': '[email protected]', 'role': 'collaborator'},
+ {'id': 'daniel', 'email': '[email protected]', 'role': 'collaborator'},
+ ];
+ server.state['agents'] = [
+ for (final pair in [
+ ('lead-agent', 'Lead'),
+ ('builder', 'Builder'),
+ ('reviewer', 'Reviewer'),
+ ])
+ {
+ 'id': pair.$1,
+ 'name': pair.$2,
+ 'projectId': 'lead',
+ 'machineId': 'm',
+ 'harnessId': pair.$1,
+ 'contributorId': 'owner',
+ 'configuration': {'engine': pair.$1 == 'builder' ? 'codex' : 'claude'},
+ },
+ ];
+ (server.state['conversations'] as List)[0]
+ ..['leadId'] = 'lead-agent'
+ ..['agentIds'] = ['lead-agent'];
+ (server.state['conversations'] as List)[1]
+ ..['number'] = 12
+ ..['agentIds'] = ['lead-agent', 'builder']
+ ..['assignment'] = {'agentId': 'builder', 'status': 'working'};
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ {
+ ...conversationFixture('review', 'Reconnect review'),
+ 'number': 13,
+ 'agentIds': ['reviewer'],
+ 'assignment': {'agentId': 'reviewer', 'status': 'working'},
+ },
+ {...conversationFixture('design-lead', 'Lead'), 'projectId': 'design'},
+ {...conversationFixture('long-lead', 'Lead'), 'projectId': 'long'},
+ ]);
+ server.state['machines'] = [
+ {
+ 'machineId': 'm',
+ 'name': 'M2',
+ 'contributorId': 'owner',
+ 'engines': ['claude', 'codex'],
+ 'observation': {
+ 'receivedAt': DateTime.now().millisecondsSinceEpoch,
+ 'runningHarnessIds': ['lead-agent', 'builder', 'reviewer'],
+ 'resources': {
+ 'cpuPercent': 27,
+ 'gpuPercent': 7,
+ 'memoryTotalBytes': 64000000000,
+ 'memoryUsedBytes': 36000000000,
+ 'diskTotalBytes': 1000000000000,
+ 'diskFreeBytes': 141000000000,
+ },
+ 'quotas': [
+ for (final engine in ['claude', 'codex'])
+ {
+ 'engine': engine,
+ 'known': true,
+ 'accountName': engine,
+ 'windows': [
+ {'name': '5-hour', 'usedPercent': engine == 'claude' ? 50 : 30},
+ ],
+ },
+ ],
+ },
+ },
+ ];
+ void lead(String text) {
+ server.append(text);
+ server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'lead-agent',
+ 'name': 'Lead',
+ };
+ }
+
+ server.append('How is offline editing coming along?');
+ lead(
+ 'The implementation is ready. Builder is checking reconnects, '
+ 'and Reviewer is testing restart recovery.',
+ );
+ lead(
+ '**Progress**\n- Edits survive a restart.\n- Reconnecting syncs each edit once.\n\n'
+ 'The work is in #12; the independent review is in #13.',
+ );
+ lead('Changes ready for review: $longUrl');
+ for (var i = 0; i < 6; i++) {
+ gap(server);
+ }
+ lead('I’ll post the final result once the review finishes.');
+ return server;
+}
+
+void main() {
+ final capture = Platform.environment['HARNESS_SUPER_TAB_CAPTURE'];
+ setUpAll(() async {
+ if (capture == null || !Platform.isMacOS) return;
+ final bytes = ByteData.sublistView(
+ await File('/System/Library/Fonts/SFNS.ttf').readAsBytes(),
+ );
+ for (final family in ['.AppleSystemUIFont', 'Roboto']) {
+ await (FontLoader(family)..addFont(Future.value(bytes))).load();
+ }
+ await (FontLoader('packages/lucide_icons_flutter/Lucide400')..addFont(
+ rootBundle.load(
+ 'packages/lucide_icons_flutter/assets/build_font/LucideVariable-w400.ttf',
+ ),
+ ))
+ .load();
+ });
+
+ testWidgets(
+ 'long raw links retain their destination; labels and code stay literal',
+ (tester) async {
+ final markdown = '$longUrl\n\n[Review changes]($longUrl)\n\n`$longUrl`';
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SingleChildScrollView(child: SuperTabMessageText(markdown)),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ final links = <String>[];
+ final opened = <Uri>[];
+ final originalOpener = browserOpener;
+ browserOpener = (uri) async {
+ opened.add(uri);
+ return true;
+ };
+ addTearDown(() => browserOpener = originalOpener);
+ for (final rich in tester.widgetList<RichText>(find.byType(RichText))) {
+ rich.text.visitChildren((span) {
+ if (span is TextSpan && span.recognizer is TapGestureRecognizer) {
+ links.add(span.toPlainText());
+ (span.recognizer as TapGestureRecognizer).onTap!();
+ }
+ return true;
+ });
+ }
+ expect(links, [
+ 'github.com/example/lamp/compare/main...offline?…',
+ 'Review changes',
+ ]);
+ expect(opened.map((uri) => uri.toString()), [longUrl, longUrl]);
+ // Link destinations stay in the original Markdown; the AST label alone changes.
+ expect(
+ tester.widget<MarkdownBody>(find.byType(MarkdownBody)).data,
+ markdown,
+ );
+ expect(find.textContaining(longUrl, findRichText: true), findsWidgets);
+ expect(tester.takeException(), isNull);
+ },
+ );
+
+ testWidgets(
+ 'bare encoded links retain punctuation boundaries and explicit destinations stay authoritative',
+ (tester) async {
+ const short = 'https://example.com/a_(b)?q=one%20two&next=%252F';
+ const target = 'https://other.example/actual%2520destination';
+ final originalOpener = browserOpener;
+ final opened = <Uri>[];
+ browserOpener = (uri) async {
+ opened.add(uri);
+ return true;
+ };
+ addTearDown(() => browserOpener = originalOpener);
+ await tester.pumpWidget(
+ const MaterialApp(
+ home: Scaffold(
+ body: SuperTabMessageText(
+ '($short).\n\n[https://example.com/label]($target)\n\n`$short`\n\n```txt\n$short\n```',
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ for (final rich in tester.widgetList<RichText>(find.byType(RichText))) {
+ rich.text.visitChildren((span) {
+ if (span is TextSpan && span.recognizer is TapGestureRecognizer) {
+ (span.recognizer as TapGestureRecognizer).onTap!();
+ }
+ return true;
+ });
+ }
+ expect(opened.map((uri) => uri.toString()), [short, target]);
+ expect(tester.takeException(), isNull);
+ },
+ );
+
+ test('recording notices preserve authors, generations, chronology, replies and delivery records', () {
+ final server = ConversationServer();
+ gap(server);
+ gap(server);
+ gap(server);
+ server.append('A real update');
+ gap(server);
+ gap(server, author: 'builder');
+ gap(server, author: 'builder');
+ server.messages.last['author']['membershipGeneration'] = 2;
+ gap(server, author: 'builder');
+ server.messages.last['createdAt'] = '2026-10-19T00:00:00Z';
+ gap(server, author: 'builder');
+ server.messages.last['replyTo'] = 'message-4';
+ gap(server, author: 'builder');
+ server.messages.last['deliveries'] = [
+ {'id': 'receipt', 'status': 'uncertain'},
+ ];
+ final messages = server.messages.map(SuperTabMessage.fromJson).toList();
+ final entries = superTabTranscriptEntries(messages);
+ expect(entries.map((e) => e.interruptions), [3, 0, 1, 1, 1, 1, 0, 0]);
+ expect(entries.map((e) => e.message.id), [
+ 'message-1',
+ 'message-4',
+ 'message-5',
+ 'message-6',
+ 'message-7',
+ 'message-8',
+ 'message-9',
+ 'message-10',
+ ]);
+ expect(messages.length, 10);
+ });
+
+ for (final profile in [
+ (
+ name: 'dark',
+ brightness: Brightness.dark,
+ size: const Size(1440, 900),
+ scale: 1.0,
+ ),
+ (
+ name: 'light',
+ brightness: Brightness.light,
+ size: const Size(1280, 800),
+ scale: 1.0,
+ ),
+ (
+ name: 'large',
+ brightness: Brightness.dark,
+ size: const Size(800, 600),
+ scale: 2.0,
+ ),
+ ]) {
+ testWidgets(
+ 'Swarm navigation, resources and transcript remain usable in ${profile.name}',
+ (tester) async {
+ await tester.binding.setSurfaceSize(profile.size);
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = profile.brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ final server = polishFixture(), c = server.controller();
+ await c.refresh();
+ c.toggleProject('lead');
+ var opened = '';
+ final boundary = GlobalKey();
+ await tester.pumpWidget(
+ RepaintBoundary(
+ key: boundary,
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: profile.brightness),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context).copyWith(
+ textScaler: TextScaler.linear(profile.scale),
+ highContrast: profile.scale > 1,
+ ),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onNewProject: () {},
+ onOpenTerminal: (agent) => opened = agent.id,
+ machineName: (_) => 'M2',
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabRecordingNotice), findsOneWidget);
+ await tester.ensureVisible(find.byType(SuperTabRecordingNotice));
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Open terminal'));
+ await tester.pumpAndSettle();
+ expect(opened, 'lead-agent');
+ expect(c.messages('lead').length, 11);
+ expect(tester.takeException(), isNull);
+ Future<void> shot(String suffix) async {
+ if (capture == null) return;
+ await tester.runAsync(
+ () => precacheImage(
+ const AssetImage('assets/engine-icons/codex.png'),
+ tester.element(find.byType(SuperTabView)),
+ ),
+ );
+ await tester.pump();
+ final render =
+ boundary.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary;
+ await tester.runAsync(() async {
+ final image = await render.toImage(pixelRatio: 1.5);
+ final bytes = await image.toByteData(
+ format: ui.ImageByteFormat.png,
+ );
+ await Directory(capture).create(recursive: true);
+ await File('$capture/polish-${profile.name}$suffix.png')
+ .writeAsBytes(bytes!.buffer.asUint8List());
+ image.dispose();
+ });
+ }
+
+ await shot('');
+ if (profile.scale > 1) {
+ await tester.tap(find.byTooltip('Members and machines'));
+ await tester.pumpAndSettle();
+ await tester.ensureVisible(find.text('Machines'));
+ await tester.pumpAndSettle();
+ expect(tester.takeException(), isNull);
+ await shot('-resources');
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ await tester.tap(find.byTooltip('Conversations'));
+ await tester.pumpAndSettle();
+ await shot('-projects');
+ expect(tester.takeException(), isNull);
+ } else {
+ expect(find.text('Machines'), findsOneWidget);
+ // Resources share one scroll area, so Machines follows the roster.
+ expect(
+ tester.getTopLeft(find.text('Machines')).dy,
+ lessThan(
+ tester
+ .getBottomLeft(
+ find.byKey(const ValueKey('super-member-reviewer')),
+ )
+ .dy +
+ 60,
+ ),
+ );
+ }
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ c.dispose();
+ },
+ );
+ }
+}
diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dart
index 686d3b0c7..262870416 100644
--- a/desktop/test/super_tab_view_test.dart
+++ b/desktop/test/super_tab_view_test.dart
@@ -372,6 +372,9 @@ void main() {
)
.first,
);
+ await tester.pumpAndSettle();
+ await tester.ensureVisible(member);
+ await tester.pumpAndSettle();
await tester.tap(member);
await tester.pumpAndSettle();
expect(target?.id, 'agent-0');
diff --git a/desktop/test/swarm_projects_test.dart b/desktop/test/swarm_projects_test.dart
index b26709f3a..bc3420c2d 100644
--- a/desktop/test/swarm_projects_test.dart
+++ b/desktop/test/swarm_projects_test.dart
@@ -62,6 +62,10 @@ void main() {
await mount(tester, c, onNewProject: () => creations++);
expect(find.byKey(const ValueKey('super-group-offline')), findsNothing);
expect(find.byIcon(AppIcons.lock), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('super-project-expand-design')),
+ findsNothing,
+ );
expect(find.text('Leads'), findsNothing);
expect(find.text('Humans'), findsOneWidget);
expect(find.text('Agents'), findsOneWidget);
@@ -198,6 +202,10 @@ void main() {
expect(visibility, 'private');
expect(find.text('Private'), findsOneWidget);
expect(find.byIcon(AppIcons.lock), findsOneWidget);
+ expect(
+ find.byKey(const ValueKey('super-project-expand-design')),
+ findsNothing,
+ );
},
);