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.

desktop: pane header on one line — model, then folder/branch/PR, then ⋮

Timae7aa55e42ab
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index 91ae41a85..a5f7f9f0d 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -476,27 +476,43 @@ class _GridModelPickerState extends State<GridModelPicker> {
horizontal: widget.compact ? 3 : 6,
vertical: 3,
),
- // The model's name alone, no dropdown arrow: the room goes to the name, which is
- // what a person reads here. A read in flight dims it rather than adding a spinner,
- // so nothing beside it moves.
- child: ConstrainedBox(
- constraints: BoxConstraints(
- // Compact: the old label plus the arrow's 14px, so a narrow header keeps its fit.
- maxWidth: widget.compact ? 58 : 200,
- ),
- child: AnimatedOpacity(
- opacity: _loading ? .45 : 1,
- duration: const Duration(milliseconds: 120),
- child: Text(
- label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: AppType.monoLabel(
- fontWeight: FontWeight.w400,
- color: AppColors.textSoft,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // Room for a whole model id ("DeepSeek-V4-Flash-0731") where the header has
+ // it; Flexible so a header that is short of room shortens the name instead of
+ // overflowing. The tooltip always says the whole model.
+ Flexible(
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: widget.compact ? 44 : 220,
+ ),
+ child: Text(
+ label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppType.monoLabel(
+ fontWeight: FontWeight.w400,
+ color: AppColors.textSoft,
+ ),
+ ),
),
),
- ),
+ // Replace the arrow while loading so a read cannot squeeze
+ // the session name or move the pane's other controls.
+ if (_loading)
+ const SizedBox(
+ width: 14,
+ height: 14,
+ child: CircularProgressIndicator(strokeWidth: 1.5),
+ )
+ else
+ Icon(
+ Icons.arrow_drop_down,
+ size: 14,
+ color: AppColors.mutedStrong,
+ ),
+ ],
),
),
),
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index 629628b7e..59668891e 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -244,15 +244,31 @@ class PaneHeaderActions extends StatelessWidget {
],
);
if (modelPicker == null) return actionArea;
- // The model, then the ⋮ menu on the header's right edge. Both keep one place in every pane:
- // the folder, branch and PR that used to sit between them, and push the picker around with
- // their length, now live under the pane's name.
+ // The model, then folder, branch and PR, then the ⋮ menu on the right edge. With the actions
+ // in one menu there is nothing for the details to swap with on hover, so they stay in view.
return Row(
mainAxisSize: MainAxisSize.min,
children: [
- Flexible(child: modelPicker!),
+ modelPicker!,
+ if (details != null)
+ // The gap shrinks WITH the details: a pane too narrow for them gives the picker and
+ // the menu every pixel rather than overflowing by the width of a gap beside nothing.
+ Flexible(
+ child: Padding(
+ padding: const EdgeInsets.only(left: 8),
+ child: trailing == null
+ ? details!
+ : Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Flexible(child: details!),
+ trailing!,
+ ],
+ ),
+ ),
+ ),
const SizedBox(width: 2),
- actionArea,
+ controls,
],
);
}
diff --git a/desktop/lib/widgets/pull_request_badge.dart b/desktop/lib/widgets/pull_request_badge.dart
index 4a448919b..49ec31645 100644
--- a/desktop/lib/widgets/pull_request_badge.dart
+++ b/desktop/lib/widgets/pull_request_badge.dart
@@ -88,15 +88,10 @@ class _PullRequestBadgeState extends State<PullRequestBadge> {
return Tooltip(
message: 'PR #$number · $state — Open on GitHub',
child: TextButton(
- // The small folder line's height and type: it sits under the pane's name, beside the
- // folder and branch.
style: TextButton.styleFrom(
- minimumSize: Size.zero,
- padding: const EdgeInsets.symmetric(horizontal: 4),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- visualDensity: VisualDensity.compact,
- // Room for descenders, as on the folder line beside it.
- textStyle: grid.AppType.monoLabel(height: 1.3).copyWith(fontSize: 10),
+ minimumSize: const Size(0, 28),
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ textStyle: grid.AppType.monoLabel(),
),
onPressed: found
? () async {
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index b27c81a41..b4e3f97c9 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -1981,21 +1981,16 @@ class _TerminalHeader extends StatelessWidget {
// Reserve space for the visible model name and the pane controls.
// Engines without a picker keep their existing header width.
final showModelPicker = !readOnly && modelPickerSupports(session.engineId);
- // The picker's name runs to 200px with its padding, and no arrow beside it.
- final pickerWidth = showModelPicker ? 212.0 : 0.0;
- final actionsWidth =
- (remoteComposer == null ? 148.0 : 178.0) +
- pickerWidth +
- (onFork == null ? 0 : 30) +
- (agent?.viewerUrl == null && agent?.viewerError == null ? 0 : 30);
+ // The picker: a model id up to 220px, its arrow and padding.
+ final pickerWidth = showModelPicker ? 250.0 : 0.0;
+ // The model, then the one ⋮ menu that holds every pane action.
+ final actionsWidth = 36.0 + pickerWidth;
// A fork says so first: "forked from X" is the one fact about this pane
// that the folder and the branch — shared with its source — cannot tell.
final forkedFrom = agent?.forkedFrom;
final strip = PaneHeaderHover(
child: SizedBox(
- // The usual height at the default text size; a larger text setting grows it so the name
- // and the folder line under it both still fit.
- height: (compact ? 38 : 46) * math.max(1, grid.appTextScaleOf(context)),
+ height: compact ? 38 : 46,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: _stripPadding),
child: LayoutBuilder(
@@ -2008,11 +2003,39 @@ class _TerminalHeader extends StatelessWidget {
agent != null &&
project?.shownBranch != null &&
constraints.maxWidth >= 360 * math.max(1, scale);
- // The right side holds only the ⋮ menu and the model: folder, branch and PR sit
- // under the name.
- final rightWidth = showModelPicker
- ? (narrow ? 100.0 : pickerWidth + 36)
- : 28.0;
+ final badgeWidth = showPr ? (narrow ? 150.0 : 180.0) : 0.0;
+ // The room the left side needs: the mark, the whole name as it will be drawn, and
+ // the status beside it — capped at 45% so a very long name still leaves the right
+ // side most of the header.
+ double titleRoom() {
+ final name = TextPainter(
+ text: TextSpan(
+ text: session.agentName,
+ style: grid.AppType.monoLabel(fontWeight: FontWeight.w600),
+ ),
+ textDirection: TextDirection.ltr,
+ textScaler: MediaQuery.textScalerOf(context),
+ maxLines: 1,
+ )..layout();
+ final width = name.width;
+ name.dispose();
+ return math.min(
+ 17 + 10 + width + 8 + (status == null ? 16 : 120) + 8,
+ constraints.maxWidth * .45,
+ );
+ }
+
+ final rightWidth = narrow
+ ? math.max(
+ (showModelPicker ? 100.0 : 28.0) + badgeWidth,
+ constraints.maxWidth * .36,
+ )
+ : math.max(
+ actionsWidth + badgeWidth,
+ // Everything the name does not use. A fixed 55% left the folder and branch
+ // shortened to "…" beside a short name with half the header empty.
+ constraints.maxWidth - titleRoom(),
+ );
return Row(
children: [
if (agent != null)
@@ -2024,199 +2047,114 @@ class _TerminalHeader extends StatelessWidget {
// engine it runs on is the dialog's and the tooltip's to say.
const SizedBox(width: 10),
Expanded(
- // The name, and under it where it works (folder, branch, PR): two short
- // lines about as tall as the mark beside them. They used to share the
- // controls' space on the right and fade on hover.
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
+ child: Row(
children: [
- // A fixed name line: a status chip appearing beside the name must not
- // nudge the folder line under it.
- SizedBox(
- height: 14 * math.max(1, scale),
- child: Row(
- children: [
- Flexible(
- child: Tooltip(
- message: identityDetail,
- waitDuration: const Duration(
- milliseconds: 700,
- ),
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onDoubleTap: () => unawaited(
- showAgentRenameDialog(
- context,
- notifier,
- session.machineId,
- session.agentId,
- session.agentName,
- ),
- ),
- child: Text(
- session.agentName,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: grid.AppType.monoLabel(
- color: AppColors.text,
- fontWeight: FontWeight.w600,
- height: 1.2,
- ).copyWith(fontSize: 11),
- ),
- ),
+ Flexible(
+ child: Tooltip(
+ message: identityDetail,
+ waitDuration: const Duration(milliseconds: 700),
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onDoubleTap: () => unawaited(
+ showAgentRenameDialog(
+ context,
+ notifier,
+ session.machineId,
+ session.agentId,
+ session.agentName,
),
),
- if (status != null || !compact)
- const SizedBox(width: 8),
- if (status != null && narrow)
- Tooltip(
- message: '${status.label}: ${status.detail}',
- child: IconButton(
- tooltip: status.actionLabel ?? status.label,
- onPressed: statusAction,
- icon: Icon(status.icon, size: 12),
- style: IconButton.styleFrom(
- foregroundColor: color,
- disabledForegroundColor: color,
- // The name's line height: the folder line sits under it.
- fixedSize: const Size(16, 16),
- minimumSize: const Size(16, 16),
- padding: EdgeInsets.zero,
- tapTargetSize:
- MaterialTapTargetSize.shrinkWrap,
- ),
- ),
- )
- else if (status != null)
- ConstrainedBox(
- constraints: BoxConstraints(
- maxWidth: math.max(
- 0,
- math.min(
- constraints.maxWidth * .22,
- constraints.maxWidth -
- actionsWidth -
- 110,
- ),
+ child: Text(
+ session.agentName,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.monoLabel(
+ color: AppColors.text,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ ),
+ ),
+ if (status != null || !compact)
+ const SizedBox(width: 8),
+ if (status != null && narrow)
+ Tooltip(
+ message: '${status.label}: ${status.detail}',
+ child: IconButton(
+ tooltip: status.actionLabel ?? status.label,
+ onPressed: statusAction,
+ icon: Icon(status.icon, size: 14),
+ style: IconButton.styleFrom(
+ foregroundColor: color,
+ disabledForegroundColor: color,
+ fixedSize: const Size(28, 28),
+ minimumSize: const Size(28, 28),
+ padding: EdgeInsets.zero,
+ tapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
+ ),
+ )
+ else if (status != null)
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: math.max(
+ 0,
+ math.min(
+ constraints.maxWidth * .22,
+ constraints.maxWidth - actionsWidth - 110,
+ ),
+ ),
+ ),
+ child: Align(
+ alignment: Alignment.centerLeft,
+ child: Tooltip(
+ message: status.detail,
+ child: TextButton(
+ onPressed: statusAction,
+ style: TextButton.styleFrom(
+ foregroundColor: color,
+ disabledForegroundColor: AppColors.textSoft,
+ minimumSize: Size.zero,
+ tapTargetSize:
+ MaterialTapTargetSize.shrinkWrap,
+ padding: const EdgeInsets.symmetric(
+ horizontal: 6,
+ vertical: 4,
),
),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Tooltip(
- message: status.detail,
- child: TextButton(
- onPressed: statusAction,
- style: TextButton.styleFrom(
- foregroundColor: color,
- disabledForegroundColor:
- AppColors.textSoft,
- minimumSize: Size.zero,
- tapTargetSize:
- MaterialTapTargetSize.shrinkWrap,
- // The name's line height: the folder line sits under it.
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(status.icon, size: 14),
+ const SizedBox(width: 6),
+ Flexible(
+ child: Text(
+ // The chip names the STATE; what
+ // pressing it does is in the tooltip
+ // and in `actionLabel`. "Link
+ // required" that can be pressed reads
+ // better than a bare verb where every
+ // neighbour is a status.
+ status.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: grid.AppType.monoLabel(
+ fontWeight: FontWeight.w400,
),
),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(status.icon, size: 12),
- const SizedBox(width: 6),
- Flexible(
- child: Text(
- // The chip names the STATE; what
- // pressing it does is in the tooltip
- // and in `actionLabel`. "Link
- // required" that can be pressed reads
- // better than a bare verb where every
- // neighbour is a status.
- status.label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: grid.AppType.monoLabel(
- fontWeight: FontWeight.w400,
- height: 1,
- ).copyWith(fontSize: 11),
- ),
- ),
- ],
- ),
),
- ),
- ),
- )
- else if (!compact)
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 4,
- ),
- child: Icon(
- Icons.circle,
- size: 8,
- color: color,
- ),
- ),
- ],
- ),
- ),
- const SizedBox(height: 1),
- Row(
- children: [
- Flexible(
- child: Tooltip(
- message: [
- if (forkedFrom != null)
- 'Forked from ${forkedFrom.name}',
- if (project != null) project.cwd,
- ?project?.branchDetail,
- machineName,
- ].join('\n'),
- child: PromptContextView(
- // Small, so the two lines stay about the mark's height. The
- // line height leaves room for descenders: at 1.0 the tails of
- // g, p and y were cut off.
- textStyle: grid.AppType.monoLabel(
- color: AppColors.textSoft,
- height: 1.3,
- ).copyWith(fontSize: 10),
- contextData: PromptContext(
- // This computer goes without saying.
- machine: machine?.isLocalMachine == true
- ? null
- : machineName,
- // The folder as it was chosen and its repository's branch;
- // the full working folder is in the tooltip.
- project: project?.label,
- // Not a branch Harness made up that waits for the
- // session's name, nor a commit an agent checked out.
- branch: project?.shownBranch,
- leading: forkedFrom != null
- ? 'forked from ${forkedFrom.name}'
- : null,
+ ],
),
),
),
),
- if (showPr) ...[
- const SizedBox(width: 6),
- PullRequestBadge(
- compact: narrow,
- identity: (
- session.machineId,
- agent.id,
- project?.cwd,
- project?.shownBranch,
- ),
- read: () => notifier.readAgentPullRequest(
- session.machineId,
- agent.id,
- ),
- ),
- ],
- ],
- ),
+ )
+ else if (!compact)
+ Padding(
+ padding: const EdgeInsets.all(4),
+ child: Icon(Icons.circle, size: 8, color: color),
+ ),
],
),
),
@@ -2236,6 +2174,24 @@ class _TerminalHeader extends StatelessWidget {
ConstrainedBox(
constraints: BoxConstraints(maxWidth: rightWidth),
child: PaneHeaderActions(
+ trailing: showPr
+ ? ConstrainedBox(
+ constraints: BoxConstraints(maxWidth: badgeWidth),
+ child: PullRequestBadge(
+ compact: narrow,
+ identity: (
+ session.machineId,
+ agent.id,
+ project?.cwd,
+ project?.shownBranch,
+ ),
+ read: () => notifier.readAgentPullRequest(
+ session.machineId,
+ agent.id,
+ ),
+ ),
+ )
+ : null,
// One ⋮ menu for the pane's actions at every width, not a row of icons.
compact: true,
// Keep the current model visible, including while the
@@ -2311,6 +2267,32 @@ class _TerminalHeader extends StatelessWidget {
viewerColor: agent == null
? null
: agentIdentity(agent).color,
+ details: Tooltip(
+ message: [
+ if (forkedFrom != null)
+ 'Forked from ${forkedFrom.name}',
+ if (project != null) project.cwd,
+ ?project?.branchDetail,
+ machineName,
+ ].join('\n'),
+ child: PromptContextView(
+ contextData: PromptContext(
+ // This computer goes without saying.
+ machine: machine?.isLocalMachine == true
+ ? null
+ : machineName,
+ // The folder as it was chosen and its repository's branch;
+ // the full working folder is in the tooltip.
+ project: narrow ? null : project?.label,
+ // Not a branch Harness made up that waits for the
+ // session's name, nor a commit an agent checked out.
+ branch: narrow ? null : project?.shownBranch,
+ leading: !narrow && forkedFrom != null
+ ? 'forked from ${forkedFrom.name}'
+ : null,
+ ),
+ ),
+ ),
),
),
],
diff --git a/desktop/test/terminal_panel_header_test.dart b/desktop/test/terminal_panel_header_test.dart
index c7651daac..f62e7b454 100644
--- a/desktop/test/terminal_panel_header_test.dart
+++ b/desktop/test/terminal_panel_header_test.dart
@@ -9,7 +9,6 @@ import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'package:harness/theme/app_theme.dart';
-import 'package:harness/widgets/grid_model_picker.dart';
import 'package:harness/widgets/terminal_panel.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
@@ -123,30 +122,6 @@ void main() {
});
}
- // The model picker is always shown, right before the ⋮ menu on the header's right edge. It used
- // to sit left of the details/controls stack, whose width follows the branch and the PR badge, so
- // it drifted from pane to pane.
- testWidgets(
- 'the model picker sits before the ⋮ menu and a PR badge does not move it',
- (tester) async {
- final session = sessionNamed('Desktop');
- addTearDown(session.dispose);
- await pump(tester, session);
- final picker = find.byType(GridModelPicker);
- final plain = tester.getRect(picker);
- final menu = tester.getRect(find.byTooltip('Pane actions'));
- expect(plain.right, lessThanOrEqualTo(menu.left));
- expect(menu.left - plain.right, lessThan(8));
-
- await tester.pumpWidget(const SizedBox());
- await pump(tester, session, withPr: true);
- expect(tester.getRect(picker), plain);
- expect(tester.takeException(), isNull);
- await tester.pumpWidget(const SizedBox());
- await tester.pump(const Duration(seconds: 1));
- },
- );
-
// Each shape describes the path topology, not an assumed speed: direct link, intermediate hop,
// backend server. Tooltip and semantics use the protocol names people will diagnose with.
testWidgets(
@@ -170,8 +145,7 @@ void main() {
find.widgetWithText(TextButton, label),
);
expect(statusRect.left, greaterThan(nameRect.right));
- // The project line sits under the name, so the status never reaches it.
- expect(projectRect.top, greaterThan(nameRect.bottom - 1));
+ expect(statusRect.right, lessThan(projectRect.left));
expect(tester.getRect(project), projectRect);
expect(tester.takeException(), isNull);
}
diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dart
index f48983af1..89325ad61 100644
--- a/desktop/test/terminal_panel_presentation_test.dart
+++ b/desktop/test/terminal_panel_presentation_test.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:harness/widgets/transient_menus.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -208,7 +207,7 @@ void main() {
);
for (final local in [true, false]) {
testWidgets(
- '${local ? 'local' : 'remote'} header keeps details under the name and shows actions on hover',
+ '${local ? 'local' : 'remote'} header keeps its details in view and its actions in the ⋮ menu',
(tester) async {
final app = createApp();
app.stateOf('m')!.localOnly = local;
@@ -253,18 +252,17 @@ void main() {
final titleBounds = tester.getRect(title);
expect(find.text('harness'), findsOneWidget);
expect(find.text('main'), findsOneWidget);
- // Folder, branch and machine sit on the line under the name.
if (local) {
// This computer goes without saying.
expect(find.text('Test host'), findsNothing);
expect(
- tester.getRect(find.text('harness')).top,
- greaterThan(titleBounds.bottom - 1),
+ tester.getRect(find.text('harness')).left,
+ greaterThan(titleBounds.right),
);
} else {
expect(
- tester.getRect(find.text('Test host')).top,
- greaterThan(titleBounds.bottom - 1),
+ tester.getRect(find.text('Test host')).left,
+ greaterThan(titleBounds.right),
);
expect(
tester.getRect(find.text('harness')).left,
@@ -275,7 +273,8 @@ void main() {
tester.getRect(find.text('main')).left,
greaterThan(tester.getRect(find.text('harness')).right),
);
- // One ⋮ menu, always in view, instead of a row of icons that appeared on hover.
+ // One ⋮ menu, always in view, instead of a row of icons that took the details' place
+ // on hover.
expect(
find.descendant(of: controls, matching: find.byType(IconButton)),
findsOneWidget,