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.

A harness tab: viewer left at three quarters, terminal right, Marp on the shelf

dee2401ed62ddde
diff --git a/desktop/assets/engine-icons/marp.png b/desktop/assets/engine-icons/marp.png
new file mode 100644
index 000000000..a719d509a
Binary files /dev/null and b/desktop/assets/engine-icons/marp.png differ
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 32eb2d7ac..c10a2aeb0 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -37,7 +37,7 @@ import '../terminal/terminal_theme_store.dart';
import '../logging/app_log.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../terminal/remote_media_download.dart';
-import '../widgets/engine_identity.dart' show allEngines;
+import '../widgets/engine_identity.dart' show allEngines, engineIdentity;
import 'dial_status.dart';
import 'pane_layout_store.dart';
import 'terminal_pane.dart';
@@ -3918,7 +3918,9 @@ class AppNotifier extends ChangeNotifier {
);
if (at < 0) continue;
if (swarm.panes.length >= maxPanes) return;
- final insertion = at + 1;
+ // The viewer goes LEFT of the terminal: it is what the user watches, the
+ // terminal is where they type, and reading order puts the product first.
+ final insertion = at;
final pane = TerminalPane(
id: _nextPaneId++,
machineId: machineId,
@@ -3934,6 +3936,12 @@ class AppNotifier extends ChangeNotifier {
);
swarm.arranged = null;
swarm.arrangedKey = null;
+ // Alone with its terminal, the viewer takes three quarters of the tab —
+ // a board or a part wants the width, a chat column does not. Only when
+ // nobody has sized this pair by hand: a manual layout is the user's.
+ if (swarm.panes.length == 2 && swarm.paneSizes['2:manual'] == null) {
+ swarm.savePaneSizes('2:manual', PaneArrangement.viewerBesideTerminal);
+ }
_persistLayout();
return;
}
@@ -4329,9 +4337,27 @@ class AppNotifier extends ChangeNotifier {
if (creation._finished) return Future.value(creation._outcome);
if (creation._inFlight case final inFlight?) return inFlight;
if (creation._choices == null) {
+ var targetId = split?.swarmId ?? swarmId ?? activeSwarmId;
+ // A harness gets a tab of its own, named after it: its viewer is the
+ // product and needs the width, and the two tiles read as one workspace
+ // rather than two more tiles in whatever tab was open. A New Harness
+ // start page the user is already on IS that tab. A split was asked for
+ // by name and wins; so does a tab other than the current one. The
+ // current tab is what the dialog passes when nothing was chosen.
+ if (dsh != null &&
+ split == null &&
+ (swarmId == null || swarmId == activeSwarmId)) {
+ final label = engineIdentity(dsh).label;
+ if (activeSwarm.isEmptyStarter) {
+ renameSwarm(activeSwarmId, label);
+ } else {
+ newSwarm(name: label);
+ }
+ targetId = activeSwarmId;
+ }
creation._choices = choices;
creation._machineId = machineId;
- creation._targetId = split?.swarmId ?? swarmId ?? activeSwarmId;
+ creation._targetId = targetId;
creation._split = split;
}
final work = _createAgentWithReceipt(creation);
diff --git a/desktop/lib/state/pane_arrangement.dart b/desktop/lib/state/pane_arrangement.dart
index ab9ca8c4f..7a397cc88 100644
--- a/desktop/lib/state/pane_arrangement.dart
+++ b/desktop/lib/state/pane_arrangement.dart
@@ -8,6 +8,14 @@ enum PaneResizeAxis { x, y }
class PaneArrangement {
PaneArrangement(Iterable<Rect> tiles) : tiles = List.unmodifiable(tiles);
final List<Rect> tiles;
+
+ /// The split a harness tab opens with: the viewer on the left at three
+ /// quarters, its terminal on the right. One shared instance, so the code
+ /// that opened the pair can tell its own split from one the user dragged.
+ static final viewerBesideTerminal = PaneArrangement(const [
+ Rect.fromLTRB(0, 0, 0.75, 1),
+ Rect.fromLTRB(0.75, 0, 1, 1),
+ ]);
static const _epsilon = 0.000001;
late final List<PaneDivider> dividers = _findDividers();
diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dart
index af8237873..2e6bcdea8 100644
--- a/desktop/lib/state/swarm.dart
+++ b/desktop/lib/state/swarm.dart
@@ -48,6 +48,13 @@ class Swarm {
if (index < 0) return;
final manual = manualLayout;
panes.removeAt(index);
+ // Layouts are kept per pane count, so the harness split for a viewer and
+ // its terminal would otherwise wait for the next two tiles of any kind.
+ // Only the split Harness itself made goes; one the user dragged is theirs.
+ if (panes.length == 1 &&
+ identical(manual, PaneArrangement.viewerBesideTerminal)) {
+ paneSizes.remove('2:manual');
+ }
if (manual != null && panes.length > 1) {
final next = manual.remove(index);
if (next == null) {
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index 1ec29913e..d316ab9b9 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -28,6 +28,7 @@ class AgentPicker extends StatelessWidget {
'opencode',
'autonomous/circuit',
'autonomous/workshop',
+ 'autonomous/marp',
];
@override
diff --git a/desktop/lib/widgets/engine_identity.dart b/desktop/lib/widgets/engine_identity.dart
index 2ef855f23..5f176d5ff 100644
--- a/desktop/lib/widgets/engine_identity.dart
+++ b/desktop/lib/widgets/engine_identity.dart
@@ -126,6 +126,12 @@ const _harnesses = <String, EngineIdentity>{
color: Color(0xffe09a3c),
asset: 'assets/engine-icons/workshop.png',
),
+ 'autonomous/marp': EngineIdentity(
+ id: 'autonomous/marp',
+ label: 'Marp',
+ color: Color(0xff218cdb),
+ asset: 'assets/engine-icons/marp.png',
+ ),
};
/// The base engine each first-party harness runs on, so the Create dialog can
@@ -134,6 +140,7 @@ const _harnesses = <String, EngineIdentity>{
const knownHarnessBase = <String, String>{
'autonomous/circuit': 'claude',
'autonomous/workshop': 'codex',
+ 'autonomous/marp': 'claude',
};
/// All known engines, in declaration order — for the New Agent engine picker.
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index e9d2ed637..c9a0e71e3 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -74,7 +74,6 @@ class _WebPanePanelState extends State<WebPanePanel> {
void _mountController() {
final controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
- ..setBackgroundColor(grid.AppPalette.windowBg)
..setNavigationDelegate(
NavigationDelegate(
onPageStarted: (_) => _set(() {
@@ -112,6 +111,13 @@ class _WebPanePanelState extends State<WebPanePanel> {
if (uri == null) return;
_loadedUrl = url;
_failure = null;
+ // The window colour behind the page, so a dark app never flashes white
+ // while a viewer loads. WKWebView on macOS has no such setting (the plugin
+ // throws UnimplementedError, seen live 2026-09-15 as a red pane), so only
+ // platforms that do get it.
+ if (!Platform.isMacOS) {
+ controller.setBackgroundColor(grid.AppPalette.windowBg);
+ }
controller.loadRequest(uri);
}
diff --git a/desktop/test/harness_tab_test.dart b/desktop/test/harness_tab_test.dart
new file mode 100644
index 000000000..26b6f5a17
--- /dev/null
+++ b/desktop/test/harness_tab_test.dart
@@ -0,0 +1,125 @@
+// A harness created from the dialog gets a tab of its own, named after the
+// harness — the viewer is the product and needs the width. A New Harness start
+// page the user is already on is that tab; a tab with work in it is left alone.
+import 'dart:async';
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/terminal/terminal_binary.dart';
+import 'package:harness/ws/ws_conn.dart';
+
+import 'swarm_screen_test.dart' show terminal;
+import 'swarm_state_test.dart' show createApp;
+
+class _Request {
+ _Request(this.type, this.payload);
+ final String type;
+ final Map<String, dynamic> payload;
+ final reply = Completer<Map<String, dynamic>>();
+ void created(String id) => reply.complete({
+ 'creationId': payload['creationId'],
+ 'state': 'created',
+ 'agent': {
+ 'id': id,
+ 'name': id,
+ 'engine': 'claude',
+ 'dsh': 'autonomous/circuit',
+ },
+ });
+}
+
+class _Connection extends WsConn {
+ _Connection()
+ : super(
+ wsBaseUrl: 'ws://fixture.invalid',
+ autonomousEnv: 'test',
+ machineId: 'm',
+ accessTokenProvider: (_, _) async => '',
+ onAuthFailure: (_) {},
+ onEvent: (_) {},
+ onStatus: (_) {},
+ );
+ final calls = <_Request>[];
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) {
+ if (type == 'engines_probe') return Future.value({'engines': []});
+ if (type == 'dsh_list') return Future.value({'dsh': []});
+ final request = _Request(type, Map.of(payload));
+ calls.add(request);
+ return request.reply.future;
+ }
+}
+
+void main() {
+ test(
+ 'a harness created on an empty start page makes it the harness tab',
+ () async {
+ final connection = _Connection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ app.stateOf('m')!.localOnly = true;
+ final starter = app.activeSwarm;
+ expect(starter.isEmptyStarter, isTrue);
+
+ final create = app.createAgent(
+ 'm',
+ engine: 'claude',
+ folder: '/w',
+ dsh: 'autonomous/circuit',
+ );
+ expect(app.swarms, hasLength(1), reason: 'the start page is reused');
+ expect(app.activeSwarm.name, 'Circuit');
+ expect(connection.calls.single.type, 'agent_create');
+ expect(connection.calls.single.payload['dsh'], 'autonomous/circuit');
+ connection.calls.single.created('c1');
+ expect(await create, isNull);
+ expect(app.activeSwarm, same(starter));
+ expect(app.activeSwarm.panes.single.agentId, 'c1');
+ },
+ );
+
+ test('a harness created beside other work opens its own tab', () async {
+ final connection = _Connection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ app.stateOf('m')!.localOnly = true;
+ final input = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a0', input));
+ final busy = app.activeSwarm;
+
+ final create = app.createAgent(
+ 'm',
+ engine: 'codex',
+ folder: '/w',
+ dsh: 'autonomous/workshop',
+ // What the dialog passes when no tab was chosen: the current one.
+ swarmId: app.activeSwarmId,
+ );
+ expect(app.swarms, hasLength(2));
+ expect(app.activeSwarm, isNot(same(busy)));
+ expect(app.activeSwarm.name, 'Workshop');
+ connection.calls.single.created('w1');
+ expect(await create, isNull);
+ expect(app.activeSwarm.panes.single.agentId, 'w1');
+ expect(busy.panes, hasLength(1), reason: 'the other tab is untouched');
+ });
+
+ test('an engine without a harness lands where it always did', () async {
+ final connection = _Connection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ app.stateOf('m')!.localOnly = true;
+ final input = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a0', input));
+ final busy = app.activeSwarm;
+ final create = app.createAgent('m', engine: 'claude', folder: '/w');
+ expect(app.swarms, hasLength(1));
+ expect(app.activeSwarm, same(busy));
+ connection.calls.single.created('p1');
+ expect(await create, isNull);
+ expect(busy.panes, hasLength(2));
+ });
+}
diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dart
index 3444f80e0..545f05142 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -1,9 +1,12 @@
-// A harness's viewer tile: opened to the right of its agent's terminal when the
+// A harness's viewer tile: opened to the left of its agent's terminal when the
// agent's frame names a viewer, navigated when that URL changes, left closed
// once the person closes it, and taken down with the agent.
+
import 'package:flutter/material.dart';
+
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/state/pane_arrangement.dart';
import 'package:harness/state/terminal_pane.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/widgets/web_pane_panel.dart';
@@ -36,46 +39,79 @@ List<TerminalPane> _viewers(AppNotifier app) =>
app.panes.where((pane) => pane.isWeb).toList();
void main() {
- test(
- 'a viewer opens to the right of its agent and follows the URL',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- final input = <TerminalBinaryFrame>[];
- final first = app.adoptSessionForTest(terminal('a0', input));
- final second = app.adoptSessionForTest(terminal('a1', input));
- app.focusPane(first.id);
-
- // A frame with no viewer opens nothing.
- await _synced(app, 'a0');
- expect(_viewers(app), isEmpty);
-
- await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
- final viewer = _viewers(app).single;
- expect(viewer.ownerAgentId, 'a0');
- expect(
- viewer.agentId,
- isNull,
- reason: 'a viewer is not the agent\'s tile',
- );
- expect(viewer.url, 'http://127.0.0.1:4179/');
- expect(app.panes.map((p) => p.id), [first.id, viewer.id, second.id]);
- expect(app.focusedPaneId, first.id, reason: 'never steals focus');
-
- // The same URL again is nothing new; a different one navigates in place.
- await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
- expect(_viewers(app).single.id, viewer.id);
- await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/?file=a.step');
- expect(_viewers(app).single.id, viewer.id);
- expect(_viewers(app).single.url, 'http://127.0.0.1:4179/?file=a.step');
- expect(app.panes.length, 3);
-
- // A frame that drops the viewer takes the tile down.
- await _synced(app, 'a0');
- expect(_viewers(app), isEmpty);
- expect(app.panes.map((p) => p.id), [first.id, second.id]);
- },
- );
+ test('a viewer opens to the left of its agent and follows the URL', () async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ final input = <TerminalBinaryFrame>[];
+ final first = app.adoptSessionForTest(terminal('a0', input));
+ final second = app.adoptSessionForTest(terminal('a1', input));
+ app.focusPane(first.id);
+
+ // A frame with no viewer opens nothing.
+ await _synced(app, 'a0');
+ expect(_viewers(app), isEmpty);
+
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
+ final viewer = _viewers(app).single;
+ expect(viewer.ownerAgentId, 'a0');
+ expect(viewer.agentId, isNull, reason: 'a viewer is not the agent\'s tile');
+ expect(viewer.url, 'http://127.0.0.1:4179/');
+ expect(app.panes.map((p) => p.id), [viewer.id, first.id, second.id]);
+ expect(app.focusedPaneId, first.id, reason: 'never steals focus');
+ expect(
+ app.activeSwarm.paneSizes['2:manual'],
+ isNull,
+ reason: 'three tiles: the grid decides, not the harness split',
+ );
+
+ // The same URL again is nothing new; a different one navigates in place.
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
+ expect(_viewers(app).single.id, viewer.id);
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/?file=a.step');
+ expect(_viewers(app).single.id, viewer.id);
+ expect(_viewers(app).single.url, 'http://127.0.0.1:4179/?file=a.step');
+ expect(app.panes.length, 3);
+
+ // A frame that drops the viewer takes the tile down.
+ await _synced(app, 'a0');
+ expect(_viewers(app), isEmpty);
+ expect(app.panes.map((p) => p.id), [first.id, second.id]);
+ });
+
+ test('alone with its terminal, the viewer takes three quarters', () async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ final input = <TerminalBinaryFrame>[];
+ final terminalPane = app.adoptSessionForTest(terminal('a0', input));
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
+ final viewer = _viewers(app).single;
+ expect(app.panes.map((p) => p.id), [viewer.id, terminalPane.id]);
+ final split = app.activeSwarm.paneSizes['2:manual'];
+ expect(split, isNotNull);
+ expect(split!.tiles.map((t) => t.left), [0, 0.75]);
+ expect(split.tiles.map((t) => t.right), [0.75, 1]);
+ expect(split.tiles.map((t) => t.height), [1, 1]);
+ // The viewer going away takes the pair's layout with it, the way any
+ // removal does; a new viewer starts the split afresh.
+ await _synced(app, 'a0');
+ expect(app.activeSwarm.paneSizes['2:manual'], isNull);
+ expect(app.panes.map((p) => p.id), [terminalPane.id]);
+ });
+
+ test('a pair the user sized by hand keeps its sizes', () async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ final input = <TerminalBinaryFrame>[];
+ app.adoptSessionForTest(terminal('a0', input));
+ final theirs = PaneArrangement(const [
+ Rect.fromLTRB(0, 0, 0.5, 1),
+ Rect.fromLTRB(0.5, 0, 1, 1),
+ ]);
+ app.activeSwarm.savePaneSizes('2:manual', theirs);
+ await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
+ expect(_viewers(app), hasLength(1));
+ expect(app.activeSwarm.paneSizes['2:manual'], same(theirs));
+ });
test('a viewer closed by hand stays closed until the URL changes', () async {
final app = createApp();
@@ -117,7 +153,7 @@ void main() {
await _synced(app, 'a0', viewerUrl: 'http://127.0.0.1:4179/');
expect(app.panes, isEmpty, reason: 'no terminal on any desk');
await app.addAgentToSwarm('m', 'a0');
- expect(app.panes.map((p) => p.isWeb), [false, true]);
+ expect(app.panes.map((p) => p.isWeb), [true, false]);
});
testWidgets('the tile renders a header and, under test, the URL in words', (
diff --git a/dsh/registry/autonomous/marp.json b/dsh/registry/autonomous/marp.json
new file mode 100644
index 000000000..9222848ca
--- /dev/null
+++ b/dsh/registry/autonomous/marp.json
@@ -0,0 +1,10 @@
+{
+ "id": "autonomous/marp",
+ "name": "Marp",
+ "description": "Describe a talk; get a Marp slide deck with a live preview, exportable to PDF and PPTX.",
+ "repo": "https://github.com/autonomous-ai/autonomous-marp",
+ "ref": "harness-dsh",
+ "engine": "claude",
+ "tier": 2,
+ "verified": false
+}