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.

The viewer pane is called what it is — 3D Viewer · Ready — not the harness a second time

dee25436c812e37
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 72c0248c6..84a45125d 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -79,7 +79,7 @@ import { buildLaunchOverrides, validateLaunchOverrides, type LaunchOverrides, ty
import { prepareCodexResume } from './engines/codex/portableHistory.js'
import { buildHarnessSessionLabel } from './lib/harnessSessionLabel.js'
import { installedDsh } from './dsh/installed.js'
-import { dshVerdictPath } from './dsh/manifest.js'
+import { dshVerdictPath, dshViewerName } from './dsh/manifest.js'
import { catalogEntry, refreshDshRegistry } from './dsh/catalog.js'
import { installDsh, resolveInstallSource, removeDsh } from './dsh/install.js'
import { preTrustClaudeProject, preTrustCodexProject } from './lib/claudeTrust.js'
@@ -1457,6 +1457,8 @@ async function runForeground(session: AuthSession): Promise<void> {
id: installed?.id ?? s.dsh,
name: installed?.manifest.name ?? catalogEntry(s.dsh)?.name ?? null,
viewerUrl: state?.viewerUrl ?? null,
+ // The pane beside the terminal says what it is, so the harness's name is not printed twice.
+ viewerName: installed ? dshViewerName(installed.manifest, (id) => installedDsh(id)?.manifest.name ?? catalogEntry(id)?.name) : null,
verdict: state?.verdict ?? null,
}
}
diff --git a/cli/src/dsh/manifest.spec.ts b/cli/src/dsh/manifest.spec.ts
index 63fb9a590..9dd72f75c 100644
--- a/cli/src/dsh/manifest.spec.ts
+++ b/cli/src/dsh/manifest.spec.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
-import { DshManifestSchema, dshSkillsDirFor, dshTier, dshVerdictPath, expandDshValue, parseDshManifest, readDshManifest , isViewerPackage, dshEngine, viewerUse} from './manifest.js'
+import { DshManifestSchema, dshSkillsDirFor, dshTier, dshVerdictPath, dshViewerName, expandDshValue, parseDshManifest, readDshManifest , isViewerPackage, dshEngine, viewerUse} from './manifest.js'
const STARTER = fileURLToPath(new URL('../../../store/starter', import.meta.url))
@@ -53,6 +53,28 @@ describe('parseDshManifest', () => {
})
})
+describe('dshViewerName: what the viewer pane beside a harness is called', () => {
+ const agent = (viewer?: Record<string, unknown>) => DshManifestSchema.parse({
+ spec: 1, id: 'autonomous/blender', name: 'Blender', engine: 'claude', ...(viewer ? { viewer } : {}),
+ })
+ const names: Record<string, string> = { 'autonomous/model-viewer': ' 3D Viewer ' }
+ const nameOf = (id: string) => names[id]
+
+ it('is the shared viewer package’s own name', () => {
+ expect(dshViewerName(agent({ use: 'autonomous/model-viewer' }), nameOf)).toBe('3D Viewer')
+ })
+
+ it('is the harness’s name and Viewer when it ships its own', () => {
+ expect(dshViewerName(agent({ command: './viewer.sh', url: 'http://127.0.0.1:${port}/' }), nameOf)).toBe('Blender Viewer')
+ })
+
+ it('is null without a viewer, or when the used package’s name is not known here', () => {
+ expect(dshViewerName(agent(), nameOf)).toBeNull()
+ expect(dshViewerName(agent({ use: 'someone/unknown-viewer' }), nameOf)).toBeNull()
+ expect(dshViewerName(agent({ use: 'autonomous/model-viewer' }), () => ' ')).toBeNull()
+ })
+})
+
describe('expandDshValue', () => {
it('expands the three variables and leaves anything else alone', () => {
const vars = { dsh: '/i/dsh', workspace: '/w', home: '/h' }
diff --git a/cli/src/dsh/manifest.ts b/cli/src/dsh/manifest.ts
index 85eb944f7..44e795291 100644
--- a/cli/src/dsh/manifest.ts
+++ b/cli/src/dsh/manifest.ts
@@ -107,6 +107,19 @@ export function viewerUse(manifest: DshManifest): string | null {
return manifest.viewer && 'use' in manifest.viewer ? manifest.viewer.use : null
}
+/**
+ * What a harness's viewer pane is called: the shared viewer package's own name ("3D Viewer"), looked
+ * up by `nameOf` (the installed package, else the catalog); for a viewer the harness ships itself,
+ * its own name and "Viewer" ("Marp Viewer"). Null for a harness with no viewer, and for a used
+ * package whose name is not known here — the pane then says what the app can.
+ */
+export function dshViewerName(manifest: DshManifest, nameOf: (id: string) => string | null | undefined): string | null {
+ if (!manifest.viewer) return null
+ const used = viewerUse(manifest)
+ if (used) return nameOf(used)?.trim() || null
+ return `${manifest.name} Viewer`
+}
+
/** The base engine of an agent package; a viewer package answers null. */
export function dshEngine(manifest: DshManifest): DshManifest['engine'] | null {
return manifest.engine ?? null
diff --git a/cli/src/lib/agentFrame.spec.ts b/cli/src/lib/agentFrame.spec.ts
index cf6b0cc19..8cea8fddb 100644
--- a/cli/src/lib/agentFrame.spec.ts
+++ b/cli/src/lib/agentFrame.spec.ts
@@ -54,6 +54,20 @@ describe('agentFrame', () => {
.toMatchObject({ selectedModel: 'opus', terminal: { available: false, primary: 'tmux/%1' } })
})
+ it('carries the viewer pane’s name with the harness, and null for a plain engine', async () => {
+ const withViewer = await agentFrame(session(null), {
+ selectedModel: null, terminalAvailable: true,
+ dsh: { id: 'autonomous/blender', name: 'Blender', viewerUrl: 'http://127.0.0.1:4100/', viewerName: '3D Viewer', verdict: null },
+ })
+ expect(withViewer).toMatchObject({ dsh: 'autonomous/blender', dshName: 'Blender', viewerName: '3D Viewer' })
+ const older = await agentFrame(session(null), {
+ selectedModel: null, terminalAvailable: true,
+ dsh: { id: 'autonomous/blender', name: 'Blender', viewerUrl: null, verdict: null },
+ })
+ expect(older).toHaveProperty('viewerName', null)
+ expect(await agentFrame(session(null), { selectedModel: null, terminalAvailable: true })).toHaveProperty('viewerName', null)
+ })
+
it('reports launch state and defaults legacy agents to ready', async () => {
const legacy = session(null)
expect(await agentFrame(legacy, { selectedModel: null, terminalAvailable: true }))
diff --git a/cli/src/lib/agentFrame.ts b/cli/src/lib/agentFrame.ts
index f7b053364..b1814a399 100644
--- a/cli/src/lib/agentFrame.ts
+++ b/cli/src/lib/agentFrame.ts
@@ -68,6 +68,8 @@ export type AgentFrame = {
dshName: string | null
/** Where this agent's viewer is being served right now, or null when it has none up. */
viewerUrl: string | null
+ /** What its viewer pane is called ("3D Viewer", "Marp Viewer"); null with no viewer or none known. */
+ viewerName: string | null
/** The DSH's last verdict for this workspace, reduced for the pane header; null when none yet. */
verdict: DshVerdict | null
}
@@ -78,6 +80,8 @@ export interface AgentDshContext {
id: string | null
name: string | null
viewerUrl: string | null
+ /** manifest.ts, dshViewerName. */
+ viewerName?: string | null
verdict: DshVerdict | null
}
@@ -133,11 +137,12 @@ export async function agentFrame(
// `grid: null` is above.
codexHome: s.codexHome ?? null,
project: await agentProject(s.cwd),
- // All four are real answers when null, for the reason the module doc gives: a frame that omits
+ // All five 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: dsh?.id ?? s.dsh ?? null,
dshName: dsh?.name ?? null,
viewerUrl: dsh?.viewerUrl ?? null,
+ viewerName: dsh?.viewerName ?? null,
verdict: dsh?.verdict ?? null,
}
}
diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dart
index a001c6ee4..14faac712 100644
--- a/desktop/lib/core/models.dart
+++ b/desktop/lib/core/models.dart
@@ -195,6 +195,11 @@ class Agent {
/// when there is none (yet). A change means the viewer pane must navigate.
final String? viewerUrl;
+ /// What the harness's viewer pane is called — the shared viewer's own name ("3D Viewer"), or
+ /// the harness's name and "Viewer" for one it ships ("Marp Viewer") — as the daemon worked it
+ /// out. Null from an older daemon or with no viewer; see [PaneGrid] for what stands in.
+ final String? viewerName;
+
/// The harness's last verdict on this workspace, or null when it has not written one.
final AgentVerdict? verdict;
@@ -220,6 +225,7 @@ class Agent {
this.dsh,
this.dshName,
this.viewerUrl,
+ this.viewerName,
this.verdict,
});
@@ -281,6 +287,7 @@ class Agent {
dsh: _safeDsh(j['dsh']),
dshName: _safeLabel(j['dshName']),
viewerUrl: _safeViewerUrl(j['viewerUrl']),
+ viewerName: _safeLabel(j['viewerName']),
verdict: AgentVerdict.fromJson(j['verdict']),
);
}
@@ -307,6 +314,7 @@ class Agent {
dsh: dsh,
dshName: dshName,
viewerUrl: viewerUrl,
+ viewerName: viewerName,
verdict: verdict,
);
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index c7c896939..2173c16c0 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -3129,6 +3129,7 @@ class AppNotifier extends ChangeNotifier {
prev.dsh != agent.dsh ||
prev.dshName != agent.dshName ||
prev.viewerUrl != agent.viewerUrl ||
+ prev.viewerName != agent.viewerName ||
prev.verdict != agent.verdict) {
return false;
}
diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dart
index 3264fef36..8dad902df 100644
--- a/desktop/lib/widgets/pane_grid.dart
+++ b/desktop/lib/widgets/pane_grid.dart
@@ -7,6 +7,8 @@ import 'package:xterm/xterm.dart';
import 'window_chrome.dart';
import '../clipboard/image_bytes.dart';
+import '../core/dsh_catalog.dart' show DshEntry;
+import '../core/models.dart' show Agent;
import '../clipboard/native_clipboard.dart';
import '../shared/theme/app_theme.dart' as grid;
// `hide TerminalKey`: this file's own shortcut-label class, unused here, collides with xterm's
@@ -1275,6 +1277,7 @@ class _PaneContent extends StatelessWidget {
key: ValueKey('web-pane-${pane.id}'),
notifier: notifier,
pane: pane,
+ title: viewerPaneName(owner, machine?.dsh.entries ?? const []),
ownerName: owner?.name ?? pane.ownerAgentId ?? 'Viewer',
ownerEngine: owner?.identityEngine,
ownerDisplayName: owner?.identityDisplayName,
@@ -2162,3 +2165,19 @@ class _EmptyGrid extends StatelessWidget {
);
}
}
+
+/// What a harness's viewer pane is called, so the harness's name is not printed twice beside its
+/// terminal. The daemon's answer first; from a daemon that predates it, the shared viewer's name
+/// from this machine's catalog ("3D Viewer"); else the harness's name and "Viewer"; else "Viewer".
+String viewerPaneName(Agent? owner, Iterable<DshEntry> catalog) {
+ if (owner == null) return 'Viewer';
+ if (owner.viewerName case final name?) return name;
+ final entry = catalog.where((e) => e.id == owner.dsh).firstOrNull;
+ final used = entry?.viewerUse;
+ if (used != null) {
+ final viewer = catalog.where((e) => e.id == used).firstOrNull;
+ if (viewer != null && viewer.name.trim().isNotEmpty) return viewer.name.trim();
+ }
+ final harness = owner.dshName ?? entry?.name;
+ return harness == null || harness.trim().isEmpty ? 'Viewer' : '${harness.trim()} Viewer';
+}
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index fddd1c219..864c6fc6f 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -33,6 +33,7 @@ class WebPanePanel extends StatefulWidget {
super.key,
required this.notifier,
required this.pane,
+ this.title = 'Viewer',
required this.ownerName,
required this.ownerEngine,
this.ownerDisplayName,
@@ -47,7 +48,10 @@ class WebPanePanel extends StatefulWidget {
final AppNotifier notifier;
final TerminalPane pane;
- /// The agent this viewer belongs to, for the header.
+ /// What the pane is called in its header ("3D Viewer"); see viewerPaneName.
+ final String title;
+
+ /// The harness this viewer belongs to — in the header's tooltip, beside the URL.
final String ownerName;
final String? ownerEngine;
final String? ownerDisplayName;
@@ -198,13 +202,16 @@ class _WebPanePanelState extends State<WebPanePanel> {
// would only repeat what the pane shows. A status, not a history.
Expanded(
child: Tooltip(
- message: widget.pane.url ?? '',
+ message: [
+ widget.ownerName,
+ ?widget.pane.url,
+ ].join('\n'),
waitDuration: const Duration(milliseconds: 700),
child: Row(
children: [
Flexible(
child: Text(
- widget.ownerName,
+ widget.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
diff --git a/desktop/test/viewer_pane_name_test.dart b/desktop/test/viewer_pane_name_test.dart
new file mode 100644
index 000000000..8c7de9966
--- /dev/null
+++ b/desktop/test/viewer_pane_name_test.dart
@@ -0,0 +1,82 @@
+// viewerPaneName: what a harness's viewer pane is called when the daemon did not say.
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/widgets/pane_grid.dart';
+
+void main() {
+ const catalog = [
+ DshEntry(
+ id: 'autonomous/blender',
+ name: 'Blender',
+ engine: 'claude',
+ viewer: true,
+ viewerUse: 'autonomous/model-viewer',
+ ),
+ DshEntry(
+ id: 'autonomous/model-viewer',
+ name: ' 3D Viewer ',
+ engine: '',
+ kind: 'viewer',
+ ),
+ DshEntry(
+ id: 'autonomous/marp',
+ name: 'Marp',
+ engine: 'claude',
+ viewer: true,
+ ),
+ DshEntry(
+ id: 'autonomous/odd',
+ name: 'Odd',
+ engine: 'claude',
+ viewer: true,
+ viewerUse: 'autonomous/blank-viewer',
+ ),
+ DshEntry(id: 'autonomous/blank-viewer', name: ' ', engine: '', kind: 'viewer'),
+ ];
+ Agent agent({String? dsh, String? dshName, String? viewerName}) => Agent(
+ id: 'a1',
+ name: 'Blender harness 9-17 15:30',
+ dsh: dsh,
+ dshName: dshName,
+ viewerName: viewerName,
+ );
+
+ test('the daemon’s name wins', () {
+ expect(
+ viewerPaneName(
+ agent(dsh: 'autonomous/blender', viewerName: 'Custom Viewer'),
+ catalog,
+ ),
+ 'Custom Viewer',
+ );
+ });
+
+ test('from an older daemon: the shared viewer’s name from the catalog, else the harness’s and Viewer', () {
+ expect(
+ viewerPaneName(
+ agent(dsh: 'autonomous/blender', dshName: 'Blender'),
+ catalog,
+ ),
+ '3D Viewer',
+ );
+ expect(
+ viewerPaneName(agent(dsh: 'autonomous/marp', dshName: 'Marp'), catalog),
+ 'Marp Viewer',
+ );
+ expect(
+ viewerPaneName(agent(dsh: 'autonomous/marp'), catalog),
+ 'Marp Viewer',
+ );
+ expect(
+ viewerPaneName(agent(dsh: 'autonomous/odd', dshName: 'Odd'), catalog),
+ 'Odd Viewer',
+ );
+ expect(
+ viewerPaneName(agent(dsh: 'someone/unknown', dshName: ' '), catalog),
+ 'Viewer',
+ );
+ expect(viewerPaneName(agent(dsh: 'someone/unknown'), const []), 'Viewer');
+ expect(viewerPaneName(null, catalog), 'Viewer');
+ });
+}
diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dart
index 1815cc526..752041ed4 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -17,6 +17,7 @@ import 'swarm_state_test.dart' show createApp;
Map<String, dynamic> _frame(
String id, {
String? viewerUrl,
+ String? viewerName,
Map<String, dynamic>? verdict,
}) => {
'id': id,
@@ -25,6 +26,7 @@ Map<String, dynamic> _frame(
'dsh': 'autonomous/autonomous-circuit',
'dshName': 'Autonomous Circuit',
'viewerUrl': ?viewerUrl,
+ 'viewerName': ?viewerName,
'verdict': ?verdict,
'terminal': {
'available': true,
@@ -38,10 +40,18 @@ Future<void> _synced(
AppNotifier app,
String id, {
String? viewerUrl,
+ String? viewerName,
Map<String, dynamic>? verdict,
}) => app.handleEventForTest('m', {
'type': 'agent_synced',
- 'payload': {'agent': _frame(id, viewerUrl: viewerUrl, verdict: verdict)},
+ 'payload': {
+ 'agent': _frame(
+ id,
+ viewerUrl: viewerUrl,
+ viewerName: viewerName,
+ verdict: verdict,
+ ),
+ },
});
List<TerminalPane> _viewers(AppNotifier app) =>
@@ -288,6 +298,53 @@ void main() {
expect(tester.takeException(), isNull);
});
+ testWidgets(
+ 'the viewer is called what it is, not the harness again — the harness name moves to the tooltip',
+ (tester) async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ app.stateOf('m')!.nodeOnline = true;
+ final input = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a0', input));
+ await mount(tester, app);
+ await _synced(
+ app,
+ 'a0',
+ viewerUrl: 'http://127.0.0.1:4179/',
+ viewerName: '3D Viewer',
+ );
+ await tester.pump();
+ final header = find.byType(WebPanePanel);
+ expect(
+ find.descendant(of: header, matching: find.text('3D Viewer')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: header, matching: find.text('Agent a0')),
+ findsNothing,
+ );
+ expect(
+ find.descendant(
+ of: header,
+ matching: find.byTooltip('Agent a0\nhttp://127.0.0.1:4179/'),
+ ),
+ findsOneWidget,
+ );
+ // A daemon that predates viewerName: the harness's name and Viewer.
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
+ await tester.pump();
+ expect(
+ find.descendant(
+ of: header,
+ matching: find.text('Autonomous Circuit Viewer'),
+ ),
+ findsOneWidget,
+ );
+ // Let the terminal's batched resize run out.
+ await tester.pump(const Duration(milliseconds: 300));
+ },
+ );
+
testWidgets(
'a working agent\'s viewer says Working, keeps the last check for its tooltip, and goes back when the turn ends',
(tester) async {
@@ -305,7 +362,10 @@ void main() {
);
await tester.pump();
final status = find.byKey(const ValueKey('pane-status'));
- expect(find.descendant(of: status, matching: find.text('Ready')), findsOneWidget);
+ expect(
+ find.descendant(of: status, matching: find.text('Ready')),
+ findsOneWidget,
+ );
Future<void> turn(String type) => app.handleEventForTest('m', {
'type': type,
@@ -314,20 +374,30 @@ void main() {
});
await turn('turn_started');
await tester.pump();
- expect(find.descendant(of: status, matching: find.text('Working')), findsOneWidget);
- expect(find.descendant(of: status, matching: find.text('Ready')), findsNothing);
+ expect(
+ find.descendant(of: status, matching: find.text('Working')),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: status, matching: find.text('Ready')),
+ findsNothing,
+ );
expect(
find.byWidgetPredicate(
(widget) =>
widget is Tooltip &&
- widget.message == 'The agent is working · last check: deck.pdf · 5 slides',
+ widget.message ==
+ 'The agent is working · last check: deck.pdf · 5 slides',
),
findsOneWidget,
);
await turn('turn_ended');
await tester.pump();
- expect(find.descendant(of: status, matching: find.text('Ready')), findsOneWidget);
+ expect(
+ find.descendant(of: status, matching: find.text('Ready')),
+ findsOneWidget,
+ );
// Let the tile's working ring wind down.
await tester.pump(const Duration(milliseconds: 300));
expect(tester.takeException(), isNull);