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
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/widgets/engine_identity.dart';
import 'package:harness/super_tabs/identity.dart';
import 'package:harness/super_tabs/message_row.dart';
import 'package:harness/super_tabs/message_text.dart';
import 'package:harness/super_tabs/ship_row.dart';
import 'package:harness/super_tabs/model.dart';
import 'package:harness/super_tabs/swarm_type.dart';
import 'package:harness/super_tabs/thread_panel.dart';
import 'package:harness/super_tabs/unread_line.dart';
import 'box_render_preview_test.dart' show loadPreviewFonts;
import 'super_tab_mentions_test.dart' show showView, shot;
import 'support/super_tab_fixture.dart';
const _legacyProposal =
"Proposal from Dee's Buddy, on Dee's behalf.\n\n"
'Goal: Save offline drafts.\nScope: Desktop and phone\nPriority: high';
Map<String, dynamic> _root(String kind, {bool legacy = false}) => {
'id': 'root',
'conversationId': 'lead',
'thread': 'root',
'sequence': 1,
'text': legacy
? kind == 'task-line'
? 'Save offline drafts · in review'
: _legacyProposal
: "Let's build: Offline drafts",
'createdAt': '2026-11-03T09:00:00Z',
'author': legacy
? {'kind': 'agent', 'id': 'buddy', 'name': 'Draft Buddy'}
: {'kind': 'person', 'id': 'requester', 'name': '[email protected]'},
'source': {
'kind': kind,
if (kind == 'task-line') ...{
'taskId': 'offline',
'title': 'Save offline drafts',
'state': 'review',
} else
'personId': 'requester',
},
'reactions': [
{
'emoji': 'heart',
'count': 1,
'by': [
{'kind': 'agent', 'id': 'buddy'},
],
},
],
};
ConversationServer _server(String kind, {bool legacy = false}) {
final server = ConversationServer()..threads = true;
(server.state['people'] as List).add({
'id': 'requester',
'email': '[email protected]',
'username': 'dee',
'role': 'member',
});
server.state['agents'] = [
{
'id': 'buddy',
'name': 'Draft Buddy',
'machineId': 'mac',
'harnessId': 'buddy',
'contributorId': 'owner',
'configuration': {'engine': 'codex'},
},
];
server.messages.addAll([
_root(kind, legacy: legacy),
{
'id': 'details',
'conversationId': 'lead',
'thread': 'root',
'replyTo': 'root',
'sequence': 2,
'text': 'Goal: Save offline drafts.\nScope: Desktop and phone\nPriority: high',
'createdAt': '2026-11-03T09:01:00Z',
'author': {'kind': 'agent', 'id': 'buddy', 'name': 'Draft Buddy'},
},
]);
(server.state['conversations'] as List).first['lastMessageSequence'] = 2;
return server;
}
Finder _row(String id, {bool thread = false}) => find.byKey(
ValueKey('${thread ? 'super-thread-message' : 'super-message'}-$id'),
);
void main() {
// A source-based compact row, title substitution, or task-conversation
// navigation loses message content/actions; these exercise the real view.
for (final kind in ['task-line', 'buddy-proposal']) {
testWidgets('$kind root keeps the requester identity and message actions', (
tester,
) async {
final server = _server(kind);
await showView(tester, server);
final row = _row('root');
expect(tester.widget(row), isA<SuperTabMessageRow>());
expect(
find.descendant(of: row, matching: find.text('dee')),
findsOneWidget,
);
final avatar = tester.widget<SuperTabAvatar>(
find.descendant(of: row, matching: find.byType(SuperTabAvatar)).first,
);
expect(avatar.identity, 'person:requester');
expect(
find.descendant(of: row, matching: find.text('Offline drafts')),
findsOneWidget,
);
expect(find.byKey(const ValueKey('super-proposal-label')), findsNothing);
expect(find.textContaining('Scope:'), findsNothing);
expect(
find.byKey(const ValueKey('super-thread-count-root')),
findsOneWidget,
);
expect(
find.descendant(of: row, matching: find.byTooltip('Reply')),
findsOneWidget,
);
expect(
find.descendant(of: row, matching: find.byTooltip('Add reaction')),
findsOneWidget,
);
await tester.tap(find.byKey(const ValueKey('super-reaction-root-heart')));
await tester.pumpAndSettle();
final sent =
server.posts.lastWhere(
(p) => (p['command'] as Map?)?['type'] == 'message.react',
)['command']
as Map;
expect(sent['messageId'], 'root');
expect(sent['emoji'], 'heart');
expect(sent['on'], isTrue);
expect(
find.descendant(of: row, matching: find.text('2')),
findsOneWidget,
);
});
testWidgets(
'$kind Reply opens the ordinary project thread and sends there',
(tester) async {
final server = _server(kind);
final c = await showView(tester, server);
await tester.tap(
find.descendant(of: _row('root'), matching: find.byTooltip('Reply')),
);
await tester.pumpAndSettle();
expect(c.selectedId, 'lead');
expect(c.openedThread?.root, 'root');
expect(find.byType(SuperTabThreadPanel), findsOneWidget);
expect(find.textContaining('Scope: Desktop and phone'), findsOneWidget);
await tester.enterText(
find.byKey(const ValueKey('super-thread-composer')),
'Please include attachments.',
);
await tester.pump();
await tester.tap(find.byKey(const ValueKey('super-thread-send')));
await tester.pumpAndSettle();
final sent =
server.posts.lastWhere(
(p) => (p['command'] as Map?)?['type'] == 'message.send',
)['command']
as Map;
expect(sent['conversationId'], 'lead');
expect(sent['replyTo'], 'root');
expect(sent['text'], 'Please include attachments.');
expect(find.text('Please include attachments.'), findsOneWidget);
},
);
testWidgets(
'legacy $kind keeps its complete text and ordinary thread at narrow width',
(tester) async {
final c = await showView(tester, _server(kind, legacy: true));
await tester.binding.setSurfaceSize(const Size(800, 800));
await tester.pumpAndSettle();
final row = _row('root');
expect(tester.widget(row), isA<SuperTabMessageRow>());
expect(
find.descendant(of: row, matching: find.text('Draft Buddy')),
findsOneWidget,
);
final text = tester.widget<SuperTabMessageText>(
find.descendant(of: row, matching: find.byType(SuperTabMessageText)),
);
expect(
text.text,
kind == 'task-line'
? 'Save offline drafts · in review'
: _legacyProposal,
);
if (kind == 'buddy-proposal') {
expect(
find.descendant(
of: row,
matching: find.textContaining("on Dee's behalf."),
),
findsOneWidget,
);
expect(
find.descendant(
of: row,
matching: find.textContaining('Priority: high'),
),
findsOneWidget,
);
} else {
expect(
find.descendant(
of: row,
matching: find.text('Save offline drafts · in review'),
),
findsOneWidget,
);
}
await tester.tap(find.byKey(const ValueKey('super-thread-line-root')));
await tester.pumpAndSettle();
expect(c.openedThread?.root, 'root');
expect(c.selectedId, 'lead');
expect(find.byType(SuperTabThreadPanel), findsOneWidget);
expect(find.textContaining('Scope: Desktop and phone'), findsWidgets);
expect(tester.takeException(), isNull);
await tester.tap(find.byKey(const ValueKey('super-thread-close')));
await tester.pumpAndSettle();
expect(c.openedThread, isNull);
},
);
}
testWidgets('a legacy task root keeps its recorded ship message visible', (
tester,
) async {
final server = _server('task-line', legacy: true);
server.messages.add({
'id': 'ship',
'conversationId': 'lead',
'thread': 'ship',
'sequence': 3,
'text': 'Shipped: Offline drafts',
'createdAt': '2026-11-03T09:02:00Z',
'author': {'kind': 'agent', 'id': 'buddy', 'name': 'Draft Buddy'},
'source': {
'kind': 'ship',
'conversationId': 'offline',
'title': 'Offline drafts',
'requesterId': 'requester',
'builderIds': ['buddy'],
},
});
(server.state['conversations'] as List).first['lastMessageSequence'] = 3;
await showView(tester, server);
expect(find.text('Save offline drafts · in review'), findsOneWidget);
expect(find.byType(SuperTabShipRow), findsOneWidget);
expect(find.text('Offline drafts'), findsOneWidget);
await tester.tap(find.text('What changed'));
await tester.pumpAndSettle();
expect(find.text('Built by'), findsOneWidget);
});
// Dee, 2026-11-04 (#2552): an ask's row reads as its title alone, with where
// it stands after the time; older rows still carry the old prefix.
group('an ask row', () {
for (final kind in ['task-line', 'buddy-proposal']) {
for (final text in ["Let's build: Offline drafts", 'Offline drafts']) {
testWidgets('$kind "$text" shows the title alone', (tester) async {
final server = _server(kind);
server.messages.first
..['text'] = text
..['reactions'] = <dynamic>[];
await showView(tester, server);
expect(
find.descendant(
of: _row('root'),
matching: find.text('Offline drafts'),
),
findsOneWidget,
);
expect(find.textContaining("Let's build"), findsNothing);
});
}
}
for (final (ask, tag) in [('proposal', '✋ Proposal')]) {
testWidgets('$ask shows $tag after the name, in its muted style', (
tester,
) async {
final server = _server('buddy-proposal')..threadAsks['root'] = ask;
await showView(tester, server);
final shown = find.descendant(
of: _row('root'),
matching: find.text(tag),
);
expect(shown, findsOneWidget);
expect(
tester.widget<Text>(shown).style,
SwarmType.time(tester.element(shown)),
);
expect(
tester.getTopLeft(find.text('dee')).dx,
lessThan(tester.getTopLeft(shown).dx),
);
});
}
testWidgets('has no tag once the PM has replied with no task', (
tester,
) async {
await showView(tester, _server('buddy-proposal'));
for (final tag in ['✋ Proposal', '● On it', '✓ Shipped', 'Task']) {
expect(
find.descendant(of: _row('root'), matching: find.textContaining(tag)),
findsNothing,
);
}
});
// Anh Dee, 11-04 ('bot messages'): a task's agent reacts 👀 and ✅ on
// the message that asked; the row draws no On it or Shipped, even from a
// server that still sends them.
for (final ask in ['on-it', 'shipped']) {
testWidgets('draws no tag on a person\'s own message for $ask', (
tester,
) async {
final server = _server('task-line');
server.messages.first.remove('source');
server.threadAsks['root'] = ask;
await showView(tester, server);
for (final tag in ['● On it', '✓ Shipped', 'On it', 'Shipped']) {
expect(
find.descendant(of: _row('root'), matching: find.text(tag)),
findsNothing,
);
}
});
}
testWidgets('a message that is no ask keeps its words and has no tag', (
tester,
) async {
final server = _server('task-line');
server.messages.add({
'id': 'plain',
'conversationId': 'lead',
'thread': 'plain',
'sequence': 3,
'text': "Let's build: a shed",
'createdAt': '2026-11-03T09:30:00Z',
'author': {
'kind': 'person',
'id': 'requester',
'name': '[email protected]',
},
});
await showView(tester, server);
expect(find.text("Let's build: a shed"), findsOneWidget);
expect(
find.descendant(
of: _row('plain'),
matching: find.textContaining('On it'),
),
findsNothing,
);
});
testWidgets('an agent\'s name comes before its tag, with no engine mark', (
tester,
) async {
final server = _server('task-line')..threadAsks['root'] = 'proposal';
(server.state['agents'] as List).add({
'id': 'pm',
'name': 'Lead',
'displayName': 'River',
'machineId': 'mac',
'harnessId': 'pm',
'contributorId': 'owner',
'configuration': {'engine': 'claude'},
});
server.messages.first['author'] = {
'kind': 'agent',
'id': 'pm',
'name': 'Lead',
};
await showView(tester, server);
double left(Finder within) => tester.getTopLeft(within).dx;
final name = find.descendant(
of: _row('root'),
matching: find.text('River'),
);
final tag = find.descendant(
of: _row('root'),
matching: find.text('✋ Proposal'),
);
// No engine mark in a message header: colour is the face's (River,
// 11-07, #4467).
expect(
find.descendant(of: _row('root'), matching: find.byType(EngineMark)),
findsNothing,
);
expect(left(name), lessThan(left(tag)));
});
testWidgets('keeps its header when the same person wrote just before', (
tester,
) async {
final server = _server('task-line')..threadAsks['root'] = 'proposal';
server.messages.insert(0, {
'id': 'before',
'conversationId': 'lead',
'thread': 'before',
'sequence': 0,
'text': 'A word first',
'createdAt': '2026-11-03T08:59:00Z',
'author': {
'kind': 'person',
'id': 'requester',
'name': '[email protected]',
},
});
await showView(tester, server);
expect(
find.descendant(of: _row('root'), matching: find.text('✋ Proposal')),
findsOneWidget,
);
expect(
find.descendant(of: _row('root'), matching: find.text('dee')),
findsOneWidget,
);
});
testWidgets('has no tag at the head of its own thread', (tester) async {
final server = _server('task-line')..threadAsks['root'] = 'proposal';
final c = await showView(tester, server);
c.openThread('root');
await tester.pumpAndSettle();
expect(
find.descendant(
of: _row('root', thread: true),
matching: find.text('✋ Proposal'),
),
findsNothing,
);
});
});
testWidgets('plain proposal and task thread screenshot fixture', (
tester,
) async {
await loadPreviewFonts();
final server = _server('buddy-proposal');
server.messages.first['reactions'] = <dynamic>[];
final c = await showView(tester, server, brightness: Brightness.light);
await shot(tester, 'desktop-plain-chat');
c.openThread('root');
await tester.pumpAndSettle();
expect(find.textContaining('Scope: Desktop and phone'), findsOneWidget);
await shot(tester, 'desktop-plain-chat-thread');
});
test("a root the server posted in the reader's name is not their own "
'writing, so it reads nothing before it (plain chat, #2294)', () {
final c = ConversationServer().controller();
addTearDown(c.dispose);
SuperTabMessage row(
int sequence,
Map<String, Object> author, [
String? kind,
]) => SuperTabMessage.fromJson({
'id': 'm$sequence',
'conversationId': 'lead',
'sequence': sequence,
'text': 'Message $sequence',
'createdAt': '2026-11-03T09:00:00Z',
'author': author,
'source': ?(kind == null ? null : {'kind': kind}),
});
final reader = {
'kind': 'person',
'id': c.accountId,
'name': '[email protected]',
};
final river = {'kind': 'agent', 'id': 'lead-agent', 'name': 'River'};
for (final kind in ['task-line', 'buddy-proposal']) {
final root = row(3, reader, kind);
expect(root.postedForAuthor, isTrue);
expect(c.isOwn(root), isFalse);
expect(
superTabFirstUnread(
[row(1, river), row(2, river), root],
1,
own: c.isOwn,
),
'm2',
);
}
expect(c.isOwn(row(4, reader)), isTrue);
});
}