Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Viewer header: actions flush right, and the verdict shown there alone

dee74b0460433f5
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index a4713d5da..56389fbae 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -32,7 +32,6 @@ import '../shared/theme/app_theme.dart' as grid;
import '../theme/app_theme.dart';
import 'engine_identity.dart';
import 'pane_header_actions.dart';
-import 'verdict_marks.dart';
/// The pane header's own horizontal inset.
const double _stripPadding = 14;
@@ -1635,14 +1634,6 @@ class _TerminalHeader extends StatelessWidget {
),
),
const SizedBox(width: 8),
- // The harness's verdict on this workspace, when it has one:
- // ready, or how far from it. Beside the connection status, not
- // instead of it — the two answer different questions.
- if (agent?.verdict != null)
- Padding(
- padding: const EdgeInsets.only(right: 6),
- child: VerdictChip(verdict: agent!.verdict!),
- ),
// Which of the three paths carries this pane's bytes. Absent for a local machine's own
// terminal, which has no such distinction and so gets no badge.
//
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index 938f670db..ef157c7e4 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -178,50 +178,59 @@ class _WebPanePanelState extends State<WebPanePanel> {
size: 17,
),
const SizedBox(width: 10),
+ // Title and phase strip share the flexible middle: the title
+ // yields first, the strip second, and whatever is left stays
+ // between them — never at the row's end, where it would push
+ // the actions off the right edge the terminal pane keeps.
Expanded(
- child: Tooltip(
- message: widget.pane.url ?? '',
- waitDuration: const Duration(milliseconds: 700),
- child: Text.rich(
- TextSpan(
- children: [
- TextSpan(text: widget.ownerName),
- TextSpan(
- text: ' · Viewer',
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Flexible(
+ child: Tooltip(
+ message: widget.pane.url ?? '',
+ waitDuration: const Duration(milliseconds: 700),
+ child: Text.rich(
+ TextSpan(
+ children: [
+ TextSpan(text: widget.ownerName),
+ TextSpan(
+ text: ' · Viewer',
+ style: TextStyle(
+ color: AppColors.mutedStrong,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ],
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
style: TextStyle(
- color: AppColors.mutedStrong,
- fontWeight: FontWeight.w500,
+ color: AppColors.text,
+ fontFamily: AppFonts.sans,
+ fontSize: 13,
+ fontWeight: FontWeight.w600,
),
),
- ],
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- color: AppColors.text,
- fontFamily: AppFonts.sans,
- fontSize: 13,
- fontWeight: FontWeight.w600,
+ ),
),
- ),
+ if (widget.verdict case final verdict?
+ when verdict.phases.isNotEmpty)
+ Flexible(
+ child: Padding(
+ padding: const EdgeInsets.only(left: 12),
+ child: PhaseStrip(phases: verdict.phases),
+ ),
+ ),
+ ],
),
),
const SizedBox(width: 8),
- if (widget.verdict case final verdict?) ...[
- // Flexible: the strip yields to the title and the chip when
- // the pane is narrow; at three quarters of a tab it has room.
- if (verdict.phases.isNotEmpty)
- Flexible(
- child: Padding(
- padding: const EdgeInsets.only(right: 10),
- child: PhaseStrip(phases: verdict.phases),
- ),
- ),
+ if (widget.verdict case final verdict?)
Padding(
padding: const EdgeInsets.only(right: 6),
child: VerdictChip(verdict: verdict),
),
- ],
if (_loading)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 6),
diff --git a/desktop/test/terminal_panel_header_test.dart b/desktop/test/terminal_panel_header_test.dart
index cb5f3f372..b1f3dea94 100644
--- a/desktop/test/terminal_panel_header_test.dart
+++ b/desktop/test/terminal_panel_header_test.dart
@@ -252,76 +252,39 @@ void main() {
verdict: verdict,
);
- testWidgets('the verdict chip says ready, or how far from it', (
- tester,
- ) async {
- final chip = find.byKey(const ValueKey('pane-verdict-chip'));
- final cases = <(AgentVerdict, String, Color)>[
- (
- const AgentVerdict(ready: true, summary: 'Board is fab-ready'),
- 'Ready',
- AppColors.success,
- ),
- (
- const AgentVerdict(ready: false, errors: 3, warnings: 2),
- '3 errors',
- AppColors.danger,
- ),
- (
- const AgentVerdict(ready: false, errors: 0, warnings: 1),
- '1 warning',
- AppColors.warning,
- ),
- (const AgentVerdict(ready: false), 'Checked', AppColors.mutedStrong),
- ];
- for (final (verdict, label, color) in cases) {
+ testWidgets(
+ 'a harness agent is drawn as its harness, with no chip of its own',
+ (tester) async {
+ final chip = find.byKey(const ValueKey('pane-verdict-chip'));
final session = sessionNamed('a');
addTearDown(session.dispose);
- await pumpWithAgent(tester, session, agentWith(verdict));
- expect(chip, findsOneWidget, reason: label);
+ final notifier = await pumpWithAgent(
+ tester,
+ session,
+ agentWith(
+ const AgentVerdict(ready: true, summary: 'Board is fab-ready'),
+ ),
+ );
+ // Its harness, with its base engine beside it.
expect(
- find.descendant(of: chip, matching: find.text(label)),
+ find.byKey(const ValueKey('engine-icon-autonomous/circuit')),
findsOneWidget,
);
expect(
- tester
- .widget<Text>(find.descendant(of: chip, matching: find.text(label)))
- .style
- ?.color,
- color,
+ find.byKey(const ValueKey('pane-header-base-engine')),
+ findsOneWidget,
);
- if (verdict.summary != null) {
- expect(find.byTooltip(verdict.summary!), findsOneWidget);
- }
- }
- // A harness agent is drawn as its harness, with its base engine beside it.
- expect(
- find.byKey(const ValueKey('engine-icon-autonomous/circuit')),
- findsOneWidget,
- );
- expect(
- find.byKey(const ValueKey('pane-header-base-engine')),
- findsOneWidget,
- );
- });
-
- testWidgets('no verdict, no chip — and a verdict arriving later is drawn', (
- tester,
- ) async {
- final chip = find.byKey(const ValueKey('pane-verdict-chip'));
- final session = sessionNamed('a');
- addTearDown(session.dispose);
- final notifier = await pumpWithAgent(tester, session, agentWith(null));
- expect(chip, findsNothing);
- // The same panel rebuilt over a frame that changed nothing but the
- // verdict: the header is memoized on its inputs, and this is one of them.
- await pumpWithAgent(
- tester,
- session,
- agentWith(const AgentVerdict(ready: false, errors: 2)),
- app: notifier,
- );
- expect(chip, findsOneWidget, reason: 'the verdict is a header input');
- expect(find.text('2 errors'), findsOneWidget);
- });
+ // The verdict is the viewer pane's to show (owner, 2026-09-15): the
+ // terminal header carries none, before or after a verdict arrives.
+ expect(chip, findsNothing);
+ await pumpWithAgent(
+ tester,
+ session,
+ agentWith(const AgentVerdict(ready: false, errors: 2)),
+ app: notifier,
+ );
+ expect(chip, findsNothing);
+ expect(find.text('2 errors'), findsNothing);
+ },
+ );
}
diff --git a/desktop/test/verdict_marks_test.dart b/desktop/test/verdict_marks_test.dart
index 69a33d44f..640a8c588 100644
--- a/desktop/test/verdict_marks_test.dart
+++ b/desktop/test/verdict_marks_test.dart
@@ -3,6 +3,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
+import 'package:harness/theme/app_theme.dart';
import 'package:harness/widgets/verdict_marks.dart';
void main() {
@@ -62,15 +63,47 @@ void main() {
expect(find.text('Polish'), findsOneWidget);
});
- testWidgets('the chip reads the verdict in one word', (tester) async {
- await tester.pumpWidget(
- const MaterialApp(
- home: Scaffold(
- body: VerdictChip(verdict: AgentVerdict(ready: true, summary: 'ok')),
- ),
+ testWidgets('the chip says ready, or how far from it', (tester) async {
+ final chip = find.byKey(const ValueKey('pane-verdict-chip'));
+ final cases = <(AgentVerdict, String, Color)>[
+ (
+ const AgentVerdict(ready: true, summary: 'Board is fab-ready'),
+ 'Ready',
+ AppColors.success,
),
- );
- expect(find.text('Ready'), findsOneWidget);
- expect(find.byKey(const ValueKey('pane-verdict-chip')), findsOneWidget);
+ (
+ const AgentVerdict(ready: false, errors: 3, warnings: 2),
+ '3 errors',
+ AppColors.danger,
+ ),
+ (
+ const AgentVerdict(ready: false, errors: 0, warnings: 1),
+ '1 warning',
+ AppColors.warning,
+ ),
+ (const AgentVerdict(ready: false), 'Checked', AppColors.mutedStrong),
+ ];
+ for (final (verdict, label, color) in cases) {
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(body: VerdictChip(verdict: verdict)),
+ ),
+ );
+ expect(chip, findsOneWidget, reason: label);
+ expect(
+ find.descendant(of: chip, matching: find.text(label)),
+ findsOneWidget,
+ );
+ expect(
+ tester
+ .widget<Text>(find.descendant(of: chip, matching: find.text(label)))
+ .style
+ ?.color,
+ color,
+ );
+ if (verdict.summary != null) {
+ expect(find.byTooltip(verdict.summary!), findsOneWidget);
+ }
+ }
});
}
diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dart
index 45d5c66f6..0a8ec7b31 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -14,13 +14,18 @@ import 'package:harness/widgets/web_pane_panel.dart';
import 'swarm_screen_test.dart' show mount, terminal;
import 'swarm_state_test.dart' show createApp;
-Map<String, dynamic> _frame(String id, {String? viewerUrl}) => {
+Map<String, dynamic> _frame(
+ String id, {
+ String? viewerUrl,
+ Map<String, dynamic>? verdict,
+}) => {
'id': id,
'name': 'Agent $id',
'engine': 'claude',
'dsh': 'autonomous/circuit',
'dshName': 'Circuit',
'viewerUrl': ?viewerUrl,
+ 'verdict': ?verdict,
'terminal': {
'available': true,
'runtimes': [
@@ -29,11 +34,15 @@ Map<String, dynamic> _frame(String id, {String? viewerUrl}) => {
},
};
-Future<void> _synced(AppNotifier app, String id, {String? viewerUrl}) =>
- app.handleEventForTest('m', {
- 'type': 'agent_synced',
- 'payload': {'agent': _frame(id, viewerUrl: viewerUrl)},
- });
+Future<void> _synced(
+ AppNotifier app,
+ String id, {
+ String? viewerUrl,
+ Map<String, dynamic>? verdict,
+}) => app.handleEventForTest('m', {
+ 'type': 'agent_synced',
+ 'payload': {'agent': _frame(id, viewerUrl: viewerUrl, verdict: verdict)},
+});
List<TerminalPane> _viewers(AppNotifier app) =>
app.panes.where((pane) => pane.isWeb).toList();
@@ -237,6 +246,39 @@ void main() {
findsOneWidget,
reason: 'the terminal keeps its own',
);
+ // The verdict is the viewer's to show — chip and strip in its header,
+ // nothing on the terminal's — and the terminal's header carries the
+ // control that hides and shows the viewer.
+ expect(find.byKey(const ValueKey('pane-verdict-chip')), findsNothing);
+ await _synced(
+ app,
+ 'a0',
+ viewerUrl: 'http://127.0.0.1:4179/',
+ verdict: {
+ 'ready': false,
+ 'warnings': 1,
+ 'phases': [
+ {'name': 'Build', 'state': 'done'},
+ {'name': 'Checks', 'state': 'active'},
+ ],
+ },
+ );
+ await tester.pump();
+ final viewerHeader = find.ancestor(
+ of: find.byTooltip('Close viewer'),
+ matching: find.byType(WebPanePanel),
+ );
+ expect(
+ find.descendant(
+ of: viewerHeader,
+ matching: find.byKey(const ValueKey('pane-verdict-chip')),
+ ),
+ findsOneWidget,
+ );
+ expect(find.byKey(const ValueKey('pane-verdict-chip')), findsOneWidget);
+ expect(find.byKey(const ValueKey('pane-phase-strip')), findsOneWidget);
+ expect(find.text('Checks'), findsOneWidget);
+ expect(find.byTooltip('Hide viewer'), findsOneWidget);
await tester.tap(find.byTooltip('Close viewer'));
await tester.pump();
expect(_viewers(app), isEmpty);