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.

One status in the viewer's title; the frame carries the harness's current id

deebd3a1b966d1b
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index c9c4bcac9..3636903f3 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -1369,8 +1369,11 @@ async function runForeground(session: AuthSession): Promise<void> {
const dshFrameContext = (s: RegisteredSession): AgentDshContext | null => {
if (!s.dsh) return null
const state = dshFrames.get(s.agentId)
+ const installed = installedDsh(s.dsh)
return {
- name: installedDsh(s.dsh)?.manifest.name ?? registryEntry(s.dsh)?.name ?? null,
+ // The current id, so a face drawn by id survives a rename the agent predates.
+ id: installed?.id ?? s.dsh,
+ name: installed?.manifest.name ?? registryEntry(s.dsh)?.name ?? null,
viewerUrl: state?.viewerUrl ?? null,
verdict: state?.verdict ?? null,
}
diff --git a/cli/src/lib/agentFrame.ts b/cli/src/lib/agentFrame.ts
index 8e2e6f12f..b6dbc2447 100644
--- a/cli/src/lib/agentFrame.ts
+++ b/cli/src/lib/agentFrame.ts
@@ -58,6 +58,8 @@ export type AgentFrame = {
/** What the daemon knows about an agent's DSH — looked up by the caller, never here. */
export interface AgentDshContext {
+ /** The harness's CURRENT id — an agent created under a former name (`formerly`) reports the new one. */
+ id: string | null
name: string | null
viewerUrl: string | null
verdict: DshVerdict | null
@@ -110,7 +112,7 @@ export async function agentFrame(
project: await agentProject(s.cwd),
// All four are real answers when null, for the reason the module doc gives: a frame that omits
// them would erase a viewer URL or a verdict an earlier frame had reported.
- dsh: s.dsh ?? null,
+ dsh: dsh?.id ?? s.dsh ?? null,
dshName: dsh?.name ?? null,
viewerUrl: dsh?.viewerUrl ?? null,
verdict: dsh?.verdict ?? null,
diff --git a/desktop/lib/widgets/verdict_marks.dart b/desktop/lib/widgets/verdict_marks.dart
index 38c48e702..ebed67787 100644
--- a/desktop/lib/widgets/verdict_marks.dart
+++ b/desktop/lib/widgets/verdict_marks.dart
@@ -1,112 +1,88 @@
-// The marks a harness's verdict puts in the viewer pane's header: the chip
-// (ready, or how far from it) and the phase mark (where the work is).
+// The one status a harness's verdict puts in the viewer pane's title: ready,
+// or what stands in the way, or where the work is. One mark, each new state
+// replacing the last — a status, not a history.
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../core/models.dart';
import '../theme/app_theme.dart';
-class VerdictChip extends StatelessWidget {
- const VerdictChip({super.key, required this.verdict});
+/// Ready wins; then errors; then the phase under way; then warnings; then the
+/// last phase that happened; then a plain "Checked". The colour says which.
+class VerdictStatus extends StatelessWidget {
+ const VerdictStatus({super.key, required this.verdict});
final AgentVerdict verdict;
+ static String _count(int n, String noun) =>
+ '$n ${n == 1 ? noun : '${noun}s'}';
+
@override
Widget build(BuildContext context) {
- final (label, color, icon) = verdict.ready
- ? ('Ready', AppColors.success, LucideIcons.circleCheck)
+ final active = verdict.activePhase;
+ final last = verdict.currentPhase;
+ final (icon, color, label, weight) = verdict.ready
+ ? (LucideIcons.circleCheck, AppColors.success, 'Ready', FontWeight.w700)
: verdict.errors > 0
? (
- '${verdict.errors} ${verdict.errors == 1 ? 'error' : 'errors'}',
- AppColors.danger,
LucideIcons.circleX,
+ AppColors.danger,
+ _count(verdict.errors, 'error'),
+ FontWeight.w600,
)
+ : active != null
+ ? (LucideIcons.circleDot, AppColors.text, active.name, FontWeight.w700)
: verdict.warnings > 0
? (
- '${verdict.warnings} ${verdict.warnings == 1 ? 'warning' : 'warnings'}',
- AppColors.warning,
LucideIcons.triangleAlert,
+ AppColors.warning,
+ _count(verdict.warnings, 'warning'),
+ FontWeight.w600,
)
- : ('Checked', AppColors.mutedStrong, LucideIcons.circleDashed);
+ : last != null
+ ? (
+ last.state == AgentPhaseState.failed
+ ? LucideIcons.x
+ : LucideIcons.check,
+ last.state == AgentPhaseState.failed
+ ? AppColors.danger
+ : AppColors.success,
+ last.name,
+ FontWeight.w500,
+ )
+ : (
+ LucideIcons.circleDashed,
+ AppColors.mutedStrong,
+ 'Checked',
+ FontWeight.w500,
+ );
return Tooltip(
message: verdict.summary ?? label,
+ waitDuration: const Duration(milliseconds: 500),
child: Semantics(
- label: 'Verdict: $label',
- child: Container(
- key: const ValueKey('pane-verdict-chip'),
- padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
- decoration: BoxDecoration(
- color: color.withValues(alpha: .12),
- borderRadius: BorderRadius.circular(999),
- border: Border.all(color: color.withValues(alpha: .35)),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(icon, size: 12, color: color),
- const SizedBox(width: 5),
- Text(
+ label: 'Status: $label',
+ child: Row(
+ key: const ValueKey('pane-status'),
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(icon, size: 12, color: color),
+ const SizedBox(width: 4),
+ Flexible(
+ child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: color,
fontFamily: AppFonts.sans,
- fontSize: 11,
- fontWeight: FontWeight.w600,
+ fontSize: 12,
+ fontWeight: weight,
),
),
- ],
- ),
+ ),
+ ],
),
),
);
}
}
-
-/// Where the work is, in one word: the phase under way, or the last one
-/// that happened. Drawn in the viewer pane's title, where "Viewer" used to
-/// be — a status, not a history, so each phase replaces the one before.
-class PhaseMark extends StatelessWidget {
- const PhaseMark({super.key, required this.phase});
-
- final AgentPhase phase;
-
- @override
- Widget build(BuildContext context) {
- final (icon, color, weight) = switch (phase.state) {
- AgentPhaseState.done => (
- LucideIcons.check,
- AppColors.success,
- FontWeight.w500,
- ),
- AgentPhaseState.active => (
- LucideIcons.circleDot,
- AppColors.text,
- FontWeight.w700,
- ),
- AgentPhaseState.failed => (
- LucideIcons.x,
- AppColors.danger,
- FontWeight.w500,
- ),
- AgentPhaseState.pending => (null, AppColors.textSoft, FontWeight.w500),
- };
- return Row(
- key: const ValueKey('pane-phase-mark'),
- mainAxisSize: MainAxisSize.min,
- children: [
- if (icon != null) ...[
- Icon(icon, size: 11, color: color),
- const SizedBox(width: 3),
- ],
- Text(
- phase.name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(fontSize: 11, fontWeight: weight, color: color),
- ),
- ],
- );
- }
-}
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index a451bedea..429f0a3f8 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -178,9 +178,9 @@ class _WebPanePanelState extends State<WebPanePanel> {
size: 17,
),
const SizedBox(width: 10),
- // The name, and where the work is — the current phase, one
- // word, in the place a "Viewer" label would only repeat what
- // the pane shows. A status, not a history.
+ // The name, and one status after it — ready, or what stands in
+ // the way, or where the work is — in the place a "Viewer" label
+ // would only repeat what the pane shows. A status, not a history.
Expanded(
child: Tooltip(
message: widget.pane.url ?? '',
@@ -200,7 +200,7 @@ class _WebPanePanelState extends State<WebPanePanel> {
),
),
),
- if (widget.verdict?.currentPhase case final phase?) ...[
+ if (widget.verdict case final verdict?) ...[
Text(
' · ',
style: TextStyle(
@@ -209,18 +209,13 @@ class _WebPanePanelState extends State<WebPanePanel> {
fontWeight: FontWeight.w500,
),
),
- Flexible(child: PhaseMark(phase: phase)),
+ Flexible(child: VerdictStatus(verdict: verdict)),
],
],
),
),
),
const SizedBox(width: 8),
- 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/verdict_marks_test.dart b/desktop/test/verdict_marks_test.dart
index f49bea19d..8f00ec984 100644
--- a/desktop/test/verdict_marks_test.dart
+++ b/desktop/test/verdict_marks_test.dart
@@ -1,5 +1,5 @@
-// The verdict's phases: parsed defensively from the frame, drawn as a strip
-// beside the chip in the viewer pane's header.
+// The one status a verdict puts in the viewer's title, and the phases it is
+// read from.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
@@ -66,74 +66,75 @@ void main() {
?.name,
'P1',
);
- expect(
- v([AgentPhaseState.done, AgentPhaseState.failed]).currentPhase?.name,
- 'P1',
- );
expect(v([AgentPhaseState.pending]).currentPhase, isNull);
expect(const AgentVerdict(ready: true).currentPhase, isNull);
},
);
- testWidgets('the mark names the phase and its state', (tester) async {
- await tester.pumpWidget(
- const MaterialApp(
- home: Scaffold(
- body: PhaseMark(
- phase: AgentPhase(
- id: 'draft',
- name: 'Draft',
- state: AgentPhaseState.active,
- ),
- ),
- ),
- ),
+ testWidgets('one status: ready, then errors, then the phase, then warnings', (
+ tester,
+ ) async {
+ const build = AgentPhase(
+ id: 'build',
+ name: 'Build',
+ state: AgentPhaseState.done,
+ );
+ const checks = AgentPhase(
+ id: 'checks',
+ name: 'Checks',
+ state: AgentPhaseState.active,
);
- expect(find.byKey(const ValueKey('pane-phase-mark')), findsOneWidget);
- expect(find.text('Draft'), findsOneWidget);
- });
-
- 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'),
+ const AgentVerdict(ready: true, phases: [build, checks], summary: 'ok'),
'Ready',
AppColors.success,
),
(
- const AgentVerdict(ready: false, errors: 3, warnings: 2),
+ const AgentVerdict(ready: false, errors: 3, phases: [build, checks]),
'3 errors',
AppColors.danger,
),
(
- const AgentVerdict(ready: false, errors: 0, warnings: 1),
+ const AgentVerdict(ready: false, warnings: 2, phases: [build, checks]),
+ 'Checks',
+ AppColors.text,
+ ),
+ (
+ const AgentVerdict(ready: false, warnings: 1, phases: [build]),
'1 warning',
AppColors.warning,
),
+ (
+ const AgentVerdict(ready: false, phases: [build]),
+ 'Build',
+ AppColors.success,
+ ),
(const AgentVerdict(ready: false), 'Checked', AppColors.mutedStrong),
];
+ final status = find.byKey(const ValueKey('pane-status'));
for (final (verdict, label, color) in cases) {
await tester.pumpWidget(
MaterialApp(
- home: Scaffold(body: VerdictChip(verdict: verdict)),
+ home: Scaffold(body: VerdictStatus(verdict: verdict)),
),
);
- expect(chip, findsOneWidget, reason: label);
+ expect(status, findsOneWidget, reason: label);
expect(
- find.descendant(of: chip, matching: find.text(label)),
+ find.descendant(of: status, matching: find.text(label)),
findsOneWidget,
+ reason: label,
);
expect(
tester
- .widget<Text>(find.descendant(of: chip, matching: find.text(label)))
+ .widget<Text>(
+ find.descendant(of: status, matching: find.text(label)),
+ )
.style
?.color,
color,
+ reason: label,
);
- 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 4d39fd9bb..df6d53282 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -248,7 +248,7 @@ void main() {
// 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);
+ expect(find.byKey(const ValueKey('pane-status')), findsNothing);
await _synced(
app,
'a0',
@@ -263,6 +263,8 @@ void main() {
},
);
await tester.pump();
+ // One status in the viewer's title, and nothing on the terminal's: the
+ // phase under way here, since the deck is neither ready nor failing.
final viewerHeader = find.ancestor(
of: find.byTooltip('Close viewer'),
matching: find.byType(WebPanePanel),
@@ -270,16 +272,14 @@ void main() {
expect(
find.descendant(
of: viewerHeader,
- matching: find.byKey(const ValueKey('pane-verdict-chip')),
+ matching: find.byKey(const ValueKey('pane-status')),
),
findsOneWidget,
);
- expect(find.byKey(const ValueKey('pane-verdict-chip')), findsOneWidget);
- // One phase, the current one, in the title — not the whole history.
- expect(find.byKey(const ValueKey('pane-phase-mark')), findsOneWidget);
+ expect(find.byKey(const ValueKey('pane-status')), findsOneWidget);
expect(find.text('Checks'), findsOneWidget);
expect(find.text('Build'), findsNothing);
- // No "Viewer" label in the title: the pane says what it is.
+ expect(find.text('1 warning'), findsNothing, reason: 'the phase wins');
expect(find.textContaining('· Viewer'), findsNothing);
expect(find.byTooltip('Hide viewer'), findsOneWidget);
await tester.tap(find.byTooltip('Close viewer'));