The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Merge batch 11-03 b1847: #2778 (#2809)
0xken1553f94bd0cf44
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dartindex 03bde6fd0..a5211b20d 100644--- a/desktop/lib/super_tabs/message_row.dart+++ b/desktop/lib/super_tabs/message_row.dart@@ -140,15 +140,19 @@ class SuperTabMessageRow extends StatefulWidget {/// Above and below a grouped line, and below a sender's last line.static const rowPad = 6.0;- /// Compact only a few short updates. Reports and long runs retain their own- /// speaker identity, so scrolling through agent output does not lose the who.+ /// A header at least every this many rows of one run, so the chat can cut+ /// its oldest rows at a header and a page read in above regroups none of+ /// the rows shown (view.dart).+ static const groupLimit = 20;++ /// The messages that join the one above them under its header: like Slack,+ /// one sender's messages within five minutes of each other, whatever their+ /// length (Huy, 2026-11-03, #2419), up to [groupLimit] to a group.static Set<String> consecutiveUpdates(List<SuperTabMessage> messages) {final joined = <String>{};var first = 0;for (var i = 1; i < messages.length; i++) {- if (i - first < 3 &&- groupsWith(messages[i], messages[i - 1]) &&- groupsWith(messages[i], messages[first])) {+ if (i - first < groupLimit && groupsWith(messages[i], messages[i - 1])) {joined.add(messages[i].id);} else {first = i;@@ -157,21 +161,22 @@ class SuperTabMessageRow extends StatefulWidget {return joined;}- static bool groupsWith(SuperTabMessage current, SuperTabMessage? previous) {+ /// Whether [current] joins [previous]'s header: the same sender, within five+ /// minutes on the same day. In the chat, a thread reply shown there stands+ /// on its own with its Replied in thread line; [inThread], replies group.+ static bool groupsWith(+ SuperTabMessage current,+ SuperTabMessage? previous, {+ bool inThread = false,+ }) {if (previous == null ||// A message that started a session stands on its own, with its line.current.sessionRoot ||previous.sessionRoot ||- current.replyTo != null ||- previous.replyTo != null ||- current.text.length > 280 ||- previous.text.length > 280 ||- current.text.contains('\n') ||- previous.text.contains('\n') ||- current.text.contains('?') ||- previous.text.contains('?') ||- current.text.contains('?') ||- previous.text.contains('?') ||+ // An older reply keeps its quote under its own header.+ (current.replyTo != null && !current.threadReply) ||+ (previous.replyTo != null && !previous.threadReply) ||+ (!inThread && (current.threadReply || previous.threadReply)) ||current.authorId.isEmpty ||current.authorId != previous.authorId ||current.authorName != previous.authorName ||@@ -265,6 +270,50 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {);}+ /// A grouped message's time, shown at its left while it is hovered or+ /// focused, as Slack does: its hour and minute on its first line,+ /// right-aligned under the avatars above, so any time fits the gutter; the+ /// full time and date are on its tooltip and in the row's label.+ Widget? _groupedTime(BuildContext context, bool active) {+ final time = widget.message.createdAt?.toLocal();+ if (!active || time == null) return null;+ final line = SwarmType.body(context);+ final l10n = MaterialLocalizations.of(context);+ final local = TimeOfDay.fromDateTime(time);+ final hour = l10n.formatHour(+ local,+ alwaysUse24HourFormat: MediaQuery.alwaysUse24HourFormatOf(context),+ );+ return ExcludeSemantics(+ child: SizedBox(+ height: line.fontSize! * line.height!,+ child: OverflowBox(+ maxWidth:+ SuperTabMessageRow.horizontalInset ++ SuperTabMessageRow.avatarSize,+ alignment: Alignment.centerRight,+ child: Tooltip(+ message: '${l10n.formatFullDate(time)}, ${local.format(context)}',+ child: Text(+ '$hour:${l10n.formatMinute(local)}',+ key: ValueKey('super-row-time-${widget.message.id}'),+ softWrap: false,+ style: SwarmType.time(context),+ ),+ ),+ ),+ ),+ );+ }++ /// What assistive technology reads for a grouped message in place of its+ /// header: its sender and time, as a header reads them.+ String get _groupedLabel => switch (widget.message.createdAt) {+ final time? =>+ '${widget.author}, ${TimeOfDay.fromDateTime(time.toLocal()).format(context)}',+ null => widget.author,+ };+@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);@@ -324,7 +373,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {},child: Semantics(container: true,- label: widget.grouped ? widget.author : null,+ label: widget.grouped ? _groupedLabel : null,child: DecoratedBox(key: taggedYou? ValueKey('super-tagged-you-${message.id}')@@ -359,7 +408,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {width: SuperTabMessageRow.avatarSize,padding: EdgeInsets.only(top: slack),child: widget.grouped- ? null+ ? _groupedTime(context, active): ExcludeSemantics(child: Tooltip(message: _identityDetails,diff --git a/desktop/lib/super_tabs/thread_panel.dart b/desktop/lib/super_tabs/thread_panel.dartindex 01600cc35..1849ce7f0 100644--- a/desktop/lib/super_tabs/thread_panel.dart+++ b/desktop/lib/super_tabs/thread_panel.dart@@ -459,10 +459,11 @@ class _SuperTabThreadPanelState extends State<SuperTabThreadPanel> {widget.row(reply,index > 0 &&- replies[index - 1].authorId ==- reply.authorId &&- replies[index - 1].fromAgent ==- reply.fromAgent,+ SuperTabMessageRow.groupsWith(+ reply,+ replies[index - 1],+ inThread: true,+ ),),),for (final sent in pending) widget.outgoing(sent),diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex f7911888a..6b9ea12b4 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -3360,10 +3360,11 @@ class _SuperTabViewState extends State<SuperTabView>return data is SliverMultiBoxAdaptorParentData ? data.layoutOffset : null;}- /// The rows that join the one above them, without their name: runs of- /// one author's short updates, three to a group. Groups are counted from- /// the list's dividing row both ways, so a page read in above regroups- /// none of the rows already shown.+ /// The rows that join the one above them, without their name: one+ /// sender's messages within five minutes of each other, up to+ /// [SuperTabMessageRow.groupLimit] to a group. Groups are counted from the+ /// list's dividing row both ways, so a page read in above regroups none of+ /// the rows already shown.static Set<String> _joined(List<SuperTabMessage> messages,SuperTabMessage? split,@@ -3377,11 +3378,9 @@ class _SuperTabViewState extends State<SuperTabView>// oldest row.var group = [at - 1];for (var i = at - 2; i >= -1; i--) {- final newest = group.first;if (i >= 0 &&- newest - i < 3 &&- SuperTabMessageRow.groupsWith(messages[i + 1], messages[i]) &&- SuperTabMessageRow.groupsWith(messages[newest], messages[i])) {+ group.first - i < SuperTabMessageRow.groupLimit &&+ SuperTabMessageRow.groupsWith(messages[i + 1], messages[i])) {group.add(i);continue;}diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dartindex 0476a300b..a4c144cb2 100644--- a/desktop/test/super_tab_chat_test.dart+++ b/desktop/test/super_tab_chat_test.dart@@ -903,13 +903,12 @@ void main() {SuperTabMessageRow.consecutiveUpdates(server.messages.map(SuperTabMessage.fromJson).toList(),),- {'message-2', 'message-3'},+ // Like Slack, a run of any length (Huy, 2026-11-03, #2419).+ {'message-2', 'message-3', 'message-4'},);+ // A question joins too.server.messages[1]['text'] = 'Should edits survive sign-out?';- expect(SuperTabMessageRow.groupsWith(message(1), message(0)), isFalse);- expect(SuperTabMessageRow.groupsWith(message(2), message(1)), isFalse);- server.messages[1]['text'] = '保留修改?';- expect(SuperTabMessageRow.groupsWith(message(1), message(0)), isFalse);+ expect(SuperTabMessageRow.groupsWith(message(1), message(0)), isTrue);server.messages[1]['text'] = 'Second update';server.messages[1]['author'] = {'kind': 'agent',diff --git a/desktop/test/super_tab_message_grouping_test.dart b/desktop/test/super_tab_message_grouping_test.dartnew file mode 100644index 000000000..22f58145d--- /dev/null+++ b/desktop/test/super_tab_message_grouping_test.dart@@ -0,0 +1,282 @@+import 'package:flutter/gestures.dart';+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/message_row.dart';+import 'package:harness/super_tabs/model.dart';+import 'package:harness/super_tabs/thread_panel.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/super_tab_fixture.dart';++/// Huy, 2026-11-03 (#2419): like Slack, one sender's messages within five+/// minutes of each other share one header, whatever their length; a gap over+/// five minutes, another sender, a new day or a thread reply shown in the+/// chat starts a new one, and hovering a grouped message shows its time.+void main() {+ const buddy = {+ 'kind': 'agent',+ 'id': 'pm',+ 'name': 'Lead',+ 'displayName': 'River',+ };+ const ken = {'kind': 'person', 'id': 'ken', 'name': '[email protected]'};+ final start = DateTime(2026, 11, 3, 14, 0);++ SuperTabMessage message(+ int n,+ DateTime at, {+ Map<String, Object> author = buddy,+ String text = 'An update.',+ String? thread,+ bool alsoInChat = false,+ }) => SuperTabMessage.fromJson({+ 'id': 'm$n',+ 'conversationId': 'lead',+ 'sequence': n,+ 'thread': thread ?? 'm$n',+ 'replyTo': ?thread,+ if (alsoInChat) 'alsoInChat': true,+ 'text': text,+ 'attachments': <dynamic>[],+ 'createdAt': at.toUtc().toIso8601String(),+ 'author': author,+ 'deliveries': <dynamic>[],+ });++ group('the rule', () {+ test('one sender within five minutes groups at any length', () {+ final long = List.filled(40, 'A long report line.').join(' ');+ final messages = [+ message(1, start),+ message(2, start.add(const Duration(minutes: 1)), text: long),+ message(+ 3,+ start.add(const Duration(minutes: 2)),+ text: 'Findings:\n- one\n- two',+ ),+ message(4, start.add(const Duration(minutes: 3)), text: 'Merge it?'),+ message(5, start.add(const Duration(minutes: 4))),+ message(6, start.add(const Duration(minutes: 9))),+ ];+ expect(SuperTabMessageRow.consecutiveUpdates(messages), {+ 'm2',+ 'm3',+ 'm4',+ 'm5',+ 'm6',+ });+ });++ test('a long run shows its name again every twenty rows', () {+ // So the chat can cut its oldest rows at a name (view.dart).+ final messages = [+ for (var i = 0; i < 45; i++)+ message(i, start.add(Duration(seconds: 10 * i))),+ ];+ final joined = SuperTabMessageRow.consecutiveUpdates(messages);+ expect(+ [+ for (final m in messages)+ if (!joined.contains(m.id)) m.id,+ ],+ ['m0', 'm20', 'm40'],+ );+ });++ test('a gap over five minutes starts a header', () {+ final first = message(1, start);+ expect(+ SuperTabMessageRow.groupsWith(+ message(2, start.add(const Duration(minutes: 5))),+ first,+ ),+ isTrue,+ );+ expect(+ SuperTabMessageRow.groupsWith(+ message(2, start.add(const Duration(minutes: 5, seconds: 1))),+ first,+ ),+ isFalse,+ );+ });++ test('another sender between starts a header', () {+ final messages = [+ message(1, start),+ message(2, start.add(const Duration(minutes: 1)), author: ken),+ message(3, start.add(const Duration(minutes: 2))),+ ];+ expect(SuperTabMessageRow.consecutiveUpdates(messages), isEmpty);+ });++ test('a new day starts a header', () {+ final late = DateTime(2026, 11, 3, 23, 58);+ expect(+ SuperTabMessageRow.groupsWith(+ message(2, late.add(const Duration(minutes: 3))),+ message(1, late),+ ),+ isFalse,+ );+ });++ test('a thread reply shown in the chat starts a header', () {+ final root = message(1, start);+ final reply = message(+ 2,+ start.add(const Duration(minutes: 1)),+ thread: 'm1',+ alsoInChat: true,+ );+ expect(SuperTabMessageRow.groupsWith(reply, root), isFalse);+ expect(+ SuperTabMessageRow.groupsWith(+ message(3, start.add(const Duration(minutes: 2))),+ reply,+ ),+ isFalse,+ );+ });+ });++ group('on screen', () {+ /// Huy's case: three Buddy messages in two minutes, a report and a+ /// question among them, then a reply thread on the first.+ Future<ConversationServer> show(WidgetTester tester) async {+ await tester.binding.setSurfaceSize(const Size(1400, 900));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final server = ConversationServer()..threads = true;+ (server.state['agents'] as List).add({+ 'id': 'pm',+ 'projectId': 'lead',+ 'name': 'Lead',+ 'displayName': 'River',+ 'machineId': 'studio',+ 'harnessId': 'h-pm',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude', 'model': 'opus'},+ });+ (server.state['people'] as List).add({+ 'id': 'ken',+ 'email': '[email protected]',+ 'role': 'collaborator',+ });+ final now = DateTime.now().toUtc();+ void say(+ String text,+ Map<String, Object> author,+ Duration ago, {+ String? thread,+ }) {+ server.append(text);+ server.messages.last+ ..['author'] = author+ ..['createdAt'] = now.subtract(ago).toIso8601String();+ if (thread != null) {+ server.messages.last+ ..['thread'] = thread+ ..['replyTo'] = thread;+ }+ }++ say('Taken. Building it now.', buddy, const Duration(minutes: 30));+ say(+ 'Report:\n- tests pass\n- screenshots attached',+ buddy,+ const Duration(minutes: 29),+ );+ say('Shall I merge it?', buddy, const Duration(minutes: 28));+ say('First', ken, const Duration(minutes: 27), thread: 'message-1');+ say('Second', ken, const Duration(minutes: 26), thread: 'message-1');+ say('Later', ken, const Duration(minutes: 10), thread: 'message-1');+ ((server.state['conversations'] as List)[0] as Map)['leadId'] = 'pm';+ final c = server.controller();+ await c.refresh();+ addTearDown(c.dispose);+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.light),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return server;+ }++ testWidgets('three Buddy messages in two minutes share one header', (+ tester,+ ) async {+ await show(tester);+ expect(find.text('River'), findsOneWidget);+ expect(find.text('Shall I merge it?'), findsOneWidget);+ });++ testWidgets('hovering a grouped message shows its time at the left', (+ tester,+ ) async {+ final server = await show(tester);+ final time = find.byKey(const ValueKey('super-row-time-message-3'));+ expect(time, findsNothing);+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await mouse.addPointer(location: Offset.zero);+ addTearDown(mouse.removePointer);+ final body = find.text('Shall I merge it?');+ await mouse.moveTo(tester.getCenter(body));+ await tester.pumpAndSettle();+ expect(time, findsOneWidget);+ final at = DateTime.parse(server.messages[2]['createdAt'] as String)+ .toLocal();+ final context = tester.element(body);+ // Slack's short time, so every time fits the gutter on one line+ // (Merlin's test: "10:01 AM" lost its AM there); the full time and+ // date are on its tooltip and in the row's label.+ final l10n = MaterialLocalizations.of(context);+ final local = TimeOfDay.fromDateTime(at);+ expect(+ tester.widget<Text>(time).data,+ '${l10n.formatHour(local)}:${l10n.formatMinute(local)}',+ );+ expect(tester.widget<Text>(time).softWrap, isFalse);+ expect(tester.getRect(time).right, lessThan(tester.getRect(body).left));+ });++ testWidgets('a grouped message reads its sender and time, as a header '+ 'does', (tester) async {+ final semantics = tester.ensureSemantics();+ final server = await show(tester);+ final at = DateTime.parse(server.messages[2]['createdAt'] as String)+ .toLocal();+ final time = TimeOfDay.fromDateTime(at)+ .format(tester.element(find.text('Shall I merge it?')));+ expect(find.bySemanticsLabel(RegExp('^River, $time')), findsOneWidget);+ semantics.dispose();+ });++ testWidgets('the thread view groups replies by the same rule', (+ tester,+ ) async {+ await show(tester);+ await tester.tap(+ find.byKey(const ValueKey('super-thread-line-message-1')),+ );+ await tester.pumpAndSettle();+ final panel = find.byType(SuperTabThreadPanel);+ // Two replies a minute apart share a header; one 16 minutes later+ // starts its own.+ expect(+ find.descendant(of: panel, matching: find.text('ken')),+ findsNWidgets(2),+ );+ });+ });+}diff --git a/desktop/test/super_tab_new_messages_test.dart b/desktop/test/super_tab_new_messages_test.dartindex 59cc0a71c..06eedb255 100644--- a/desktop/test/super_tab_new_messages_test.dart+++ b/desktop/test/super_tab_new_messages_test.dart@@ -35,6 +35,19 @@ void _fromLead('id': 'lead-agent','name': 'Lead',};+ _spread(server);+}++/// [server]'s messages a minute apart, with six more before every third: the+/// long chat of three-message groups these tests were measured on, now that+/// one sender's messages within five minutes share one header (#2419).+void _spread(ConversationServer server) {+ for (final row in server.messages) {+ final sequence = row['sequence'] as int;+ row['createdAt'] = DateTime.utc(2026, 10, 18)+ .add(Duration(minutes: sequence + 6 * ((sequence - 1) ~/ 3)))+ .toIso8601String();+ }}void main() {@@ -42,6 +55,7 @@ void main() {WidgetTester tester,ConversationServer server,) async {+ _spread(server);final c = server.controller();await c.refresh();await tester.pumpWidget(@@ -648,7 +662,8 @@ void main() {expect(find.byKey(_jump), findsNothing);final unread = await linkedTop(tester, offlineChat(22));expect(find.byKey(_jump), findsOneWidget);- expect(unread, read);+ // Layout arithmetic differs in the last bits with the rows above.+ expect(unread, moreOrLessEquals(read, epsilon: .5));});testWidgets('the band going as the reader scrolls up to the line moves the '