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 b1836: #2788 (#2806)
0xken158b47ddfdcd76
diff --git a/desktop/lib/super_tabs/decisions_view.dart b/desktop/lib/super_tabs/decisions_view.dartindex cb3bbac8e..c0705c992 100644--- a/desktop/lib/super_tabs/decisions_view.dart+++ b/desktop/lib/super_tabs/decisions_view.dart@@ -78,10 +78,15 @@ class SuperTabDecisionsPanel extends StatelessWidget {super.key,required this.decisions,required this.projectId,+ this.edge = false,});final SuperTabDecisions decisions;final String projectId;+ /// Ends with the chrome's rim while it shows, where the chat's list stops+ /// right under it; nothing is drawn while there are no decisions.+ final bool edge;+@overrideWidget build(BuildContext context) => ListenableBuilder(listenable: decisions,@@ -91,7 +96,7 @@ class SuperTabDecisionsPanel extends StatelessWidget {if (open.isEmpty) return const SizedBox.shrink();final shown = decisions.shownIn(projectId);final folded = shown.isEmpty;- return ConstrainedBox(+ final panel = ConstrainedBox(constraints: const BoxConstraints(maxHeight: 320),child: LaidOutListView(key: const ValueKey('super-pm-decisions'),@@ -125,6 +130,14 @@ class SuperTabDecisionsPanel extends StatelessWidget {],),);+ return edge+ ? DecoratedBox(+ decoration: BoxDecoration(+ border: Border(bottom: BorderSide(color: DesktopChrome.rim)),+ ),+ child: panel,+ )+ : panel;},);}diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex f2293b147..f7911888a 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -3624,6 +3624,14 @@ class _SuperTabViewState extends State<SuperTabView>]);// No conversation read yet: its error is the page itself, not a line over "Loading".final unread = _readsFirst && c.snapshot == null;+ // The reader's own Buddy chat shows what the PM asked them.+ final decisions = group != null && _isBuddyChat(group)+ ? ({required bool edge}) => SuperTabDecisionsPanel(+ decisions: SuperTabDecisions.of(c),+ projectId: group.projectId,+ edge: edge,+ )+ : null;return Column(children: [if (c.error != null && !unread)@@ -3640,16 +3648,28 @@ class _SuperTabViewState extends State<SuperTabView>],),),- if (group != null &&- _isBuddyChat(group) &&- !c.isEarlierBuddyChat(group))- SuperTabBuddyBar(controller: c, chat: group, app: widget.app),- // The reader's own Buddy chat shows what the PM asked them.- if (group != null && _isBuddyChat(group))- SuperTabDecisionsPanel(- decisions: SuperTabDecisions.of(c),- projectId: group.projectId,- ),+ if (group != null && decisions != null && !c.isEarlierBuddyChat(group))+ // The list stops at an edge under the Buddy's line, as it does under+ // the header: without one, a message scrolled up to the line read as+ // cut off under it (Huy, 11-03).+ DecoratedBox(+ key: const ValueKey('super-buddy-edge'),+ decoration: BoxDecoration(+ border: Border(bottom: BorderSide(color: DesktopChrome.rim)),+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ mainAxisSize: MainAxisSize.min,+ children: [+ SuperTabBuddyBar(controller: c, chat: group, app: widget.app),+ decisions(edge: false),+ ],+ ),+ )+ // An earlier Buddy chat has no Buddy line: its decisions, when it has+ // any, end at the same edge.+ else if (decisions != null)+ decisions(edge: true),Expanded(child: c.loading? const Center(child: CircularProgressIndicator())diff --git a/desktop/test/super_tab_chat_edge_test.dart b/desktop/test/super_tab_chat_edge_test.dartnew file mode 100644index 000000000..89acabcdf--- /dev/null+++ b/desktop/test/super_tab_chat_edge_test.dart@@ -0,0 +1,35 @@+import 'dart:io';+import 'dart:ui' as ui;++import 'package:flutter/rendering.dart';+import 'package:flutter_test/flutter_test.dart';++import 'box_render_preview_test.dart' show loadPreviewFonts;+import 'support/chat_edge.dart';++/// Set to a folder to write the PR's screenshots there.+final shots = Platform.environment['SUPER_TAB_CHAT_EDGE_SHOTS'];++/// The chat's edge under the Buddy line on Desktop (support/chat_edge.dart).+void main() {+ setUpAll(() async {+ if (shots != null) await loadPreviewFonts();+ });+ chatEdgeTests(+ shot: shots == null+ ? null+ : (tester, picture, name) => tester.runAsync(() async {+ final boundary =+ picture.currentContext!.findRenderObject()!+ as RenderRepaintBoundary;+ final image = await boundary.toImage(pixelRatio: 1.5);+ final bytes = await image.toByteData(+ format: ui.ImageByteFormat.png,+ );+ await Directory(shots!).create(recursive: true);+ await File('$shots/$name.png')+ .writeAsBytes(bytes!.buffer.asUint8List());+ image.dispose();+ }),+ );+}diff --git a/desktop/test/support/chat_edge.dart b/desktop/test/support/chat_edge.dartnew file mode 100644index 000000000..32f8fffe6--- /dev/null+++ b/desktop/test/support/chat_edge.dart@@ -0,0 +1,217 @@+import 'dart:typed_data';++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/view.dart';+import 'package:harness/widgets/desktop_chrome.dart';++import 'buddy_fixture.dart';+import 'super_tab_fixture.dart';++/// Takes a screenshot of [picture] named [name], for the PR.+typedef ChatEdgeShot = Future<void> Function(+ WidgetTester tester,+ GlobalKey picture,+ String name,+);++/// Huy, 11-03: in a Buddy chat, messages scrolled up to the line under the+/// header (the Buddy's engine, machine and who reads the chat) with no edge+/// between them, so a message read as cut off under that line. The list now+/// stops at a drawn edge, as it does under the header. Run on the VM+/// (Desktop) and in a browser (the web), which share the view.+void chatEdgeTests({ChatEdgeShot? shot}) {+ for (final brightness in Brightness.values) {+ testWidgets(+ 'the chat list stops at a drawn edge under the Buddy line while '+ 'scrolling (${brightness.name})',+ (tester) async {+ final picture = GlobalKey();+ final server = oneBuddySwarm();+ giveSwarmBuddy(server);+ for (var i = 1; i <= 40; i++) {+ server.append(+ 'Line $i of a long Buddy chat, long enough to wrap onto a second '+ 'line in the pane so rows are tall.',+ conversationId: 'swarm-buddy-peer',+ );+ }+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);+ await tester.binding.setSurfaceSize(const Size(1280, 800));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final c = server.controller(account: 'peer');+ await c.refresh();+ await c.select('swarm-buddy-peer');+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: brightness),+ builder: (context, child) =>+ RepaintBoundary(key: picture, child: child),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Kens-MacBook',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ expect(find.textContaining('reads all your projects'), findsOneWidget);++ // Read back part way, so a message straddles the top of the list.+ final list = find.byKey(+ PageStorageKey('super-messages-${c.tabId}-swarm-buddy-peer'),+ );+ final scroll = tester.widget<CustomScrollView>(list).controller!;+ scroll.jumpTo(scroll.position.maxScrollExtent / 2 + 30);+ await tester.pumpAndSettle();++ final bar = tester.getRect(+ find.byKey(const ValueKey('super-buddy-bar')),+ );+ final top = tester.getRect(list).top;+ // The list starts below the line and clips what scrolls past its top.+ expect(top, greaterThanOrEqualTo(bar.bottom));+ expect(+ tester.widget<CustomScrollView>(list).clipBehavior,+ Clip.hardEdge,+ );++ // Taken before the check, so the PR shows the chat before the fix too.+ await shot?.call(tester, picture, 'chat-edge-${brightness.name}');+ // And there is an edge to see, as under the header.+ await expectRimAbove(tester, picture, top, bar);++ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ },+ );+ }++ // Review of #2788: the same cause in an earlier Buddy chat, where the PM's+ // open decisions sit straight above the list with no Buddy line.+ for (final brightness in Brightness.values) {+ testWidgets('the list stops at a drawn edge under the decisions of an '+ 'earlier Buddy chat (${brightness.name})', (tester) async {+ final picture = GlobalKey();+ final server = oneBuddySwarm();+ giveSwarmBuddy(server);+ // The reader's Buddy chat in a project, from before one Buddy per Swarm.+ (server.state['conversations'] as List).add({+ ...conversationFixture('buddy-peer-lead', "peer's Buddy"),+ 'projectId': 'lead',+ 'kind': 'buddy',+ 'buddyOwnerId': 'peer',+ });+ server.ask(['Ship how?']);+ for (var i = 1; i <= 40; i++) {+ server.append(+ 'Line $i of an earlier Buddy chat, long enough to wrap onto a second '+ 'line in the pane so rows are tall.',+ conversationId: 'buddy-peer-lead',+ );+ }+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);+ await tester.binding.setSurfaceSize(const Size(1280, 800));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final c = server.controller(account: 'peer');+ await c.refresh();+ await c.select('buddy-peer-lead');+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: brightness),+ builder: (context, child) =>+ RepaintBoundary(key: picture, child: child),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Kens-MacBook',+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ expect(c.isEarlierBuddyChat(c.selected), isTrue);+ final panel = find.byKey(const ValueKey('super-pm-decisions'));+ expect(panel, findsOneWidget);++ final list = find.byKey(+ PageStorageKey('super-messages-${c.tabId}-buddy-peer-lead'),+ );+ final scroll = tester.widget<CustomScrollView>(list).controller!;+ scroll.jumpTo(scroll.position.maxScrollExtent / 2 + 30);+ await tester.pumpAndSettle();+ final decisions = tester.getRect(panel);+ final top = tester.getRect(list).top;+ expect(top, greaterThanOrEqualTo(decisions.bottom));+ await expectRimAbove(tester, picture, top, decisions);++ await tester.pumpWidget(const SizedBox());+ await c.flush();+ c.dispose();+ });+ }+}++/// The row just above the list ([top]) is the chrome's rim drawn over the+/// pane, across [span].+Future<void> expectRimAbove(+ WidgetTester tester,+ GlobalKey picture,+ double top,+ Rect span,+) async {+ final rim = DesktopChrome.rim;+ final rows = await tester.runAsync(() async {+ final boundary =+ picture.currentContext!.findRenderObject()! as RenderRepaintBoundary;+ final image = await boundary.toImage();+ final bytes = (await image.toByteData())!;+ final edge = (top - 1).floor(), pane = (top - 4).floor();+ final pairs = [+ for (var x = span.left.ceil() + 8; x < span.right.floor() - 8; x += 4)+ (+ Color(_argb(bytes, image.width, x, edge)),+ Color(_argb(bytes, image.width, x, pane)),+ ),+ ];+ image.dispose();+ return pairs;+ });+ final onRim = rows!+ .where((pair) => _near(pair.$1, Color.alphaBlend(rim, pair.$2)))+ .length;+ expect(+ onRim,+ greaterThan(rows.length * 0.9),+ reason: 'the row above the list should be the rim over the pane',+ );+}++int _argb(ByteData rgba, int width, int x, int y) {+ final at = (y * width + x) * 4;+ final r = rgba.getUint8(at),+ g = rgba.getUint8(at + 1),+ b = rgba.getUint8(at + 2),+ a = rgba.getUint8(at + 3);+ return (a << 24) | (r << 16) | (g << 8) | b;+}++/// Within a small tolerance, as a rasterizer rounds.+bool _near(Color drawn, Color expected) {+ int d(double a, double b) => ((a - b) * 255).abs().round();+ return d(drawn.r, expected.r) <= 3 &&+ d(drawn.g, expected.g) <= 3 &&+ d(drawn.b, expected.b) <= 3;+}diff --git a/desktop/test/web/super_tab_chat_edge_web_test.dart b/desktop/test/web/super_tab_chat_edge_web_test.dartnew file mode 100644index 000000000..927fa0cc6--- /dev/null+++ b/desktop/test/web/super_tab_chat_edge_web_test.dart@@ -0,0 +1,10 @@+@TestOn('browser')+library;++import 'package:flutter_test/flutter_test.dart';++import '../support/chat_edge.dart';++/// The chat's edge under the Buddy line on the web, the same view as Desktop+/// rendered by the browser (ENGINEERING.md §10).+void main() => chatEdgeTests();diff --git a/docs/plans/assets/2026-11-03-chat-edge/after-dark.png b/docs/plans/assets/2026-11-03-chat-edge/after-dark.pngnew file mode 100644index 000000000..ca5138ce9Binary files /dev/null and b/docs/plans/assets/2026-11-03-chat-edge/after-dark.png differdiff --git a/docs/plans/assets/2026-11-03-chat-edge/after-light.png b/docs/plans/assets/2026-11-03-chat-edge/after-light.pngnew file mode 100644index 000000000..b866c4e35Binary files /dev/null and b/docs/plans/assets/2026-11-03-chat-edge/after-light.png differdiff --git a/docs/plans/assets/2026-11-03-chat-edge/before-dark.png b/docs/plans/assets/2026-11-03-chat-edge/before-dark.pngnew file mode 100644index 000000000..c73a96ebaBinary files /dev/null and b/docs/plans/assets/2026-11-03-chat-edge/before-dark.png differdiff --git a/docs/plans/assets/2026-11-03-chat-edge/before-light.png b/docs/plans/assets/2026-11-03-chat-edge/before-light.pngnew file mode 100644index 000000000..d5a533e80Binary files /dev/null and b/docs/plans/assets/2026-11-03-chat-edge/before-light.png differ