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
perf(desktop): retain terminal layout and controls during navigation
dee0e18b3f3edc1
diff --git a/desktop/lib/settings/settings_screen.dart b/desktop/lib/settings/settings_screen.dartindex 6e70d6ea4..ce8501373 100644--- a/desktop/lib/settings/settings_screen.dart+++ b/desktop/lib/settings/settings_screen.dart@@ -45,13 +45,8 @@ Future<void> showSettingsScreen(initialSection: initialSection,source: source,),- transitionsBuilder: (context, animation, _, child) =>- FadeTransition(opacity: animation, child: child),- // A cross-fade, not a slide. A screen that slides in from the right reads- // as a phone pushing a detail view; Settings arriving in place reads as- // the window changing what it is showing.- transitionDuration: const Duration(milliseconds: 170),- reverseTransitionDuration: const Duration(milliseconds: 120),+ transitionDuration: Duration.zero,+ reverseTransitionDuration: Duration.zero,),);}@@ -148,8 +143,8 @@ class _SettingsScreenState extends State<SettingsScreen> {/// The screen behind a [SettingsSection].///-/// Cross-fades rather than cuts: the rail's own row highlight animates, and a-/// pane that appears the instant you click reads as a jolt beside it.+/// Switch immediately, disposing the previous section instead of retaining it+/// for a cross-fade while the new section starts its work.class _SettingsBody extends StatelessWidget {const _SettingsBody({required this.section, required this.notifier});@@ -169,16 +164,6 @@ class _SettingsBody extends StatelessWidget {SettingsSection.tracking => const TrackingSection(),SettingsSection.about => AboutSection(notifier: notifier),};- return AnimatedSwitcher(- // The exit is the shorter half — waiting on it is what makes a cross-fade- // feel sluggish.- duration: const Duration(milliseconds: 200),- reverseDuration: const Duration(milliseconds: 90),- switchInCurve: Curves.easeOutCubic,- switchOutCurve: Curves.easeIn,- // Keyed by section, not by widget type: that is what tells the switcher a- // *different screen* arrived.- child: KeyedSubtree(key: ValueKey(section), child: screen),- );+ return KeyedSubtree(key: ValueKey(section), child: screen);}}diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex e85a790e6..6160fe85b 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -24,17 +24,8 @@ import 'harness_join_guide_screen.dart';import 'new_agent_dialog.dart';import 'terminal_panel.dart';-/// The terminals, as up to four tiles.-///-/// Fixed shapes rather than a splittable tree. A binary layout tree is what-/// tmux and herdr give you, and it earns its complexity — drag handles, sibling-/// ordering, a serialised shape — only once the count is open-ended. Capped at-/// four, every arrangement anyone would build by hand is already one of the-/// four below, and none of that machinery has to exist or be maintained.-///-/// The shapes are fixed; the DIVIDERS are not. Each one can be dragged and its-/// position is remembered per pane count (see [PaneSplits]) — which is the part-/// of a split tree people actually reach for, without the tree.+/// Terminal views arranged by the chosen preset. Swarms keep each view under+/// one stable parent as its rectangle, visibility and keyboard focus change.class PaneGrid extends StatelessWidget {const PaneGrid({super.key,@@ -52,6 +43,13 @@ class PaneGrid extends StatelessWidget {return ValueListenableBuilder<AgentDragRef?>(valueListenable: agentDrag,builder: (context, dragging, _) {+ if (swarmMode) {+ return _SwarmCanvas(+ notifier: notifier,+ dragging: dragging,+ empty: empty,+ );+ }final panes = notifier.panes;final zoomed = notifier.zoomedPaneId;final visible = zoomed == null@@ -75,43 +73,9 @@ class PaneGrid extends StatelessWidget {child: const _AddSlot(),),];- final canvas = panes.isEmpty+ return panes.isEmpty? empty ?? _EmptyGrid(notifier: notifier): _arrange(cells);- if (!swarmMode) return canvas;- // A shared agent is mounted exactly once, including across tab changes.- // Offstage keeps its renderer/selection/scroll position; the fixed old- // size and disabled auto-resize keep hidden geometry off the wire.- return Stack(- fit: StackFit.expand,- children: [- Positioned.fill(child: canvas),- for (final pane in notifier.allPanes)- if (!visible.contains(pane) && pane.lastViewSize != null)- Positioned.fill(- key: ValueKey(pane.id),- child: _ParkedPane(- session: pane.session,- child: Offstage(- offstage: true,- child: TickerMode(- enabled: false,- child: ExcludeFocus(- child: OverflowBox(- alignment: Alignment.topLeft,- minWidth: pane.lastViewSize!.width,- maxWidth: pane.lastViewSize!.width,- minHeight: pane.lastViewSize!.height,- maxHeight: pane.lastViewSize!.height,- child: cell(pane, visible: false),- ),- ),- ),- ),- ),- ),- ],- );},);}@@ -234,32 +198,268 @@ class PaneGrid extends StatelessWidget {}}-/// A tab switch does not change terminals that stay hidden. Keep their widget-/// configuration as well as their renderer; rebuilding their headers, menus,-/// and gestures makes switching cost grow with every previously visited tab.-/// Session replacement still reaches the parked view. When shown, the cell's-/// GlobalKey moves it into the active layout with current agent metadata.-class _ParkedPane extends StatefulWidget {- const _ParkedPane({required this.session, required this.child});+/// Switching layouts must not reparent terminal subtrees. GlobalKey grafting+/// preserves State but invalidates inherited dependencies throughout each view.+/// This canvas changes rectangles under a single Stack instead, including when+/// a large Swarm needs to scroll. Unvisited views remain unmounted.+class _SwarmCanvas extends StatefulWidget {+ const _SwarmCanvas({+ required this.notifier,+ required this.dragging,+ this.empty,+ });+ final AppNotifier notifier;+ final AgentDragRef? dragging;+ final Widget? empty;+ @override+ State<_SwarmCanvas> createState() => _SwarmCanvasState();+}++class _SwarmCanvasState extends State<_SwarmCanvas> {+ final _scroll = ScrollController(keepScrollOffset: false);+ final _offsets = <String, double>{};+ late String _activeId = widget.notifier.activeSwarmId;++ @override+ void initState() {+ super.initState();+ widget.notifier.addListener(_onAppChanged);+ terminalFontStore.addListener(_onFontChanged);+ }++ @override+ void didUpdateWidget(_SwarmCanvas oldWidget) {+ super.didUpdateWidget(oldWidget);+ if (!identical(oldWidget.notifier, widget.notifier)) {+ oldWidget.notifier.removeListener(_onAppChanged);+ widget.notifier.addListener(_onAppChanged);+ _offsets.clear();+ _activeId = widget.notifier.activeSwarmId;+ if (_scroll.hasClients) _scroll.jumpTo(0);+ }+ }++ void _onAppChanged() {+ final app = widget.notifier;+ if (_activeId != app.activeSwarmId) {+ if (_scroll.hasClients) _offsets[_activeId] = _scroll.offset;+ _activeId = app.activeSwarmId;+ // The notification precedes the frame. Restore before layout/paint so+ // switching never briefly displays the previous Swarm's scroll offset.+ if (_scroll.hasClients) _scroll.jumpTo(_offsets[_activeId] ?? 0);+ final open = app.swarms.map((s) => s.id).toSet();+ _offsets.removeWhere((id, _) => !open.contains(id));+ }+ setState(() {});+ }++ void _onFontChanged() => setState(() {});++ @override+ void dispose() {+ widget.notifier.removeListener(_onAppChanged);+ terminalFontStore.removeListener(_onFontChanged);+ _scroll.dispose();+ super.dispose();+ }++ /// Cache the healthy terminal path when focus/discovery changes no visible+ /// presentation. Connection/setup views still read their complete state.+ /// Theme/font dependencies continue updating retained descendants directly.+ Object? _presentation(TerminalPane pane, bool visible) {+ if (!visible) return null;+ final app = widget.notifier;+ final machine = app.stateOf(pane.machineId);+ final agent = machine?.agents+ .where((a) => a.id == pane.agentId)+ .firstOrNull;+ final session = pane.session;+ if (machine == null ||+ agent == null ||+ session == null ||+ machine.nodeOnline == false ||+ machine.needsLink ||+ (machine.isLocalMachine && !machine.usesLocalTransport) ||+ !agent.terminalAvailable ||+ session.status != TerminalSessionStatus.controlling) {+ return Object();+ }+ return (+ notifier: app,+ machine: machine.machine,+ local: machine.isLocalMachine,+ agent: agent,+ project: machine.projectOf(agent),+ session: session,+ terminal: session.terminal,+ name: session.agentName,+ link: session.linkMode,+ upload: session.uploadProgress,+ focused: app.isPaneFocused(pane.id),+ single: app.panes.length == 1,+ pinned: app.isPanePinned(pane),+ composer: pane.composerVisible,+ blocked: app.questionFor(pane.machineId, agent.id) != null,+ dragging: widget.dragging,+ );+ }++ @override+ Widget build(BuildContext context) => LayoutBuilder(+ builder: (context, constraints) {+ final app = widget.notifier;+ final visible = [+ for (final pane in app.panes)+ if (app.zoomedPaneId == null || pane.id == app.zoomedPaneId) pane,+ ];+ final layout = _SwarmGeometry(+ count: visible.length,+ viewport: constraints.biggest,+ preset: app.presetFor(visible.length),+ minimum: _MinTile.of(),+ );+ if (layout.columns != null) app.gridColumns = layout.columns;+ final rectangles = {+ for (var i = 0; i < visible.length; i++)+ visible[i].id: layout.rectangles[i],+ };+ // The scroll view stays mounted even when content fits. Its maximum+ // extent is then zero; keeping its ancestry is what avoids grafting.+ return SingleChildScrollView(+ controller: _scroll,+ child: SizedBox(+ width: constraints.maxWidth,+ height: layout.height,+ child: Stack(+ children: [+ if (visible.isEmpty)+ Positioned.fill(+ child: widget.empty ?? _EmptyGrid(notifier: app),+ ),+ for (final pane in app.allPanes)+ if (rectangles.containsKey(pane.id) ||+ pane.lastViewSize != null)+ Positioned.fromRect(+ key: ValueKey(pane.id),+ rect:+ rectangles[pane.id] ?? Offset.zero & pane.lastViewSize!,+ child: _PaneLayer(+ session: pane.session,+ visible: rectangles.containsKey(pane.id),+ presentation: _presentation(+ pane,+ rectangles.containsKey(pane.id),+ ),+ child: _PaneCell(+ key: pane.cellKey,+ notifier: app,+ pane: pane,+ dragging: widget.dragging,+ visible: rectangles.containsKey(pane.id),+ swarmMode: true,+ ),+ ),+ ),+ ],+ ),+ ),+ );+ },+ );+}++/// Convert the same unit rectangles used by the layout picker and keyboard+/// navigation to pixels. A boundary at fraction f maps to f * (extent + gap);+/// subtracting one gap from each tile preserves spanning and nested cuts.+class _SwarmGeometry {+ _SwarmGeometry({+ required int count,+ required Size viewport,+ required PanePreset? preset,+ required Size minimum,+ }) : height = viewport.height {+ if (count == 0) return;+ if (count == 1) {+ rectangles = [Offset.zero & viewport];+ return;+ }+ var shape = preset ?? PanePreset.defaultFor(count)!;+ if (shape == PanePreset.splitLong && viewport.height > viewport.width) {+ shape = PanePreset.rows;+ }+ if (shape == PanePreset.auto || shape.statedColumns != null) {+ columns =+ (shape.statedColumns ?? (viewport.width / minimum.width).floor())+ .clamp(1, count);+ final rows = (count / columns!).ceil();+ height = (rows * minimum.height + kPaneGap * (rows - 1)).clamp(+ viewport.height,+ double.infinity,+ );+ }+ rectangles = [+ for (final tile in shape.tilesFor(count, columns: columns))+ Rect.fromLTWH(+ tile.left * (viewport.width + kPaneGap),+ tile.top * (height + kPaneGap),+ (tile.width * (viewport.width + kPaneGap) - kPaneGap).clamp(+ 0,+ double.infinity,+ ),+ (tile.height * (height + kPaneGap) - kPaneGap).clamp(+ 0,+ double.infinity,+ ),+ ),+ ];+ }+ double height;+ int? columns;+ List<Rect> rectangles = const [];+}++/// A hidden view retains its last configuration and geometry. Status changes+/// update a replaced session; showing it applies fresh machine/agent metadata.+class _PaneLayer extends StatefulWidget {+ const _PaneLayer({+ required this.session,+ required this.visible,+ required this.presentation,+ required this.child,+ });final TerminalSession? session;+ final bool visible;+ final Object? presentation;final Widget child;@override- State<_ParkedPane> createState() => _ParkedPaneState();+ State<_PaneLayer> createState() => _PaneLayerState();}-class _ParkedPaneState extends State<_ParkedPane> {- late Widget _child = widget.child;+class _PaneLayerState extends State<_PaneLayer> {+ late Widget _layer = _buildLayer();@override- void didUpdateWidget(_ParkedPane oldWidget) {+ void didUpdateWidget(_PaneLayer oldWidget) {super.didUpdateWidget(oldWidget);- if (!identical(oldWidget.session, widget.session)) _child = widget.child;+ if (oldWidget.visible != widget.visible ||+ oldWidget.presentation != widget.presentation ||+ !identical(oldWidget.session, widget.session)) {+ _layer = _buildLayer();+ }}@override- Widget build(BuildContext context) => _child;+ Widget build(BuildContext context) => _layer;++ Widget _buildLayer() => Offstage(+ offstage: !widget.visible,+ child: TickerMode(+ enabled: widget.visible,+ child: ExcludeFocus(excluding: !widget.visible, child: widget.child),+ ),+ );}/// Five or more tiles: a grid, sized by what a terminal actually needs.@@ -401,12 +601,12 @@ class _Axis extends StatelessWidget {////// The font is one process-wide setting, so one measurement serves every tile.class _MinTile {- static double _forSize = -1;+ static TerminalStyle? _forStyle;static Size _cached = Size.zero;static Size of() {final style = terminalFontStore.value;- if (style.fontSize == _forSize) return _cached;+ if (identical(style, _forStyle)) return _cached;// The renderer measures its cell by laying out ten 'm' and dividing; do the// same here rather than inventing a second idea of how wide a column is.final painter = TextPainter(@@ -423,7 +623,8 @@ class _MinTile {)..layout();final cellW = painter.width / 10;final cellH = painter.height;- _forSize = style.fontSize;+ painter.dispose();+ _forStyle = style;// 46 is the pane header, which is chrome the terminal never gets._cached = Size(40 * cellW + 16, 46 + 12 * cellH + 8);return _cached;diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dartindex 3fcdc8fd4..1845d2798 100644--- a/desktop/lib/widgets/terminal_panel.dart+++ b/desktop/lib/widgets/terminal_panel.dart@@ -115,6 +115,8 @@ class _TerminalPanelState extends State<TerminalPanel>late final RemoteMediaDownloader _mediaDownloader;MediaDownloadCancellation? _previewCancellation;RemoteMediaProgress? _previewProgress;+ Object? _headerPresentation;+ Widget? _header;@overridevoid initState() {@@ -665,19 +667,7 @@ class _TerminalPanelState extends State<TerminalPanel>color: grid.AppPalette.windowBg,child: Column(children: [- _TerminalHeader(- notifier: widget.notifier,- session: session,- compact: widget.compactHeader,- onClose: widget.onClose,- pinned: widget.pinned,- onTogglePin: widget.onTogglePin,- onToggleComposer: remote && !widget.readOnly- ? widget.onToggleComposer- : null,- composerVisible: widget.composerVisible,- paneDrag: widget.paneDrag,- ),+ _buildHeader(context, remote: remote),Divider(height: 1, color: AppColors.border),Expanded(@@ -807,6 +797,59 @@ class _TerminalPanelState extends State<TerminalPanel>),);}++ /// Visibility and focus affect the renderer, not its title and controls.+ /// Retain that subtree until its presentation changes. Callback wrappers+ /// resolve the current widget so cached controls never retain an old action.+ Widget _buildHeader(BuildContext context, {required bool remote}) {+ final session = widget.session;+ final machine = widget.notifier.stateOf(session.machineId);+ final agent = machine?.agents+ .where((a) => a.id == session.agentId)+ .firstOrNull;+ final canToggleComposer =+ remote && !widget.readOnly && widget.onToggleComposer != null;+ final presentation = (+ theme: Theme.of(context),+ brightness: grid.AppTheme.brightness.value,+ fontFamily: AppFonts.sans,+ notifier: widget.notifier,+ session: session,+ name: session.agentName,+ status: session.status,+ link: session.linkMode,+ machine: machine?.machine,+ agent: agent,+ project: agent == null ? null : machine?.projectOf(agent),+ compact: widget.compactHeader,+ pinned: widget.pinned,+ close: widget.onClose != null,+ pin: widget.onTogglePin != null,+ composer: canToggleComposer,+ composerVisible: widget.composerVisible,+ dragId: widget.paneDrag?.ref.paneId,+ dragSize: widget.paneDrag?.size,+ );+ if (_headerPresentation != presentation) {+ _headerPresentation = presentation;+ _header = _TerminalHeader(+ notifier: widget.notifier,+ session: session,+ compact: widget.compactHeader,+ onClose: widget.onClose == null ? null : () => widget.onClose?.call(),+ pinned: widget.pinned,+ onTogglePin: widget.onTogglePin == null+ ? null+ : () => widget.onTogglePin?.call(),+ onToggleComposer: canToggleComposer+ ? () => widget.onToggleComposer?.call()+ : null,+ composerVisible: widget.composerVisible,+ paneDrag: widget.paneDrag,+ );+ }+ return _header!;+ }}class _TerminalHeader extends StatelessWidget {diff --git a/desktop/test/benchmarks/swarm_benchmark.dart b/desktop/test/benchmarks/swarm_benchmark.dartindex b307e7a6f..5eb270a30 100644--- a/desktop/test/benchmarks/swarm_benchmark.dart+++ b/desktop/test/benchmarks/swarm_benchmark.dart@@ -206,8 +206,23 @@ void main() {}final largest = rebuilds.entries.toList()..sort((a, b) => b.value.compareTo(a.value));+ final focusTimes = <int>[];+ for (var sample = 0; sample < 60; sample++) {+ final watch = Stopwatch()..start();+ app.focusPaneBy(1);+ await tester.pump();+ focusTimes.add(watch.elapsedMicroseconds);+ }+ var focusRebuilds = 0;+ debugOnRebuildDirtyWidget = (_, _) => focusRebuilds++;+ try {+ app.focusPaneBy(1);+ await tester.pump();+ } finally {+ debugOnRebuildDirtyWidget = null;+ }debugPrint(- 'SWARM_BENCH ${jsonEncode({'kind': 'headless_debug_cpu', 'swarms': swarmCount, 'terminals': swarmCount * 4, 'scrollbackLinesPerTerminal': 1000, 'viewport': '1280x800', 'tabSwitchAndFrame': distribution(times), 'rebuildsPerSwitch': rebuilds.values.fold(0, (total, count) => total + count), 'mostRebuiltWidgets': Map.fromEntries(largest.take(12))})}',+ 'SWARM_BENCH ${jsonEncode({'kind': 'headless_debug_cpu', 'swarms': swarmCount, 'terminals': swarmCount * 4, 'scrollbackLinesPerTerminal': 1000, 'viewport': '1280x800', 'tabSwitchAndFrame': distribution(times), 'rebuildsPerSwitch': rebuilds.values.fold(0, (total, count) => total + count), 'focusAndFrame': distribution(focusTimes), 'rebuildsPerFocus': focusRebuilds, 'mostRebuiltWidgets': Map.fromEntries(largest.take(12))})}',);await tester.pumpWidget(const SizedBox());app.dispose();diff --git a/desktop/test/pane_preset_test.dart b/desktop/test/pane_preset_test.dartindex 0c58dd967..6ff5f3a6e 100644--- a/desktop/test/pane_preset_test.dart+++ b/desktop/test/pane_preset_test.dart@@ -28,14 +28,23 @@ AppNotifier _withPanes(int n) {}/// Where each tile actually landed, as fractions of the grid.-Future<List<Rect>> _layout(WidgetTester tester, AppNotifier notifier) async {+Future<List<Rect>> _layout(+ WidgetTester tester,+ AppNotifier notifier, {+ bool swarmMode = false,+ Size size = const Size(1600, 1500),+}) async {// Tall enough that no shape here hits the scroll fallback. Two columns of// nine tiles is five rows, and a window without the height for five rows at// the terminal floor SCROLLS rather than squeezing — correct behaviour, and// covered in pane_lattice_test, but it puts tiles outside the grid box and// there are no fractions of a visible grid left to measure.- await tester.binding.setSurfaceSize(const Size(1600, 1500));- await tester.pumpWidget(MaterialApp(home: PaneGrid(notifier: notifier)));+ await tester.binding.setSurfaceSize(size);+ await tester.pumpWidget(+ MaterialApp(+ home: PaneGrid(notifier: notifier, swarmMode: swarmMode),+ ),+ );await tester.pump();final grid = tester.getRect(find.byType(PaneGrid));return [@@ -74,6 +83,37 @@ void _expectShape(List<Rect> actual, List<Rect> want) {}void main() {+ testWidgets(+ 'automatic Swarm layouts match the prior geometry at narrow and wide sizes',+ (tester) async {+ for (final size in [const Size(880, 600), const Size(1800, 900)]) {+ for (final count in [6, 17]) {+ final notifier = _withPanes(count);+ notifier.setPreset(count, PanePreset.auto);+ final legacy = await _layout(tester, notifier, size: size);+ final swarm = await _layout(+ tester,+ notifier,+ size: size,+ swarmMode: true,+ );+ for (var i = 0; i < count; i++) {+ expect(+ (swarm[i].topLeft - legacy[i].topLeft).distance,+ lessThan(0.000001),+ );+ expect(+ (swarm[i].bottomRight - legacy[i].bottomRight).distance,+ lessThan(0.000001),+ );+ }+ await tester.pumpWidget(const SizedBox());+ notifier.dispose();+ }+ }+ },+ );+for (final count in [2, 3, 4, 5, 6, 7, 9]) {for (final preset in PanePreset.forCount(count)) {// `auto` measures the window, so its diagram is openly approximate and@@ -85,7 +125,22 @@ void main() {) async {final notifier = _withPanes(count);notifier.setPreset(count, preset);- _expectShape(await _layout(tester, notifier), preset.tilesFor(count));+ final legacy = await _layout(tester, notifier);+ _expectShape(legacy, preset.tilesFor(count));+ final swarm = await _layout(tester, notifier, swarmMode: true);+ _expectShape(swarm, preset.tilesFor(count));+ for (var i = 0; i < count; i++) {+ expect(+ (swarm[i].topLeft - legacy[i].topLeft).distance,+ lessThan(0.000001),+ );+ expect(+ (swarm[i].bottomRight - legacy[i].bottomRight).distance,+ lessThan(0.000001),+ );+ }+ await tester.pumpWidget(const SizedBox());+ notifier.dispose();});}}diff --git a/desktop/test/swarm_canvas_test.dart b/desktop/test/swarm_canvas_test.dartnew file mode 100644index 000000000..835d52176--- /dev/null+++ b/desktop/test/swarm_canvas_test.dart@@ -0,0 +1,207 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/state/pane_preset.dart';+import 'package:harness/terminal/terminal_font_store.dart';+import 'package:harness/widgets/pane_grid.dart';+import 'package:harness/widgets/terminal_panel.dart';+import 'package:xterm/xterm.dart';++import 'swarm_state_test.dart' show createApp;+import 'swarm_screen_test.dart' show terminal;++void main() {+ testWidgets(+ 'changed terminal metrics update the grid without a font-size change',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ for (var i = 0; i < 6; i++) {+ app.adoptSessionForTest(terminal('a$i', []));+ }+ app.setPreset(6, PanePreset.cols2);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1000, 800);+ addTearDown(tester.view.reset);+ final previous = terminalFontStore.value;+ // Change only the in-memory ValueNotifier; no persistence method is called.+ addTearDown(() => terminalFontStore.value = previous);+ await tester.pumpWidget(+ MaterialApp(home: PaneGrid(notifier: app, swarmMode: true)),+ );+ await tester.pump();+ final scroll = tester+ .widget<SingleChildScrollView>(+ find.byType(SingleChildScrollView).first,+ )+ .controller!;+ final before = scroll.position.maxScrollExtent;+ terminalFontStore.value = TerminalStyle(+ fontSize: previous.fontSize,+ fontFamily: previous.fontFamily,+ fontFamilyFallback: previous.fontFamilyFallback,+ height: 4,+ );+ await tester.pump();+ expect(scroll.position.maxScrollExtent, greaterThan(before + 500));+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ testWidgets(+ 'scroll positions restore on the first frame across different Swarm sizes',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ for (var i = 0; i < 12; i++) {+ app.adoptSessionForTest(terminal('a$i', []));+ }+ app.setPreset(12, PanePreset.cols2);+ final first = app.activeSwarmId;+ app.newSwarm();+ for (var i = 12; i < 18; i++) {+ app.adoptSessionForTest(terminal('a$i', []));+ }+ app.setPreset(6, PanePreset.cols2);+ final second = app.activeSwarmId;+ app.selectSwarm(first);+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1000, 500);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(home: PaneGrid(notifier: app, swarmMode: true)),+ );+ await tester.pump();+ final scroll = tester+ .widget<SingleChildScrollView>(+ find.byType(SingleChildScrollView).first,+ )+ .controller!;+ scroll.jumpTo(600);+ await tester.pump();+ expect(scroll.position.maxScrollExtent, greaterThan(600));+ app.selectSwarm(second);+ await tester.pump();+ expect(scroll.offset, 0);+ scroll.jumpTo(120);+ await tester.pump();+ app.selectSwarm(first);+ await tester.pump();+ expect(scroll.offset, 600);+ app.selectSwarm(second);+ await tester.pump();+ expect(scroll.offset, 120);+ app.newSwarm();+ await tester.pump();+ expect(scroll.offset, 0);+ expect(scroll.position.maxScrollExtent, 0);+ app.selectSwarm(first);+ await tester.pump();+ expect(scroll.offset, 600);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ testWidgets(+ 'tab, zoom and preset changes keep each terminal under the same ancestors',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ for (var i = 0; i < 4; i++) {+ app.adoptSessionForTest(terminal('a$i', []));+ }+ final first = app.activeSwarmId;+ final pane = app.panes.first;+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1280, 800);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(home: PaneGrid(notifier: app, swarmMode: true)),+ );+ await tester.pump();+ final cell = tester.element(find.byKey(pane.cellKey));+ List<Element> ancestors() {+ final result = <Element>[];+ cell.visitAncestorElements((e) {+ result.add(e);+ return e.widget is! PaneGrid;+ });+ return result;+ }++ final before = ancestors();+ final renderer = tester.state(+ find.byWidgetPredicate(+ (w) => w is TerminalView && w.terminal == pane.session!.terminal,+ ),+ );+ app.newSwarm();+ app.adoptSessionForTest(terminal('a5', []));+ app.dismissError();+ await tester.pump();+ expect(ancestors(), before);+ expect(find.byType(TerminalPanel), findsOneWidget);+ app.selectSwarm(first);+ await tester.pump();+ app.focusPane(pane.id);+ app.toggleZoomPane();+ await tester.pump();+ expect(ancestors(), before);+ expect(find.byType(TerminalPanel), findsOneWidget);+ app.toggleZoomPane();+ app.setPreset(4, PanePreset.mainAndStack);+ await tester.pump();+ expect(ancestors(), before);+ expect(+ tester.state(+ find.byWidgetPredicate(+ (w) => w is TerminalView && w.terminal == pane.session!.terminal,+ ),+ ),+ same(renderer),+ );+ expect(find.byType(TerminalPanel), findsNWidgets(4));+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ testWidgets(+ 'automatic split follows a tall viewport and a resize keeps hidden geometry',+ (tester) async {+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ app.adoptSessionForTest(terminal('a0', []));+ app.adoptSessionForTest(terminal('a1', []));+ final first = app.activeSwarmId;+ final panes = [...app.panes];+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(800, 1200);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(home: PaneGrid(notifier: app, swarmMode: true)),+ );+ await tester.pump();+ final upper = tester.getRect(find.byKey(panes.first.cellKey));+ final lower = tester.getRect(find.byKey(panes.last.cellKey));+ expect(upper.left, lower.left);+ expect(lower.top - upper.bottom, closeTo(kPaneGap, 0.001));+ final hiddenSize = panes.first.lastViewSize;+ app.newSwarm();+ await tester.pump();+ tester.view.physicalSize = const Size(1400, 800);+ await tester.pump();+ expect(panes.first.lastViewSize, hiddenSize);+ app.selectSwarm(first);+ await tester.pump();+ final left = tester.getRect(find.byKey(panes.first.cellKey));+ final right = tester.getRect(find.byKey(panes.last.cellKey));+ expect(left.top, right.top);+ expect(right.left - left.right, closeTo(kPaneGap, 0.001));+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );+}diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dartnew file mode 100644index 000000000..fdb8b1e8f--- /dev/null+++ b/desktop/test/terminal_panel_presentation_test.dart@@ -0,0 +1,68 @@+import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/core/models.dart';+import 'package:harness/terminal/terminal_session.dart';+import 'package:harness/widgets/terminal_panel.dart';++import 'swarm_screen_test.dart' show terminal;+import 'swarm_state_test.dart' show createApp;++void main() {+ testWidgets(+ 'retained header uses current callbacks, names, projects and status',+ (tester) async {+ final app = createApp();+ final session = terminal('a0', []);+ final revision = ValueNotifier(0);+ final closed = <int>[];+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = const Size(1100, 700);+ addTearDown(tester.view.reset);+ await tester.pumpWidget(+ MaterialApp(+ home: ValueListenableBuilder<int>(+ valueListenable: revision,+ builder: (_, version, _) => TerminalPanel(+ notifier: app,+ session: session,+ focused: version.isEven,+ compactHeader: true,+ onClose: () => closed.add(version),+ ),+ ),+ ),+ );+ await tester.pump();+ revision.value = 1;+ await tester.pump();+ await tester.tap(find.byTooltip('Close pane'));+ expect(closed, [1]);+ session.agentName = 'Renamed terminal';+ app.machineStates['m']!.agents = [+ const Agent(+ id: 'a0',+ name: 'Renamed terminal',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(+ name: 'Terminal project',+ cwd: '/work/terminal',+ branch: 'fast-focus',+ ),+ ),+ ];+ revision.value = 2;+ await tester.pump();+ expect(find.text('Renamed terminal'), findsOneWidget);+ expect(find.text('Terminal project / fast-focus'), findsOneWidget);+ session.status = TerminalSessionStatus.takenOver;+ revision.value = 3;+ await tester.pump();+ expect(find.byTooltip('taken over'), findsOneWidget);+ await tester.pumpWidget(const SizedBox());+ revision.dispose();+ session.dispose();+ app.dispose();+ },+ );+}diff --git a/docs/harness-v2-developer-tools-research.md b/docs/harness-v2-developer-tools-research.mdindex 7d3b19255..3c8f04240 100644--- a/docs/harness-v2-developer-tools-research.md+++ b/docs/harness-v2-developer-tools-research.md@@ -53,7 +53,7 @@ The opportunity for Harness is to make movement among real agents across real ma| **Preserve compatibility** | Real agent terminals and user shell environments | Verify selection, multiline/image paste, scrollback, nested tmux/Vim and escape/control keys. Before promising a full terminal replacement, verify a straightforward ordinary-shell workflow too; the current New agent UI centers on detected agent engines. || **Remove from active work — implemented** | Wallpaper behind populated Swarms | Use `#463746`, matching the selected native tab. Wallpaper fills only an empty New swarm canvas and its decoded cache entry is evicted when that view is disposed. || **Reduce prominence** | “Next wallpaper” button, repeated metadata, permanent Settings gear | Keep appearance choices in a secondary location. Keep machine identity legible where needed to distinguish remote work. Settings already has `Cmd+,` and the app menu; consider reclaiming the extra toolbar control. These are proposals, not removed features. |-| **Remove avoidable waiting** | Settings route transitions and section cross-fades | The current source has 170/120 ms route transitions and a 200 ms section transition. Prefer immediate navigation, with animation reserved for feedback that helps understanding. No need for another settings feature. |+| **Removed avoidable waiting** | Settings route transitions and section cross-fades | Implemented: Settings now opens/closes and switches sections immediately. Removed the 170/120 ms route and 200/90 ms section fades; existing route/modal checks pass. Reserve animation for feedback that helps understanding. || **Keep optional; stop expanding** | Usage ledger and hardware/dial settings | Usage can answer a real cost question; hardware supports existing users. Keep these away from the main work loop. Do not delete capabilities or data merely because they were absent from this small research sample. || **Keep absent** | Models/Grid dashboard, permanent workspace sidebar, pane footers | The authenticated V2 shell already removed these. Avoid introducing equivalent clutter through new agent-management panels. || **Defer** | Workflow canvases, autonomous manager-of-managers, social features, a plugin marketplace, a full IDE or a new Git client | None is required to prove the first three promises. Add only after repeated daily-use evidence identifies a concrete need. |diff --git a/docs/harness-v2-performance.md b/docs/harness-v2-performance.mdindex 560387243..e3e762659 100644--- a/docs/harness-v2-performance.md+++ b/docs/harness-v2-performance.md@@ -1,6 +1,6 @@# Harness V2 performance checks-Measured on 2026-09-12 with Apple M2 Max, macOS 26.6.2, Flutter 3.47.2 and Dart 3.13.2.+Measured on 2026-09-12, with a retained-canvas continuation on 2026-09-13, using Apple M2 Max, macOS 26.6.2, Flutter 3.47.2 and Dart 3.13.2.The explicit benchmark runs in the headless Flutter test runner with isolated synthetic sessions. It never opens a sample-data app or connects to a real agent. Run it from `desktop/`:@@ -31,14 +31,33 @@ The output checks call the production `TerminalSession.handleBinary` with 16 KiB## Reduced work when switching tabs-Previously, switching between two swarms rebuilt headers, gestures and menus for terminals in every previously visited swarm. Hidden panes now retain their widget configuration as well as their renderer, with stable identities in the parked list. Session replacement updates a parked view; showing it applies current machine and agent metadata.+The first improvement retained hidden panes' widget configurations as well as their renderers. It reduced a 16-terminal switch from 2,480 to 1,491 widget rebuilds; the 48-terminal case rebuilt 1,625 widgets. Moving GlobalKey subtrees between the visible layout and parked list still invalidated inherited dependencies when changing tabs, zoom or presets.-With 16 retained terminals, one switch went from **2,480 to 1,491 widget rebuilds**, a 40% reduction. With 48 retained terminals, it rebuilt 1,625 widgets. Background output continues reaching the session buffer. Regression checks cover renderer identity, hidden geometry, input ownership, selection, scroll position, renaming while hidden and session replacement.+The current Swarm canvas keeps every visited terminal under one mounted scroll view and Stack, changing its rectangle without reparenting it. Healthy visible cells and unchanged headers retain their widget configuration too. Connection/setup states remain uncached, and cached header actions resolve the current widget. Session replacement updates hidden views; showing a pane applies current machine and agent metadata. Background output continues reaching the session buffer.++The paired continuation used the same benchmark before and after these changes, adding 60 focus-change/frame samples to each existing tab workload:++| Workload | Before median / p95 | After median / p95 | Rebuilds before → after |+| --- | ---: | ---: | ---: |+| Tab switch: 4 Swarms / 16 terminals | 20.924 / 26.020 ms | 12.226 / 17.116 ms | 1,491 → 917 |+| Tab switch: 12 Swarms / 48 terminals | 14.151 / 17.363 ms | 8.925 / 10.497 ms | 1,625 → 1,051 |+| Focus change: 4 Swarms / 16 terminals | 6.764 / 7.909 ms | 5.284 / 6.613 ms | 980 → 602 |+| Focus change: 12 Swarms / 48 terminals | 5.150 / 6.260 ms | 4.586 / 5.535 ms | 1,114 → 736 |++Median tab CPU time fell by 42% and 37%; focus CPU time fell by 22% and 11%. These remain headless debug measurements with host-load and JIT variability, excluding native input and the physical display. Stable-ancestry tests and lower rebuild counts provide structural evidence alongside the timings. Logs: `/private/tmp/harness-v2-stable-canvas-before.log` and `/private/tmp/harness-v2-stable-canvas-measured.log`. Reproduce with:++```bash+flutter test test/benchmarks/swarm_benchmark.dart --no-pub --reporter expanded --plain-name 'tab-switch CPU benchmark'+```++Regression checks cover renderer identity and element ancestry, hidden geometry, input ownership, selection, first-frame per-Swarm scroll restoration, renaming while hidden, session replacement and fresh header callbacks. Swarm geometry matches the legacy layouts across fixed presets and auto grids. Changing font metrics at the same point size now invalidates the minimum-tile cache and immediately updates grid dimensions.Rapid navigation also coalesces pending arrangement writes. While the first write is in flight, only the latest subsequent snapshot is retained. Tests with 100 rapid tab changes verify that the first and final snapshots are written, including recovery after the first write fails. Normal quit waits for the final snapshot with a one-second bound for stalled storage.Incoming binary data now skips unrelated sessions before awaiting the matching renderer queue. This removes one async scheduling turn per unrelated view from each frame's dispatch, while retaining socket FIFO, current stream identity and machine isolation. This change is verified by routing tests; the CPU table above does not measure network delivery.+Settings route and section fades are removed: the former opening/closing durations were 170/120 ms for the route and 200/90 ms for the section switcher. Both now present their destination immediately. Existing Settings, modal and route checks pass; this change removes configured animation time, not all possible input or rendering cost.+## Terminal output allocationsOrdinary output packets now decode directly from their existing byte view. Previously every packet was copied into a joined list and copied again to select the decodable prefix. A joined buffer is still used when a UTF-8 character crosses packet boundaries, and the decoder reads a bounded range without copying that prefix. Malformed-byte replacement and terminal recovery behavior are unchanged.@@ -68,7 +87,7 @@ All five benchmark cases passed; retained rebuild counts remained 1,491 / 1,625.## Native follow-up-The optimized real-data app builds and runs locally. The desktop is now unlocked, and native visual review is underway. The tab strip uses AppKit's compact unified title bar: the old right accessory was clipped to 32 points; the container now supplies 40 points and aligns controls with the system traffic lights.+The optimized real-data app builds and runs locally. The native tab/canvas polish was visually reviewed before the navigation and retained-canvas continuations; CUA currently returns `cgWindowNotFound` for the rebuilt Release preview, so those newer interactions still need live native review. The tab strip uses AppKit's compact unified title bar: the old right accessory was clipped to 32 points; the container now supplies 40 points and aligns controls with the system traffic lights.The native check covers overflow, resizing, accessibility order and disabled actions. `bash tool/check_swarm_titlebar.sh /path/to/flutter --window-layout` adds actual container checks in a hidden window at three widths, for 170 assertions total. No Flutter engine, account or terminal is accessed.diff --git a/docs/harness-v2-progress.md b/docs/harness-v2-progress.mdindex 21359ccc5..4dbc316e2 100644--- a/docs/harness-v2-progress.md+++ b/docs/harness-v2-progress.md@@ -1,6 +1,6 @@# Harness App V2 — development handoff-Updated 2026-09-13 after the jump-navigation continuation. This is a working preview, not a release.+Updated 2026-09-13 after the retained-canvas performance continuation. This is a working preview, not a release.## Resume here@@ -14,7 +14,8 @@ Updated 2026-09-13 after the jump-navigation continuation. This is a working pre- Latest design direction: wallpaper fills an empty New swarm only. Populated Swarms use a flat `#463746` canvas matching the selected native tab. Tab hover, spacing and alignment are being compared with the user's Chrome references.- The user requested research into expert developers' tools and a smaller feature set. [Developer-tool research and the keep/improve/remove/defer audit](harness-v2-developer-tools-research.md) documents firsthand sources and a proposed three-part focus: durable sessions, instant navigation, and steering agents without losing concentration.- Cmd+P now jumps to existing agents and Swarms with fuzzy project/machine context and bounded recent-work history. Cmd+Shift+F remains Add agent. The jump dialog has no transition or backdrop blur; selecting an existing view is focus-only, including terminals controlled elsewhere. The 2,000-agent headless search check measured 1.06 ms median / 1.15 ms p95 CPU time; this is not native display latency.-- The final Release preview was rebuilt and normally relaunched; PID **19010** was the sole V2 instance at the last check. Revalidate the process before any later restart. CUA now reports `cgWindowNotFound` when selecting that full bundle path, including after a CUA reset and a second normal rebuild/relaunch. The first relaunched process did have a 1280×840 onscreen CoreGraphics window. Bundle-ID selection was also ambiguous with the retained backup under `/Users/ab/code/harness-app-v2`; no backup was altered. Do not claim the new jump interaction was reviewed in the live native window. The actual native titlebar/canvas had been reviewed before this continuation; the new picker was visually inspected in an isolated Flutter render with native font files and engine icons loaded.+- Swarm terminals now keep the same widget ancestry across tabs, zoom and presets, retaining unchanged cells and headers. The paired headless check reduced median tab-switch CPU time from 20.924 to 12.226 ms with 16 terminals and from 14.151 to 8.925 ms with 48; focus changes also improved. Settings route and section fades are removed. These are debug CPU measurements, not native input-to-display timings.+- The final Release preview was rebuilt and normally relaunched; PID **39721** was the sole V2 instance at the last check. Revalidate the process before any later restart. CUA still reports `cgWindowNotFound` when selecting that full bundle path after this rebuild, as it did after an earlier CUA reset and normal relaunches. An earlier relaunched process did have a 1280×840 onscreen CoreGraphics window. Bundle-ID selection was also ambiguous with the retained backup under `/Users/ab/code/harness-app-v2`; no backup was altered. Do not claim the new jump interaction or stable canvas was reviewed in the live native window. The actual native titlebar/canvas had been reviewed before these continuations; the new picker was visually inspected in an isolated Flutter render with native font files and engine icons loaded.- Continue implementation here. Do not create another repository or fork for V2.```bash@@ -67,8 +68,9 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83### Retained terminal views-- `PaneGrid` swarm mode parks previously displayed inactive terminal widgets under Offstage with ticking/focus disabled and their last visible dimensions preserved.-- Parked panes retain their widget configuration while hidden, so tab changes do not rebuild unrelated terminal headers and controls. A replaced session still updates its parked view; returning to a tab uses current metadata. The 16-terminal benchmark dropped from 2,480 to 1,491 widget rebuilds per switch; see `docs/harness-v2-performance.md` for measurements and limits.+- `PaneGrid` swarm mode keeps visited terminals at stable keyed positions under one mounted scroll view and Stack. Tab, zoom and preset changes update rectangles without GlobalKey reparenting or inherited-dependency invalidation. Unvisited views remain unmounted; inactive views use Offstage with ticking/focus disabled and retain their last visible dimensions.+- Hidden panes retain their widget configuration; healthy visible cells retain it until their presentation changes. Connection/setup views continue reading their full state. A replaced session updates its hidden view; returning to a tab applies current machine and agent metadata. Headers separately retain unchanged title/controls, with callbacks resolving the current widget. The paired 16-terminal benchmark reduced rebuilds from 1,491 to 917 per switch and 980 to 602 per focus change; see `docs/harness-v2-performance.md` for all measurements and limits.+- Swarm rectangles use the same unit geometry as the layout picker and keyboard navigation. Per-Swarm scroll offsets restore before the first frame, including transitions between large, small and empty Swarms. Font metric changes invalidate the minimum-tile cache and update grid geometry even when the point size is unchanged. Legacy non-Swarm layouts retain their existing renderer.- `TerminalPane.lastViewSize` retains geometry. Hidden `TerminalPanel` views stop auto-resizing/reporting viewport and release input focus.- Compact headers remove routine transport/status/pin clutter, retaining exceptional states and offline/unavailable placeholders.- Existing terminal sessions/transports/renderer and patched `third_party/xterm` are retained. One regression verifies renderer identity, hidden geometry during window resize, and input going only to the active view.@@ -90,6 +92,7 @@ Approved reference: `/Users/ab/code/harness-new-ui`, React prototype commit `f83- Search supports arrows, Ctrl-N/P, and Return, reveals the selected row, and retains the highlighted agent across live list changes. Both the welcome and picker immediately focus search; blank Return on welcome does not open an invisible first result.- Notifications come from real blocked agents; selecting an existing membership uses the same focus-only navigation without implicitly retrying the terminal.- Spoken-task subscription/reporting/window reveal and existing linking dialogs are retained. Settings is in the title bar, with Account/sign-out restored inside Settings.+- Settings opens/closes immediately and switches sections without cross-fades. The former 170/120 ms route and 200/90 ms section transitions are removed.- Non-macOS/tests use a Flutter reorderable tab-strip fallback. Linux/Windows have not been built or visually reviewed.### Native macOS tabs@@ -153,7 +156,8 @@ The reopen binding follows the documented Mac tab-recovery shortcut in [Safari](| --- | --- || macOS debug build | Passed and launched from the monorepo with real saved Swarms and terminals. || macOS optimized local build | Passed and running with the real entry point and saved V2 state. Local ad hoc signing requires the command-line `ENABLE_HARDENED_RUNTIME=NO` override for Flutter's framework; distribution signing settings remain unchanged. The distribution Developer ID certificate is unavailable; nothing was uploaded. Normal asynchronous quit and relaunch were verified. Unlocked native review confirmed the taller tab container, edge-to-edge empty wallpaper, and the flat populated canvas joining the selected tab. The native hover rendering was also inspected in a local image. |-| Full Flutter suite | **1,000 passed, 1 skipped** after the jump navigation changes, including terminal, modal, persistence and shortcut regressions. |+| Full Flutter suite | **1,005 passed, 1 skipped** on the final retained-canvas production code, including terminal, modal, persistence and shortcut regressions. One additional auto-layout comparison was then added to the tests only; the complete 39-case layout file passed afterward. |+| Retained canvas and header | Five new checks cover stable element ancestry and terminal State across tabs/zoom/presets, first-frame per-Swarm scrolling, tall splits and hidden geometry, font metrics at unchanged point size, and fresh header metadata/callbacks. Layout checks compare legacy and Swarm geometry for all fixed presets and auto layouts at two sizes. || Jump navigation | 13 new state/widget checks cover fuzzy context, shared/offline views, focus-only navigation, preserved layout and terminal state, bounded recents, stale results, captured destinations, immediate focus, keyboard scrolling, live discovery and Add separation. The three widget checks also pass after adding assertions that the first terminal key reaches only the destination session. || Jump visual review | Isolated render inspected with SF font files and engine icons; selected-result text now stays white on a quiet highlight. Four checks (the three widget cases plus the temporary visual fixture) passed after this contrast adjustment. Final Release build passed. Live CUA review remains unavailable with `cgWindowNotFound`. || Focused interaction checks | 8 passed: picker navigation/scroll/refresh, welcome keys, shared-view close, composer, native modal guard, profile and folder races. |@@ -162,7 +166,7 @@ The reopen binding follows the documented Mac tab-recovery shortcut in [Safari](| CLI typecheck | `npm run typecheck` passed. || CLI targeted tests | 135 passed across project/frame, registry/restore, and terminal recovery files. Project/frame tests rerun after port normalization: 9 passed. || Flutter analyzer | **0 errors, 0 warnings, 12 existing vendored xterm infos**; passes with `--no-fatal-infos`. |-| Headless performance | 5 explicit benchmarks passed: 2,000-agent catalog, 16/48 retained terminals and two terminal output workloads. Reproducible commands and limits in `docs/harness-v2-performance.md`. |+| Headless performance | The prior five-case catalog/terminal/output benchmark passed. The paired retained-canvas continuation reran both 16/48-terminal cases with new focus measurements: tab medians 12.226 / 8.925 ms and focus medians 5.284 / 4.586 ms. Reproducible commands and limits in `docs/harness-v2-performance.md`. || AppKit components and container | **170 assertions passed**: the original 151 component checks plus native-container checks at 880, 1280 and 1920 points. These verify height, traffic-light clearance/alignment, direct contact with the content edge and active-tab visibility. The optional container check creates a hidden native window; no window is displayed and no engine, account or terminal is accessed. || Remote terminals / production release | No remote takeover, release, installer, or production CLI update/restart. Cross-platform and end-to-end latency measurements remain. |@@ -172,11 +176,15 @@ Tests now exercise the actual V2 welcome/settings/linking flow. Usage pricing agEvidence on this Mac under `/private/tmp`:+- `harness-v2-canvas-full-tests.log`: full 1,005-test pass on the final production changes.+- `harness-v2-canvas-geometry.log`: 39 layout checks after adding the final test-only auto-layout comparison.+- `harness-v2-canvas-analyze.log`: latest diagnostics, 0 errors/warnings and 12 existing vendored infos.+- `harness-v2-stable-canvas-before.log`, `harness-v2-stable-canvas-measured.log`: paired tab/focus CPU and rebuild counts before and after the stable canvas and presentation caches.- `harness-v2-jump-full-tests.log`: full 1,000-test pass.- `harness-v2-jump-tests.log`: 60 focused navigation/shortcut/interaction checks.- `harness-v2-jump-focus-tests.log`: three widget checks including first-key destination ownership.- `harness-v2-jump-visual-tests.log` and `harness-jump-review.png`: final focused checks and isolated visual fixture (not the real-data app). Temporary renderer source is `/private/tmp/harness-jump-render.dart`; no mock data or capture tooling was added to the application.-- `harness-v2-jump-analyze.log`: latest diagnostics.+- `harness-v2-jump-analyze.log`: earlier jump-navigation diagnostics.- `harness-v2-final-build.log`: real-entry debug build.- `harness-v2-release-build.log`: optimized local build.- `harness-v2-final-cli-check.log`, `harness-v2-final-cli-tests.log`: final metadata checks.@@ -184,7 +192,7 @@ Evidence on this Mac under `/private/tmp`:- `harness-v2-keyboard-tests.log`, `harness-v2-local-project-tests.log`: focused interaction/discovery checks.- `harness-v2-retained-tests.log`: 27 terminal/menu/layout checks.- `harness-v2-persistence-tests.log`: 21 state/async checks including rapid writes and bounded quit.-- `harness-v2-benchmark-final.log`: latest catalog and retained-terminal CPU measurements.+- `harness-v2-benchmark-final.log`: earlier catalog and retained-terminal CPU measurements.- `harness-v2-benchmark-polish.log`: subsequent five-case pass after native/canvas polish; identical retained rebuild counts, higher debug timings across workloads. Both runs and the comparison limits are recorded in the performance notes.- `harness-v2-benchmark-jump.log`: five-case pass after navigation changes, including the new catalog-build/query measurements; retained rebuild counts remain 1,491 / 1,625.- `harness-v2-output-before.log`, `harness-v2-output-after.log`: paired production terminal decode-and-parse CPU measurements.@@ -197,7 +205,7 @@ Earlier logs contain superseded failures. Temporary logs and toolchains are loca## Remaining work-1. Restore CUA access to the current Release preview and review the new jump workflow, actual project starters and keyboard navigation. The tool currently reports `cgWindowNotFound`; the process is running. The user can change window size and Swarms; re-read UI state before actions and preserve their arrangement.+1. Restore CUA access to the current Release preview and review the new jump workflow, stable canvas, actual project starters and keyboard navigation. The tool currently reports `cgWindowNotFound`; the process is running. The user can change window size and Swarms; re-read UI state before actions and preserve their arrangement.2. Audit native drag/reorder, overflow, close-last-tab, renaming and accessibility without changing the user's saved agent memberships. Keep any integration runner separate and out of the foreground review app.3. Measure native terminal input and tab-switch responsiveness before making end-to-end latency claims. Headless CPU benchmarks are now recorded. Preserve the existing immediate first-input flush and shared retained renderers.4. Visually confirm app-menu modal behavior and overflow accessibility in AppKit; route/shortcut behavior is covered by passing Flutter tests.