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
Desktop: the Swarm chat reads like iMessage: bubbles, cards, folded messages, a pill composer (#4529) (#3563)
0xken151955d9c5a305
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.mdindex 2163e40f6..7b953b0fa 100644--- a/desktop/design/desktop-design-system.md+++ b/desktop/design/desktop-design-system.md@@ -483,19 +483,37 @@ on it (anh Dee, 2026-11-07, task #4465). Every element below follows them.lines, and two 18 faces: who asked, then who is doing it. Only while thetask waits for the reader: Decline as plain text and Accept as the bluecapsule, on the right.-- **Chat message.** A message row (`SuperTabMessageRow`) leads with a round- 28 face, then one header line: the name at 13 semibold and the time at 12- in tertiary ink (`textFaint`), nothing else; no engine mark, since colour- is only the face's. The text reads at 14 on 20 px lines (`SwarmType`).- An empty chat shows no line; only a chat that can't be read or is still- loading says so (task #4467).-- **Chat composer.** Both composers (the chat's and a thread's) are Cmd-N's- field: radius 12, a hairline (`rim`) and the faint fill (`field`). Under- the text, the paperclip on the left and, on the right, the mic beside the- round send (`SwarmSendButton`, `super_tabs/chat/send_button.dart`): a 28- circle in a 32 target, `rim` with a `textFaint` arrow while there is- nothing to send, `AppPalette.accent` with a white (`onSelection`) arrow- once there is text or a file. No @ button: an @ typed tags.+- **Chat bubbles.** A chat reads like iMessage (anh Dee's mockup,+ 2026-11-07, task #4529). Your own messages are bubbles on the right in+ `SwarmPalette.ownBubble` (#0A84FF) under white text (`onSelection`);+ everyone else's on the left in grey (`field`). Radius 18, and 4 on the+ sender's side where one sender's bubbles meet; a bubble takes at most three+ quarters of the row (`SwarmBubble`, `super_tabs/chat/bubble.dart`). Between+ you and a chat's own agent (a Buddy chat, an agent chat) there are no names+ or faces; in a group chat a speaker's name sits over their first bubble in+ 13 plain secondary ink, and their round 28 face by their last. No engine+ mark: colour is the face's. Text reads at 14 on 20 px lines (`SwarmType`).+- **Chat times.** No time in a bubble's row. A time sits centered between+ messages only after a pause of more than five minutes (`SwarmChatTime`);+ a bubble's full date and time are on its tooltip.+- **Chat cards.** A sent brief and a shipped note are compact cards+ (`SwarmChatCard`): an icon and a small label (Sent to River, Shipped), one+ title line, and one blue action (View brief, What changed) that shows the+ rest in place. Never the whole brief inline. A task's live card under its+ brief keeps its status and checks without repeating the title.+- **Long messages.** An agent's message folds after about six lines, with+ More (`SwarmFold`); a person's never does.+- **Voice.** A voice message is its own bubble with play, waveform and+ length, blue on your side; it plays only, with no words under it (anh Dee,+ 2026-11-04, again 2026-11-07).+- **Chat composer.** The chat's composer is a pill (`SwarmComposerPill`,+ radius 20, a hairline and the faint fill) holding the paperclip, the text+ and its options; beside it the mic while there is nothing to send, and the+ round send (`SwarmSendButton`, 28, blue) in its place once there is text or+ a file. A thread's box keeps its row under the text, with a grey send until+ there is something to send. No @ button: an @ typed tags.+- **Blue.** Blue is for the main action and for your own bubbles, nothing+ else.- **Decision card.** One question (`SuperTabDecisionCard`, in the Buddy chatand Notifications; the Decisions page row uses the same buttons): thequestion, `Unblocks:` line, one button per option with the recommended onediff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dartindex 0886444c5..4f256a9bb 100644--- a/desktop/lib/shared/theme/app_theme.dart+++ b/desktop/lib/shared/theme/app_theme.dart@@ -1561,9 +1561,9 @@ abstract final class AppDesktop {/// The Swarm composer's box, as the phone draws it (Huy, 11-04): the text/// [composerTop] below the top and [composerSide] in from each side, and- /// [composerRowGap] between the text and the row of actions under it. Its- /// corners are Cmd-N's field's (anh Dee, 11-07, #4467).- static const double composerRadius = 12;+ /// [composerRowGap] between the text and the row of actions under it. A+ /// rounded pill, as iMessage's (anh Dee's mockup, 11-07, #4529).+ static const double composerRadius = 20;static const double composerTop = 12;static const double composerSide = groupGap;static const double composerRowGap = 12;@@ -1580,6 +1580,29 @@ abstract final class AppDesktop {/// A chat or thread message's face: round at 28, as every other avatar/// (anh Dee, 11-07, #4467; was Slack's 36 rounded square).static const double messageAvatarSize = 28;++ /// A chat bubble's text from its edges (anh Dee's mockup, 11-07, #4529).+ static const EdgeInsets bubblePadding = EdgeInsets.symmetric(+ horizontal: 12,+ vertical: 7,+ );++ /// A chat card's content from its edges: a little more than a bubble's.+ static const EdgeInsets chatCardPadding = EdgeInsets.fromLTRB(14, 10, 14, 10);++ /// A centered chat time: a pause's room above it, its line's below.+ static const EdgeInsets chatTimePadding = EdgeInsets.only(top: 12, bottom: 4);++ /// A small line under or beside a bubble (a fold's More, a line's status)+ /// from it.+ static const double bubbleNoteGap = 4;++ /// A group chat's name over its first bubble: in from the bubble's edge as+ /// its text is, and close above it.+ static const EdgeInsets bubbleNamePadding = EdgeInsets.only(+ left: 12,+ bottom: 2,+ );static const double formWidth = 460;static const double focusWidth = 1.5;diff --git a/desktop/lib/shared/theme/swarm_palette.dart b/desktop/lib/shared/theme/swarm_palette.dartindex 1c809e1ed..4d39b15f3 100644--- a/desktop/lib/shared/theme/swarm_palette.dart+++ b/desktop/lib/shared/theme/swarm_palette.dart@@ -20,6 +20,10 @@ abstract final class SwarmPalette {/// The thin ring a Lead wears around its avatar.static final leadRing = _hsl(42, 92, 58);++ /// Your own chat bubbles, as iMessage draws them (anh Dee's mockup, 11-07): the same in light and dark, under+ /// white text.+ static const ownBubble = Color(0xFF0A84FF);}Color _hsl(double hue, double saturation, double lightness) =>diff --git a/desktop/lib/super_tabs/chat/bubble.dart b/desktop/lib/super_tabs/chat/bubble.dartnew file mode 100644index 000000000..a2ddf88c4--- /dev/null+++ b/desktop/lib/super_tabs/chat/bubble.dart@@ -0,0 +1,88 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_theme.dart' as grid;+import '../../shared/theme/swarm_palette.dart';+import '../../widgets/desktop_chrome.dart';++/// A chat message's bubble (anh Dee's mockup, 11-07, #4529): your own on the+/// right in blue under white text, everyone else's on the left in grey.+/// Radius 18, and a small corner on the sender's side where one sender's+/// bubbles meet, as iMessage joins a run. Keyed `swarm-bubble`.+class SwarmBubble extends StatelessWidget {+ const SwarmBubble({+ super.key,+ required this.own,+ this.joinsAbove = false,+ this.joinsBelow = false,+ this.tooltip,+ required this.child,+ });++ final bool own;++ /// The bubble right above, or below, is the same sender's.+ final bool joinsAbove, joinsBelow;++ /// What hovering the bubble says, such as its message's exact time.+ final String? tooltip;+ final Widget child;++ static const radius = Radius.circular(18);+ static const joined = Radius.circular(4);++ /// The text colour inside one of your own bubbles.+ static Color get ownInk => DesktopChrome.onSelection;++ BorderRadius get _corners {+ final top = joinsAbove ? joined : radius;+ final bottom = joinsBelow ? joined : radius;+ return own+ ? BorderRadius.only(+ topLeft: radius,+ bottomLeft: radius,+ topRight: top,+ bottomRight: bottom,+ )+ : BorderRadius.only(+ topRight: radius,+ bottomRight: radius,+ topLeft: top,+ bottomLeft: bottom,+ );+ }++ @override+ Widget build(BuildContext context) => switch (tooltip) {+ final tip? => Tooltip(+ message: tip,+ waitDuration: const Duration(milliseconds: 600),+ child: _bubble,+ ),+ null => _bubble,+ };++ Widget get _bubble => DecoratedBox(+ key: const ValueKey('swarm-bubble'),+ decoration: BoxDecoration(+ color: own ? SwarmPalette.ownBubble : DesktopChrome.field,+ borderRadius: _corners,+ ),+ child: Padding(padding: grid.AppDesktop.bubblePadding, child: child),+ );+}++/// Which side of the chat a message's parts sit on, for the parts drawn as+/// their own bubble, such as a voice message: blue on your side.+class SwarmBubbleSide extends InheritedWidget {+ const SwarmBubbleSide({super.key, required this.own, required super.child});++ final bool own;++ /// Whether [context] is inside one of your own messages.+ static bool ownOf(BuildContext context) =>+ context.dependOnInheritedWidgetOfExactType<SwarmBubbleSide>()?.own ??+ false;++ @override+ bool updateShouldNotify(SwarmBubbleSide old) => old.own != own;+}diff --git a/desktop/lib/super_tabs/chat/chat_card.dart b/desktop/lib/super_tabs/chat/chat_card.dartnew file mode 100644index 000000000..293ed9d63--- /dev/null+++ b/desktop/lib/super_tabs/chat/chat_card.dart@@ -0,0 +1,82 @@+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 '../swarm_type.dart';+import 'bubble.dart';+import 'chat_link.dart';++/// A compact card in the chat (anh Dee's mockup, 11-07, #4529): a sent brief,+/// a shipped note. A small [label], one [title] line and one blue [action]+/// that shows its [details] in place; never the whole text inline.+class SwarmChatCard extends StatefulWidget {+ const SwarmChatCard({+ super.key,+ required this.icon,+ required this.label,+ required this.title,+ required this.action,+ required this.details,+ });++ final IconData icon;+ final String label, title, action;+ final Widget details;++ @override+ State<SwarmChatCard> createState() => _SwarmChatCardState();+}++class _SwarmChatCardState extends State<SwarmChatCard> {+ var _open = false;++ @override+ Widget build(BuildContext context) => DecoratedBox(+ key: const ValueKey('swarm-chat-card'),+ decoration: BoxDecoration(+ color: DesktopChrome.surface,+ borderRadius: const BorderRadius.all(SwarmBubble.radius),+ border: Border.all(color: DesktopChrome.rim),+ ),+ child: Padding(+ padding: grid.AppDesktop.chatCardPadding,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Icon(+ widget.icon,+ size: AppIcons.metadataSize,+ color: DesktopChrome.muted,+ ),+ const SizedBox(width: 6),+ Text(+ widget.label,+ style: SwarmType.time(context, color: DesktopChrome.muted),+ ),+ ],+ ),+ const SizedBox(height: 2),+ Text(+ widget.title,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: SwarmType.body(context)+ .copyWith(fontWeight: FontWeight.w600),+ ),+ if (_open) ...[const SizedBox(height: 8), widget.details],+ const SizedBox(height: 6),+ SwarmChatLink(+ label: _open ? 'Hide' : widget.action,+ chevron: !_open,+ onPressed: () => setState(() => _open = !_open),+ ),+ ],+ ),+ ),+ );+}diff --git a/desktop/lib/super_tabs/chat/chat_link.dart b/desktop/lib/super_tabs/chat/chat_link.dartnew file mode 100644index 000000000..0ee66d675--- /dev/null+++ b/desktop/lib/super_tabs/chat/chat_link.dart@@ -0,0 +1,47 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_icons.dart';+import '../../widgets/desktop_chrome.dart';+import '../swarm_type.dart';++/// A chat card's or a fold's one action, as blue text (View brief, More):+/// a button the keyboard reaches with Tab and presses with Enter or Space, as+/// the pointer does with a click.+class SwarmChatLink extends StatelessWidget {+ const SwarmChatLink({+ super.key,+ required this.label,+ required this.onPressed,+ this.chevron = false,+ });++ final String label;+ final VoidCallback onPressed;++ /// A › after the words, for an action that shows more.+ final bool chevron;++ @override+ Widget build(BuildContext context) => Semantics(+ button: true,+ child: InkWell(+ onTap: onPressed,+ borderRadius: BorderRadius.circular(DesktopChrome.controlRadius),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Text(+ label,+ style: SwarmType.body(context, color: DesktopChrome.accent),+ ),+ if (chevron)+ Icon(+ AppIcons.chevronRight,+ size: AppIcons.metadataSize,+ color: DesktopChrome.accent,+ ),+ ],+ ),+ ),+ );+}diff --git a/desktop/lib/super_tabs/chat/chat_time.dart b/desktop/lib/super_tabs/chat/chat_time.dartnew file mode 100644index 000000000..28f06182a--- /dev/null+++ b/desktop/lib/super_tabs/chat/chat_time.dart@@ -0,0 +1,35 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_theme.dart' as grid;+import '../swarm_type.dart';++/// A time centered between chat messages, shown only after a pause of more+/// than [pause] (anh Dee's mockup, 11-07, #4529): the bubbles themselves carry+/// none. Keyed `swarm-chat-time-<message id>` by the list.+class SwarmChatTime extends StatelessWidget {+ const SwarmChatTime(this.time, {super.key});++ final DateTime time;++ /// The pause after which the next message gets a time above it.+ static const pause = Duration(minutes: 5);++ /// Whether [time] comes more than [pause] after [previous], on the same+ /// day: a new day has its own line.+ static bool after(DateTime? previous, DateTime? time) =>+ previous != null &&+ time != null &&+ DateUtils.isSameDay(previous.toLocal(), time.toLocal()) &&+ time.difference(previous) > pause;++ @override+ Widget build(BuildContext context) => Padding(+ padding: grid.AppDesktop.chatTimePadding,+ child: Center(+ child: Text(+ TimeOfDay.fromDateTime(time.toLocal()).format(context),+ style: SwarmType.time(context),+ ),+ ),+ );+}diff --git a/desktop/lib/super_tabs/chat/composer_pill.dart b/desktop/lib/super_tabs/chat/composer_pill.dartnew file mode 100644index 000000000..16e3410ad--- /dev/null+++ b/desktop/lib/super_tabs/chat/composer_pill.dart@@ -0,0 +1,27 @@+import 'package:flutter/material.dart';++import '../../shared/theme/app_theme.dart' as grid;+import '../../widgets/desktop_chrome.dart';++/// The chat composer's rounded pill (anh Dee's mockup, 11-07, #4529): a+/// hairline and the faint fill around the text, the paperclip and the+/// options; the mic or send sits beside it. Keyed+/// `super-message-composer-surface`.+class SwarmComposerPill extends StatelessWidget {+ const SwarmComposerPill({super.key, required this.child});++ final Widget child;++ static BoxDecoration get decoration => BoxDecoration(+ color: DesktopChrome.field,+ borderRadius: BorderRadius.circular(grid.AppDesktop.composerRadius),+ border: Border.all(color: DesktopChrome.rim),+ );++ @override+ Widget build(BuildContext context) => DecoratedBox(+ key: const ValueKey('super-message-composer-surface'),+ decoration: decoration,+ child: child,+ );+}diff --git a/desktop/lib/super_tabs/chat/fold.dart b/desktop/lib/super_tabs/chat/fold.dartnew file mode 100644index 000000000..02fc002e7--- /dev/null+++ b/desktop/lib/super_tabs/chat/fold.dart@@ -0,0 +1,145 @@+import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';++import '../../shared/theme/app_theme.dart' as grid;+import '../../widgets/desktop_chrome.dart';+import '../swarm_type.dart';+import 'chat_link.dart';++/// A long message folded after about [lines] lines, with More to read it all+/// (anh Dee's mockup, 11-07, #4529): no walls of text in the chat.+class SwarmFold extends StatefulWidget {+ const SwarmFold({super.key, this.lines = 6, required this.child});++ final int lines;+ final Widget child;++ @override+ State<SwarmFold> createState() => _SwarmFoldState();+}++class _SwarmFoldState extends State<SwarmFold> {+ var _open = false, _overflows = false;++ /// A cut message fades out over its last line or so, so no line shows cut+ /// in half above More (Mac test of #4529).+ Widget _faded(Widget clip) => !_overflows+ ? clip+ : ShaderMask(+ key: const ValueKey('swarm-fold-fade'),+ blendMode: BlendMode.dstIn,+ // Only the mask's alpha counts: opaque ink, then none.+ shaderCallback: (bounds) => LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ colors: [+ DesktopChrome.foreground,+ DesktopChrome.foreground,+ Colors.transparent,+ ],+ stops: const [0, .7, 1],+ ).createShader(bounds),+ child: clip,+ );++ void _measured(bool overflows) {+ if (overflows == _overflows || !mounted) return;+ WidgetsBinding.instance.addPostFrameCallback((_) {+ if (mounted) setState(() => _overflows = overflows);+ });+ }++ @override+ Widget build(BuildContext context) {+ if (_open) return widget.child;+ final line = SwarmType.body(context);+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ _faded(+ _FoldClip(+ height: line.fontSize! * line.height! * widget.lines,+ onMeasured: _measured,+ child: widget.child,+ ),+ ),+ if (_overflows)+ Padding(+ padding: const EdgeInsets.only(top: grid.AppDesktop.bubbleNoteGap),+ child: SwarmChatLink(+ label: 'More',+ onPressed: () => setState(() => _open = true),+ ),+ ),+ ],+ );+ }+}++/// Lays [child] out at its full height and shows at most [height] of it,+/// saying whether anything was cut.+class _FoldClip extends SingleChildRenderObjectWidget {+ const _FoldClip({+ required this.height,+ required this.onMeasured,+ required super.child,+ });++ final double height;+ final ValueChanged<bool> onMeasured;++ @override+ RenderObject createRenderObject(BuildContext context) =>+ _RenderFoldClip(height, onMeasured);++ @override+ void updateRenderObject(BuildContext context, _RenderFoldClip render) =>+ render+ ..height = height+ ..onMeasured = onMeasured;+}++class _RenderFoldClip extends RenderProxyBox {+ _RenderFoldClip(this._height, this.onMeasured);++ double _height;+ set height(double value) {+ if (value == _height) return;+ _height = value;+ markNeedsLayout();+ }++ ValueChanged<bool> onMeasured;++ @override+ void performLayout() {+ final child = this.child!;+ child.layout(+ constraints.copyWith(maxHeight: double.infinity),+ parentUsesSize: true,+ );+ final full = child.size.height;+ size = constraints.constrain(+ Size(child.size.width, full > _height ? _height : full),+ );+ onMeasured(full > _height);+ }++ @override+ void paint(PaintingContext context, Offset offset) {+ if (child!.size.height <= size.height) return super.paint(context, offset);+ layer = context.pushClipRect(+ needsCompositing,+ offset,+ Offset.zero & size,+ super.paint,+ oldLayer: layer as ClipRectLayer?,+ );+ }++ @override+ bool hitTestChildren(BoxHitTestResult result, {required Offset position}) =>+ size.contains(position) &&+ super.hitTestChildren(result, position: position);+}diff --git a/desktop/lib/super_tabs/live_card.dart b/desktop/lib/super_tabs/live_card.dartindex 4925eb61e..eaad25498 100644--- a/desktop/lib/super_tabs/live_card.dart+++ b/desktop/lib/super_tabs/live_card.dart@@ -35,8 +35,13 @@ class SuperTabLiveCard extends StatefulWidget {required this.card,required this.controller,required this.facts,+ this.titled = true,});final SuperTabConversation group;++ /// Whether a task card names its task; off under a brief's card, which+ /// already does (#4529).+ final bool titled;final SuperTabCard card;final SuperTabController controller;final SuperTabPullRequestFacts facts;@@ -133,7 +138,8 @@ class _SuperTabLiveCardState extends State<SuperTabLiveCard>// (backend commands.ts `work.check`).final passed = checks.where((c) => c['passedBy'] != null).length;return [- Text(widget.group.label, style: DesktopChrome.control(medium: true)),+ if (widget.titled)+ Text(widget.group.label, style: DesktopChrome.control(medium: true)),SuperTabCardLine([superTabCardStatus(widget.group.assignment),if (checks.isNotEmpty) '$passed of ${checks.length} checks passed',diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dartindex 4a9ac243b..2399a2622 100644--- a/desktop/lib/super_tabs/message_row.dart+++ b/desktop/lib/super_tabs/message_row.dart@@ -10,6 +10,8 @@ import '../widgets/desktop_chrome.dart';import '../widgets/engine_identity.dart';import '../widgets/finger_target.dart';import 'attachment_chips.dart';+import 'chat/bubble.dart';+import 'chat/fold.dart';import 'composer_newline.dart';import 'identity.dart';import 'identity_card.dart';@@ -62,6 +64,7 @@ class SuperTabMessageRow extends StatefulWidget {required this.author,required this.onReturnToComposer,this.card,+ this.brief,required this.receipts,this.agent,this.person,@@ -71,6 +74,8 @@ class SuperTabMessageRow extends StatefulWidget {this.quoteThreadReply = false,this.replyGone = false,this.grouped = false,+ this.joinsBelow = false,+ this.oneOnOne = false,this.onReply,this.onOpenAgent,this.onOpenReply,@@ -112,6 +117,10 @@ class SuperTabMessageRow extends StatefulWidget {/// request links; null for a plain message.final Widget? card;+ /// A card drawn in place of the message's text, such as a sent brief's:+ /// a label, one title line and its action (#4529).+ final Widget? brief;+/// The thread [message] is the root of, once it has a reply.final SuperTabThread? thread;final bool threadUnread;@@ -166,6 +175,14 @@ class SuperTabMessageRow extends StatefulWidget {/// The original [reply] would show is no longer in the conversation.final bool replyGone;final bool grouped;++ /// The row below is the same sender's, joined to this one: this bubble's+ /// lower corner meets it, and a group chat's face waits for the last.+ final bool joinsBelow;++ /// The chat has one other party (a Buddy chat, an agent chat): no names and+ /// no faces, as a one-on-one iMessage draws it.+ final bool oneOnOne;final VoidCallback? onReply, onOpenAgent;/// Follows the quote to the original, given this row so that the way back@@ -222,6 +239,12 @@ class SuperTabMessageRow extends StatefulWidget {/// Above and below a grouped line, and below a sender's last line.static const rowPad = 6.0;+ /// A bubble takes at most this share of the row (anh Dee's mockup, 11-07).+ static const bubbleShare = .75;++ /// The room between one sender's joined bubbles.+ static const joinedGap = 2.0;+/// 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).@@ -568,40 +591,38 @@ 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) {+ /// The reader's own message, a task line or proposal sent in their name+ /// too: drawn as their bubble on the right.+ bool get _own {+ final message = widget.message;+ return widget.readerId.isNotEmpty &&+ !message.fromAgent &&+ message.authorId == widget.readerId;+ }++ /// Whether the row has words for a bubble: its text, a note, an edit, or+ /// that it was deleted. A voice message is its own bubble.+ bool _bubbled(bool voiceMessage) {+ final message = widget.message;+ return message.deleted ||+ _editing != null ||+ message.terminalNote != null ||+ (message.text.isNotEmpty && !voiceMessage);+ }++ /// An agent's long message folds after about six lines, with More; a+ /// person's never does (anh Dee's mockup, 11-07, #4529).+ Widget _folded(Widget text) =>+ widget.message.fromAgent ? SwarmFold(child: text) : text;++ /// The message's full date and time, on its bubble's tooltip: the chat+ /// shows a time only after a pause.+ String get _clock {final time = widget.message.createdAt?.toLocal();- if (!active || time == null) return null;- final line = SwarmType.body(context);+ if (time == null) return widget.author;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),- ),- ),- ),- ),- );+ return '${l10n.formatFullDate(time)}, '+ '${TimeOfDay.fromDateTime(time).format(context)}';}/// What assistive technology reads for a grouped message in place of its@@ -623,20 +644,20 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {final taggedYou =widget.readerId.isNotEmpty &&message.mentions.contains(widget.readerId);- final authorStyle = SwarmType.name(context);- // A phone's author is a finger tall, 44 over its 20 px line. The gap- // above the row gives up the half that would push the name down and the- // avatar moves down with it, so both stay where they were.+ // Your own bubbles sit on the right (anh Dee's mockup, 11-07, #4529).+ final own = _own;+ // Names and faces only where more than one other party speaks.+ final faces = !widget.oneOnOne && !own;+ final named = faces && !widget.grouped;+ // A phone's name is a finger tall: the gap above gives up the half that+ // would push it down.final phone = workspaceIsCompact(context);- final finger = phone && !widget.grouped;+ final finger = phone && named;final slack = finger ? 12.0 : 0.0;- // A new sender starts a group gap down, and its name a control gap below- // that, as Slack spaces its senders (Huy, 2026-11-03). A grouped follow-up- // line keeps its tight spacing.- final above = widget.grouped ? 0.0 : grid.AppDesktop.groupGap - slack;- final headerTop = widget.grouped- ? SuperTabMessageRow.rowPad- : grid.AppDesktop.controlGap;+ // One sender's bubbles sit close; a new sender starts a group gap down.+ final above = widget.grouped+ ? SuperTabMessageRow.joinedGap+ : grid.AppDesktop.groupGap - slack;return Padding(padding: EdgeInsets.only(top: above),child: MouseRegion(@@ -673,7 +694,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {},child: Semantics(container: true,- label: widget.grouped ? _groupedLabel : null,+ label: named ? null : _groupedLabel,child: DecoratedBox(key: taggedYou? ValueKey('super-tagged-you-${message.id}')@@ -698,227 +719,317 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {padding: EdgeInsets.only(left: SuperTabMessageRow.horizontalInset,right: SuperTabMessageRow.horizontalInset,- top: headerTop,- bottom: SuperTabMessageRow.rowPad,),- child: Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Container(- width: SuperTabMessageRow.avatarSize,- padding: EdgeInsets.only(top: slack),- child: widget.grouped- ? _groupedTime(context, active)- : ExcludeSemantics(- child: switch (widget.identity) {- final identity? => SuperTabHoverCard(- facts: identity,- child: _avatar(message),- ),- null => Tooltip(- message: _identityDetails,- child: _avatar(message),+ child: LayoutBuilder(+ builder: (_, room) => Row(+ mainAxisAlignment: own+ ? MainAxisAlignment.end+ : MainAxisAlignment.start,+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ // A group chat's face sits by its sender's last+ // bubble (anh Dee's mockup, 11-07, #4529).+ if (faces) ...[+ SizedBox(+ width: SuperTabMessageRow.avatarSize,+ child: widget.joinsBelow+ ? null+ : ExcludeSemantics(+ child: switch (widget.identity) {+ final identity? => SuperTabHoverCard(+ facts: identity,+ child: _avatar(message),+ ),+ null => Tooltip(+ message: _identityDetails,+ child: _avatar(message),+ ),+ },),- },+ ),+ const SizedBox(width: SuperTabMessageRow.avatarGap),+ ],+ // A line on its way says so beside its bubble, so+ // the row keeps its height once it is confirmed.+ if (widget.headerStatus case final status?) ...[+ ConstrainedBox(+ // The room a bubble leaves: a long status+ // wraps there and never narrows the bubble.+ constraints: BoxConstraints(+ maxWidth:+ room.maxWidth *+ (1 - SuperTabMessageRow.bubbleShare) -+ 8,+ ),+ child: Padding(+ padding: const EdgeInsets.only(+ bottom: grid.AppDesktop.bubbleNoteGap,),- ),- const SizedBox(width: SuperTabMessageRow.avatarGap),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- if (!widget.grouped) ...[- Padding(- padding: const EdgeInsets.only(right: 64),- child: Wrap(- spacing: 8,- runSpacing: 4,- crossAxisAlignment:- WrapCrossAlignment.center,- children: [- // The name and the time only: colour- // is the face's (River, 11-07, #4467).- _name(authorStyle, finger),- if (widget.headerStatus- case final status?)- status- else if (message.createdAt- case final time?)- Tooltip(- message: MaterialLocalizations.of(- context,- ).formatFullDate(time.toLocal()),+ child: status,+ ),+ ),+ const SizedBox(width: 8),+ ],+ Flexible(+ child: ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth:+ room.maxWidth *+ SuperTabMessageRow.bubbleShare,+ ),+ child: SwarmBubbleSide(+ own: own,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: own+ ? CrossAxisAlignment.end+ : CrossAxisAlignment.start,+ children: [+ if (named)+ Padding(+ padding:+ grid.AppDesktop.bubbleNamePadding,+ child: Wrap(+ spacing: 8,+ crossAxisAlignment:+ WrapCrossAlignment.center,+ children: [+ _name(+ DesktopChrome.text(+ size: SwarmType.nameSize,+ height:+ SwarmType.bodyLine /+ SwarmType.nameSize,+ color: DesktopChrome.muted,+ ),+ finger,+ ),+ if (widget.thread?.askTag+ case final tag?)+ Text(+ tag,+ style: SwarmType.time(context),+ ),+ ],+ ),+ ),+ if (message.threadReply &&+ widget.onOpenThread != null)+ Padding(+ padding: const EdgeInsets.only(+ bottom: grid.AppDesktop.menuInset,+ ),+ child: SuperTabLink(+ key: ValueKey(+ 'super-thread-also-${message.id}',+ ),+ label:+ 'Replied in thread, open thread',+ onTap: widget.onOpenThread!,child: Text(- TimeOfDay.fromDateTime(- time.toLocal(),- ).format(context),- style: SwarmType.time(context),+ 'Replied in thread',+ style: DesktopChrome.metadata(),),),- if (widget.thread?.askTag case final tag?)- Text(- tag,- style: SwarmType.time(context),+ ),+ // A thread reply sits under its root, so it+ // quotes nothing; an older reply keeps its quote.+ if ((message.replyTo != null &&+ !message.threadReply) ||+ (widget.quoteThreadReply &&+ widget.reply != null))+ Padding(+ padding: const EdgeInsets.only(+ bottom: 8,+ ),+ child: SuperTabReplyPreview(+ author:+ widget.replyAuthor ??+ widget.reply?.authorName ??+ 'Earlier message',+ text: switch (widget.reply) {+ final reply? => superTabQuoteText(+ reply,+ ),+ null when widget.replyGone =>+ 'Original message removed',+ null =>+ 'Original message not loaded',+ },+ onTap: widget.onOpenReply == null+ ? null+ : () => widget.onOpenReply!(+ context,+ ),+ ),+ ),+ if (widget.brief case final brief?)+ brief+ else if (_bubbled(voiceMessage))+ SwarmBubble(+ own: own,+ tooltip: _clock,+ joinsAbove: widget.grouped,+ joinsBelow: widget.joinsBelow,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment:+ CrossAxisAlignment.start,+ children: [+ if (message.terminalNote+ case final note?)+ Padding(+ padding: const EdgeInsets.only(+ bottom: 6,+ ),+ child: Text(+ note,+ style:+ DesktopChrome.metadata(),+ ),+ ),+ if (message.deleted)+ Text(+ SuperTabMessageRow.deletedText,+ key: ValueKey(+ 'super-message-deleted-${message.id}',+ ),+ style:+ SwarmType.body(+ context,+ color:+ DesktopChrome.muted,+ ).copyWith(+ fontStyle:+ FontStyle.italic,+ ),+ )+ else if (_editing+ case final editing?)+ ConstrainedBox(+ constraints:+ const BoxConstraints(+ maxWidth: 960,+ ),+ child: _editor(+ context,+ editing,+ ),+ )+ // A voice message's text is its words, never+ // shown: it plays only (anh Dee, 2026-11-04).+ else if (message.text.isNotEmpty &&+ !voiceMessage)+ Opacity(+ opacity: widget.dimmed+ ? 0.6+ : 1,+ child: ConstrainedBox(+ constraints:+ const BoxConstraints(+ maxWidth: 960,+ ),+ child: _folded(+ SuperTabMessageText(+ message.text,+ ink: own+ ? SwarmBubble.ownInk+ : null,+ references:+ widget.references,+ onOpenGroup:+ widget.onOpenGroup,+ mentions: widget.mentions,+ addresses: widget+ .mentionAddresses,+ labels:+ widget.mentionLabels,+ taggedYou: taggedYou,+ ),+ ),+ ),+ ),+ if (message.editedAt != null &&+ !message.deleted &&+ _editing == null)+ Text(+ '(edited)',+ key: ValueKey(+ 'super-message-edited-${message.id}',+ ),+ style: SwarmType.time(+ context,+ color: own+ ? SwarmBubble.ownInk+ : null,+ ),+ ),+ ],),+ ),+ if (message.attachments.isNotEmpty &&+ !message.deleted)+ Opacity(+ opacity: widget.dimmed ? 0.6 : 1,+ child: Padding(+ padding: EdgeInsets.only(+ top:+ message.text.isEmpty ||+ voiceMessage+ ? 0+ : 8,+ ),+ child: SuperTabAttachments(+ message.attachments,+ conversationId:+ message.conversationId,+ messageId: message.id,+ ),+ ),+ ),+ if (!message.deleted) ...[+ widget.card ??+ SuperTabPullRequestLinks(+ message.text,+ ),+ if (widget.linkTarget case final resolve?)+ if (widget.onOpenLink case final open?)+ SuperTabMessageLinkPreviews(+ message.text,+ resolve: resolve,+ onOpen: open,+ ),+ SuperTabReactionBar(+ message: message,+ readerId: widget.readerId,+ nameOf:+ widget.reactorName ?? (_, id) => id,+ onReact: widget.onReact,+ ),],- ),- ),- const SizedBox(height: 4),- ],- if (message.threadReply &&- widget.onOpenThread != null)- Padding(- padding: const EdgeInsets.only(- bottom: grid.AppDesktop.menuInset,- ),- child: SuperTabLink(- key: ValueKey(- 'super-thread-also-${message.id}',- ),- label: 'Replied in thread, open thread',- onTap: widget.onOpenThread!,- child: Text(- 'Replied in thread',- style: DesktopChrome.metadata(),- ),- ),- ),- // A thread reply sits under its root, so it- // quotes nothing; an older reply keeps its quote.- if ((message.replyTo != null &&- !message.threadReply) ||- (widget.quoteThreadReply &&- widget.reply != null))- Padding(- padding: const EdgeInsets.only(bottom: 8),- child: SuperTabReplyPreview(- author:- widget.replyAuthor ??- widget.reply?.authorName ??- 'Earlier message',- text: switch (widget.reply) {- final reply? => superTabQuoteText(reply),- null when widget.replyGone =>- 'Original message removed',- null => 'Original message not loaded',- },- onTap: widget.onOpenReply == null- ? null- : () => widget.onOpenReply!(context),- ),- ),- if (message.terminalNote case final note?)- Padding(- padding: const EdgeInsets.only(bottom: 6),- child: Text(- note,- style: DesktopChrome.metadata(),- ),- ),- if (message.deleted)- Text(- SuperTabMessageRow.deletedText,- key: ValueKey(- 'super-message-deleted-${message.id}',- ),- style: SwarmType.body(- context,- color: DesktopChrome.muted,- ).copyWith(fontStyle: FontStyle.italic),- )- else if (_editing case final editing?)- ConstrainedBox(- constraints: const BoxConstraints(- maxWidth: 960,- ),- child: _editor(context, editing),- )- // A voice message's text is its words, never- // shown: it plays only (anh Dee, 2026-11-04).- else if (message.text.isNotEmpty && !voiceMessage)- Opacity(- opacity: widget.dimmed ? 0.6 : 1,- child: ConstrainedBox(- constraints: const BoxConstraints(- maxWidth: 960,- ),- child: SuperTabMessageText(- message.text,- references: widget.references,- onOpenGroup: widget.onOpenGroup,- mentions: widget.mentions,- addresses: widget.mentionAddresses,- labels: widget.mentionLabels,- taggedYou: taggedYou,- ),- ),- ),- if (message.editedAt != null &&- !message.deleted &&- _editing == null)- Text(- '(edited)',- key: ValueKey(- 'super-message-edited-${message.id}',- ),- style: SwarmType.time(context),- ),- if (message.attachments.isNotEmpty &&- !message.deleted)- Opacity(- opacity: widget.dimmed ? 0.6 : 1,- child: Padding(- padding: EdgeInsets.only(- top: message.text.isEmpty || voiceMessage- ? 0- : 8,- ),- child: SuperTabAttachments(- message.attachments,- conversationId: message.conversationId,- messageId: message.id,- ),- ),- ),- if (!message.deleted) ...[- widget.card ??- SuperTabPullRequestLinks(message.text),- if (widget.linkTarget case final resolve?)- if (widget.onOpenLink case final open?)- SuperTabMessageLinkPreviews(- message.text,- resolve: resolve,- onOpen: open,- ),- SuperTabReactionBar(- message: message,- readerId: widget.readerId,- nameOf: widget.reactorName ?? (_, id) => id,- onReact: widget.onReact,- ),- ],- if ((widget.thread, widget.onOpenThread) case (- final thread?,- final open?,- ))- SuperTabThreadLine(- key: ValueKey(- 'super-thread-line-${message.id}',- ),- thread: thread,- unread: widget.threadUnread,- tagged: widget.threadTagged,- fresh: widget.threadFresh,- onOpen: open,- member: widget.member,- trailing: widget.threadTrailing,- end: widget.threadEnd,+ if ((widget.thread, widget.onOpenThread)+ case (final thread?, final open?))+ SuperTabThreadLine(+ key: ValueKey(+ 'super-thread-line-${message.id}',+ ),+ thread: thread,+ unread: widget.threadUnread,+ tagged: widget.threadTagged,+ fresh: widget.threadFresh,+ onOpen: open,+ member: widget.member,+ trailing: widget.threadTrailing,+ end: widget.threadEnd,+ ),+ ...widget.receipts,+ ],),- ...widget.receipts,- ],+ ),+ ),),- ),- ],+ ],+ ),),),// A deleted message has nothing left to act on, and one@@ -926,7 +1037,9 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {if (!message.deleted && _editing == null)Positioned(top: 0,- right: 12,+ // Away from the bubble, so they never cover it.+ right: own ? null : 12,+ left: own ? 12 : null,child: Opacity(opacity: active ? 1 : 0,alwaysIncludeSemantics: true,diff --git a/desktop/lib/super_tabs/message_text.dart b/desktop/lib/super_tabs/message_text.dartindex 6c9e1bfa7..043b83573 100644--- a/desktop/lib/super_tabs/message_text.dart+++ b/desktop/lib/super_tabs/message_text.dart@@ -20,6 +20,7 @@ class SuperTabMessageText extends StatelessWidget {this.addresses = const {},this.labels = const {},this.taggedYou = false,+ this.ink,});final String text;final Map<int, String> references;@@ -42,6 +43,29 @@ class SuperTabMessageText extends StatelessWidget {/// takes the stronger accent in light, to stay 4.5:1 on its pill there.final bool taggedYou;+ /// The text's colour where the ground is not the page's, such as white in+ /// your own blue bubble; links take it too, underlined.+ final Color? ink;++ MarkdownStyleSheet _sheet(BuildContext context) {+ final sheet = swarmMarkdownStyleSheet(context);+ final ink = this.ink;+ if (ink == null) return sheet;+ TextStyle? inked(TextStyle? style) => style?.copyWith(color: ink);+ return sheet.copyWith(+ p: inked(sheet.p),+ listBullet: inked(sheet.listBullet),+ blockquote: inked(sheet.blockquote),+ h1: inked(sheet.h1),+ h2: inked(sheet.h2),+ h3: inked(sheet.h3),+ h4: inked(sheet.h4),+ h5: inked(sheet.h5),+ h6: inked(sheet.h6),+ a: inked(sheet.a)?.copyWith(decoration: TextDecoration.underline),+ );+ }+static Uri? webLink(String? href) {final uri = href == null ? null : Uri.tryParse(href);return uri != null &&@@ -108,7 +132,7 @@ class SuperTabMessageText extends StatelessWidget {),},paddingBuilders: {'a': _CompactLinkLabel()},- styleSheet: swarmMarkdownStyleSheet(context),+ styleSheet: _sheet(context),onTapLink: (_, href, _) {final number = href?.startsWith('workgroup:') == true? int.tryParse(href!.substring(10))diff --git a/desktop/lib/super_tabs/ship_row.dart b/desktop/lib/super_tabs/ship_row.dartindex 870421723..fbca83551 100644--- a/desktop/lib/super_tabs/ship_row.dart+++ b/desktop/lib/super_tabs/ship_row.dart@@ -1,9 +1,12 @@import 'package:flutter/material.dart';+import '../shared/theme/app_icons.dart';import '../widgets/desktop_chrome.dart';+import 'chat/chat_card.dart';import 'confetti.dart';import 'controller.dart';import 'identity.dart';+import 'message_row.dart';import 'model.dart';import 'pull_requests.dart';@@ -63,56 +66,59 @@ class _SuperTabShipRowState extends State<SuperTabShipRow> {if (snapshot?.agent(id) case final agent?)(SuperTabAvatar.agent(agent, size: 20), snapshot!.agentName(id)),]);- final line = Container(- margin: const EdgeInsets.fromLTRB(24, 12, 24, 0),- padding: const EdgeInsets.all(14),- decoration: BoxDecoration(- color: DesktopChrome.selection,- borderRadius: BorderRadius.circular(DesktopChrome.rowRadius),- border: Border.all(color: DesktopChrome.accent.withValues(alpha: .4)),+ // A compact card, as the chat draws a sent brief (anh Dee's mockup,+ // 11-07, #4529): Shipped, the title, and What changed for the rest.+ final line = Padding(+ padding: const EdgeInsets.fromLTRB(+ SuperTabMessageRow.bodyInset,+ 12,+ SuperTabMessageRow.horizontalInset,+ 0,),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- children: [- const ExcludeSemantics(- child: Text('🎉', style: TextStyle(fontSize: 20)),- ),- const SizedBox(width: 8),- Expanded(- child: Text(- 'Shipped: $title',- style: DesktopChrome.control(medium: true),- ),- ),- ],- ),- const SizedBox(height: 8),- Wrap(- spacing: 16,- runSpacing: 6,- children: [- if (requester != null)- _Credit('Requested by', [- (- SuperTabAvatar.person(requester, size: 20),- requester.shownName,+ child: Align(+ alignment: Alignment.centerLeft,+ // As wide as its words, up to a bubble's share, as a brief's card is.+ child: LayoutBuilder(+ builder: (context, room) => ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: room.maxWidth * SuperTabMessageRow.bubbleShare,+ ),+ child: SwarmChatCard(+ icon: AppIcons.circleCheck,+ label: 'Shipped',+ title: title,+ action: 'What changed',+ details: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Wrap(+ spacing: 16,+ runSpacing: 6,+ children: [+ if (requester != null)+ _Credit('Requested by', [+ (+ SuperTabAvatar.person(requester, size: 20),+ requester.shownName,+ ),+ ]),+ agents('Built by', _ids('builderIds')),+ agents('Reviewed by', _ids('reviewerIds')),+ ],),- ]),- agents('Built by', _ids('builderIds')),- agents('Reviewed by', _ids('reviewerIds')),- ],- ),- SuperTabPullRequestLinks(- _ids('pullRequests').join(' '),- repositoryUrl:- snapshot- ?.projectFor(message.conversationId)- ?.repository?['repositoryUrl']- as String?,+ SuperTabPullRequestLinks(+ _ids('pullRequests').join(' '),+ repositoryUrl:+ snapshot+ ?.projectFor(message.conversationId)+ ?.repository?['repositoryUrl']+ as String?,+ ),+ ],+ ),+ ),),- ],+ ),),);if (!_throws) return line;diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 6c5056b4b..0a0bbe4ee 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -85,6 +85,7 @@ import 'message_link_swarms.dart';import 'message_link_preview.dart';import 'message_row.dart';import 'message_receipt.dart';+import 'message_text.dart';import 'notifications.dart';import 'buddies.dart';import 'buddy_card.dart';@@ -118,6 +119,9 @@ import 'buddy_rows.dart';import 'task_groups.dart';import 'tasks_view.dart';import 'chat/agent_chat_header.dart';+import 'chat/chat_card.dart';+import 'chat/chat_time.dart';+import 'chat/composer_pill.dart';import 'chat/send_button.dart';import 'tasks/personal_tasks_pane.dart';import 'tasks/task_header.dart';@@ -3386,6 +3390,67 @@ class _SuperTabViewState extends State<SuperTabView>// height gets the squeezed row, which beats a composer that overflows.final target = _phone ? kFingerTarget : grid.AppControl.height;final row = composerRowInsets(target: target);+ // Desktop's composer is one pill row (anh Dee's mockup, 11-07, #4529):+ // the paperclip, the text, and at its end the mic while there is nothing+ // to send, send once there is.+ // The paperclip stays at the pill's start: without it no file could be+ // picked, only dropped or pasted.+ if (!_phone && voice == null) {+ return Row(+ key: const ValueKey('super-message-composer-actions'),+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ Expanded(+ child: SwarmComposerPill(+ child: Padding(+ padding: EdgeInsets.only(+ left: row.left,+ right: grid.AppDesktop.composerSide,+ ),+ child: ConstrainedBox(+ constraints: BoxConstraints(+ minHeight: grid.AppControl.heightFieldScaled,+ ),+ // A long draft keeps its buttons by its last line.+ child: Row(+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ attach,+ // One line centres on the buttons beside it.+ Expanded(+ child: ConstrainedBox(+ constraints: const BoxConstraints(+ minHeight: grid.AppControl.height,+ ),+ child: Align(+ alignment: AlignmentDirectional.centerStart,+ child: field,+ ),+ ),+ ),+ ...options,+ ],+ ),+ ),+ ),+ ),+ ),+ const SizedBox(width: grid.AppDesktop.controlGap),+ SizedBox(+ height: grid.AppControl.heightFieldScaled,+ child: Center(+ child: ListenableBuilder(+ listenable: Listenable.merge([_composer, _files]),+ builder: (context, _) =>+ _composer.text.trim().isNotEmpty || !_files.isEmpty+ ? send+ : Row(mainAxisSize: MainAxisSize.min, children: trailing),+ ),+ ),+ ),+ ],+ );+ }if (_phone && room < _phoneComposerTwoRowsFrom && voice == null) {return Padding(padding: EdgeInsets.only(@@ -3443,6 +3508,59 @@ class _SuperTabViewState extends State<SuperTabView>);}+ /// A task's brief as a card (anh Dee's mockup, 11-07, #4529): who it went+ /// to and the task's title; View brief shows the whole brief in place.+ Widget _briefCard(SuperTabConversation group, SuperTabMessage message) {+ final agentId = group.assignment?['agentId'] as String?;+ return SwarmChatCard(+ icon: AppIcons.send,+ label: agentId == null+ ? 'Brief'+ : 'Sent to ${c.snapshot!.agentName(agentId, fallback: 'its agent')}',+ title: group.title,+ action: 'View brief',+ details: SuperTabMessageText(message.text),+ );+ }++ /// A decision asked of a person, or the one made, as a card (anh Dee's+ /// mockup, 11-07, #4529): Decision or Decided, its question, and View for+ /// the rest; null for any other message.+ Widget? _decisionCard(SuperTabMessage message) {+ final kind = message.source['kind'];+ if (!_decisionKinds.contains(kind)) return null;+ final first = message.text.trim().split('\n').first;+ // "River asks dee (#12): Ship it?" reads as its question.+ final asks = kind == 'decision-asked' ? first.indexOf(': ') : -1;+ return SwarmChatCard(+ icon: AppIcons.flag,+ label: kind == 'decision-delegated' ? 'Decided' : 'Decision',+ title: asks < 0 ? first : first.substring(asks + 2),+ action: 'View',+ details: SuperTabMessageText(message.text),+ );+ }++ /// The backend's decision lines (superTabs/decisions.ts).+ static const _decisionKinds = {+ 'decision-asked',+ 'decision-delegated',+ 'decision-must-agree',+ };++ /// Whether [message] is said between the two parties of a one-on-one chat+ /// (a Buddy chat, an agent chat): the reader and that chat's own agent. Its+ /// bubble carries no name or face (#4529); a line from anyone else there,+ /// such as the PM's to the reader, keeps its name.+ bool _oneOnOne(SuperTabMessage message) =>+ switch (c.snapshot?.conversation(message.conversationId)) {+ final group? when group.isBuddyChat || group.isAgentChat =>+ message.fromAgent+ ? group.agentIds.contains(message.authorId)+ : message.authorId == c.accountId,+ _ => false,+ };+/// Whether ⋮ carries the views a wider header draws as icons.bool get _menuNamesViews =>_phone && !_devicesVisible && !_listViewHoldsThePane;@@ -4754,6 +4872,7 @@ class _SuperTabViewState extends State<SuperTabView>SuperTabOutgoing sent,Map<String, SuperTabMessage> byId, {required bool grouped,+ bool joinsBelow = false,}) {final message = _outgoingMessage(sent);final person = c.snapshot?.people@@ -4769,6 +4888,8 @@ class _SuperTabViewState extends State<SuperTabView>person: person,member: _member,grouped: grouped,+ joinsBelow: joinsBelow,+ oneOnOne: _oneOnOne(message),reply: reply,replyAuthor: reply == null ? null : _shownAuthor(c, reply),onReturnToComposer: _focus.requestFocus,@@ -4840,6 +4961,7 @@ class _SuperTabViewState extends State<SuperTabView>Map<String, SuperTabMessage> byId, {bool showReceipt = false,bool inThread = false,+ bool joinsBelow = false,}) {_index();if (SuperTabShipRow.shows(message)) {@@ -4907,6 +5029,11 @@ class _SuperTabViewState extends State<SuperTabView>'${inThread ? 'super-thread-message' : 'super-message'}-${message.id}',),message: message,+ joinsBelow: joinsBelow,+ oneOnOne: _oneOnOne(message),+ brief: card?.task == true+ ? _briefCard(group!, message)+ : _decisionCard(message),card: card == null? null: SuperTabLiveCard(@@ -4914,6 +5041,7 @@ class _SuperTabViewState extends State<SuperTabView>card: card,controller: c,facts: _facts,+ titled: !card.task,),author: _shownAuthor(c, message),// A person is found by their username, as they are tagged, and reads@@ -5451,6 +5579,12 @@ class _SuperTabViewState extends State<SuperTabView>final joined =grouped.contains(message.id) &&previous?.conversationId == message.conversationId;+ final next = index + 1 < messages.length ? messages[index + 1] : null;+ final joinsBelow =+ next != null &&+ grouped.contains(next.id) &&+ next.conversationId == message.conversationId &&+ next.id != _unread.lineAt(c.selectedId);final time = message.createdAt;return SuperTabDayMark(key: ValueKey(_rowKey(c.messageIdentity(message.id))),@@ -5464,6 +5598,11 @@ class _SuperTabViewState extends State<SuperTabView>previous?.createdAt?.toLocal(),))_date(time),+ if (time != null && SwarmChatTime.after(previous?.createdAt, time))+ SwarmChatTime(+ time,+ key: ValueKey('swarm-chat-time-${message.id}'),+ ),if (message.id == _unread.lineAt(c.selectedId))SuperTabNewMessagesLine(key: _unread.key),// The message itself is kept in place: its@@ -5481,12 +5620,14 @@ class _SuperTabViewState extends State<SuperTabView>pendingById[message.id]!,byId,grouped: joined,+ joinsBelow: joinsBelow,): _message(message,joined,byId,showReceipt: message.id == latestOwn?.id,+ joinsBelow: joinsBelow,),),),@@ -6093,14 +6234,15 @@ class _SuperTabViewState extends State<SuperTabView>return KeyEventResult.handled;},child: DecoratedBox(- key: const ValueKey('super-message-composer-surface'),- decoration: BoxDecoration(- color: DesktopChrome.field,- borderRadius: BorderRadius.circular(- grid.AppDesktop.composerRadius,- ),- border: Border.all(color: DesktopChrome.rim),- ),+ // Desktop's pill is drawn around the text alone, with+ // the mic or send beside it (#4529); a phone's box holds+ // its whole row.+ key: _phone+ ? const ValueKey('super-message-composer-surface')+ : null,+ decoration: _phone+ ? SwarmComposerPill.decoration+ : const BoxDecoration(),child: NewHarnessDropZone(attachments: _files,enabled: writable && !busy,diff --git a/desktop/lib/super_tabs/voice_bubble.dart b/desktop/lib/super_tabs/voice_bubble.dartindex 60cbe922a..03a167dae 100644--- a/desktop/lib/super_tabs/voice_bubble.dart+++ b/desktop/lib/super_tabs/voice_bubble.dart@@ -9,9 +9,11 @@ import 'package:video_player/video_player.dart';import '../core/open_in_browser.dart';import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;+import '../shared/theme/swarm_palette.dart';import '../widgets/desktop_chrome.dart';import '../widgets/finger_target.dart';import 'attachment_viewer.dart';+import 'chat/bubble.dart';import 'file_links.dart';import 'model.dart';import 'voice_length.dart';@@ -183,9 +185,12 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {? (position.inMilliseconds / length.inMilliseconds).clamp(0.0, 1.0): 0.0;final finger = workspaceIsCompact(context);+ // Your own voice message is your bubble's blue, under white ink; anyone+ // else's their grey (anh Dee's mockup, 11-07, #4529).+ final own = SwarmBubbleSide.ownOf(context);+ final ink = own ? SwarmBubble.ownInk : null;return Material(- // The file chip's fill: the bubble is the chip of a voice file.- color: DesktopChrome.foreground.withValues(alpha: .055),+ color: own ? SwarmPalette.ownBubble : DesktopChrome.field,shape: const StadiumBorder(),child: Padding(// The length ends it, a group's gap in from the bubble's round end.@@ -202,18 +207,18 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {enabled: finger,_PlayButton(key: ValueKey('super-voice-play:$id'),+ own: own,playing: playing,onPressed: _loading ? null : () => unawaited(_toggle()),),),const SizedBox(width: grid.AppDesktop.controlGap),- _Waveform(id: id, bars: voice.waveform, played: played),+ _Waveform(id: id, bars: voice.waveform, played: played, own: own),const SizedBox(width: grid.AppDesktop.controlGap),Text(superTabVoiceLength(position > Duration.zero ? position : length),- style: DesktopChrome.metadata().copyWith(- fontFeatures: const [FontFeature.tabularFigures()],- ),+ style: DesktopChrome.metadata(color: ink)+ .copyWith(fontFeatures: const [FontFeature.tabularFigures()]),),],),@@ -223,15 +228,20 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {}class _PlayButton extends StatelessWidget {- const _PlayButton({super.key, required this.playing, this.onPressed});- final bool playing;+ const _PlayButton({+ super.key,+ required this.own,+ required this.playing,+ this.onPressed,+ });+ final bool own, playing;final VoidCallback? onPressed;@overrideWidget build(BuildContext context) => Tooltip(message: playing ? 'Pause' : 'Play',child: Material(- color: DesktopChrome.accent,+ color: own ? SwarmBubble.ownInk : DesktopChrome.accent,shape: const CircleBorder(),child: InkWell(customBorder: const CircleBorder(),@@ -241,7 +251,7 @@ class _PlayButton extends StatelessWidget {child: Icon(playing ? AppIcons.pause : AppIcons.play,size: AppIcons.metadataSize,- color: DesktopChrome.onSelection,+ color: own ? SwarmPalette.ownBubble : DesktopChrome.onSelection,),),),@@ -252,10 +262,16 @@ class _PlayButton extends StatelessWidget {/// The clip's loudness, one bar per slice: the [played] fraction in the/// accent, the rest muted.class _Waveform extends StatelessWidget {- const _Waveform({required this.id, required this.bars, required this.played});+ const _Waveform({+ required this.id,+ required this.bars,+ required this.played,+ required this.own,+ });final String id;final List<int> bars;final double played;+ final bool own;/// A bar, and the gap after it, are each a list row's gap wide; the/// tallest is an icon's height, the quietest a dot.@@ -278,7 +294,11 @@ class _Waveform extends StatelessWidget {child: DecoratedBox(key: ValueKey('super-voice-bar:$id:$i'),decoration: BoxDecoration(- color: i < filled+ color: own+ ? SwarmBubble.ownInk.withValues(+ alpha: i < filled ? 1 : .55,+ )+ : i < filled? DesktopChrome.accent: DesktopChrome.muted,borderRadius: BorderRadius.circular(_bar / 2),diff --git a/desktop/test/goldens/swarm-elements-dark.png b/desktop/test/goldens/swarm-elements-dark.pngindex 72a04e510..a4d07538b 100644Binary files a/desktop/test/goldens/swarm-elements-dark.png and b/desktop/test/goldens/swarm-elements-dark.png differdiff --git a/desktop/test/goldens/swarm-elements-light.png b/desktop/test/goldens/swarm-elements-light.pngindex 36ed2b5e6..dc2b1b539 100644Binary files a/desktop/test/goldens/swarm-elements-light.png and b/desktop/test/goldens/swarm-elements-light.png differdiff --git a/desktop/test/super_tab_buddy_sessions_test.dart b/desktop/test/super_tab_buddy_sessions_test.dartindex 13e8db002..8a5113050 100644--- a/desktop/test/super_tab_buddy_sessions_test.dart+++ b/desktop/test/super_tab_buddy_sessions_test.dart@@ -1057,10 +1057,16 @@ void main() {find.byTooltip('Starts a separate Buddy session for this message'),findsOneWidget,);- // Left of the attach and send buttons, on the composer's row.+ // Inside the composer's pill, on its row (#4529).expect(tester.getRect(chatSession).right,- lessThan(tester.getRect(chatSend).left),+ lessThanOrEqualTo(+ tester+ .getRect(+ find.byKey(const ValueKey('super-message-composer-surface')),+ )+ .right,+ ),);final chatNote = find.byKey(const ValueKey('super-chat-session-note'))@@ -1097,9 +1103,17 @@ void main() {// In the chat the message stands on its own, not under the one before// it, with its session's line: found again once the pane is closed.final row = find.byKey(ValueKey('super-message-$root'));+ // Its bubble joins none above: its upper corner on your side is round.+ final bubble = tester.widget<DecoratedBox>(+ find.descendant(+ of: row,+ matching: find.byKey(const ValueKey('swarm-bubble')),+ ),+ );expect(- find.descendant(of: row, matching: find.text('You')),- findsOneWidget,+ ((bubble.decoration as BoxDecoration).borderRadius! as BorderRadius)+ .topRight,+ const Radius.circular(18),);c.closeThread();await tester.pumpAndSettle();diff --git a/desktop/test/super_tab_chat_bubbles_test.dart b/desktop/test/super_tab_chat_bubbles_test.dartnew file mode 100644index 000000000..484eeb0a2--- /dev/null+++ b/desktop/test/super_tab_chat_bubbles_test.dart@@ -0,0 +1,160 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/super_tabs/avatar_art.dart';+import 'package:harness/super_tabs/message_row.dart';+import 'package:harness/widgets/desktop_chrome.dart';++import 'super_tab_mentions_test.dart' show showView;+import 'support/super_tab_fixture.dart';++/// Task #4529 (anh Dee's mockup, 11-07): the chat reads like iMessage. Your+/// own bubbles on the right in blue, everyone else's on the left in grey,+/// radius 18 with a small corner where one sender's bubbles meet; a group chat+/// names a speaker over their first bubble and puts their face by the last.+void main() {+ const blue = Color(0xFF0A84FF);+ const pm = {'kind': 'agent', 'id': 'pm', 'name': 'Lead'};++ ConversationServer server({String chat = 'lead'}) {+ final server = ConversationServer();+ (server.state['agents'] as List).add({+ 'id': 'pm',+ 'name': 'Lead',+ 'displayName': 'River',+ 'machineId': 'mac',+ 'harnessId': 'h-pm',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude'},+ });+ void say(String text, Map<String, Object> author) {+ server.append(text, conversationId: chat);+ server.messages.last['author'] = author;+ }++ server.append('From me', conversationId: chat);+ say('First from River', pm);+ say('Second from River', pm);+ say('Last from River', pm);+ return server;+ }++ Finder bubbleOf(String text) => find.ancestor(+ of: find.text(text),+ matching: find.byKey(const ValueKey('swarm-bubble')),+ );++ BoxDecoration decorationOf(WidgetTester tester, String text) =>+ tester.widget<DecoratedBox>(bubbleOf(text).first).decoration+ as BoxDecoration;++ Finder rowOf(String text) => find.ancestor(+ of: find.text(text),+ matching: find.byType(SuperTabMessageRow),+ );++ for (final brightness in Brightness.values) {+ testWidgets('your bubble is blue on the right, theirs grey on the left, '+ 'at most three quarters wide (${brightness.name})', (tester) async {+ await showView(tester, server(), brightness: brightness);+ final mine = decorationOf(tester, 'From me');+ expect(mine.color, blue);+ final theirs = decorationOf(tester, 'First from River');+ expect(theirs.color, DesktopChrome.field);++ final row = tester.getRect(rowOf('From me'));+ final myBubble = tester.getRect(bubbleOf('From me').first);+ final theirBubble = tester.getRect(bubbleOf('First from River').first);+ expect(myBubble.center.dx, greaterThan(row.center.dx));+ expect(theirBubble.center.dx, lessThan(row.center.dx));+ for (final bubble in [myBubble, theirBubble]) {+ expect(bubble.width, lessThanOrEqualTo(row.width * .75));+ }+ });+ }++ testWidgets('one sender\'s bubbles meet at a small corner', (tester) async {+ await showView(tester, server());+ BorderRadius radius(String text) =>+ decorationOf(tester, text).borderRadius! as BorderRadius;+ const big = Radius.circular(18), small = Radius.circular(4);+ expect(radius('From me'), const BorderRadius.all(big));+ expect(+ radius('First from River'),+ const BorderRadius.only(+ topLeft: big,+ topRight: big,+ bottomRight: big,+ bottomLeft: small,+ ),+ );+ expect(+ radius('Second from River'),+ const BorderRadius.only(+ topLeft: small,+ topRight: big,+ bottomRight: big,+ bottomLeft: small,+ ),+ );+ expect(+ radius('Last from River'),+ const BorderRadius.only(+ topLeft: small,+ topRight: big,+ bottomRight: big,+ bottomLeft: big,+ ),+ );+ });++ testWidgets('a group chat names the speaker once and shows their face by '+ 'their last bubble', (tester) async {+ await showView(tester, server());+ final rows = find.byType(SuperTabMessageRow);+ expect(+ find.descendant(of: rows, matching: find.text('River')),+ findsOneWidget,+ );+ expect(+ find.descendant(+ of: rowOf('Last from River'),+ matching: find.byType(SuperTabAvatarFace),+ ),+ findsOneWidget,+ );+ for (final text in ['First from River', 'Second from River', 'From me']) {+ expect(+ find.descendant(+ of: rowOf(text),+ matching: find.byType(SuperTabAvatarFace),+ ),+ findsNothing,+ reason: text,+ );+ }+ });++ testWidgets('a chat with one other party shows no names or faces', (+ tester,+ ) async {+ final s = server(chat: 'offline');+ ((s.state['conversations'] as List)[1] as Map)+ ..['kind'] = 'buddy'+ ..['buddyOwnerId'] = 'owner'+ ..['agentIds'] = ['pm'];+ final c = await showView(tester, s);+ await c.select('offline');+ await tester.pumpAndSettle();+ final rows = find.byType(SuperTabMessageRow);+ expect(rows, findsWidgets);+ expect(+ find.descendant(of: rows, matching: find.text('River')),+ findsNothing,+ );+ expect(find.descendant(of: rows, matching: find.text('You')), findsNothing);+ expect(+ find.descendant(of: rows, matching: find.byType(SuperTabAvatarFace)),+ findsNothing,+ );+ });+}diff --git a/desktop/test/super_tab_chat_cards_test.dart b/desktop/test/super_tab_chat_cards_test.dartnew file mode 100644index 000000000..4a1c02477--- /dev/null+++ b/desktop/test/super_tab_chat_cards_test.dart@@ -0,0 +1,203 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/super_tabs/chat/chat_card.dart';+import 'package:harness/super_tabs/message_row.dart';+import 'package:harness/super_tabs/ship_row.dart';++import 'super_tab_mentions_test.dart' show showView;+import 'super_tab_ship_test.dart' show shipServer;+import 'support/super_tab_fixture.dart';++/// Task #4529 (anh Dee's mockup, 11-07): no walls of text. A sent brief or a+/// shipped note is a compact card, a label, one title line and one blue+/// action; a long agent message folds after about six lines, with More.+void main() {+ group('a sent brief', () {+ ConversationServer server() {+ final server = ConversationServer();+ (server.state['agents'] as List).add({+ 'id': 'kai',+ 'name': 'Kai',+ 'machineId': 'm',+ 'harnessId': 'kai',+ 'contributorId': 'owner',+ 'configuration': {'engine': 'claude'},+ });+ (server.state['conversations'] as List).add({+ ...conversationFixture('work', 'Friendly agent faces'),+ 'number': 12,+ 'agentIds': ['kai'],+ 'assignment': {'id': 'w', 'agentId': 'kai', 'status': 'working'},+ 'cards': {'task': 'message-1', 'pullRequests': <Object>[]},+ });+ server.append(+ 'Goal:\nGive every agent a face.\n\nChanges:\nDraw the faces.',+ conversationId: 'work',+ );+ server.messages.last['author'] = {+ 'kind': 'agent',+ 'id': 'lead',+ 'name': 'Lead',+ };+ server.messages.last['source'] = {'kind': 'system'};+ return server;+ }++ testWidgets('is a card naming who it went to and its title; View brief '+ 'shows the rest', (tester) async {+ final c = await showView(tester, server());+ await c.select('work');+ await tester.pumpAndSettle();+ final row = find.byType(SuperTabMessageRow);+ Finder inRow(String text) =>+ find.descendant(of: row, matching: find.textContaining(text));+ expect(inRow('Sent to Kai'), findsOneWidget);+ expect(inRow('Friendly agent faces'), findsOneWidget);+ expect(inRow('Give every agent a face.'), findsNothing);+ await tester.tap(inRow('View brief'));+ await tester.pumpAndSettle();+ expect(inRow('Give every agent a face.'), findsOneWidget);+ });+ });++ group('a shipped note', () {+ testWidgets('is a card: Shipped, its title and What changed, which shows '+ 'its pull requests and credits', (tester) async {+ await showView(tester, shipServer());+ final ship = find.byType(SuperTabShipRow);+ Finder inCard(String text) =>+ find.descendant(of: ship, matching: find.text(text));+ expect(inCard('Shipped'), findsOneWidget);+ expect(inCard('Avatars'), findsOneWidget);+ expect(inCard('Built by'), findsNothing);+ await tester.tap(inCard('What changed'));+ await tester.pumpAndSettle();+ expect(inCard('Built by'), findsOneWidget);+ expect(inCard('app · PR #7'), findsOneWidget);+ });++ testWidgets('is as wide as its words, as a brief\'s card is', (+ tester,+ ) async {+ await showView(tester, shipServer());+ final ship = find.byType(SuperTabShipRow);+ final card = tester.getRect(+ find.descendant(+ of: ship,+ matching: find.byKey(const ValueKey('swarm-chat-card')),+ ),+ );+ expect(card.width, lessThan(tester.getSize(ship).width / 2));+ });+ });++ group('a long message', () {+ final long = [for (var i = 1; i <= 14; i++) 'Line $i of the plan.']+ .join('\n\n');++ testWidgets('from an agent folds after about six lines, with More', (+ tester,+ ) async {+ final server = ConversationServer()..append(long, agent: true);+ await showView(tester, server);+ expect(find.text('More'), findsOneWidget);+ expect(find.text('Line 14 of the plan.').hitTestable(), findsNothing);+ await tester.tap(find.text('More'));+ await tester.pumpAndSettle();+ expect(find.text('More'), findsNothing);+ expect(find.text('Line 14 of the plan.').hitTestable(), findsOneWidget);+ });++ testWidgets('fades out above More, so no line shows cut in half', (+ tester,+ ) async {+ final server = ConversationServer()..append(long, agent: true);+ await showView(tester, server);+ final fade = find.byKey(const ValueKey('swarm-fold-fade'));+ expect(fade, findsOneWidget);+ expect(+ tester.getBottomLeft(fade).dy,+ lessThanOrEqualTo(tester.getTopLeft(find.text('More')).dy),+ );+ await tester.tap(find.text('More'));+ await tester.pumpAndSettle();+ expect(fade, findsNothing);+ });++ testWidgets('from a person is never folded', (tester) async {+ final server = ConversationServer()..append(long);+ await showView(tester, server);+ expect(find.text('More'), findsNothing);+ });+ });++ group('a decision', () {+ testWidgets('is a card: Decision, its question, and View for the rest', (+ tester,+ ) async {+ final server = ConversationServer();+ server.append(+ 'River asks owner (#12): Ship it tonight?\n\nOptions: Yes, No\n',+ agent: true,+ );+ server.messages.last['source'] = {+ 'kind': 'decision-asked',+ 'decisionId': 'd1',+ };+ await showView(tester, server);+ final row = find.byType(SuperTabMessageRow);+ Finder inRow(String text) =>+ find.descendant(of: row, matching: find.textContaining(text));+ expect(inRow('Decision'), findsOneWidget);+ expect(inRow('Ship it tonight?'), findsOneWidget);+ expect(inRow('Options: Yes, No'), findsNothing);+ await tester.tap(inRow('View'));+ await tester.pumpAndSettle();+ expect(inRow('Options: Yes, No'), findsOneWidget);+ });+ });++ group('by keyboard', () {+ /// Focuses the control drawing [label] and presses Enter on it.+ Future<void> press(WidgetTester tester, String label) async {+ Focus.of(tester.element(find.text(label))).requestFocus();+ await tester.pump();+ expect(+ Focus.of(tester.element(find.text(label))).hasPrimaryFocus,+ isTrue,+ reason: '$label takes focus',+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ }++ testWidgets('View brief opens with Enter', (tester) async {+ await tester.pumpWidget(+ MaterialApp(+ home: Scaffold(+ body: SwarmChatCard(+ icon: Icons.send,+ label: 'Sent to Kai',+ title: 'Faces',+ action: 'View brief',+ details: const Text('Give every agent a face.'),+ ),+ ),+ ),+ );+ await press(tester, 'View brief');+ expect(find.text('Give every agent a face.'), findsOneWidget);+ });++ testWidgets('More opens with Enter', (tester) async {+ final long = [for (var i = 1; i <= 14; i++) 'Line $i of the plan.']+ .join('\n\n');+ final server = ConversationServer()..append(long, agent: true);+ await showView(tester, server);+ await press(tester, 'More');+ expect(find.text('More'), findsNothing);+ expect(find.text('Line 14 of the plan.').hitTestable(), findsOneWidget);+ });+ });+}diff --git a/desktop/test/super_tab_chat_pill_test.dart b/desktop/test/super_tab_chat_pill_test.dartnew file mode 100644index 000000000..24183c023--- /dev/null+++ b/desktop/test/super_tab_chat_pill_test.dart@@ -0,0 +1,85 @@+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/controller.dart';+import 'package:harness/super_tabs/view.dart';++import 'support/fake_voice_recorder.dart';+import 'support/super_tab_fixture.dart';++/// Task #4529 (anh Dee's mockup, 11-07): the composer is a rounded pill+/// holding the text, and beside it the mic while there is nothing to send;+/// send takes the mic's place once there is. The paperclip stays at the+/// pill's start, so a file can still be picked.+void main() {+ Finder key(String value) => find.byKey(ValueKey(value));++ Future<SuperTabController> show(+ WidgetTester tester,+ Brightness brightness,+ ) async {+ final c = ConversationServer().controller();+ addTearDown(c.dispose);+ await c.refresh();+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = Brightness.light);+ await tester.binding.setSurfaceSize(const Size(1280, 720));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: brightness),+ home: Scaffold(+ body: SuperTabView(+ controller: c,+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ voiceRecorder: FakeVoiceRecorder.new,+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return c;+ }++ for (final brightness in Brightness.values) {+ testWidgets('a pill of text, the mic or send beside it '+ '(${brightness.name})', (tester) async {+ final c = await show(tester, brightness);+ const surface = 'super-message-composer-surface';+ final box = tester.widget<DecoratedBox>(key(surface)).decoration;+ expect(+ (box as BoxDecoration).borderRadius,+ BorderRadius.circular(grid.AppDesktop.composerRadius),+ );+ expect(grid.AppDesktop.composerRadius, 20);+ final pill = tester.getRect(key(surface));+ final field = tester.getRect(key('super-message-composer'));+ final mic = tester.getRect(key('super-composer-mic'));+ final attach = tester.getRect(+ find.descendant(of: key(surface), matching: key('new-harness-attach')),+ );+ expect(attach.right, lessThanOrEqualTo(field.left));+ // The text inside the pill, the mic outside it on the same line.+ expect(pill.contains(field.center), isTrue);+ expect(mic.left, greaterThanOrEqualTo(pill.right));+ expect(mic.center.dy, closeTo(pill.center.dy, 2));+ expect(find.byTooltip('Send message'), findsNothing);++ await tester.enterText(key('super-message-composer'), 'Ship it');+ await tester.pump();+ expect(find.byTooltip('Send message'), findsOneWidget);+ expect(key('super-composer-mic'), findsNothing);++ await tester.enterText(key('super-message-composer'), '');+ await tester.pump();+ expect(key('super-composer-mic'), findsOneWidget);+ expect(find.byTooltip('Send message'), findsNothing);+ // The draft's save waits on a timer: let it run.+ await tester.pumpWidget(const SizedBox());+ await c.flush();+ });+ }+}diff --git a/desktop/test/super_tab_chat_quiet_test.dart b/desktop/test/super_tab_chat_quiet_test.dartindex 4b8ec6699..1a40a7b58 100644--- a/desktop/test/super_tab_chat_quiet_test.dart+++ b/desktop/test/super_tab_chat_quiet_test.dart@@ -62,7 +62,8 @@ void main() {of: find.byType(SuperTabMessageRow),matching: find.byType(SuperTabAvatarFace),);- expect(faces, findsNWidgets(4));+ // Your own bubble wears no face; one sender's run, one face (#4529).+ expect(faces, findsWidgets);for (final face in faces.evaluate()) {final widget = face.widget as SuperTabAvatarFace;expect(widget.radius, isNull, reason: 'round, not a rounded square');@@ -97,7 +98,10 @@ void main() {void expectField(WidgetTester tester, String surface) {final box = tester.widget<DecoratedBox>(key(surface));final decoration = box.decoration as BoxDecoration;- expect(decoration.borderRadius, BorderRadius.circular(12));+ expect(+ decoration.borderRadius,+ BorderRadius.circular(grid.AppDesktop.composerRadius),+ );expect(decoration.border, Border.all(color: DesktopChrome.rim));expect(decoration.color, DesktopChrome.field);expect(@@ -122,23 +126,24 @@ void main() {);const surface = 'super-message-composer-surface';expectField(tester, surface);- expectNeutral(sendFill(tester, surface));+ // Nothing to send: no send at all, the mic's place (#4529).+ expect(key('swarm-send-fill'), findsNothing);// Only the paperclip on the left; @ still tags when typed (River, 11-07).expect(key('super-composer-tag'), findsNothing);await tester.enterText(key('super-message-composer'), 'Ship it');await tester.pump();- expectBlue(sendFill(tester, surface));+ expectBlue(sendFill(tester, 'super-message-composer-actions'));await tester.enterText(key('super-message-composer'), '');await tester.pump();- expectNeutral(sendFill(tester, surface));+ expect(key('swarm-send-fill'), findsNothing);c.attachments('lead').add([HarnessAttachment('a.png', Uint8List.fromList([1, 2, 3])),]);await tester.pump();- expectBlue(sendFill(tester, surface));+ expectBlue(sendFill(tester, 'super-message-composer-actions'));c.attachments('lead').clear();// The typed draft's save waits on a timer: let it run.await tester.pumpWidget(const SizedBox());diff --git a/desktop/test/super_tab_chat_times_test.dart b/desktop/test/super_tab_chat_times_test.dartnew file mode 100644index 000000000..cc0ca3d0e--- /dev/null+++ b/desktop/test/super_tab_chat_times_test.dart@@ -0,0 +1,74 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/super_tabs/message_row.dart';++import 'super_tab_mentions_test.dart' show showView;+import 'support/super_tab_fixture.dart';++/// Task #4529 (anh Dee's mockup, 11-07): no time in a bubble's row. A time+/// sits centered between messages only after a pause of more than about five+/// minutes; a bubble's exact time is on its tooltip.+void main() {+ ConversationServer server() {+ final server = ConversationServer();+ final now = DateTime.now().toUtc();+ for (final (text, minutesAgo) in [+ ('First', 30),+ ('Two minutes on', 28),+ ('After a pause', 10),+ ]) {+ server.append(text);+ server.messages.last['createdAt'] = now+ .subtract(Duration(minutes: minutesAgo))+ .toIso8601String();+ }+ return server;+ }++ Finder time(String id) => find.byKey(ValueKey('swarm-chat-time-$id'));++ testWidgets('a time sits centered only after a pause over five minutes', (+ tester,+ ) async {+ await showView(tester, server());+ expect(time('message-1'), findsNothing);+ expect(time('message-2'), findsNothing);+ expect(time('message-3'), findsOneWidget);+ final row = tester.getRect(+ find.ancestor(+ of: find.text('After a pause'),+ matching: find.byType(SuperTabMessageRow),+ ),+ );+ expect(tester.getCenter(time('message-3')).dx, closeTo(row.center.dx, 1));+ expect(+ tester.getBottomLeft(time('message-3')).dy,+ lessThanOrEqualTo(row.top),+ );+ // No row carries a time of its own.+ expect(+ find.descendant(+ of: find.byType(SuperTabMessageRow),+ matching: find.textContaining(RegExp(r'^\d{1,2}:\d\d')),+ ),+ findsNothing,+ );+ });++ testWidgets('a bubble\'s exact time is on its tooltip', (tester) async {+ final s = server();+ await showView(tester, s);+ final at = DateTime.parse(s.messages[1]['createdAt'] as String).toLocal();+ final context = tester.element(find.text('Two minutes on'));+ final clock = TimeOfDay.fromDateTime(at).format(context);+ final tip = tester.widget<Tooltip>(+ find+ .ancestor(+ of: find.text('Two minutes on'),+ matching: find.byType(Tooltip),+ )+ .first,+ );+ expect(tip.message, contains(clock));+ });+}diff --git a/desktop/test/super_tab_composer_chips_bottom_test.dart b/desktop/test/super_tab_composer_chips_bottom_test.dartindex d922023fa..cc2d52a77 100644--- a/desktop/test/super_tab_composer_chips_bottom_test.dart+++ b/desktop/test/super_tab_composer_chips_bottom_test.dart@@ -136,27 +136,21 @@ void main() {('one line', 'Check the release notes.'),('five lines', fiveLines),]) {- testWidgets('$lines: the chips stay on one row under the last line, '- 'send at the bottom-right', (tester) async {+ testWidgets('$lines: the chips sit in the pill by the last line, send '+ 'beside the pill at its bottom (#4529)', (tester) async {await show(tester);final box = field(thread: false);await type(tester, box, text);final line = lastLine(tester, box);- final row = tester.getRect(chips.last);- for (final chip in chips) {+ final pill = tester.getRect(surface);+ for (final chip in chips.take(2)) {final rect = tester.getRect(chip);- expect(rect.top, greaterThanOrEqualTo(line.bottom), reason: '$chip');- expect((rect.center.dy - row.center.dy).abs(), lessThan(1));- expect(- rect.bottom,- lessThanOrEqualTo(tester.getRect(surface).bottom),- );+ expect(rect.bottom, lessThanOrEqualTo(pill.bottom), reason: '$chip');+ expect(rect.bottom, greaterThanOrEqualTo(line.bottom - 1));}- expect(row.right, greaterThan(tester.getRect(surface).right - 16));- expect(- tester.getRect(surface).bottom - row.bottom,- lessThanOrEqualTo(16),- );+ final send = tester.getRect(chips.last);+ expect(send.left, greaterThanOrEqualTo(pill.right));+ expect((send.bottom - pill.bottom).abs(), lessThanOrEqualTo(4));});}});diff --git a/desktop/test/super_tab_composer_layout_test.dart b/desktop/test/super_tab_composer_layout_test.dartindex d757a17e2..02671ce7a 100644--- a/desktop/test/super_tab_composer_layout_test.dart+++ b/desktop/test/super_tab_composer_layout_test.dart@@ -34,9 +34,9 @@ void main() {for (final brightness in Brightness.values) {for (final scale in [1.0, 2.0]) {- // Huy and Scholes, 11-04: the text has its own line above the row of- // actions, as on the phone; the caret and the hint centre on it.- testWidgets('composer text sits on its line above the actions in '+ // anh Dee's mockup (11-07, #4529): the text sits in its pill, the mic or+ // send beside it; the caret and the hint centre on its line.+ testWidgets('composer text sits on its line inside the pill in ''${brightness.name} at ${scale}x', (tester) async {final previousBrightness = grid.AppTheme.brightness.value;grid.AppTheme.brightness.value = brightness;@@ -117,12 +117,8 @@ void main() {});}debugPrint('Composer $name: ${measurements[name]}');- final actions = tester.getRect(- find.byKey(const ValueKey('super-message-composer-actions')),- );- expect(editableRect.top, greaterThan(rect.top));- expect(editableRect.bottom, lessThanOrEqualTo(actions.top));- expect(actions.bottom, lessThanOrEqualTo(rect.bottom));+ expect(editableRect.top, greaterThanOrEqualTo(rect.top));+ expect(editableRect.bottom, lessThanOrEqualTo(rect.bottom));expect(caret.center.dy, closeTo(editableRect.center.dy, .75));if (name == 'empty') {expect(diff --git a/desktop/test/super_tab_composer_mic_test.dart b/desktop/test/super_tab_composer_mic_test.dartindex 206d6f7b9..83d5554f5 100644--- a/desktop/test/super_tab_composer_mic_test.dart+++ b/desktop/test/super_tab_composer_mic_test.dart@@ -30,17 +30,13 @@ void main() {/// The refused line's words sit a gap below the row, as any line under a/// composer's buttons does (Alder2878's review of 83e32f41a).- void expectGapUnder(WidgetTester tester, Finder send) {+ void expectGapUnder(WidgetTester tester, Finder send, {double inset = 0}) {final words = tester.getRect(find.textContaining("Harness can't use the microphone"),);expect(words.top - tester.getRect(send).bottom,- greaterThanOrEqualTo(- composerRowInsets(target: grid.AppControl.height).bottom +- grid.AppDesktop.controlGap -- 0.5,- ),+ greaterThanOrEqualTo(inset + grid.AppDesktop.controlGap - 0.5),);}@@ -177,7 +173,9 @@ void main() {find.textContaining("Harness can't use the microphone"),findsOneWidget,);- expectGapUnder(tester, find.byTooltip('Send message'));+ // The chat's pill has its buttons beside it, so the gap is under the+ // pill (#4529).+ expectGapUnder(tester, key('super-message-composer-surface'));await tester.tap(key('super-voice-settings'));expect(opened, [superTabMicrophoneSettings]);await close(tester);@@ -219,7 +217,11 @@ void main() {await tester.tap(key('super-thread-mic'));await tester.pumpAndSettle();expect(key('super-voice-refused'), findsOneWidget);- expectGapUnder(tester, key('super-thread-send'));+ expectGapUnder(+ tester,+ key('super-thread-send'),+ inset: composerRowInsets(target: grid.AppControl.height).bottom,+ );await close(tester);});diff --git a/desktop/test/super_tab_composer_padding_test.dart b/desktop/test/super_tab_composer_padding_test.dartindex e8db42865..b8e6418ac 100644--- a/desktop/test/super_tab_composer_padding_test.dart+++ b/desktop/test/super_tab_composer_padding_test.dart@@ -15,7 +15,8 @@ import 'support/super_tab_fixture.dart';/// the bottom as the text sits down from the top, and the corners are Cmd-N's/// field's (anh Dee, 11-07, #4467).void main() {- const top = 12.0, side = 16.0, rowGap = 12.0, radius = 12.0;+ const top = 12.0, side = 16.0, rowGap = 12.0;+ const radius = grid.AppDesktop.composerRadius;ConversationServer buddyChat() {final server = ConversationServer()..threads = true;@@ -59,7 +60,9 @@ void main() {tester.getRect(find.descendant(of: button, matching: find.byIcon(icon)));for (final brightness in Brightness.values) {- for (final scene in ['chat', 'thread', 'web-phone']) {+ // The chat's own composer is a pill now, at any width (#4529,+ // super_tab_chat_pill_test.dart); the thread's box keeps this.+ for (final scene in ['thread']) {testWidgets('the $scene composer has room inside its box ''(${brightness.name})', (tester) async {final thread = scene == 'thread', phone = scene == 'web-phone';diff --git a/desktop/test/super_tab_composer_row_test.dart b/desktop/test/super_tab_composer_row_test.dartindex 9315efb72..e1e0450e2 100644--- a/desktop/test/super_tab_composer_row_test.dart+++ b/desktop/test/super_tab_composer_row_test.dart@@ -119,38 +119,23 @@ void main() {Finder send() => find.byTooltip('Send message');testWidgets(- 'holds the paperclip and New session under the text, and send at '- 'the row\'s right end',+ 'holds the paperclip and New session in the pill on the text\'s line, '+ 'and send beside the pill (#4529)',(tester) async {await show(tester);- for (final text in ['One line', fiveLines]) {- await tester.enterText(key('super-message-composer'), text);- await tester.pumpAndSettle();- final field = tester.getRect(key('super-message-composer'));- final surface = tester.getRect(key('super-message-composer-surface'));- final plus = tester.getRect(attach());- final session = tester.getRect(key('super-chat-new-session'));- final arrow = tester.getRect(send());- expect(key('super-message-composer-actions'), findsOneWidget);- for (final button in [plus, session, arrow]) {- expect(- button.top,- greaterThanOrEqualTo(field.bottom),- reason: text,- );- }- expect(plus.left, lessThan(session.left));- expect(session.right, lessThan(arrow.left));- // Send keeps the box's bottom-right corner however long the message- // (Scholes, 11-03), the box's inset from its edges.- expect(- surface.right - arrow.right,- lessThanOrEqualTo(grid.AppDesktop.groupGap),- );- expect(- surface.bottom - arrow.bottom,- lessThanOrEqualTo(grid.AppDesktop.groupGap),- );+ await tester.enterText(key('super-message-composer'), 'One line');+ await tester.pumpAndSettle();+ final field = tester.getRect(key('super-message-composer'));+ final surface = tester.getRect(key('super-message-composer-surface'));+ final plus = tester.getRect(attach());+ final session = tester.getRect(key('super-chat-new-session'));+ final arrow = tester.getRect(send());+ expect(plus.right, lessThanOrEqualTo(field.left));+ expect(session.left, greaterThanOrEqualTo(field.right));+ expect(session.right, lessThanOrEqualTo(surface.right));+ expect(arrow.left, greaterThanOrEqualTo(surface.right));+ for (final button in [plus, session, arrow]) {+ expect(button.center.dy, closeTo(field.center.dy, 4));}expect(find.descendant(@@ -171,15 +156,17 @@ void main() {expect(key('super-thread-also-send'), findsNothing);});- testWidgets('puts the mic left of send, and a click starts a take for the '- 'chat', (tester) async {+ testWidgets('puts the mic where send goes while there is nothing to '+ 'send, and a click starts a take for the chat', (tester) async {final recorder = FakeVoiceRecorder();await show(tester, recorder: recorder);final mic = tester.getRect(key('super-composer-mic'));- expect(mic.right, lessThanOrEqualTo(tester.getRect(send()).left));+ expect(send(), findsNothing);expect(mic.left,- greaterThan(tester.getRect(key('super-chat-new-session')).right),+ greaterThanOrEqualTo(+ tester.getRect(key('super-message-composer-surface')).right,+ ),);await tester.tap(key('super-composer-mic'));await tester.pump();@@ -209,28 +196,32 @@ void main() {expect(field.controller!.text.length, greaterThan(4));});- testWidgets(- 'Tab goes from the text to the paperclip, New session, the mic and '- 'send, in the row\'s order',- (tester) async {- await show(tester, recorder: FakeVoiceRecorder());- await tester.enterText(key('super-message-composer'), 'Ready');+ testWidgets('Tab goes from the text to New session and send, in the row\'s '+ 'order; the paperclip is the stop before the text', (tester) async {+ await show(tester, recorder: FakeVoiceRecorder());+ await tester.enterText(key('super-message-composer'), 'Ready');+ await tester.pump();+ expect(focusedIn(tester, key('super-message-composer')), isTrue);+ // With text, send stands in the mic's place.+ for (final next in [key('super-chat-new-session'), send()]) {+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);await tester.pump();- expect(focusedIn(tester, key('super-message-composer')), isTrue);- for (final next in [- attach(),- key('super-chat-new-session'),- key('super-composer-mic'),- send(),- ]) {- await tester.sendKeyEvent(LogicalKeyboardKey.tab);- await tester.pump();- expect(focusedIn(tester, next), isTrue, reason: '$next');- }- // The draft's save runs out.- await tester.pump(const Duration(seconds: 1));- },- );+ expect(focusedIn(tester, next), isTrue, reason: '$next');+ }+ // The paperclip, before the text in the row, is the stop before it.+ await tester.tap(key('super-message-composer'));+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.pump();+ await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);+ await tester.pump();+ expect(focusedIn(tester, attach()), isTrue);+ // The draft's save runs out.+ await tester.pump(const Duration(seconds: 1));+ });});group('a thread', () {diff --git a/desktop/test/super_tab_message_avatar_test.dart b/desktop/test/super_tab_message_avatar_test.dartindex 2358def25..f9b000723 100644--- a/desktop/test/super_tab_message_avatar_test.dart+++ b/desktop/test/super_tab_message_avatar_test.dart@@ -100,24 +100,32 @@ void main() {expect((fill.decoration! as BoxDecoration).shape, BoxShape.circle);});- testWidgets('a new sender starts a group gap and a control gap down', (+ Finder bubble() => find.byKey(const ValueKey('swarm-bubble'));++ testWidgets('a new sender starts a group gap down, its face by its bubble', (tester,) async {await _show(tester, [_row(_message('m1'))]);final rowTop = tester.getTopLeft(find.byType(SuperTabMessageRow)).dy;- final avatarTop = tester.getTopLeft(find.byType(SuperTabAvatar)).dy;expect(- avatarTop - rowTop,- grid.AppDesktop.groupGap + grid.AppDesktop.controlGap,+ tester.getTopLeft(find.text('ivy')).dy - rowTop,+ grid.AppDesktop.groupGap,+ );+ // The face sits by the bottom of its sender's last bubble (#4529).+ expect(+ tester.getBottomLeft(find.byType(SuperTabAvatar)).dy,+ tester.getBottomLeft(bubble()).dy,);});- testWidgets('a grouped follow-up line keeps today\'s tight spacing', (+ testWidgets('a grouped follow-up bubble sits close under the one above', (tester,) async {await _show(tester, [_row(_message('m2'), grouped: true)]);final rowTop = tester.getTopLeft(find.byType(SuperTabMessageRow)).dy;- final textTop = tester.getTopLeft(find.text('Shipped the fix')).dy;- expect(textTop - rowTop, 6);+ expect(+ tester.getTopLeft(bubble()).dy - rowTop,+ SuperTabMessageRow.joinedGap,+ );});}diff --git a/desktop/test/super_tab_message_grouping_test.dart b/desktop/test/super_tab_message_grouping_test.dartindex b5afe1b9d..6aab91e1f 100644--- a/desktop/test/super_tab_message_grouping_test.dart+++ b/desktop/test/super_tab_message_grouping_test.dart@@ -2,7 +2,6 @@ import 'dart:async';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';@@ -638,35 +637,6 @@ void main() {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();diff --git a/desktop/test/super_tab_message_media_test.dart b/desktop/test/super_tab_message_media_test.dartindex bc07d058d..502865daa 100644--- a/desktop/test/super_tab_message_media_test.dart+++ b/desktop/test/super_tab_message_media_test.dart@@ -388,13 +388,18 @@ void main() {);expect(asked.map((p) => (p.fileId, p.side)).toSet(), {('a1', 360.0)});+ final before = asked.length;await tester.tap(find.byKey(const ValueKey('super-attachment-inline:a1')),);await tester.pumpAndSettle();- expect(asked.last.fileId, 'a1');- expect(asked.last.side, isNull);+ // The viewer asks for the original; the chat's own copy may be asked+ // again at its size as the row lays out under it (#4529).+ expect(+ asked.skip(before).where((p) => p.fileId == 'a1' && p.side == null),+ isNotEmpty,+ );await close(tester, c);},);diff --git a/desktop/test/super_tab_new_messages_test.dart b/desktop/test/super_tab_new_messages_test.dartindex 90bacbf41..7260fa2d9 100644--- a/desktop/test/super_tab_new_messages_test.dart+++ b/desktop/test/super_tab_new_messages_test.dart@@ -155,6 +155,8 @@ void main() {tester.getTopLeft(find.byKey(_line)).dy,lessThan(tester.getTopLeft(find.text('After my answer')).dy),);+ // Bubbles are short enough to read to the end: its mark's save runs out.+ await tester.pump(const Duration(milliseconds: 300));});/// [server]'s next message as a reply in message 5's thread, [inChat] when@@ -186,6 +188,7 @@ void main() {tester.getTopLeft(find.byKey(_line)).dy,lessThan(tester.getTopLeft(find.text('Reply also in the chat')).dy),);+ await tester.pump(const Duration(milliseconds: 300));});testWidgets('only thread replies past the mark: no line and no pill', (diff --git a/desktop/test/super_tab_outgoing_rows_test.dart b/desktop/test/super_tab_outgoing_rows_test.dartindex bf5f4f8fb..df6f9d5de 100644--- a/desktop/test/super_tab_outgoing_rows_test.dart+++ b/desktop/test/super_tab_outgoing_rows_test.dart@@ -87,7 +87,7 @@ void main() {);testWidgets('a quick line under my own line joins it while it sends and '- 'after, at one height apart from its delivery line', (tester) async {+ 'after, its bubble the same height', (tester) async {final server = ConversationServer()..append('Earlier line');server.messages.last['createdAt'] = DateTime.now().toUtc()@@ -98,16 +98,20 @@ void main() {await type(tester, 'Quick follow-up');expect(grouped(tester, 'Quick follow-up'), isTrue);- final height = tester.getSize(rowOf('Quick follow-up')).height;+ Finder bubble() => find.ancestor(+ of: find.text('Quick follow-up'),+ matching: find.byKey(const ValueKey('swarm-bubble')),+ );+ final height = tester.getSize(bubble()).height;post.complete();await tester.pumpAndSettle();expect(c.outgoing('lead'), isEmpty);expect(grouped(tester, 'Quick follow-up'), isTrue);- // The confirmed latest line of mine adds its delivery line below; the- // line itself, with no avatar or name, keeps the height it had.- final receipt = tester.getSize(find.byType(SuperTabMessageReceipt)).height;- expect(tester.getSize(rowOf('Quick follow-up')).height - receipt, height);+ // Its status line under the bubble becomes the delivery line; the bubble+ // keeps its height (#4529).+ expect(find.byType(SuperTabMessageReceipt), findsOneWidget);+ expect(tester.getSize(bubble()).height, height);await close(tester, c);});diff --git a/desktop/test/super_tab_phone_composer_test.dart b/desktop/test/super_tab_phone_composer_test.dartindex fa6cbdcce..1c4760e76 100644--- a/desktop/test/super_tab_phone_composer_test.dart+++ b/desktop/test/super_tab_phone_composer_test.dart@@ -117,9 +117,9 @@ void main() {await unmountPhoneSuperTab(tester, c);});- // Huy and Scholes, 11-04: a wide window lays the composer out as the phone- // does, the field on top and its actions on a row under it.- testWidgets('a wider window has the phone\'s row under the field', (+ // anh Dee's mockup (11-07, #4529): a wide window draws the pill, the field+ // on one line and send beside it; the phone keeps its row under the field.+ testWidgets('a wider window has the pill, send beside the field', (tester,) async {final (_, c) = await mountPhoneSuperTab(@@ -128,9 +128,11 @@ void main() {desktop: true,);expect(_actions, findsOneWidget);+ await tester.enterText(_field, 'Ready');+ await tester.pump();final field = tester.getRect(_field), send = tester.getRect(_send);- expect(send.top, greaterThanOrEqualTo(field.bottom));- expect(send.right, greaterThan(field.center.dx));+ expect(send.left, greaterThanOrEqualTo(field.right));+ expect(send.center.dy, closeTo(field.center.dy, 4));await unmountPhoneSuperTab(tester, c);});diff --git a/desktop/test/super_tab_phone_targets_test.dart b/desktop/test/super_tab_phone_targets_test.dartindex 6a6c9a8f6..e044cd4fc 100644--- a/desktop/test/super_tab_phone_targets_test.dart+++ b/desktop/test/super_tab_phone_targets_test.dart@@ -6,7 +6,6 @@import 'package:flutter/material.dart';import 'package:flutter_test/flutter_test.dart';-import 'package:harness/super_tabs/identity.dart';import 'package:harness/super_tabs/message_row.dart';import 'support/super_tab_fixture.dart';@@ -106,10 +105,10 @@ void main() {await unmountPhoneSuperTab(tester, controller);});- testWidgets('a phone\'s taller author keeps the name and avatar in place', (+ testWidgets('a phone\'s taller author keeps the name in place', (tester,) async {- Future<(double, double)> tops({required bool desktop}) async {+ Future<double> tops({required bool desktop}) async {final (_, controller) = await mountPhoneSuperTab(tester,const Size(390, 844),@@ -124,7 +123,7 @@ void main() {double top(Finder f) =>tester.getTopLeft(find.descendant(of: row, matching: f)).dy -tester.getTopLeft(row).dy;- final result = (top(find.text('Lark')), top(find.byType(SuperTabAvatar)));+ final result = top(find.text('Lark'));await unmountPhoneSuperTab(tester, controller);return result;}@@ -144,6 +143,12 @@ void main() {);expect(find.byKey(const ValueKey('super-terminals')), findsOneWidget);expect(find.byTooltip('Project options'), findsOneWidget);+ // Send shows once there is something to send (#4529).+ await tester.enterText(+ find.byKey(const ValueKey('super-message-composer')),+ 'Ready',+ );+ await tester.pump();const mouse = {'Reply': Size(32, 32),'Copy message': Size(32, 32),diff --git a/desktop/test/super_tab_quiet_polish_test.dart b/desktop/test/super_tab_quiet_polish_test.dartindex b8bd96f09..a6902906b 100644--- a/desktop/test/super_tab_quiet_polish_test.dart+++ b/desktop/test/super_tab_quiet_polish_test.dart@@ -142,8 +142,9 @@ void main() {});group('the chat', () {- testWidgets("a task's and a proposal's name start where a message's text "- 'does', (tester) async {+ testWidgets("a proposal sent in your name is your own bubble, on the "+ "right with your message; an agent's task line is on the left "+ '(#4529)', (tester) async {final server = swarm();server.messages..add(_said(1, 'A plain message.'))@@ -154,12 +155,17 @@ void main() {'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 · working')).dx,- text,+ Rect bubble(String text) => tester.getRect(+ find+ .ancestor(+ of: find.textContaining(text),+ matching: find.byKey(const ValueKey('swarm-bubble')),+ )+ .first,);- expect(tester.getTopLeft(find.text('Goal: Activity read fix')).dx, text);+ final mine = bubble('A plain message.');+ expect(bubble('Goal: Activity read fix').right, mine.right);+ expect(bubble('Windows credential fix').left, lessThan(mine.left));});});diff --git a/desktop/test/super_tab_route_test.dart b/desktop/test/super_tab_route_test.dartindex 7306c0bfe..c7436dbe5 100644--- a/desktop/test/super_tab_route_test.dart+++ b/desktop/test/super_tab_route_test.dart@@ -7,7 +7,6 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/message_row.dart';-import 'package:harness/super_tabs/message_text.dart';import 'package:harness/super_tabs/model.dart';import 'package:harness/super_tabs/route_row.dart';@@ -485,7 +484,10 @@ void main() {),);await tester.pumpAndSettle();- final messageX = tester.getTopLeft(find.byType(SuperTabMessageText)).dx;+ // The routing line starts where the chat's bubbles do (#4529).+ final messageX = tester+ .getTopLeft(find.byKey(const ValueKey('swarm-bubble')).first)+ .dx;final routeX = tester.getTopLeft(find.text('Routed to Multiply')).dx;expect(routeX, messageX);expect(tester.takeException(), isNull);diff --git a/desktop/test/super_tab_ship_test.dart b/desktop/test/super_tab_ship_test.dartindex 73542a352..269b58958 100644--- a/desktop/test/super_tab_ship_test.dart+++ b/desktop/test/super_tab_ship_test.dart@@ -59,6 +59,7 @@ Future<void> show(WidgetTester tester,ConversationServer server, {bool reduceMotion = false,+ bool open = true,}) async {await tester.binding.setSurfaceSize(const Size(1200, 900));addTearDown(() => tester.binding.setSurfaceSize(null));@@ -81,6 +82,12 @@ Future<void> show(),),);+ // A shipped card shows its credits and pull requests under What changed+ // (#4529).+ if (open) {+ await tester.tap(find.text('What changed'));+ await tester.pump();+ }}void main() {@@ -90,7 +97,7 @@ void main() {'a ship line names who asked, built and reviewed, each with an avatar',(tester) async {await show(tester, shipServer());- expect(find.text('Shipped: Avatars'), findsOneWidget);+ expect(find.text('Avatars'), findsOneWidget);for (final words in ['Requested by','owner',@@ -121,19 +128,21 @@ void main() {testWidgets('a fresh celebration throws confetti once, then it is gone', (tester,) async {- await show(tester, shipServer());+ await show(tester, shipServer(), open: false);expect(find.byKey(const ValueKey('super-confetti')), findsOneWidget);await tester.pump(const Duration(seconds: 3));expect(find.byKey(const ValueKey('super-confetti')), findsNothing);- await show(tester, shipServer());+ await show(tester, shipServer(), open: false);expect(find.byKey(const ValueKey('super-confetti')), findsNothing);});- testWidgets('a rebuild during the burst does not cut it short', (tester) async {+ testWidgets('a rebuild during the burst does not cut it short', (+ tester,+ ) async {final server = shipServer();- await show(tester, server);+ await show(tester, server, open: false);await tester.pump(const Duration(milliseconds: 500));- await show(tester, server);+ await show(tester, server, open: false);await tester.pump(const Duration(milliseconds: 500));expect(find.byKey(const ValueKey('super-confetti')), findsOneWidget);await tester.pumpAndSettle();@@ -142,7 +151,7 @@ void main() {testWidgets('reduced motion keeps the line still', (tester) async {await show(tester, shipServer(), reduceMotion: true);expect(find.byKey(const ValueKey('super-confetti')), findsNothing);- expect(find.text('Shipped: Avatars'), findsOneWidget);+ expect(find.text('Avatars'), findsOneWidget);});testWidgets('an old celebration in the history throws none', (tester) async {@@ -161,24 +170,30 @@ void main() {const own = 'https://github.com/autonomous-ai/openharness/pull/2527';const wrongOwner = 'https://github.com/openharness/openharness/pull/2527';- test('two links for one pull request are one link, whatever their case', () {- final links = superTabPullRequestLinks(- '$own https://github.com/Autonomous-AI/OpenHarness/pull/2527 $own '- 'https://github.com/autonomous-ai/openharness/pull/2528',- );- expect([for (final l in links) l.pathSegments[3]], ['2527', '2528']);- });+ test(+ 'two links for one pull request are one link, whatever their case',+ () {+ final links = superTabPullRequestLinks(+ '$own https://github.com/Autonomous-AI/OpenHarness/pull/2527 $own '+ 'https://github.com/autonomous-ai/openharness/pull/2528',+ );+ expect([for (final l in links) l.pathSegments[3]], ['2527', '2528']);+ },+ );- test('a pull request elsewhere than the project\'s repository names it', () {- final links = superTabPullRequestLinks('$own $wrongOwner');- expect(- superTabPullRequestLabels(- links,- repositoryUrl: '[email protected]:autonomous-ai/openharness.git',- ),- ['openharness · PR #2527', 'openharness/openharness · PR #2527'],- );- });+ test(+ 'a pull request elsewhere than the project\'s repository names it',+ () {+ final links = superTabPullRequestLinks('$own $wrongOwner');+ expect(+ superTabPullRequestLabels(+ links,+ repositoryUrl: '[email protected]:autonomous-ai/openharness.git',+ ),+ ['openharness · PR #2527', 'openharness/openharness · PR #2527'],+ );+ },+ );test('the project\'s repository is read in every form git writes it', () {final links = superTabPullRequestLinks('$own $wrongOwner');@@ -188,11 +203,10 @@ void main() {'git://github.com/autonomous-ai/openharness','https://github.com/autonomous-ai/openharness.git/',]) {- expect(- superTabPullRequestLabels(links, repositoryUrl: address),- ['openharness · PR #2527', 'openharness/openharness · PR #2527'],- reason: address,- );+ expect(superTabPullRequestLabels(links, repositoryUrl: address), [+ 'openharness · PR #2527',+ 'openharness/openharness · PR #2527',+ ], reason: address);}});@@ -207,30 +221,32 @@ void main() {]);});- testWidgets('a ship line with two links for one pull request has one chip', (- tester,- ) async {- await show(- tester,- shipServer(- source: {- 'pullRequests': [- own,- 'https://github.com/Autonomous-AI/openharness/pull/2527',- 'https://github.com/autonomous-ai/openharness/pull/2528',- ],- },- )..state['project'] = {- 'machineId': 'm',- 'cwd': '/work',- 'repositoryUrl': 'https://github.com/autonomous-ai/openharness',- },- );- expect(find.text('openharness · PR #2527'), findsOneWidget);- expect(find.text('openharness · PR #2528'), findsOneWidget);- expect(find.byType(OutlinedButton), findsNWidgets(2));- await tester.pumpAndSettle();- });+ testWidgets(+ 'a ship line with two links for one pull request has one chip',+ (tester) async {+ await show(+ tester,+ shipServer(+ source: {+ 'pullRequests': [+ own,+ 'https://github.com/Autonomous-AI/openharness/pull/2527',+ 'https://github.com/autonomous-ai/openharness/pull/2528',+ ],+ },+ )+ ..state['project'] = {+ 'machineId': 'm',+ 'cwd': '/work',+ 'repositoryUrl': 'https://github.com/autonomous-ai/openharness',+ },+ );+ expect(find.text('openharness · PR #2527'), findsOneWidget);+ expect(find.text('openharness · PR #2528'), findsOneWidget);+ expect(find.byType(OutlinedButton), findsNWidgets(2));+ await tester.pumpAndSettle();+ },+ );testWidgets('a link in another repository shows owner and repository', (tester,@@ -238,14 +254,15 @@ void main() {await show(tester,shipServer(- source: {- 'pullRequests': [own, wrongOwner],+ source: {+ 'pullRequests': [own, wrongOwner],+ },+ )+ ..state['project'] = {+ 'machineId': 'm',+ 'cwd': '/work',+ 'repositoryUrl': 'https://github.com/autonomous-ai/openharness',},- )..state['project'] = {- 'machineId': 'm',- 'cwd': '/work',- 'repositoryUrl': 'https://github.com/autonomous-ai/openharness',- },);expect(find.text('openharness · PR #2527'), findsOneWidget);expect(find.text('openharness/openharness · PR #2527'), findsOneWidget);diff --git a/desktop/test/super_tab_task_line_test.dart b/desktop/test/super_tab_task_line_test.dartindex 3a1fb8ad8..1aea1589b 100644--- a/desktop/test/super_tab_task_line_test.dart+++ b/desktop/test/super_tab_task_line_test.dart@@ -259,7 +259,9 @@ void main() {await showView(tester, server);expect(find.text('Save offline drafts · in review'), findsOneWidget);expect(find.byType(SuperTabShipRow), findsOneWidget);- expect(find.text('Shipped: Offline drafts'), findsOneWidget);+ expect(find.text('Offline drafts'), findsOneWidget);+ await tester.tap(find.text('What changed'));+ await tester.pumpAndSettle();expect(find.text('Built by'), findsOneWidget);});@@ -287,7 +289,7 @@ void main() {}for (final (ask, tag) in [('proposal', '✋ Proposal')]) {- testWidgets('$ask shows $tag after the time, in its muted style', (+ testWidgets('$ask shows $tag after the name, in its muted style', (tester,) async {final server = _server('buddy-proposal')..threadAsks['root'] = ask;@@ -301,17 +303,9 @@ void main() {tester.widget<Text>(shown).style,SwarmType.time(tester.element(shown)),);- final time = find.descendant(- of: _row('root'),- matching: find.textContaining(RegExp(r'^\d+:\d\d')),- );- expect(- tester.getTopLeft(time).dx,- lessThan(tester.getTopLeft(shown).dx),- );expect(tester.getTopLeft(find.text('dee')).dx,- lessThan(tester.getTopLeft(time).dx),+ lessThan(tester.getTopLeft(shown).dx),);});}diff --git a/desktop/test/super_tab_typography_test.dart b/desktop/test/super_tab_typography_test.dartindex d4cfd04fa..25440bff6 100644--- a/desktop/test/super_tab_typography_test.dart+++ b/desktop/test/super_tab_typography_test.dart@@ -52,10 +52,12 @@ void main() {});testWidgets(- 'the sender is named at 13 px in semibold on the body\'s line, the time '- 'at 12 px in tertiary ink',+ 'another sender is named over their bubble at 13 px, plain, in '+ 'secondary ink; your own bubble carries no name',(tester) async {- final server = ConversationServer()..append('Shipped');+ final server = ConversationServer()+ ..append('Shipped')+ ..append('Thanks', agent: true);await showView(tester, server);final row = find.byType(SuperTabMessageRow);final texts = tester@@ -63,16 +65,11 @@ void main() {find.descendant(of: row, matching: find.byType(Text)),).toList();- // The reader's own message: its author reads You.- final name = texts.firstWhere((t) => t.data == 'You');+ expect(texts.where((t) => t.data == 'You'), isEmpty);+ final name = texts.firstWhere((t) => t.data == 'Lead');expect(name.style!.fontSize, 13);- expect(name.style!.fontWeight, FontWeight.w600);- expect(lineOf(name.style!), closeTo(20, 0.01));- final time = texts.firstWhere(- (t) => RegExp(r'^\d{1,2}:\d{2}').hasMatch(t.data ?? ''),- );- expect(time.style!.fontSize, 12);- expect(time.style!.color, DesktopChrome.hint);+ expect(name.style!.fontWeight, FontWeight.w400);+ expect(name.style!.color, DesktopChrome.muted);},);diff --git a/desktop/test/super_tab_voice_message_test.dart b/desktop/test/super_tab_voice_message_test.dartindex fb8f0a2f0..f0e38614e 100644--- a/desktop/test/super_tab_voice_message_test.dart+++ b/desktop/test/super_tab_voice_message_test.dart@@ -9,6 +9,7 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/open_in_browser.dart';+import 'package:harness/super_tabs/chat/bubble.dart';import 'package:harness/super_tabs/attachment_viewer.dart';import 'package:harness/super_tabs/controller.dart';import 'package:harness/super_tabs/message_link.dart';@@ -18,7 +19,6 @@ import 'package:harness/super_tabs/message_text.dart';import 'package:harness/super_tabs/view.dart';import 'package:harness/super_tabs/voice_bubble.dart';import 'package:harness/super_tabs/voice_length.dart';-import 'package:harness/widgets/desktop_chrome.dart';import 'package:video_player/video_player.dart';import 'support/super_tab_fixture.dart';@@ -388,13 +388,13 @@ void main() {expect(copy.existsSync(), isFalse);});- testWidgets('the played part of the waveform fills in the accent', (- tester,- ) async {+ testWidgets('your own voice message is blue, its played part in full '+ 'white (#4529)', (tester) async {await show(tester, withVoice());final at = find.descendant(of: bubble, matching: bars);+ final unplayed = SwarmBubble.ownInk.withValues(alpha: .55);expect(at.evaluate().map(colorOf).toSet(), {- DesktopChrome.muted,+ unplayed,}, reason: 'nothing played yet');await tester.tap(find.byTooltip('Play'));await settleFiles(tester);@@ -404,8 +404,8 @@ void main() {await tester.pump();final colors = at.evaluate().map(colorOf).toList();- expect(colors.take(19).toSet(), {DesktopChrome.accent});- expect(colors.skip(19).toSet(), {DesktopChrome.muted});+ expect(colors.take(19).toSet(), {SwarmBubble.ownInk});+ expect(colors.skip(19).toSet(), {unplayed});// Playing, it counts up.expect(find.descendant(of: bubble, matching: find.text('0:32')),diff --git a/desktop/test/swarm_elements_gallery_test.dart b/desktop/test/swarm_elements_gallery_test.dartindex cb86a5dbe..5d16a03b0 100644--- a/desktop/test/swarm_elements_gallery_test.dart+++ b/desktop/test/swarm_elements_gallery_test.dart@@ -7,8 +7,15 @@ import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;-import 'package:harness/state/harness_activity.dart';import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/state/harness_activity.dart';+import 'package:harness/super_tabs/chat/chat_card.dart';+import 'package:harness/super_tabs/chat/chat_time.dart';+import 'package:harness/super_tabs/chat/composer_pill.dart';+import 'package:harness/super_tabs/chat/fold.dart';+import 'package:harness/super_tabs/chat/send_button.dart';+import 'package:harness/super_tabs/swarm_type.dart';+import 'package:harness/widgets/desktop_chrome.dart';import 'package:harness/shared/theme/app_type.dart';import 'package:harness/shared/widgets/app_icon_button.dart';import 'package:harness/state/harness_attachments.dart';@@ -169,7 +176,7 @@ Future<List<SuperTabController>> _show(await buddy.select('swarm-buddy-peer');await member.select('aeef');tester.view.devicePixelRatio = 1;- tester.view.physicalSize = const Size(760, 1740);+ tester.view.physicalSize = const Size(760, 1950);addTearDown(tester.view.reset);await tester.pumpWidget(MaterialApp(@@ -190,6 +197,8 @@ Future<List<SuperTabController>> _show(),);await tester.pump();+ // A fold says More a frame after it measures what it holds.+ await tester.pump();expect(tester.takeException(), isNull);return [buddy, member, empty];}@@ -635,27 +644,78 @@ class _Gallery extends StatelessWidget {),],),- title('Chat: message rows, and the composer empty and typed'),- SizedBox(- width: 440,- child: Column(- children: [- _message(- 'River',- 'New Project is in the sidebar now.',- agent: _agent('River'),+ title('Chat: bubbles, a time after a pause, cards, a fold'),+ Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ SizedBox(+ width: 400,+ child: Column(+ children: [+ _message(+ 'River',+ 'New Project is in the sidebar now.',+ agent: _agent('River'),+ joinsBelow: true,+ ),+ _message(+ 'River',+ 'Press it and name the project.',+ agent: _agent('River'),+ id: 'm-River-2',+ grouped: true,+ ),+ SwarmChatTime(DateTime.utc(2026, 11, 7, 9, 12)),+ _message('dee', 'Found it, thanks!', person: _person),+ ],),- _message('dee', 'Found it, thanks!', person: _person),- ],- ),+ ),+ gap(),+ SizedBox(+ width: 300,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const SwarmChatCard(+ icon: AppIcons.send,+ label: 'Sent to River',+ title: 'Everything waiting on me shows in Decisions',+ action: 'View brief',+ details: SizedBox.shrink(),+ ),+ const SizedBox(height: 8),+ const SwarmChatCard(+ icon: AppIcons.circleCheck,+ label: 'Shipped',+ title: 'Wake fix: the mic closes after 1 second',+ action: 'What changed',+ details: SizedBox.shrink(),+ ),+ const SizedBox(height: 8),+ SwarmFold(+ child: Text(+ [for (var i = 1; i <= 9; i++) 'Line $i of a plan.']+ .join('\n'),+ style: SwarmType.body(context),+ ),+ ),+ ],+ ),+ ),+ ],),- const SizedBox(height: 8),- const Row(+ title('Chat composer: the pill empty and typed, a thread box'),+ Row(crossAxisAlignment: CrossAxisAlignment.start,children: [- SizedBox(width: 340, child: _Composer('empty', '')),- SizedBox(width: 16),- SizedBox(width: 340, child: _Composer('typed', 'Ship it')),+ SizedBox(width: 210, child: _pill(context, typed: false)),+ gap(),+ SizedBox(width: 210, child: _pill(context, typed: true)),+ gap(),+ const SizedBox(+ width: 250,+ child: _Composer('typed', 'Ship it'),+ ),],),title('Top bar: your Buddy, a member agent'),@@ -772,9 +832,14 @@ Widget _message(String text, {SuperTabAgent? agent,SuperTabPerson? person,+ String? id,+ bool grouped = false,+ bool joinsBelow = false,}) => SuperTabMessageRow(+ grouped: grouped,+ joinsBelow: joinsBelow,message: SuperTabMessage.fromJson({- 'id': 'm-$author',+ 'id': id ?? 'm-$author','conversationId': 'lead','text': text,'sequence': 1,@@ -791,7 +856,45 @@ Widget _message(readerId: 'p1',);-/// A chat composer ([SuperTabReplyBox], the box both composers draw) holding+/// The chat's composer as it draws itself: the pill around the paperclip and+/// the text, the mic beside it while empty, send once [typed].+Widget _pill(BuildContext context, {required bool typed}) => Row(+ crossAxisAlignment: CrossAxisAlignment.end,+ children: [+ Expanded(+ child: SwarmComposerPill(+ child: SizedBox(+ height: grid.AppControl.heightFieldScaled,+ child: Row(+ children: [+ const SizedBox(width: 10),+ Icon(AppIcons.paperclip, size: 16, color: DesktopChrome.muted),+ const SizedBox(width: 10),+ Text(+ typed ? 'Ship it' : 'Message #Pilot',+ style: SwarmType.composer(+ context,+ color: typed ? null : DesktopChrome.hint,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ const SizedBox(width: 8),+ SizedBox(+ height: grid.AppControl.heightFieldScaled,+ child: Center(+ child: typed+ ? SwarmSendButton(tooltip: 'Send', onPressed: () {})+ : Icon(AppIcons.mic, size: 16, color: DesktopChrome.muted),+ ),+ ),+ ],+);++/// A thread's reply box ([SuperTabReplyBox]) holding/// [typed]: the round send grey while empty, blue once there is text.class _Composer extends StatefulWidget {const _Composer(this.name, this.typed);diff --git a/docs/plans/2026-11-07-swarm-chat-imessage-plan.md b/docs/plans/2026-11-07-swarm-chat-imessage-plan.mdnew file mode 100644index 000000000..87c417fea--- /dev/null+++ b/docs/plans/2026-11-07-swarm-chat-imessage-plan.md@@ -0,0 +1,103 @@+# Swarm chat reads like iMessage: bubbles, cards for briefs, folded long messages (task #4529)++**Goal:** anh Dee's approved mockup (11-07): the chat reads like talking to a person. Bubbles, compact cards for+briefs and shipped notes, long agent messages folded, times only between pauses, a pill composer.++**Architecture:** The chat's look lives in four new widgets in `desktop/lib/super_tabs/chat/`: `SwarmBubble` (the+shape and colour), `SwarmFold` (folds a long body after about 6 lines, with More), `SwarmChatCard` (a label, one title+line and one blue action that reveals the details) and `SwarmChatTime` (a centered time). `SuperTabMessageRow` keeps+its API and behaviour (hover actions, keys, edit, reactions, thread line, receipts) and lays its parts out as a bubble+row: your own on the right, everyone else on the left. `view.dart` tells each row what it can't know alone: whether+the chat is one-on-one, whether the next row joins it, and where a pause puts a centered time. The composer keeps+`SuperTabReplyBox`/the chat composer and becomes one pill row.++**Tech Stack:** Flutter (Desktop), flutter_test widget tests, the Swarm elements gallery.++**Spec:** task #4529 brief (River, 11-07, anh Dee's mockup). Voice plays only, no transcript (anh Dee, 11-04 and+11-05; River confirmed 11-07). No decision card: the chat has no marker for a decision message (person+decisions show in the Decisions panel).++Way of working: the project's Engineer flow: this plan first, each task's failing test committed before its code, one+pull request, one independent review.++```+ ╭──────────────────────╮+ │ Can it auto-approve? │ yours: right, #0A84FF, white text+ ╰──────────────────────╯+ 4:12 PM a time only after a pause over 5 min+ River+ ╭────────────────────────────────╮+ │ Yes, for fixes under 20 lines. │ theirs: left, grey; name in a group chat+ ╰────────────────────────────────╯+● ╭─ Sent to Chatquiet ────────────╮ face by the sender's last bubble (group)+ │ Swarm chat reads like iMessage │+ │ View brief │ a brief is a card, never the whole text+ ╰────────────────────────────────╯+ 📎 ( Message #Pilot 🎤 ) pill; send replaces the mic once there is text+```++## Global Constraints++- Desktop only; phone layouts later. Copy by the design doc's rules (one idea a line, buttons verb first, no filler).+- Rule 1 and 2: grey everywhere, colour only on faces; blue for the main action and your own bubbles.+- Bubbles: radius 18, a 4-point corner where one sender's consecutive bubbles meet, at most three quarters of the row.+- One-on-one (a Buddy chat, an agent chat): no names, no faces. A group chat: a small name above the first bubble when+ the speaker changes, a 28 face beside that sender's last bubble.+- Offscreen tests, memory store, fake sign-in. Light and dark, at 1440 and 880.++## Review Focus++- A task line or proposal sent in your name is your own bubble, on the right.+- A grouped run broken by a reply, a thread or a day line: the corner joins only bubbles that touch.+- An outgoing (not yet sent) message is your bubble, dimmed, with its status under it.+- A long message being edited never folds; one tagged you still shows its bar.+- The hover actions stay reachable on your own (right-hand) bubbles.++## Task 1: bubbles++**Files:** `chat/bubble.dart` (new), `message_row.dart`, `view.dart`, `swarm_palette.dart` (own bubble role), tests+`test/super_tab_chat_bubbles_test.dart` (new) and the row tests the old layout pinned.++**Interfaces:** `SwarmBubble({required bool own, bool joinsAbove, bool joinsBelow, required Widget child})`, key+`swarm-bubble`; `SuperTabMessageRow` gains `oneOnOne` (no names, no faces) and `joinsBelow`.++- [ ] Test: your message is a blue (#0A84FF) bubble on the right with white text; another's is grey on the left; a+ bubble is at most 3/4 of the row; a run's touching corners are 4, the rest 18; a group chat names the first+ bubble of a speaker and puts the face beside the last; a Buddy chat shows neither.+- [ ] Watch it fail. Implement. Pass; update the row tests the old layout pinned.++## Task 2: centered times++**Files:** `chat/chat_time.dart` (new), `view.dart`, `message_row.dart`.++- [ ] Test: no time in a bubble's row; a centered time before a message more than 5 minutes after the one before it,+ none within 5 minutes; the exact time stays on the bubble's tooltip.+- [ ] Watch it fail. Implement. Pass.++## Task 3: cards and folding++**Files:** `chat/chat_card.dart`, `chat/fold.dart` (new), `view.dart`, `ship_row.dart`, `message_row.dart`.++**Interfaces:** `SwarmChatCard({required String label, required String title, required String action, required Widget+details})`; `SwarmFold({required int lines, required Widget child})`.++- [ ] Test: a task's brief shows "Sent to <agent>", the task's title and View brief, not its goal; View brief shows+ it. A shipped note shows Shipped, its title and What changed; What changed shows its pull requests and credits.+ An agent's message over 6 lines folds with More; More shows it all; a person's message never folds.+- [ ] Watch it fail. Implement. Pass.++## Task 4: pill composer and voice++**Files:** `view.dart` (composer row), `reply_box.dart`, `app_theme.dart`, tests.++- [ ] Test: both composers are one row in a pill (radius 20): paperclip, the text, the mic while empty; once there is+ text or a file, send in the mic's place. A voice message is your bubble's side and colour, with play, waveform+ and length, no transcript.+- [ ] Watch it fail. Implement. Pass.++## Task 5: design doc, gallery, screenshots++- [ ] Gallery: bubbles (yours, theirs, a joined run), a centered time, a brief card, a shipped card, a folded message,+ the pill composer empty and typed; fails before the images. Update, inspect, commit.+- [ ] Doc: Chat message and Chat composer rewritten; blue is for the main action and your own bubbles.+- [ ] Screenshots light and dark at 1440 and 880 in the PR.diff --git a/scripts/ui-style-allowlist/desktop.json b/scripts/ui-style-allowlist/desktop.jsonindex 8f6a2c0f5..997f919c6 100644--- a/scripts/ui-style-allowlist/desktop.json+++ b/scripts/ui-style-allowlist/desktop.json@@ -36,7 +36,7 @@"border-radius": 1},"desktop/lib/super_tabs/message_row.dart": {- "edge-insets": 4+ "edge-insets": 3},"desktop/lib/super_tabs/notifications.dart": {"edge-insets": 8@@ -72,8 +72,7 @@"edge-insets": 4},"desktop/lib/super_tabs/ship_row.dart": {- "font-size": 1,- "edge-insets": 2+ "edge-insets": 1},"desktop/lib/super_tabs/terminal_row.dart": {"edge-insets": 2