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.

Refine workspace bars and move model switching to pane headers (#319)

Deec860e84355bf
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index 1d224a8cf..a85f7fac9 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -263,8 +263,9 @@ its headless debug timings do not establish native display or network latency.
`appTextScaleOf` for geometry. The terminal grid, composer, find field, empty tab's welcome
page, and terminal-workspace dialogs follow the selected terminal size (⌘+/⌘−). Dialogs use
`terminalContentStyle()` and `terminalCellSizeOf(context)` for the exact font and character grid;
- see [the dialog guide](design/terminal-dialogs.md). Native tabs get the terminal face at
- `AppType.chromeSize`; native menus keep the system menu font.
+ see [the dialog guide](design/terminal-dialogs.md). Workspace tabs, status text, pane
+ titles, and model selectors use `workspaceBarTextStyle()`: fixed 13 pt SF Mono regular
+ on macOS, platform monospace elsewhere. Native menus keep the system menu font.
- `ThemeModeStore` and `TerminalFontStore` are `ValueNotifier` singletons (they must resolve above the
provider scope and before sign-in).
diff --git a/desktop/design/images/workspace-bars-13pt.png b/desktop/design/images/workspace-bars-13pt.png
new file mode 100644
index 000000000..8af7e64fa
Binary files /dev/null and b/desktop/design/images/workspace-bars-13pt.png differ
diff --git a/desktop/design/terminal-dialogs.md b/desktop/design/terminal-dialogs.md
index c8c0cfa93..4481ea1da 100644
--- a/desktop/design/terminal-dialogs.md
+++ b/desktop/design/terminal-dialogs.md
@@ -58,8 +58,9 @@ when using custom row widgets.
- No provider logos, avatars, decorative emoji, image assets, or icon-font
glyphs in dialog chrome. Write `Codex`, `Claude`, or the harness name.
-- Use plain markers when useful: `>` for the search prompt, `@` for a machine,
- `/` for a project, and `git:` for a branch. Keep identity readable as text.
+- Use `>` for the search prompt. Harness result subtitles use the compact
+ Standard status format: `machine:project (branch)`. Omit missing fields and
+ redundant provider/engine labels; preserve important state such as Offline.
- Boolean controls use `[x]` and `[ ]`; Enter and Space toggle them.
- Actions use concise text, such as `[ New Harness ]`. Shortcut hints are text
beside the action, resolved from the live keymap.
@@ -74,10 +75,10 @@ For example, a result is two text lines followed by one blank row:
> Find a harness...
Checkout retries 5m
- Codex @ M2 / storefront git: fix/retry
+ M2:storefront (fix/retry)
Search experience 1h
- Claude @ M2 / storefront git: main
+ M2:storefront (main)
```
The highlight covers only the selected title line.
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 019d33426..4d12a941d 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -1,10 +1,10 @@
# Workspace status bar
-One shared status line, using the terminal font and measured character cells.
+One shared status line, using compact monospace text and measured character cells.
Follow the [terminal dialog design system](terminal-dialogs.md).
```text
-1:api 2:web 3:blender + OpenAI M2:autonomous-harness (main)
+1:api 2:web 3:blender + M2:autonomous-harness (main)
```
## Tabs on the left
@@ -26,25 +26,37 @@ them. Preserve the full name for inspection when its visible label is truncated.
Center the text with one cell of padding on each side. Cap long labels at 24
cells and scroll overflow, revealing the selected tab on keyboard navigation.
-There is no close button or reserved close-button space. Cmd-W closes the active
+There is no close button or reserved close-button space. Cmd-Shift-W closes the active
tab; preserve remapped shortcuts, native menu access, and middle-click closing.
Preserve reorder, rename, keyboard focus, and terminal sessions.
-Tab labels, status text, and pane titles use the selected terminal font, point
-size, and regular weight. Pane titles must not use the smaller `monoLabel` UI
-style. As in the terminal renderer, do not apply a second UI text-scale factor
-to pane titles.
+Tab labels, status text, pane titles, and model selectors use **13 pt SF Mono,
+regular weight** on macOS. Linux uses its platform monospace stack at the same
+size. Use `workspaceBarTextStyle()` and `workspaceBarCellSizeOf(context)` from
+`lib/shared/theme/workspace_bar_style.dart`; the native bar receives that same
+font through `barStyle`. Keep this size independent of terminal zoom and avoid
+an additional UI text-scale factor. Selection uses background color, not bold.
+Terminal content and dialogs still follow the user's selected terminal font
+and size.
+
+![13 pt workspace bars with synthetic pane names](images/workspace-bars-13pt.png)
## Pane controls
-Keep three muted ASCII controls at the right of a harness pane: `-` closes only
-that view, `[]` toggles zoom, and `x` stops the harness after confirmation. Each
-control occupies two character columns. Use the terminal font and palette,
-plain text, and a subtle hover/focus fill. Reveal these controls only while the
-pointer is over that pane's top bar, or a control has keyboard focus. Hovering
-the terminal body does not reveal them. Reserve their columns while hidden so
-the title never shifts, and keep keyboard traversal available. Retain
-descriptive tooltips and accessibility labels; never rely on the symbols alone.
+The right edge of each supported harness pane shows its model selector. Prefer
+its local model ID or the daemon's observed subscription model (`selectedModel`),
+such as `GPT-6 Astra`, `Fable`, or `Opus`. Keep versions when reported; never infer
+a version from a family alias. Older daemons fall back to the provider name.
+Keep this label visible without requiring hover, including while disconnected;
+disable switching when the pane is read-only. Use a hand cursor, subtle hover and
+keyboard-focus fill, and a tooltip explaining subscription/local switching.
+A model update must repaint the label without reopening or retargeting the pane.
+The observed subscription model does not select a Local row in the picker.
+
+There are no ASCII close, zoom, or stop buttons. Cmd-W closes the focused pane
+view, Cmd-Shift-W closes the tab, and Cmd-Enter toggles pane zoom. Closing a view
+keeps its harness running; Stop Harness remains a separate command with its
+existing confirmation. Preserve explicit user keymap overrides.
Pane edges have no floating split buttons. Split Right and Split Down remain
keyboard commands (Cmd-R and Cmd-D by default), with File menu and command-search
@@ -57,7 +69,8 @@ follow a dependent viewer's owner.
## Focused context on the right
-Show provider or selected model, `machine:project`, then `(branch)` when known.
+Show `machine:project`, then `(branch)` when known. Model selection lives in each
+pane header, not in this shared context.
Use the shared `AgentProject.label` rule: at a Git root, prefer the remote repo's
name, falling back to the local repo name; in a repo subfolder, use that folder's
name; outside Git, use the ordinary folder name. A worktree follows exactly the
@@ -65,21 +78,22 @@ same rule. Its generated path and `[worktree]` marker do not belong in the bar.
Keep the full actual path in the tooltip and accessibility detail.
A focused viewer shows its owning harness's context. Omit absent project or Git
-metadata; detached commits say `detached:<commit>`. Clicking the context opens
-the harness's existing model picker when supported. Clear it for an empty tab.
+metadata; detached commits say `detached:<commit>`. The context is informational;
+only a PR label is clickable. Clear it for an empty tab.
Customize Harness → Status offers five saved themes with a colored preview of
the same sample pane beneath each choice. Selection covers only the name row.
-The selected theme also previews PR status. All choices inherit the terminal
-font, cell size, and ANSI palette; controls keep the plain terminal design.
+The selected theme also previews PR status. Previews inherit the terminal font,
+cell size, and ANSI palette; the workspace bar uses the fixed 13 pt bar font.
+Controls keep the plain terminal design.
| Theme | Treatment |
| --- | --- |
-| Standard (default) | Foreground provider, cyan `machine:project`, green `(branch)` |
+| Standard (default) | Cyan `machine:project`, green `(branch)` |
| Robbyrussell | Green arrow, cyan project, blue `git:(` with red branch |
| Pure | Blue project, muted machine/branch, magenta prompt mark |
| Agnoster | Joined black context, blue project, and green branch segments |
-| Powerlevel10k Rainbow | Separate light provider, yellow-on-black machine, blue project, and green branch segments |
+| Powerlevel10k Rainbow | Yellow-on-black machine, blue project, and green branch segments |
These are one-line visual adaptations, not installed shell themes. Powerline
separators are drawn one-cell shapes and do not require patched fonts. Prompt
@@ -88,10 +102,10 @@ privilege, or exit-status readings. Standard keeps familiar host/directory
notation; Zsh's actual stock prompt is `%m%# ` (host and prompt character).
The rightmost PR label belongs to the focused harness, including when its viewer
-has focus. Display `PR #298 · Merged` (or Draft/Open/Closed), with a separate link
+has focus. Display `#298 Merged` (or Draft/Open/Closed), with a separate link
to that PR. Plain themes leave one text cell before the label. Segmented themes
connect it directly to the preceding arrow, making one continuous bar while
-retaining separate model-picker and PR click targets. The selected-theme preview
+retaining the PR click target. The selected-theme preview
shows that same joined line. State colors come from the terminal palette:
muted for Draft, green for Open, magenta for Merged, and red for Closed. Turning
Color off applies a monochrome treatment to context and PR together.
@@ -110,7 +124,7 @@ References: [Zsh prompt parameters](https://zsh.sourceforge.io/Doc/Release/Param
[Agnoster](https://github.com/agnoster/agnoster-zsh-theme), and
[Powerlevel10k](https://github.com/romkatv/powerlevel10k).
-Pane headers keep task identity and controls. Machines, Models, Harnesses, and
+Pane headers keep task identity and model selection. Machines, Models, Harnesses, and
the Store remain reachable from native menus and commands. Leave a window drag
area between tabs and context and prevent overlap in narrow windows.
diff --git a/desktop/lib/core/models.dart b/desktop/lib/core/models.dart
index 2430ee233..e259548a3 100644
--- a/desktop/lib/core/models.dart
+++ b/desktop/lib/core/models.dart
@@ -3,6 +3,8 @@ library;
import 'package:flutter/foundation.dart' show immutable;
+import 'runtime_model_name.dart';
+
enum MachineAuthMode { managed, remote, self, provider }
enum ConnectionStatus { disconnected, connecting, connected, reconnecting }
@@ -285,6 +287,10 @@ class Agent {
final String? engineIconHint;
final String? codexHome;
+ /// Model observed in this session by the daemon, when available. Independent
+ /// of [gridModel], which determines subscription versus local-model routing.
+ final String? modelName;
+
/// The grid model this agent is CURRENTLY running on, or null for its own vendor login.
///
/// Read by the daemon off the live process on every discovery, never bookkept — so it is the
@@ -379,6 +385,7 @@ class Agent {
this.engineDisplayName,
this.engineIconHint,
this.codexHome,
+ this.modelName,
this.gridModel,
this.gridWebSearch,
this.parentAgentId,
@@ -503,6 +510,11 @@ class Agent {
engineDisplayName: _safeLabel(j['engineDisplayName']),
engineIconHint: _safeLabel(j['engineIconHint']),
codexHome: j['engine'] == 'codex' ? _safeCodexHome(j['codexHome']) : null,
+ modelName: runtimeModelName(
+ j['selectedModel'],
+ agentId: j['id'] as String,
+ engine: _safeEngine(j['engine']),
+ ),
gridModel: _safeLabel(grid?['model']),
gridWebSearch: GridWebSearch.fromWire(grid?['webSearch']),
parentAgentId: _safeLabel(j['parentAgentId'] ?? j['parentId']),
@@ -554,6 +566,7 @@ class Agent {
engineDisplayName: engineDisplayName,
engineIconHint: engineIconHint,
codexHome: codexHome,
+ modelName: modelName,
gridModel: gridModel,
gridWebSearch: gridWebSearch,
parentAgentId: parentAgentId,
diff --git a/desktop/lib/core/pull_request_status.dart b/desktop/lib/core/pull_request_status.dart
index f1dd74155..a1bd50e46 100644
--- a/desktop/lib/core/pull_request_status.dart
+++ b/desktop/lib/core/pull_request_status.dart
@@ -5,7 +5,7 @@ class PullRequestStatus {
final int number;
final String state;
final Uri url;
- String get label => 'PR #$number · $state';
+ String get label => '#$number $state';
static PullRequestStatus? fromResult(Map<String, dynamic>? result) {
final number = result?['number'];
diff --git a/desktop/lib/core/runtime_model_name.dart b/desktop/lib/core/runtime_model_name.dart
new file mode 100644
index 000000000..3d891acef
--- /dev/null
+++ b/desktop/lib/core/runtime_model_name.dart
@@ -0,0 +1,50 @@
+/// Display the model observed by the daemon, without treating it as a local
+/// model selection. The runtime-v1 wire ID is shared with CLI model controls.
+String? runtimeModelName(
+ Object? value, {
+ required String agentId,
+ String? engine,
+}) {
+ if (value is! String || value.length > 1024) return null;
+ final match = RegExp(
+ r'^runtime-v1:([^:]+):([a-z0-9_-]+):([^@]+)@([a-z0-9_-]+)$',
+ caseSensitive: false,
+ ).firstMatch(value);
+ if (match == null || match[2]!.toLowerCase() != engine?.toLowerCase()) {
+ return null;
+ }
+ try {
+ if (Uri.decodeComponent(match[1]!) != agentId) return null;
+ final model = Uri.decodeComponent(match[3]!).trim();
+ if (model.isEmpty ||
+ model.length > 256 ||
+ RegExp(r'[\x00-\x1f\x7f]').hasMatch(model)) {
+ return null;
+ }
+ // Claude may report only a family alias. Never invent a version for it.
+ final claude = RegExp(
+ r'^(?:claude-)?(fable|opus|sonnet|haiku)(?:-(\d+(?:[-.]\d{1,2})*))?(\[1m\])?$',
+ caseSensitive: false,
+ ).firstMatch(model);
+ if (claude != null) {
+ final family = claude[1]!.toLowerCase();
+ final version = claude[2]?.replaceAll('-', '.');
+ return '${family[0].toUpperCase()}${family.substring(1)}'
+ '${version == null ? '' : ' $version'}${claude[3] ?? ''}';
+ }
+ final gpt = RegExp(
+ r'^gpt-(\d+(?:\.\d+)*)(?:-(astra|sol|terra|luna|codex))?$',
+ caseSensitive: false,
+ ).firstMatch(model);
+ if (gpt != null) {
+ final family = gpt[2]?.toLowerCase();
+ return 'GPT-${gpt[1]}${family == null ? '' : ' ${family[0].toUpperCase()}${family.substring(1)}'}';
+ }
+ // Unknown names, dated IDs and local/provider-qualified IDs stay exact.
+ return model;
+ } on ArgumentError {
+ return null;
+ } on FormatException {
+ return null;
+ }
+}
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 27e56b76e..7889dbd8f 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -21,6 +21,7 @@ import '../models/models_panel.dart';
import '../settings/settings_screen.dart';
import '../settings/settings_section.dart';
import '../shared/theme/app_theme.dart' as grid;
+import '../shared/theme/workspace_bar_style.dart';
import '../sharing/share_harness_dialog.dart';
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/status_line_style.dart';
@@ -53,7 +54,6 @@ import '../widgets/transient_menus.dart';
import '../widgets/layout_palette.dart';
import '../widgets/move_pane_palette.dart';
import '../widgets/engine_identity.dart';
-import '../widgets/grid_model_picker.dart';
import '../widgets/status_line.dart';
import '../store/store_mark.dart';
import '../store/store_screen.dart';
@@ -157,7 +157,6 @@ class _SwarmScreenState extends State<SwarmScreen>
StreamSubscription<void>? _modelsRequests;
final _shellFocus = FocusNode(debugLabel: 'Swarm shell');
final _paneContextAnchor = GlobalKey();
- final _focusedModel = GridModelPickerController();
late final WorkspacePullRequest _pullRequest;
MachinesPanelHandle? _machinesPanel;
final _toolbarNotices = ToolbarNotices();
@@ -411,7 +410,6 @@ class _SwarmScreenState extends State<SwarmScreen>
_navigation.dispose();
_searchFocus.dispose();
_searchText.dispose();
- _focusedModel.dispose();
_tabScroll.dispose();
_canvasFocus.dispose();
_shellFocus.dispose();
@@ -834,14 +832,15 @@ class _SwarmScreenState extends State<SwarmScreen>
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
+ final barStyle = workspaceBarTextStyle();
final payload = {
'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,
'activeId': app.activeSwarmId,
'palette': grid.AppTheme.palette.value.nativeColors,
- 'terminalStyle': {
- 'family': terminalFontStore.value.fontFamily,
- 'fallback': terminalFontStore.value.fontFamilyFallback,
- 'size': terminalFontStore.size,
+ 'barStyle': {
+ 'family': barStyle.fontFamily,
+ 'fallback': barStyle.fontFamilyFallback,
+ 'size': workspaceBarFontSize,
'foreground': terminalTheme.foreground.toARGB32(),
'selection': terminalTheme.selection.toARGB32(),
},
@@ -850,7 +849,7 @@ class _SwarmScreenState extends State<SwarmScreen>
: {
..._nativeStatusLine(parts!, terminalTheme),
'detail': focused.detail,
- 'canSelectModel': _canSelectFocusedModel(focused),
+ 'interactive': false,
},
'pullRequest': _pullRequest.value == null
? null
@@ -866,7 +865,7 @@ class _SwarmScreenState extends State<SwarmScreen>
),
'url': _pullRequest.value!.url.toString(),
'detail': '${_pullRequest.value!.label} — Open on GitHub',
- 'canSelectModel': true,
+ 'interactive': true,
},
'canReopen': app.canReopenLastClosed,
'canFind': _canFindTerminal,
@@ -1176,11 +1175,6 @@ class _SwarmScreenState extends State<SwarmScreen>
// event any Flutter overlay can see itself.
dismissTransientMenus();
switch (call.method) {
- case 'focusedModel':
- final focused = WorkspacePaneContext.focused(app);
- if (focused != null && _canSelectFocusedModel(focused)) {
- _focusedModel.open();
- }
case 'focusedPullRequest':
await _openFocusedPullRequest(args['url'] as String?);
case 'store':
@@ -3635,8 +3629,8 @@ class _SwarmScreenState extends State<SwarmScreen>
backgroundColor: grid.AppPalette.swarmField,
body: Column(
children: [
- _focusedModelPicker(),
- if (!_native) _tabStrip(),
+ if (!_native)
+ MediaQuery.withNoTextScaling(child: _tabStrip()),
if (_learning.active && app.viewer == null)
WorkspaceQuickStart(
learning: _learning,
@@ -3946,54 +3940,14 @@ class _SwarmScreenState extends State<SwarmScreen>
});
}
- bool _canSelectFocusedModel(WorkspacePaneContext data) {
- final machine = app.stateOf(data.pane.machineId);
- return data.agent != null &&
- data.agentId != null &&
- modelPickerSupports(data.engine) &&
- data.pane.session?.readOnly != true &&
- machine?.needsLink != true &&
- machine?.nodeOnline != false;
- }
-
- Widget _focusedModelPicker() {
- final data = WorkspacePaneContext.focused(app);
- if (data == null || !_canSelectFocusedModel(data)) {
- return const SizedBox.shrink();
- }
- final machineId = data.pane.machineId;
- final agentId = data.agentId!;
- return GridModelPicker(
- key: ValueKey(('workspace-model', machineId, agentId)),
- notifier: app,
- machineId: machineId,
- controller: _focusedModel,
- menuOnly: true,
- engineLabel: data.engine,
- currentModel: data.agent?.gridModel,
- webSearch: data.agent?.gridWebSearch,
- onSelected: (model) => unawaited(
- app.retargetAgentToGridModel(
- machineId,
- agentId,
- model.id,
- gridName: model.grid,
- ),
- ),
- onUseOwnLogin: () => unawaited(app.clearAgentGrid(machineId, agentId)),
- onRunLocalModel: () =>
- unawaited(app.runLocalModel(context, machineId: machineId)),
- );
- }
-
Widget _tabStrip() => LayoutBuilder(
builder: (context, constraints) {
- final cell = terminalCellSizeOf(context);
+ final cell = workspaceBarCellSizeOf(context);
final theme = terminalThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final style = terminalContentStyle(color: theme.foreground);
+ final style = workspaceBarTextStyle(color: theme.foreground);
final names = workspaceTabNames(app);
final labels = [
for (var index = 0; index < app.swarms.length; index++)
@@ -4033,7 +3987,6 @@ class _SwarmScreenState extends State<SwarmScreen>
segmentOffset: parts.segments.length,
).first.background
: null;
- final canSelectModel = focused != null && _canSelectFocusedModel(focused);
_revealSelectedTab(tabsWidth);
return Material(
key: const ValueKey('workspace-status-bar'),
@@ -4138,13 +4091,13 @@ class _SwarmScreenState extends State<SwarmScreen>
child: Tooltip(
key: _paneContextAnchor,
message: focused?.detail ?? '',
- child: InkWell(
+ child: SizedBox(
key: const ValueKey('workspace-pane-context'),
- onTap: canSelectModel ? _focusedModel.open : null,
child: parts == null
? const SizedBox.shrink()
: StatusLine(
parts: parts,
+ workspaceBar: true,
color: prefs.color,
nextBackground: prBackground,
),
@@ -4165,6 +4118,7 @@ class _SwarmScreenState extends State<SwarmScreen>
onTap: () => _openFocusedPullRequest(pr.url.toString()),
child: StatusLine(
parts: prParts!,
+ workspaceBar: true,
color: prefs.color,
segmentOffset: parts?.segments.length ?? 0,
),
diff --git a/desktop/lib/shared/theme/status_line_style.dart b/desktop/lib/shared/theme/status_line_style.dart
index 4b9694eee..b8e590eba 100644
--- a/desktop/lib/shared/theme/status_line_style.dart
+++ b/desktop/lib/shared/theme/status_line_style.dart
@@ -144,7 +144,7 @@ StatusLineParts pullRequestStatusLineParts({
if (style.segmented) {
return StatusLineParts(style, [
StatusLineSegment(
- 'PR #$number · $state',
+ '#$number $state',
foreground: state == 'Open' || state == 'Draft'
? StatusLineTone.black
: StatusLineTone.white,
@@ -154,7 +154,7 @@ StatusLineParts pullRequestStatusLineParts({
}
return StatusLineParts(style, [
StatusLineSegment(
- 'PR #$number · ',
+ '#$number ',
foreground: switch (style) {
StatusLineStyle.robbyrussell => StatusLineTone.blue,
StatusLineStyle.pure => StatusLineTone.muted,
diff --git a/desktop/lib/shared/theme/workspace_bar_style.dart b/desktop/lib/shared/theme/workspace_bar_style.dart
new file mode 100644
index 000000000..6a23514e7
--- /dev/null
+++ b/desktop/lib/shared/theme/workspace_bar_style.dart
@@ -0,0 +1,30 @@
+import 'package:flutter/widgets.dart';
+
+import '../../terminal/terminal_typography.dart';
+
+/// Compact workspace labels stay stable when terminal text is zoomed.
+/// SF Mono on macOS, with the platform's monospace stack elsewhere.
+const workspaceBarFontSize = 13.0;
+
+TextStyle workspaceBarTextStyle({Color? color}) => TextStyle(
+ fontFamily: terminalFontFamily,
+ fontFamilyFallback: terminalFontFallback,
+ fontSize: workspaceBarFontSize,
+ fontWeight: FontWeight.normal,
+ height: 1.2,
+ letterSpacing: 0,
+ wordSpacing: 0,
+ color: color,
+);
+
+/// Measure bar padding and controls using their own character grid.
+Size workspaceBarCellSizeOf(BuildContext context) {
+ final painter = TextPainter(
+ text: TextSpan(text: 'mmmmmmmmmm', style: workspaceBarTextStyle()),
+ textDirection: TextDirection.ltr,
+ textScaler: MediaQuery.textScalerOf(context),
+ )..layout();
+ final size = Size(painter.width / 10, painter.height);
+ painter.dispose();
+ return size;
+}
diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dart
index 4af0b9a02..27c751447 100644
--- a/desktop/lib/shortcuts/app_shortcuts.dart
+++ b/desktop/lib/shortcuts/app_shortcuts.dart
@@ -428,7 +428,11 @@ const kSwarmShortcuts = [
),
AppShortcut(
action: ShortcutAction.closeSwarm,
- activator: SingleActivator(LogicalKeyboardKey.keyW, meta: true),
+ activator: SingleActivator(
+ LogicalKeyboardKey.keyW,
+ meta: true,
+ shift: true,
+ ),
label: 'Close Tab',
group: ShortcutGroup.navigate,
),
@@ -490,11 +494,7 @@ const kSwarmShortcuts = [
),
AppShortcut(
action: ShortcutAction.closePane,
- activator: SingleActivator(
- LogicalKeyboardKey.keyW,
- meta: true,
- shift: true,
- ),
+ activator: SingleActivator(LogicalKeyboardKey.keyW, meta: true),
label: 'Close the focused pane',
group: ShortcutGroup.panes,
),
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index dcc362f49..724291d9f 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -4551,6 +4551,7 @@ class AppNotifier extends ChangeNotifier {
prev.engineDisplayName != agent.engineDisplayName ||
prev.engineIconHint != agent.engineIconHint ||
prev.codexHome != agent.codexHome ||
+ prev.modelName != agent.modelName ||
prev.parentAgentId != agent.parentAgentId ||
prev.project != agent.project ||
prev.lastActivityAt != agent.lastActivityAt ||
diff --git a/desktop/lib/state/workspace_status.dart b/desktop/lib/state/workspace_status.dart
index cd3bc8450..7aad5fc0c 100644
--- a/desktop/lib/state/workspace_status.dart
+++ b/desktop/lib/state/workspace_status.dart
@@ -139,9 +139,9 @@ class WorkspacePaneContext {
String? get agentId => pane.isWeb ? pane.ownerAgentId : pane.agentId;
String? get engine => agent?.engine ?? pane.session?.engineId;
String get suffix => branch == null ? '' : ' ($branch)';
- String get text => '${provider.isEmpty ? '' : '$provider '}$location$suffix';
+ String get text => '$location$suffix';
StatusLineParts format(PromptPrefs prefs) => statusLineParts(
- provider: provider,
+ provider: '',
machine: prefs.machine ? machineName : '',
project: prefs.project ? projectName : '',
branch: prefs.branch ? branch : null,
diff --git a/desktop/lib/widgets/grid_model_picker.dart b/desktop/lib/widgets/grid_model_picker.dart
index 1ffb2b7c3..c60ead2ed 100644
--- a/desktop/lib/widgets/grid_model_picker.dart
+++ b/desktop/lib/widgets/grid_model_picker.dart
@@ -1,6 +1,12 @@
import 'dart:async';
import 'package:flutter/material.dart';
+
+import '../shared/theme/workspace_bar_style.dart';
+import '../shared/theme/app_theme.dart' as grid;
+import '../terminal/terminal_theme.dart';
+import '../terminal/terminal_theme_store.dart';
+
import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
@@ -68,6 +74,9 @@ class GridModelPicker extends StatefulWidget {
/// filled row, so the menu answers "where am I" as well as "where could I go".
final String? currentModel;
+ /// Observed subscription model for the label. Does not select a Local row.
+ final String? subscriptionModel;
+
/// Whether the agent can search the web on [currentModel], as the daemon decided when it built
/// the launch. Shown as a subtitle under the current Local row and in the control's tooltip —
/// only for the two degraded values; `on` and null (nothing said) show nothing. Read only when
@@ -78,9 +87,11 @@ class GridModelPicker extends StatefulWidget {
/// The agent's engine, for the subscription row's icon and label.
final String? engineLabel;
final bool compact;
+ final bool paneHeader;
+ final bool enabled;
- /// Native workspace chrome opens the same picker without duplicating its
- /// label in every pane. The menu anchors to the top of the Flutter surface.
+ /// An optional programmatic trigger without a visible label. The menu anchors
+ /// to the top of the Flutter surface; pane headers use the normal trigger.
final bool menuOnly;
final GridModelPickerController? controller;
@@ -92,9 +103,12 @@ class GridModelPicker extends StatefulWidget {
this.onUseOwnLogin,
this.onRunLocalModel,
this.currentModel,
+ this.subscriptionModel,
this.webSearch,
this.engineLabel,
this.compact = false,
+ this.paneHeader = false,
+ this.enabled = true,
this.menuOnly = false,
this.controller,
});
@@ -132,15 +146,17 @@ class _GridModelPickerState extends State<GridModelPicker> {
// a header do nothing. Fire-and-forget: nothing here waits on it, and a failure just means the
// first open pays what it used to. Not while the app is in the background: a pane restored
// behind a minimised window asks nothing until somebody can see it.
- if (widget.notifier.inForeground) {
- unawaited(_prefetch());
- } else {
- _prefetchOwed = true;
- }
+ _prefetchOwed = true;
+ _foregroundChanged();
}
void _foregroundChanged() {
- if (!mounted || !_prefetchOwed || !widget.notifier.inForeground) return;
+ if (!mounted ||
+ !widget.enabled ||
+ !_prefetchOwed ||
+ !widget.notifier.inForeground) {
+ return;
+ }
_prefetchOwed = false;
unawaited(_prefetch().then((_) => _refreshOpenMenu()));
}
@@ -208,6 +224,14 @@ class _GridModelPickerState extends State<GridModelPicker> {
@override
void didUpdateWidget(GridModelPicker oldWidget) {
super.didUpdateWidget(oldWidget);
+ if (widget.enabled != oldWidget.enabled) {
+ _foregroundChanged();
+ if (!widget.enabled) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted && !widget.enabled) _close?.call();
+ });
+ }
+ }
if (widget.controller != oldWidget.controller) {
oldWidget.controller?.removeListener(_openFromController);
widget.controller?.addListener(_openFromController);
@@ -297,7 +321,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
void _openFromController() => unawaited(_open());
Future<void> _open() async {
- if (_loading) return;
+ if (_loading || !widget.enabled) return;
// A warm answer opens the menu with no wait at all. It is at most seconds old — the daemon's own
// memo is what bounds that — and the refresh below lands in time for the next open.
final GridModels answer;
@@ -328,7 +352,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
/// Draw the menu for an answer already in hand. Split from [_open] so a warm open shares exactly
/// the same menu as a cold one rather than a second copy of it.
Future<void> _show(GridModels answer) async {
- if (!mounted) return;
+ if (!mounted || !widget.enabled) return;
_shown = answer;
final box = context.findRenderObject() as RenderBox?;
@@ -359,7 +383,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
close: close,
),
);
- if (chosen == null) return;
+ if (chosen == null || !mounted || !widget.enabled) return;
if (chosen.runLocalModel) {
widget.onRunLocalModel?.call();
return;
@@ -500,6 +524,7 @@ class _GridModelPickerState extends State<GridModelPicker> {
final sentence = _webSearchSentence;
final current =
widget.currentModel ??
+ widget.subscriptionModel ??
switch (widget.engineLabel?.toLowerCase()) {
'codex' => 'OpenAI',
'claude' => 'Anthropic',
@@ -507,29 +532,43 @@ class _GridModelPickerState extends State<GridModelPicker> {
_ => 'Model',
};
final label = _expecting ? 'Switching…' : current;
+ final foreground = widget.paneHeader
+ ? terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ ).foreground.withValues(alpha: .65)
+ : AppColors.textSoft;
return Tooltip(
// The same sentence the menu shows, one line under the control's own — so a person can learn
// the agent has no web search without opening the menu at all.
- message: sentence == null
- ? 'Model: $current · Click to switch'
- : 'Model: $current · Click to switch\n$sentence',
+ message: [
+ 'Model: $current',
+ if (widget.enabled) 'Switch model · Subscription or local models',
+ ?sentence,
+ ].join('\n'),
waitDuration: const Duration(milliseconds: 700),
child: MouseRegion(
// Stated rather than inherited. The pane header sits over a terminal, and the cursor a
// person sees while hovering this was whatever the surface underneath asked for — so a
// control that opens a menu did not look like one until you clicked it.
- cursor: SystemMouseCursors.click,
+ cursor: widget.enabled
+ ? SystemMouseCursors.click
+ : SystemMouseCursors.basic,
// Its own ink surface: an InkWell needs a Material above it, and a pane header is not
// always inside one — every test that drew a header threw "No Material widget found".
child: Material(
type: MaterialType.transparency,
child: InkWell(
- onTap: _open,
+ onTap: widget.enabled ? _open : null,
// Stated on the InkWell as well as on the MouseRegion above it. The cursor a person sees is
// the INNERMOST annotation under the pointer, and InkWell installs one of its own — so an
// ancestor asking for a hand is not, by itself, the thing that decides.
- mouseCursor: SystemMouseCursors.click,
+ mouseCursor: widget.enabled
+ ? SystemMouseCursors.click
+ : SystemMouseCursors.basic,
borderRadius: BorderRadius.circular(4),
+ hoverColor: foreground.withValues(alpha: 0.10),
+ focusColor: foreground.withValues(alpha: 0.10),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: widget.compact ? 3 : 6,
@@ -544,28 +583,32 @@ class _GridModelPickerState extends State<GridModelPicker> {
Flexible(
child: ConstrainedBox(
constraints: BoxConstraints(
- maxWidth: widget.compact ? 44 : 220,
+ maxWidth: widget.compact && !widget.paneHeader
+ ? 44
+ : 220,
),
child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: AppType.monoLabel(
- fontWeight: FontWeight.w400,
- color: AppColors.textSoft,
- ),
+ style: widget.paneHeader
+ ? workspaceBarTextStyle(color: foreground)
+ : 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)
+ if (_loading && !widget.paneHeader)
const SizedBox(
width: 14,
height: 14,
child: CircularProgressIndicator(strokeWidth: 1.5),
)
- else
+ else if (!widget.paneHeader)
Icon(
Icons.arrow_drop_down,
size: 14,
diff --git a/desktop/lib/widgets/pane_header_actions.dart b/desktop/lib/widgets/pane_header_actions.dart
index d3da08570..2c889920b 100644
--- a/desktop/lib/widgets/pane_header_actions.dart
+++ b/desktop/lib/widgets/pane_header_actions.dart
@@ -1,121 +1,22 @@
-import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
-import '../shared/theme/app_theme.dart' as grid;
-import '../terminal/terminal_text.dart';
-import '../terminal/terminal_theme.dart';
-import '../terminal/terminal_theme_store.dart';
-
-/// Reveals only this header's controls, not those of the whole pane or grid.
-class PaneHeaderHover extends StatefulWidget {
- const PaneHeaderHover({super.key, required this.child});
-
- final Widget child;
-
- @override
- State<PaneHeaderHover> createState() => _PaneHeaderHoverState();
-}
-
-class _PaneHeaderHoverState extends State<PaneHeaderHover> {
- bool _hovered = false;
-
- void _hover(bool value) {
- if (_hovered != value) setState(() => _hovered = value);
- }
-
- @override
- Widget build(BuildContext context) => MouseRegion(
- onEnter: (_) => _hover(true),
- onExit: (_) => _hover(false),
- child: _PaneHeaderHoverScope(hovered: _hovered, child: widget.child),
- );
-}
-
-class _PaneHeaderHoverScope extends InheritedWidget {
- const _PaneHeaderHoverScope({required this.hovered, required super.child});
-
- final bool hovered;
-
- @override
- bool updateShouldNotify(_PaneHeaderHoverScope oldWidget) =>
- hovered != oldWidget.hovered;
-}
-
-/// Three quiet terminal characters: close this view, zoom, and stop its harness.
+/// Pane-local model selection and optional standalone terminal context.
+/// Closing, zooming, and stopping remain keyboard/menu commands.
class PaneHeaderActions extends StatelessWidget {
const PaneHeaderActions({
super.key,
- required this.zoomed,
- this.onZoom,
- this.onDelete,
- this.onClose,
this.details,
this.trailing,
this.modelPicker,
- this.terminal = false,
});
- final bool zoomed, terminal;
- final VoidCallback? onZoom, onDelete, onClose;
final Widget? details, trailing, modelPicker;
- /// Two columns per control, including the space around a single character.
- static double widthOf(BuildContext context) =>
- terminalCellSizeOf(context).width * 6;
-
@override
- Widget build(BuildContext context) {
- grid.AppTheme.watch(context);
- final cell = terminalCellSizeOf(context);
- final theme = terminalThemeFor(
- grid.AppTheme.palette.value,
- terminalThemeStore.value,
- );
- Widget action(
- String symbol,
- String label,
- VoidCallback? callback, {
- bool? toggled,
- }) => Tooltip(
- message: label,
- child: Semantics(
- label: label,
- button: true,
- enabled: callback != null,
- toggled: toggled,
- child: TextButton(
- onPressed: callback,
- style: ButtonStyle(
- fixedSize: WidgetStatePropertyAll(
- Size(cell.width * 2, cell.height * 2),
- ),
- minimumSize: const WidgetStatePropertyAll(Size.zero),
- padding: const WidgetStatePropertyAll(EdgeInsets.zero),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- visualDensity: VisualDensity.standard,
- textStyle: WidgetStatePropertyAll(terminalContentStyle()),
- shape: const WidgetStatePropertyAll(RoundedRectangleBorder()),
- foregroundColor: WidgetStateProperty.resolveWith((states) {
- if (states.contains(WidgetState.disabled)) {
- return theme.foreground.withValues(alpha: .2);
- }
- if (states.contains(WidgetState.hovered) ||
- states.contains(WidgetState.focused)) {
- return theme.foreground;
- }
- return theme.foreground.withValues(alpha: .55);
- }),
- overlayColor: WidgetStatePropertyAll(
- theme.foreground.withValues(alpha: .08),
- ),
- ),
- child: ExcludeSemantics(child: Text(symbol)),
- ),
- ),
- );
- return Row(
+ Widget build(BuildContext context) => LayoutBuilder(
+ builder: (context, constraints) => Row(
mainAxisSize: MainAxisSize.min,
children: [
- if (modelPicker != null) Flexible(child: modelPicker!),
if (details != null || trailing != null)
Flexible(
child: Row(
@@ -123,63 +24,27 @@ class PaneHeaderActions extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
if (details != null) Flexible(child: details!),
- ?trailing,
+ if (details != null && trailing != null)
+ const SizedBox(width: 8),
+ if (trailing != null) Flexible(child: trailing!),
],
),
),
- _HoverControls(
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- action('-', 'Close Pane', onClose),
- action(
- '[]',
- zoomed ? 'Restore Pane' : 'Zoom Pane',
- onZoom,
- toggled: zoomed,
- ),
- action(
- 'x',
- terminal ? 'Stop Terminal' : 'Stop Harness',
- onDelete,
- ),
- ],
+ if (modelPicker != null) ...[
+ if (details != null || trailing != null) const SizedBox(width: 8),
+ // Let a short model use only its natural width, leaving the remaining
+ // space for context. Cap it when context shares a narrow header.
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: constraints.maxWidth.isFinite
+ ? constraints.maxWidth *
+ (details != null || trailing != null ? .4 : 1)
+ : 232,
+ ),
+ child: modelPicker!,
),
- ),
+ ],
],
- );
- }
-}
-
-class _HoverControls extends StatefulWidget {
- const _HoverControls({required this.child});
-
- final Widget child;
-
- @override
- State<_HoverControls> createState() => _HoverControlsState();
-}
-
-class _HoverControlsState extends State<_HoverControls> {
- bool _focused = false;
-
- @override
- Widget build(BuildContext context) {
- final header = context
- .dependOnInheritedWidgetOfExactType<_PaneHeaderHoverScope>();
- final visible = (header?.hovered ?? true) || _focused;
- return Focus(
- canRequestFocus: false,
- onFocusChange: (focused) => setState(() => _focused = focused),
- child: IgnorePointer(
- ignoring: !visible,
- child: Opacity(
- key: const ValueKey('pane-header-controls'),
- opacity: visible ? 1 : 0,
- alwaysIncludeSemantics: true,
- child: widget.child,
- ),
- ),
- );
- }
+ ),
+ );
}
diff --git a/desktop/lib/widgets/prompt_customize.dart b/desktop/lib/widgets/prompt_customize.dart
index ec69c0bda..035bfb478 100644
--- a/desktop/lib/widgets/prompt_customize.dart
+++ b/desktop/lib/widgets/prompt_customize.dart
@@ -31,7 +31,7 @@ class PromptCustomize extends StatelessWidget {
final style = terminalContentStyle(color: theme.foreground);
void choose(PromptPrefs next) => unawaited(store.setPrompt(next));
StatusLineParts example(StatusLineStyle format) => statusLineParts(
- provider: 'OpenAI',
+ provider: '',
machine: prefs.machine ? 'M2' : '',
project: prefs.project ? 'app' : '',
branch: prefs.branch ? 'main' : null,
diff --git a/desktop/lib/widgets/pull_request_badge.dart b/desktop/lib/widgets/pull_request_badge.dart
index 77cf36507..63a44952c 100644
--- a/desktop/lib/widgets/pull_request_badge.dart
+++ b/desktop/lib/widgets/pull_request_badge.dart
@@ -71,9 +71,9 @@ class _PullRequestBadgeState extends State<PullRequestBadge> {
final pr = PullRequestStatus.fromResult(_result);
if (pr == null) return const SizedBox.shrink();
final number = pr.number, state = pr.state, uri = pr.url;
- final label = '${widget.compact ? '' : 'PR '}#$number · $state';
+ final label = pr.label;
return Tooltip(
- message: 'PR #$number · $state — Open on GitHub',
+ message: '#$number $state — Open on GitHub',
child: TextButton(
style: TextButton.styleFrom(
minimumSize: const Size(0, 28),
diff --git a/desktop/lib/widgets/status_line.dart b/desktop/lib/widgets/status_line.dart
index 0431e5ec5..fecc084a7 100644
--- a/desktop/lib/widgets/status_line.dart
+++ b/desktop/lib/widgets/status_line.dart
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/status_line_style.dart';
+import '../shared/theme/workspace_bar_style.dart';
import '../terminal/terminal_text.dart';
import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
@@ -17,6 +18,7 @@ class StatusLine extends StatelessWidget {
this.textAlign = TextAlign.right,
this.nextBackground,
this.segmentOffset = 0,
+ this.workspaceBar = false,
});
final StatusLineParts parts;
final bool color;
@@ -25,6 +27,7 @@ class StatusLine extends StatelessWidget {
/// Fill behind the final arrow to join a separately clickable next segment.
final Color? nextBackground;
final int segmentOffset;
+ final bool workspaceBar;
@override
Widget build(BuildContext context) {
@@ -37,7 +40,9 @@ class StatusLine extends StatelessWidget {
grid.AppTheme.palette.value,
terminalThemeStore.value,
);
- final style = terminalContentStyle(color: theme.foreground);
+ final style = workspaceBar
+ ? workspaceBarTextStyle(color: theme.foreground)
+ : terminalContentStyle(color: theme.foreground);
final segments = statusLinePaintSegments(
parts,
theme,
@@ -62,7 +67,9 @@ class StatusLine extends StatelessWidget {
textAlign: textAlign,
);
}
- final cell = terminalCellSizeOf(context);
+ final cell = workspaceBar
+ ? workspaceBarCellSizeOf(context)
+ : terminalCellSizeOf(context);
final scaler = MediaQuery.textScalerOf(context);
return Semantics(
label: parts.text,
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 78290eab5..c3aba9bc5 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -11,6 +11,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import 'box_chrome.dart';
import 'prompt_context.dart';
+import '../shared/theme/status_line_style.dart';
import '../terminal/terminal_text.dart';
import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
@@ -1132,12 +1133,14 @@ class _SearchRowContentState extends State<_SearchRowContent> {
final detail = data == null
? row.terminalDetail ?? row.detail
: [
- if (data.harness?.isNotEmpty == true) data.harness!,
+ statusLineParts(
+ provider: '',
+ machine: data.machine ?? '',
+ project: data.project ?? '',
+ branch: data.branch,
+ ).text,
if (data.leading?.isNotEmpty == true) data.leading!,
- if (data.machine?.isNotEmpty == true) '@ ${data.machine}',
- if (data.project?.isNotEmpty == true) '/ ${data.project}',
- if (data.branch?.isNotEmpty == true) 'git: ${data.branch}',
- ].join(' ');
+ ].where((part) => part.isNotEmpty).join(' ');
return Semantics(
label: row.isCreate
? 'New Harness'
diff --git a/desktop/lib/widgets/terminal_panel.dart b/desktop/lib/widgets/terminal_panel.dart
index 7a1f533b4..7d45d9001 100644
--- a/desktop/lib/widgets/terminal_panel.dart
+++ b/desktop/lib/widgets/terminal_panel.dart
@@ -33,6 +33,7 @@ import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
import '../terminal/terminal_viewport.dart';
import '../shared/theme/app_theme.dart' as grid;
+import '../shared/theme/workspace_bar_style.dart';
import '../theme/app_theme.dart';
import 'engine_identity.dart';
import 'grid_model_picker.dart';
@@ -1876,7 +1877,7 @@ class _TerminalHeader extends StatelessWidget {
Widget _buildHeader(BuildContext context) {
TerminalFontScope.watch(context);
- final titleStyle = terminalContentStyle(
+ final titleStyle = workspaceBarTextStyle(
color: terminalThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
@@ -1955,14 +1956,12 @@ class _TerminalHeader extends StatelessWidget {
if (profile != null) 'Codex profile: $profile',
'Double-click to rename',
].join('\n');
- // Reserve space for the visible model name and the pane controls.
+ // Reserve space for the pane-local model selector.
// Engines without a picker keep their existing header width.
- final showModelPicker =
- !compact && !readOnly && modelPickerSupports(session.engineId);
- // The picker: a model id up to 220px, its arrow and padding.
+ final showModelPicker = modelPickerSupports(session.engineId);
+ // The picker: a model id up to 220px and its padding.
final pickerWidth = showModelPicker ? 250.0 : 0.0;
- // Reserve the same measured columns used by the three ASCII controls.
- final actionsWidth = PaneHeaderActions.widthOf(context) + pickerWidth;
+ final actionsWidth = 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;
@@ -2002,9 +2001,7 @@ class _TerminalHeader extends StatelessWidget {
final desiredRightWidth = narrow
? math.max(
- PaneHeaderActions.widthOf(context) +
- (showModelPicker ? 64.0 : 0.0) +
- badgeWidth,
+ (showModelPicker ? 96.0 : 0.0) + badgeWidth,
constraints.maxWidth * .36,
)
: math.max(
@@ -2016,10 +2013,7 @@ class _TerminalHeader extends StatelessWidget {
// The name/status retain space while model and project text yield.
final rightWidth = math.min(
desiredRightWidth,
- math.max(
- PaneHeaderActions.widthOf(context),
- constraints.maxWidth - 99,
- ),
+ math.max(0.0, constraints.maxWidth - 99),
);
return Row(
children: [
@@ -2178,10 +2172,18 @@ class _TerminalHeader extends StatelessWidget {
// terminal reconnects, without shifting the other controls.
modelPicker: showModelPicker
? GridModelPicker(
+ key: ValueKey((
+ 'pane-model',
+ session.machineId,
+ session.agentId,
+ )),
+ paneHeader: true,
+ enabled: !readOnly && !session.readOnly,
compact: narrow,
notifier: notifier,
machineId: session.machineId,
currentModel: agent?.gridModel,
+ subscriptionModel: agent?.modelName,
webSearch: agent?.gridWebSearch,
engineLabel: session.engineId,
onSelected: (model) => unawaited(
@@ -2208,11 +2210,6 @@ class _TerminalHeader extends StatelessWidget {
),
)
: null,
- zoomed: zoomed,
- onZoom: onToggleZoom,
- onDelete: onDelete,
- onClose: onClose,
- terminal: isTerminalEngine(session.engineId),
details: compact || narrow
? null
: Tooltip(
@@ -2249,7 +2246,7 @@ class _TerminalHeader extends StatelessWidget {
),
),
);
- final strip = PaneHeaderHover(child: header);
+ final strip = header;
final handle = paneDrag;
if (handle == null) return strip;
diff --git a/desktop/lib/widgets/web_pane_panel.dart b/desktop/lib/widgets/web_pane_panel.dart
index e900d03ce..a452fa5b8 100644
--- a/desktop/lib/widgets/web_pane_panel.dart
+++ b/desktop/lib/widgets/web_pane_panel.dart
@@ -8,6 +8,7 @@ import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';
import '../core/models.dart' show AgentVerdict;
import '../core/test_run.dart';
import '../shared/theme/app_theme.dart' as grid;
+import '../shared/theme/workspace_bar_style.dart';
import '../state/app_state.dart';
import '../state/terminal_pane.dart';
import '../theme/app_theme.dart';
@@ -247,7 +248,7 @@ class _WebPanePanelState extends State<WebPanePanel> {
key: const ValueKey('viewer-pane-title'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
- style: terminalContentStyle(color: AppColors.text),
+ style: workspaceBarTextStyle(color: AppColors.text),
),
),
if (widget.verdict case final verdict?) ...[
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index f96f12b67..c3d821059 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -112,7 +112,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func sendTabAction(_ method: String, arguments: Any?) {
- guard ["focusedModel", "select", "close", "new", "rename", "commands", "notifications", "store", "sessions", "models", "addAgent", "newAgent", "newTerminal", "cloneAgent", "restartAgent", "shareAgent", "toggleViewer", "toggleComposer", "movePaneToTab", "runLocalModel", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines", "machineList"].contains(method) else {
+ guard ["select", "close", "new", "rename", "commands", "notifications", "store", "sessions", "models", "addAgent", "newAgent", "newTerminal", "cloneAgent", "restartAgent", "shareAgent", "toggleViewer", "toggleComposer", "movePaneToTab", "runLocalModel", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines", "machineList"].contains(method) else {
channel.invokeMethod(method, arguments: arguments)
return
}
@@ -287,13 +287,13 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
file.addItem(.separator())
add(file, "New Tab", "t", "new")
add(file, "Rename Tab", "r", "renameActive", [.command, .shift])
- add(file, "Close Tab", "w", "closeActive")
+ add(file, "Close Tab", "w", "closeActive", [.command, .shift])
file.addItem(.separator())
add(file, "Split Right", "r", "splitRight")
add(file, "Split Down", "d", "splitDown")
add(file, "Zoom Pane", "", "zoomPane")
add(file, "Move Pane to Tab", "m", "movePaneToTab", [.command, .shift])
- add(file, "Close Pane", "w", "closePane", [.command, .shift])
+ add(file, "Close Pane", "w", "closePane")
install(file, at: 1)
historyMenu.delegate = self
@@ -952,7 +952,7 @@ private final class SwarmContextButton: NSButton {
}
actionURL = context?["url"] as? String
toolTip = context?["detail"] as? String
- isEnabled = enabled && context?["canSelectModel"] as? Bool == true
+ isEnabled = enabled && context?["interactive"] as? Bool == true
setAccessibilityValue(text)
setAccessibilityHelp(toolTip)
needsDisplay = true
@@ -1031,7 +1031,7 @@ private final class SwarmTabStrip: NSView {
fileprivate let newButton = SwarmIconButton()
fileprivate let contextButton = SwarmContextButton()
fileprivate let pullRequestButton = SwarmContextButton()
- private var terminalFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
+ private var barFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular)
private var terminalForeground = NSColor(white: 0.85, alpha: 1)
private var terminalSelection = NSColor(white: 0.35, alpha: 1)
private var tabs: [SwarmTabButton] = []
@@ -1073,7 +1073,6 @@ private final class SwarmTabStrip: NSView {
contextButton.isBordered = false
contextButton.alignment = .right
contextButton.target = self
- contextButton.action = #selector(openFocusedModel)
contextButton.setAccessibilityLabel("Focused pane")
addSubview(contextButton)
pullRequestButton.isBordered = false
@@ -1101,20 +1100,20 @@ private final class SwarmTabStrip: NSView {
// Workspace teardown clears its controls without changing appearance.
if let palette = state["palette"] as? [String: Any] { updatePalette(palette) }
actionsEnabled = state["enabled"] as? Bool == true
- if let style = state["terminalStyle"] as? [String: Any] {
+ if let style = state["barStyle"] as? [String: Any] {
let size = CGFloat(min(36, max(8, (style["size"] as? NSNumber)?.doubleValue ?? 13)))
let families = [style["family"] as? String].compactMap { $0 } + (style["fallback"] as? [String] ?? [])
- terminalFont = families.lazy.compactMap { NSFont(name: $0, size: size) }.first
+ barFont = families.lazy.compactMap { NSFont(name: $0, size: size) }.first
?? NSFont.monospacedSystemFont(ofSize: size, weight: .regular)
terminalForeground = statusColor(style["foreground"], fallback: terminalForeground)
terminalSelection = statusColor(style["selection"], fallback: terminalSelection)
}
- newButton.font = terminalFont
+ newButton.font = barFont
newButton.contentTintColor = terminalForeground
- contextButton.font = terminalFont
+ contextButton.font = barFont
contextButton.foreground = terminalForeground
contextButton.update(state["focusedContext"] as? [String: Any], enabled: actionsEnabled)
- pullRequestButton.font = terminalFont
+ pullRequestButton.font = barFont
pullRequestButton.foreground = terminalForeground
pullRequestButton.update(state["pullRequest"] as? [String: Any], enabled: actionsEnabled)
pullRequestButton.isHidden = state["pullRequest"] == nil
@@ -1133,7 +1132,7 @@ private final class SwarmTabStrip: NSView {
tab.palette = palette
tab.name = row["name"] as? String ?? "New Tab"
tab.displayLabel = row["label"] as? String ?? tab.name
- tab.labelFont = terminalFont
+ tab.labelFont = barFont
tab.foreground = terminalForeground
tab.selection = terminalSelection
tab.selected = id == activeId
@@ -1174,7 +1173,7 @@ private final class SwarmTabStrip: NSView {
let activeWasVisible = active.map { scroll.documentVisibleRect.intersects($0.frame) } ?? false
let previousScrollSize = scroll.frame.size
let previousDocumentSize = document.frame.size
- let cell = ceil(("m" as NSString).size(withAttributes: [.font: terminalFont]).width)
+ let cell = ceil(("m" as NSString).size(withAttributes: [.font: barFont]).width)
let trailing = cell
// Compact windows keep a scrolling tab list; context never overlaps it.
let available = max(0, bounds.width - trailing - cell * 5)
@@ -1237,9 +1236,6 @@ private final class SwarmTabStrip: NSView {
hypot(event.locationInWindow.x - first.point.x,
event.locationInWindow.y - first.point.y) <= 4
}
- @objc private func openFocusedModel() {
- if actionsEnabled && contextButton.isEnabled { emit?("focusedModel", nil) }
- }
@objc private func openFocusedPullRequest() {
if actionsEnabled && pullRequestButton.isEnabled, let url = pullRequestButton.actionURL {
emit?("focusedPullRequest", ["url": url])
@@ -1289,7 +1285,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
private let selectButton = SwarmSelectButton()
/// Whether the middle button went down on THIS tab — see otherMouseUp.
private var middleDown = false
- /// Status text and numbered tabs share the selected terminal face.
+ /// Status text and numbered tabs share the compact workspace face.
var labelFont = NSFont.monospacedSystemFont(ofSize: 13, weight: .regular) {
didSet { if oldValue != labelFont { invalidateLabel() } }
}
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 7314c4461..76d78bac2 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -137,7 +137,7 @@ void main() {
if (entry == 'new tab') {
expect(app.swarms, hasLength(2));
expect(app.panes, isEmpty);
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
}
expect(app.focusedPane, same(pane));
expect(app.activeSwarmId, original);
diff --git a/desktop/test/agent_model_test.dart b/desktop/test/agent_model_test.dart
index ab9e530e8..d8b4f817b 100644
--- a/desktop/test/agent_model_test.dart
+++ b/desktop/test/agent_model_test.dart
@@ -3,6 +3,39 @@ import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
void main() {
+ test('observed model survives renames and updates the roster independently of local routing', () {
+ final raw = {
+ 'id': 'a',
+ 'engine': 'codex',
+ 'selectedModel': 'runtime-v1:a:codex:gpt-6-astra@high',
+ };
+ final agent = Agent.fromJson(raw);
+ expect(agent.modelName, 'GPT-6 Astra');
+ expect(agent.gridModel, isNull);
+ expect(agent.copyWith(name: 'Renamed').modelName, 'GPT-6 Astra');
+ expect(AppNotifier.agentsEqual([agent], [Agent.fromJson(raw)]), isTrue);
+ expect(
+ AppNotifier.agentsEqual(
+ [agent],
+ [
+ Agent.fromJson({
+ ...raw,
+ 'selectedModel': 'runtime-v1:a:codex:gpt-5.6-sol@high',
+ }),
+ ],
+ ),
+ isFalse,
+ );
+ expect(
+ AppNotifier.agentsEqual(
+ [agent],
+ [
+ Agent.fromJson({...raw, 'selectedModel': null}),
+ ],
+ ),
+ isFalse,
+ );
+ });
test(
'cached output stats survive renames and participate in roster equality',
() {
diff --git a/desktop/test/benchmarks/primary_workflows_benchmark.dart b/desktop/test/benchmarks/primary_workflows_benchmark.dart
index 25ecb5501..26bc31da7 100644
--- a/desktop/test/benchmarks/primary_workflows_benchmark.dart
+++ b/desktop/test/benchmarks/primary_workflows_benchmark.dart
@@ -180,7 +180,7 @@ void main() {
if (name == 'cmd_n' || name == 'cmd_o') {
await key(tester, LogicalKeyboardKey.escape);
} else if (name == 'cmd_t') {
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
expect(app.swarms.length, tabCount);
app.selectSwarm(before);
}
diff --git a/desktop/test/command_dock_interaction_test.dart b/desktop/test/command_dock_interaction_test.dart
index 54b193441..e00400f14 100644
--- a/desktop/test/command_dock_interaction_test.dart
+++ b/desktop/test/command_dock_interaction_test.dart
@@ -88,10 +88,12 @@ void main() {
of: row,
matching: find.byWidgetPredicate(
(widget) =>
- widget is SearchResultText && widget.text.contains('git:'),
+ widget is SearchResultText &&
+ widget.text.contains('(feature/login-redirect)'),
),
),
);
+ expect(detail.text, 'M2:openharness (feature/login-redirect)');
for (final label in ['M2', 'openharness', 'feature/login-redirect']) {
expect(detail.text, contains(label));
}
diff --git a/desktop/test/grid_model_picker_test.dart b/desktop/test/grid_model_picker_test.dart
index eefd26983..427008e7c 100644
--- a/desktop/test/grid_model_picker_test.dart
+++ b/desktop/test/grid_model_picker_test.dart
@@ -1,8 +1,12 @@
+import 'dart:async';
+
// The pane header's model picker: two sections, the way back always offered, and a marked row that
// says where the agent actually is.
import 'package:flutter/material.dart';
+import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:harness/widgets/box_chrome.dart';
+import 'package:harness/shared/theme/workspace_bar_style.dart';
import 'package:harness/widgets/transient_menus.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/auth/auth_session.dart';
@@ -72,6 +76,21 @@ class _Conn extends WsConn {
}
}
+class _DelayedConn extends _Conn {
+ _DelayedConn() : super([]);
+ final reply = Completer<Map<String, dynamic>>();
+ int reads = 0;
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) {
+ reads++;
+ return reply.future;
+ }
+}
+
void main() {
late AppNotifier notifier;
@@ -101,6 +120,51 @@ void main() {
setUp(() => build());
tearDown(() => notifier.dispose());
+ testWidgets(
+ 'offline selectors do not read models and late reads cannot open a disabled picker',
+ (tester) async {
+ notifier.dispose();
+ final connection = _DelayedConn();
+ notifier = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ connectionForTest: (_) => connection,
+ );
+ Future<void> mount(bool enabled) => tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: GridModelPicker(
+ notifier: notifier,
+ machineId: 'local',
+ paneHeader: true,
+ enabled: enabled,
+ ),
+ ),
+ ),
+ );
+ await mount(false);
+ await tester.pump();
+ expect(connection.reads, 0);
+ await mount(true);
+ await tester.tap(find.byType(GridModelPicker));
+ await tester.pump();
+ expect(connection.reads, 1);
+ await mount(false);
+ connection.reply.complete({'models': [], 'gridName': null});
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsNothing);
+ await mount(true);
+ await tester.tap(find.byType(GridModelPicker));
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsOneWidget);
+ await mount(false);
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsNothing);
+ expect(tester.takeException(), isNull);
+ },
+ );
+
Future<void> open(
WidgetTester tester, {
String? currentModel,
@@ -136,6 +200,107 @@ void main() {
await tester.pumpAndSettle();
}
+ testWidgets(
+ 'pane model label stays compact and disabled selectors cannot open',
+ (tester) async {
+ final controller = GridModelPickerController();
+ addTearDown(controller.dispose);
+ Future<void> mount(bool enabled) => tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SizedBox(
+ width: 180,
+ child: GridModelPicker(
+ notifier: notifier,
+ machineId: 'local',
+ currentModel: 'a-very-long-local-model-name',
+ controller: controller,
+ paneHeader: true,
+ enabled: enabled,
+ ),
+ ),
+ ),
+ ),
+ );
+ await mount(false);
+ controller.open();
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsNothing);
+ expect(find.byType(Icon), findsNothing);
+ final label = tester.widget<Text>(
+ find.text('a-very-long-local-model-name'),
+ );
+ expect(label.style!.fontSize, 13);
+ expect(label.style!.fontFamily, workspaceBarTextStyle().fontFamily);
+ expect(label.style!.fontWeight, FontWeight.normal);
+ expect(tester.takeException(), isNull);
+ await mount(true);
+ await tester.tap(find.byType(GridModelPicker));
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ expect(find.byType(ModelPickerSearch), findsNothing);
+ },
+ );
+
+ testWidgets(
+ 'observed subscription model updates live and advertises local switching on hover',
+ (tester) async {
+ Future<void> mount(String? model, {String? local}) => tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: Center(
+ child: GridModelPicker(
+ notifier: notifier,
+ machineId: 'local',
+ engineLabel: 'codex',
+ subscriptionModel: model,
+ currentModel: local,
+ paneHeader: true,
+ ),
+ ),
+ ),
+ ),
+ );
+ await mount('GPT-6 Astra');
+ expect(find.text('GPT-6 Astra'), findsOneWidget);
+ final hover = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await hover.addPointer(location: Offset.zero);
+ addTearDown(hover.removePointer);
+ await hover.moveTo(tester.getCenter(find.text('GPT-6 Astra')));
+ await tester.pump(const Duration(seconds: 1));
+ await tester.pump(const Duration(milliseconds: 200));
+ expect(
+ find.text(
+ 'Model: GPT-6 Astra\nSwitch model · Subscription or local models',
+ ),
+ findsOneWidget,
+ );
+ final ink = tester.widget<InkWell>(find.byType(InkWell));
+ expect(ink.mouseCursor, SystemMouseCursors.click);
+ expect(ink.hoverColor!.a, greaterThan(0));
+ await hover.moveTo(Offset.zero);
+ await tester.pumpAndSettle();
+ await mount('GPT-5.6 Sol');
+ expect(find.text('GPT-5.6 Sol'), findsOneWidget);
+ expect(find.text('GPT-6 Astra'), findsNothing);
+ await tester.tap(find.text('GPT-5.6 Sol'));
+ await tester.pumpAndSettle();
+ final subscription = tester
+ .widgetList<ModelPickerRow>(find.byType(ModelPickerRow))
+ .singleWhere((row) => row.title == 'OpenAI');
+ expect(subscription.selected, isTrue);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pumpAndSettle();
+ await mount('GPT-5.6 Sol', local: 'Local-Exact-Name');
+ expect(find.text('Local-Exact-Name'), findsOneWidget);
+ expect(find.text('GPT-5.6 Sol'), findsNothing);
+ await mount(null);
+ expect(find.text('OpenAI'), findsOneWidget);
+ },
+ );
+
testWidgets('shows both sections, and the way back is in the first one', (
tester,
) async {
@@ -818,7 +983,7 @@ void main() {
.first,
)
.message,
- 'Model: Qwen-Test · Click to switch',
+ 'Model: Qwen-Test\nSwitch model · Subscription or local models',
);
});
@@ -856,7 +1021,7 @@ void main() {
.first,
)
.message,
- 'Model: Qwen-Test · Click to switch\nWeb search unavailable',
+ 'Model: Qwen-Test\nSwitch model · Subscription or local models\nWeb search unavailable',
);
},
);
@@ -885,7 +1050,7 @@ void main() {
.first,
)
.message,
- 'Model: Qwen-Test · Click to switch\nWeb search not supported by this engine',
+ 'Model: Qwen-Test\nSwitch model · Subscription or local models\nWeb search not supported by this engine',
);
});
diff --git a/desktop/test/harness_placement_test.dart b/desktop/test/harness_placement_test.dart
index 303838d78..004f291a0 100644
--- a/desktop/test/harness_placement_test.dart
+++ b/desktop/test/harness_placement_test.dart
@@ -902,7 +902,8 @@ void main() {
var inside = false;
element.visitAncestorElements((ancestor) {
final key = ancestor.widget.key;
- inside = key is ValueKey<String> &&
+ inside =
+ key is ValueKey<String> &&
app.swarms.any((swarm) => swarm.id == key.value);
return !inside;
});
@@ -917,7 +918,7 @@ void main() {
await tester.pump();
expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);
if (placement == HarnessPlacement.newTab) {
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
}
expect(app.swarms, [original]);
await chord(tester, key);
diff --git a/desktop/test/harness_store_entry_test.dart b/desktop/test/harness_store_entry_test.dart
index 654e6f56e..3aa760f3d 100644
--- a/desktop/test/harness_store_entry_test.dart
+++ b/desktop/test/harness_store_entry_test.dart
@@ -55,7 +55,7 @@ void main() {
await openStore();
expect(app.activeSwarm, same(store));
expect(app.swarms, hasLength(2));
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
expect(app.activeSwarm, same(work));
expect(tester.state(view), same(terminalState));
await key(tester, LogicalKeyboardKey.arrowLeft);
diff --git a/desktop/test/keyboard_practice_test.dart b/desktop/test/keyboard_practice_test.dart
index 1d281449f..0e7e63838 100644
--- a/desktop/test/keyboard_practice_test.dart
+++ b/desktop/test/keyboard_practice_test.dart
@@ -117,7 +117,7 @@ void main() {
await command(tester, 'Keyboard practice');
expect(filter, findsOneWidget);
await openLesson(tester, 'New Tab');
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
expect(find.textContaining('That is Close Tab'), findsOneWidget);
expect(app.swarms, [original]);
expect(original.panes, panes);
diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dart
index af58046b8..5d8131382 100644
--- a/desktop/test/keymap_host_test.dart
+++ b/desktop/test/keymap_host_test.dart
@@ -47,6 +47,25 @@ Future<void> key(
}
void main() {
+ test('saved close shortcuts override the new pane and tab defaults', () {
+ final map = MemoryKeymap();
+ addTearDown(map.dispose);
+ map.apply(
+ '{"bindings":[{"keys":"cmd+w","command":"swarm.close"},{"keys":"cmd+shift+w","command":"pane.close"}]}',
+ );
+ expect(
+ map.current.match(KeymapContext.terminal, [
+ KeyStroke.parse('cmd+w'),
+ ]).command,
+ 'swarm.close',
+ );
+ expect(
+ map.current.match(KeymapContext.terminal, [
+ KeyStroke.parse('cmd+shift+w'),
+ ]).command,
+ 'pane.close',
+ );
+ });
test('the command catalog retains the current direct workspace keys', () {
String? command(
String keys, [
@@ -80,8 +99,8 @@ void main() {
('cmd+i', 'models.list'),
('cmd+shift+l', 'pane.layout'),
('cmd+b', 'task.route'),
- ('cmd+shift+w', 'pane.close'),
- ('cmd+w', 'swarm.close'),
+ ('cmd+w', 'pane.close'),
+ ('cmd+shift+w', 'swarm.close'),
('ctrl+tab', 'swarm.next'),
]) {
expect(command(keys), expected, reason: keys);
diff --git a/desktop/test/pull_request_badge_test.dart b/desktop/test/pull_request_badge_test.dart
index 0ce279b3b..5217cc7b1 100644
--- a/desktop/test/pull_request_badge_test.dart
+++ b/desktop/test/pull_request_badge_test.dart
@@ -1,5 +1,3 @@
-import 'dart:ui' show PointerDeviceKind;
-
import 'package:harness/widgets/pane_header_actions.dart';
import 'dart:async';
@@ -18,7 +16,7 @@ void main() {
body: PullRequestBadge(identity: id, read: read, open: open),
),
);
- testWidgets('PR and branch stay visible beside the quiet pane controls', (
+ testWidgets('standalone PR and branch remain beside the model selector', (
tester,
) async {
await tester.pumpWidget(
@@ -27,43 +25,30 @@ void main() {
body: SizedBox(
width: 500,
height: 46,
- child: PaneHeaderHover(
- child: PaneHeaderActions(
- zoomed: false,
- onZoom: () {},
- details: const Text('branch-name'),
- trailing: PullRequestBadge(
- identity: 'branch',
- read: () async => {
- 'status': 'found',
- 'number': 12,
- 'state': 'Open',
- 'url': 'https://github.com/acme/repo/pull/12',
- },
- ),
+ child: PaneHeaderActions(
+ details: const Text('branch-name'),
+ modelPicker: const Text('OpenAI'),
+ trailing: PullRequestBadge(
+ identity: 'branch',
+ read: () async => {
+ 'status': 'found',
+ 'number': 12,
+ 'state': 'Open',
+ 'url': 'https://github.com/acme/repo/pull/12',
+ },
),
),
),
),
),
);
- await tester.pump();
- expect(find.byTooltip('Zoom Pane').hitTestable(), findsNothing);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: Offset.zero);
- await mouse.moveTo(tester.getCenter(find.text('PR #12 · Open')));
await tester.pumpAndSettle();
expect(find.text('branch-name').hitTestable(), findsOneWidget);
- expect(find.text('PR #12 · Open').hitTestable(), findsOneWidget);
- expect(find.byTooltip('Zoom Pane').hitTestable(), findsOneWidget);
- await mouse.moveTo(const Offset(600, 100));
- await tester.pump();
- expect(find.byTooltip('Zoom Pane').hitTestable(), findsNothing);
- expect(find.text('branch-name').hitTestable(), findsOneWidget);
- expect(find.text('PR #12 · Open').hitTestable(), findsOneWidget);
- await mouse.removePointer();
- await tester.pumpWidget(const SizedBox());
+ expect(find.text('#12 Open').hitTestable(), findsOneWidget);
+ expect(find.text('OpenAI').hitTestable(), findsOneWidget);
+ expect(find.byTooltip('Zoom Pane'), findsNothing);
});
+
for (final state in ['Draft', 'Open', 'Merged', 'Closed']) {
testWidgets('labels $state and opens the PR URL', (tester) async {
Uri? opened;
@@ -83,7 +68,7 @@ void main() {
),
);
await tester.pump();
- await tester.tap(find.text('PR #12 · $state'));
+ await tester.tap(find.text('#12 $state'));
expect(opened.toString(), 'https://github.com/acme/repo/pull/12');
await tester.pumpWidget(const SizedBox());
});
@@ -119,7 +104,7 @@ void main() {
expect(find.byType(TextButton), findsNothing);
await tester.pump(const Duration(seconds: 60));
await tester.pump();
- expect(find.text('PR #12 · Open'), findsOneWidget);
+ expect(find.text('#12 Open'), findsOneWidget);
await tester.pumpWidget(const SizedBox());
});
testWidgets(
diff --git a/desktop/test/runtime_model_name_test.dart b/desktop/test/runtime_model_name_test.dart
new file mode 100644
index 000000000..ddea45f8d
--- /dev/null
+++ b/desktop/test/runtime_model_name_test.dart
@@ -0,0 +1,57 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/runtime_model_name.dart';
+
+void main() {
+ test('observed model names preserve identity and never infer a version', () {
+ for (final (engine, model, label) in [
+ ('codex', 'gpt-6-astra', 'GPT-6 Astra'),
+ ('codex', 'gpt-5.6-sol', 'GPT-5.6 Sol'),
+ ('codex', 'gpt-5.6', 'GPT-5.6'),
+ ('claude', 'fable', 'Fable'),
+ ('claude', 'opus', 'Opus'),
+ ('claude', 'claude-opus-5', 'Opus 5'),
+ ('claude', 'claude-sonnet-4-6[1m]', 'Sonnet 4.6[1m]'),
+ ('claude', 'claude-haiku-4-5-20251001', 'claude-haiku-4-5-20251001'),
+ ('opencode', 'provider/Model-Next', 'provider/Model-Next'),
+ ]) {
+ expect(
+ runtimeModelName(
+ 'runtime-v1:a%3A1:$engine:${Uri.encodeComponent(model)}@high',
+ agentId: 'a:1',
+ engine: engine,
+ ),
+ label,
+ );
+ }
+ });
+
+ test('missing, stale and malformed runtime metadata has no model label', () {
+ for (final value in <Object?>[
+ null,
+ 42,
+ '',
+ 'gpt-6-astra',
+ 'x' * 1025,
+ 'runtime-v2:a:codex:gpt-6-astra@high',
+ 'runtime-v1:a:claude:opus@high',
+ 'runtime-v1:other:codex:gpt-6-astra@high',
+ 'runtime-v1:%ZZ:codex:gpt-6-astra@high',
+ 'runtime-v1:a:codex:%ZZ@high',
+ 'runtime-v1:a:codex:%FF@high',
+ 'runtime-v1:a:codex:%C0%80@high',
+ 'runtime-v1:a:codex:%20@high',
+ 'runtime-v1:a:codex:model%0Aname@high',
+ 'runtime-v1:a:codex:${'x' * 257}@high',
+ ]) {
+ expect(
+ runtimeModelName(value, agentId: 'a', engine: 'codex'),
+ isNull,
+ reason: '$value',
+ );
+ }
+ expect(
+ runtimeModelName('runtime-v1:a:codex:gpt-6-astra@high', agentId: 'a'),
+ isNull,
+ );
+ });
+}
diff --git a/desktop/test/status_line_test.dart b/desktop/test/status_line_test.dart
index ae820eaea..82ad09633 100644
--- a/desktop/test/status_line_test.dart
+++ b/desktop/test/status_line_test.dart
@@ -45,7 +45,7 @@ void main() {
state: state,
style: style,
);
- expect(pr.text, 'PR #298 · $state');
+ expect(pr.text, '#298 $state');
expect(
statusLinePaintSegments(
pr,
diff --git a/desktop/test/swarm_arrange_keyboard_test.dart b/desktop/test/swarm_arrange_keyboard_test.dart
index eb54594fc..57fc305c4 100644
--- a/desktop/test/swarm_arrange_keyboard_test.dart
+++ b/desktop/test/swarm_arrange_keyboard_test.dart
@@ -65,7 +65,7 @@ void main() {
].every((frames) => frames.isEmpty),
isTrue,
);
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
await visible();
app.reorderSwarm(app.activeSwarmId, 0);
await tester.pump();
diff --git a/desktop/test/swarm_immediate_input_test.dart b/desktop/test/swarm_immediate_input_test.dart
index e28de558c..f17344a9b 100644
--- a/desktop/test/swarm_immediate_input_test.dart
+++ b/desktop/test/swarm_immediate_input_test.dart
@@ -97,7 +97,7 @@ void main() {
} else if (nativeEntry) {
await native(tester, 'keymapCommand', {'command': commandId});
} else {
- await command(tester, key, shift: action == 'close pane');
+ await command(tester, key, shift: action == 'close tab');
}
// Both events arrive before the canvas updates its widgets.
await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dart
index def833c47..f338c5687 100644
--- a/desktop/test/swarm_interactions_test.dart
+++ b/desktop/test/swarm_interactions_test.dart
@@ -5,7 +5,6 @@ import 'dart:async';
import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/gestures.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/auth/auth_session.dart';
@@ -21,7 +20,6 @@ import 'package:harness/state/swarm_catalog.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/widgets/codex_profile_field.dart';
import 'package:harness/widgets/new_agent_dialog.dart';
-import 'package:harness/widgets/pane_header_actions.dart';
import 'package:harness/widgets/harness_session_manager.dart';
import 'package:harness/widgets/swarm_dialogs.dart';
import 'package:harness/widgets/terminal_find_bar.dart';
@@ -151,7 +149,7 @@ void main() {
await tester.pump();
expect(input, findsNothing);
expect(app.activeSwarmId, created);
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
expect(app.swarms, hasLength(2));
}
await newFromChrome();
@@ -221,11 +219,11 @@ void main() {
app.newSwarm();
await app.addAgentToSwarm('m', 'a0');
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyW, shift: true);
+ await chord(tester, LogicalKeyboardKey.keyW);
expect(app.swarms.length, 2);
expect(app.panes, isEmpty);
expect(original.panes.single.session, same(session));
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
expect(app.swarms.single, same(original));
expect(app.panes.single.session, same(session));
await tester.pumpWidget(const SizedBox());
@@ -233,82 +231,47 @@ void main() {
},
);
- testWidgets('pane controls zoom, confirm stopping and close only this view', (
- tester,
- ) async {
- final app = createApp();
- app.machineStates['m']!.nodeOnline = true;
- final input = <TerminalBinaryFrame>[];
- final session = terminal('a0', input);
- app.adoptSessionForTest(session);
- final original = app.activeSwarm;
- app.newSwarm();
- await app.addAgentToSwarm('m', 'a0');
- final pane = app.panes.single;
- app.adoptSessionForTest(terminal('a1', []));
- await mount(tester, app);
-
- final controls = find.byType(PaneHeaderActions).first;
- expect(
- tester
- .widgetList<Text>(
- find.descendant(of: controls, matching: find.byType(Text)),
- )
- .map((text) => text.data),
- ['-', '[]', 'x'],
- );
- expect(find.byTooltip('Stop Harness').first.hitTestable(), findsNothing);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: const Offset(1, 1));
- Future<void> hover() async {
- await mouse.moveTo(tester.getCenter(controls));
- await tester.pump(const Duration(milliseconds: 120));
- }
-
- await hover();
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
- await tester.tap(find.byTooltip('Zoom Pane').first);
- await tester.pump();
- expect(app.zoomedPaneId, pane.id);
- await hover();
- await tester.tap(find.byTooltip('Restore Pane'));
- await tester.pump();
- expect(app.zoomedPaneId, isNull);
- await hover();
-
- await tester.tap(
- find.descendant(of: controls, matching: find.byTooltip('Stop Harness')),
- );
- await tester.pumpAndSettle();
- expect(find.text('Stop Harness'), findsOneWidget);
- expect(find.text('Stop'), findsOneWidget);
- expect(app.panes, contains(pane));
- expect(original.panes.single.session, same(session));
- await tester.tap(find.text('Cancel'));
- await tester.pumpAndSettle();
- expect(app.panes, contains(pane));
- await hover();
+ testWidgets(
+ 'keyboard pane actions replace header controls and keep other views alive',
+ (tester) async {
+ final app = createApp();
+ app.machineStates['m']!.nodeOnline = true;
+ final input = <TerminalBinaryFrame>[];
+ final session = terminal('a0', input);
+ app.adoptSessionForTest(session);
+ final original = app.activeSwarm;
+ app.newSwarm();
+ await app.addAgentToSwarm('m', 'a0');
+ final pane = app.panes.single;
+ app.adoptSessionForTest(terminal('a1', []));
+ await mount(tester, app);
- await tester.tap(
- find.descendant(of: controls, matching: find.byTooltip('Close Pane')),
- );
- await tester.pump();
- await mouse.removePointer();
- expect(app.panes.single.agentId, 'a1');
- expect(original.panes.single.session, same(session));
- app.selectSwarm(original.id);
- await tester.pump();
- tester.testTextInput.enterText('x');
- await tester.pump(const Duration(milliseconds: 20));
- expect(
- String.fromCharCodes(
- input.where((f) => f.kind == TerminalBinaryKind.input).single.bytes,
- ),
- 'x',
- );
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
+ app.focusPane(pane.id);
+ await tester.pump();
+ for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {
+ expect(find.byTooltip(label), findsNothing);
+ }
+ await chord(tester, LogicalKeyboardKey.enter);
+ expect(app.zoomedPaneId, pane.id);
+ await chord(tester, LogicalKeyboardKey.enter);
+ expect(app.zoomedPaneId, isNull);
+ await chord(tester, LogicalKeyboardKey.keyW);
+ expect(app.panes.single.agentId, 'a1');
+ expect(original.panes.single.session, same(session));
+ app.selectSwarm(original.id);
+ await tester.pump();
+ tester.testTextInput.enterText('x');
+ await tester.pump(const Duration(milliseconds: 20));
+ expect(
+ String.fromCharCodes(
+ input.where((f) => f.kind == TerminalBinaryKind.input).single.bytes,
+ ),
+ 'x',
+ );
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
testWidgets(
'native tab replies wait for destination focus and allow rename input',
diff --git a/desktop/test/swarm_reopen_test.dart b/desktop/test/swarm_reopen_test.dart
index 21eaba7c4..04bbdab9a 100644
--- a/desktop/test/swarm_reopen_test.dart
+++ b/desktop/test/swarm_reopen_test.dart
@@ -190,7 +190,7 @@ void main() {
await app.addAgentToSwarm('m', 'a0');
app.renameSwarm(app.activeSwarmId, 'My work');
await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
expect(app.panes, isEmpty);
await chord(tester, LogicalKeyboardKey.keyT, shift: true);
expect(app.panes, isEmpty);
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 6ad4b4a69..f9a205471 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -84,7 +84,7 @@ TerminalSession terminal(String id, List<TerminalBinaryFrame> input) =>
void main() {
testWidgets(
- 'tabs omit close buttons and Command-W still closes the active tab',
+ 'tabs omit close buttons and Command-Shift-W closes the active tab',
(tester) async {
final app = createApp();
final first = app.activeSwarm;
@@ -102,7 +102,7 @@ void main() {
);
Focus.of(tester.element(label)).requestFocus();
await tester.pumpAndSettle();
- await chord(tester, LogicalKeyboardKey.keyW);
+ await chord(tester, LogicalKeyboardKey.keyW, shift: true);
await tester.pumpAndSettle();
expect(app.swarms.map((swarm) => swarm.id), [first.id]);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/terminal_catalog_test.dart b/desktop/test/terminal_catalog_test.dart
index 058d4ac0f..59dd47e4e 100644
--- a/desktop/test/terminal_catalog_test.dart
+++ b/desktop/test/terminal_catalog_test.dart
@@ -107,7 +107,7 @@ void main() {
expect(sharedTab.name, 'openharness');
expect(sharedTab.panes.single.session, same(claude));
expect(source.panes, [firstPane, secondPane]);
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
expect(app.activeSwarm, same(source));
expect(secondPane.session, same(claude));
await command('reopen tab');
@@ -125,7 +125,7 @@ void main() {
await key(tester, LogicalKeyboardKey.enter, cmd: true);
expect(app.zoomedPaneId, isNull);
await key(tester, LogicalKeyboardKey.keyL, cmd: true);
- await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true);
expect(source.panes, [firstPane]);
expect(
app.swarms
diff --git a/desktop/test/terminal_panel_header_test.dart b/desktop/test/terminal_panel_header_test.dart
index f62e7b454..d2ee8ba57 100644
--- a/desktop/test/terminal_panel_header_test.dart
+++ b/desktop/test/terminal_panel_header_test.dart
@@ -113,10 +113,7 @@ void main() {
final session = sessionNamed('Desktop');
addTearDown(session.dispose);
await pump(tester, session, width: width, withPr: true);
- expect(
- find.text(width < 588 ? '#260 · Draft' : 'PR #260 · Draft'),
- findsOneWidget,
- );
+ expect(find.text('#260 Draft'), findsOneWidget);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox());
});
diff --git a/desktop/test/terminal_panel_presentation_test.dart b/desktop/test/terminal_panel_presentation_test.dart
index 35e6bbf47..7820eb5eb 100644
--- a/desktop/test/terminal_panel_presentation_test.dart
+++ b/desktop/test/terminal_panel_presentation_test.dart
@@ -1,13 +1,14 @@
import 'dart:ui' show PointerDeviceKind;
import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
+import 'package:harness/shared/theme/workspace_bar_style.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'package:harness/terminal/terminal_font_store.dart';
import 'package:harness/widgets/terminal_panel.dart';
import 'package:harness/widgets/pane_header_actions.dart';
+import 'package:harness/widgets/grid_model_picker.dart';
import 'package:xterm/xterm.dart';
import 'support/real_fonts.dart';
@@ -48,18 +49,12 @@ void main() {
await tester.pump();
revision.value = 1;
await tester.pump();
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: const Offset(1, 100));
- await mouse.moveTo(tester.getCenter(find.byType(PaneHeaderActions)));
- await tester.pump();
- addTearDown(mouse.removePointer);
for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {
- await tester.tap(find.byTooltip(label));
- await tester.pumpAndSettle();
+ expect(find.byTooltip(label), findsNothing);
}
- expect(closed, [1]);
- expect(deleted, [1]);
- expect(zoomed, [1]);
+ expect(closed, isEmpty);
+ expect(deleted, isEmpty);
+ expect(zoomed, isEmpty);
expect(find.byTooltip('Pane actions'), findsNothing);
expect(find.byTooltip('Restart Harness'), findsNothing);
expect(find.byTooltip('Share harness'), findsNothing);
@@ -171,7 +166,7 @@ void main() {
);
revision.value = 2;
await tester.pump();
- expect(find.byTooltip('Restore Pane'), findsOneWidget);
+ expect(find.byTooltip('Restore Pane'), findsNothing);
session.status = TerminalSessionStatus.takenOver;
revision.value = 3;
await tester.pump();
@@ -193,7 +188,7 @@ void main() {
await tester.pump();
expect(
tester.widget<Text>(find.text('Renamed terminal')).style!.fontFamily,
- 'Monaco',
+ workspaceBarTextStyle().fontFamily,
);
await tester.pumpWidget(const SizedBox());
revision.dispose();
@@ -203,7 +198,7 @@ void main() {
);
for (final local in [true, false]) {
testWidgets(
- '${local ? 'local' : 'remote'} compact controls reveal on header hover without moving the title or terminal',
+ '${local ? 'local' : 'remote'} compact model selectors stay visible without moving the title or terminal',
(tester) async {
final app = createApp();
app.stateOf('m')!.localOnly = local;
@@ -262,8 +257,9 @@ void main() {
),
)
.length,
- 3,
+ 0,
);
+ expect(find.text('OpenAI').hitTestable(), findsOneWidget);
for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {
expect(find.byTooltip(label).hitTestable(), findsNothing);
}
@@ -273,14 +269,10 @@ void main() {
await mouse.moveTo(tester.getCenter(title));
await tester.pump();
for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {
- expect(find.byTooltip(label).hitTestable(), findsOneWidget);
+ expect(find.byTooltip(label), findsNothing);
}
expect(tester.getRect(title), titleBounds);
expect(tester.getRect(controls), controlsBounds);
- await mouse.moveTo(tester.getCenter(find.byTooltip('Zoom Pane')));
- await mouse.down(tester.getCenter(find.byTooltip('Zoom Pane')));
- await mouse.up();
- await tester.pump();
await mouse.moveTo(tester.getCenter(find.byType(TerminalView)));
await tester.pump();
for (final label in ['Close Pane', 'Zoom Pane', 'Stop Harness']) {
@@ -294,8 +286,8 @@ void main() {
same(terminalWidget),
);
final titleStyle = tester.widget<Text>(title).style!;
- expect(titleStyle.fontFamily, terminalFontStore.value.fontFamily);
- expect(titleStyle.fontSize, terminalFontStore.size);
+ expect(titleStyle.fontFamily, workspaceBarTextStyle().fontFamily);
+ expect(titleStyle.fontSize, 13);
expect(titleStyle.fontWeight, FontWeight.normal);
await mouse.removePointer();
await tester.pumpWidget(const SizedBox());
@@ -305,7 +297,7 @@ void main() {
);
}
testWidgets(
- 'narrow headers preserve identity and keyboard actions at large text',
+ 'narrow headers preserve identity and model selection at large text',
(tester) async {
final app = createApp();
final session = terminal('a0', []);
@@ -324,7 +316,6 @@ void main() {
),
),
];
- var zooms = 0;
final revision = ValueNotifier(0);
tester.view.devicePixelRatio = 1;
tester.platformDispatcher.textScaleFactorTestValue = 1.7;
@@ -341,7 +332,6 @@ void main() {
session: session,
focused: false,
compactHeader: true,
- onToggleZoom: () => zooms++,
onClose: () {},
onDelete: () {},
onToggleComposer: () {},
@@ -354,17 +344,11 @@ void main() {
expect(tester.getSize(title).width, greaterThan(64));
expect(tester.takeException(), isNull);
final titleBefore = tester.getRect(title);
- final zoom = find.byTooltip('Zoom Pane');
- Focus.of(tester.element(find.text('[]'))).requestFocus();
- await tester.pumpAndSettle();
- expect(zoom.hitTestable(), findsOneWidget);
- expect(find.byTooltip('Fork Harness'), findsNothing);
- expect(find.byTooltip('Stop Harness').hitTestable(), findsOneWidget);
+ final picker = find.byType(GridModelPicker);
+ expect(picker.hitTestable(), findsOneWidget);
+ expect(find.byTooltip('Stop Harness'), findsNothing);
+ expect(find.byTooltip('Zoom Pane'), findsNothing);
expect(tester.getRect(title), titleBefore);
- await tester.sendKeyEvent(LogicalKeyboardKey.space);
- await tester.pumpAndSettle();
- expect(zooms, [240.0, 280.0, 420.0].indexOf(width) + 1);
- expect(tester.takeException(), isNull);
for (final status in [
TerminalSessionStatus.opening,
TerminalSessionStatus.takenOver,
diff --git a/desktop/test/terminal_ui_typography_test.dart b/desktop/test/terminal_ui_typography_test.dart
index 56dc4ce41..326792588 100644
--- a/desktop/test/terminal_ui_typography_test.dart
+++ b/desktop/test/terminal_ui_typography_test.dart
@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/screens/swarm_screen.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/shared/theme/workspace_bar_style.dart';
import 'package:harness/shortcuts/app_keymap.dart';
import 'package:harness/state/app_state.dart';
import 'package:harness/state/new_harness.dart';
@@ -63,12 +64,16 @@ void main() {
grid.AppType.captionSize,
};
- /// General UI keeps its fixed scale; workspace chrome follows the terminal.
+ /// General UI and workspace bars keep their fixed scales during terminal zoom.
/// Return general UI sizes for comparisons across a terminal zoom.
Map<String, double> checkText(WidgetTester tester, {int atLeast = 4}) {
final sizes = <String, double>{};
var checked = 0;
- void check(InlineSpan span, TextStyle inherited, {bool terminal = false}) {
+ void check(
+ InlineSpan span,
+ TextStyle inherited, {
+ bool workspaceBar = false,
+ }) {
final style = inherited.merge(span.style);
if (span is TextSpan) {
final text = span.text?.trim();
@@ -79,11 +84,11 @@ void main() {
'LucideIcons',
].any((icon) => style.fontFamily?.contains(icon) == true)) {
checked++;
- if (terminal) {
- expect(style.fontSize, terminalFontStore.size, reason: text);
+ if (workspaceBar) {
+ expect(style.fontSize, 13, reason: text);
expect(
style.fontFamily,
- terminalFontStore.value.fontFamily,
+ workspaceBarTextStyle().fontFamily,
reason: text,
);
} else {
@@ -97,7 +102,7 @@ void main() {
}
}
for (final child in span.children ?? <InlineSpan>[]) {
- check(child, style, terminal: terminal);
+ check(child, style, workspaceBar: workspaceBar);
}
}
}
@@ -124,7 +129,7 @@ void main() {
check(
(element.widget as RichText).text,
const TextStyle(),
- terminal: find
+ workspaceBar: find
.descendant(
of: find.byWidgetPredicate(
(widget) =>
@@ -378,7 +383,7 @@ void main() {
});
testWidgets(
- 'native tabs receive the same live font and size as the terminal',
+ 'native tabs keep 13 pt platform monospace during terminal font changes',
(tester) async {
final updates = <Map<dynamic, dynamic>>[];
const channel = MethodChannel('harness/swarm_tabs');
@@ -402,15 +407,18 @@ void main() {
await mount(tester, app, map, native: true);
selectFont(22, TerminalFontChoice.monaco);
await tester.pumpAndSettle();
- expect(updates.last['terminalStyle'], containsPair('family', 'Monaco'));
- expect(updates.last['terminalStyle'], containsPair('size', 22.0));
+ expect(
+ updates.last['barStyle'],
+ containsPair('family', workspaceBarTextStyle().fontFamily),
+ );
+ expect(updates.last['barStyle'], containsPair('size', 13.0));
selectFont(14, TerminalFontChoice.sfMono);
await tester.pumpAndSettle();
expect(
- updates.last['terminalStyle'],
- containsPair('family', terminalFontStore.value.fontFamily),
+ updates.last['barStyle'],
+ containsPair('family', workspaceBarTextStyle().fontFamily),
);
- expect(updates.last['terminalStyle'], containsPair('size', 14.0));
+ expect(updates.last['barStyle'], containsPair('size', 13.0));
expect(updates.last.containsKey('fontFallbacks'), isFalse);
await tester.pumpWidget(const SizedBox());
},
diff --git a/desktop/test/web_pane_test.dart b/desktop/test/web_pane_test.dart
index 5e9bedd68..55b87c6fc 100644
--- a/desktop/test/web_pane_test.dart
+++ b/desktop/test/web_pane_test.dart
@@ -327,9 +327,9 @@ void main() {
expect(find.text('http://127.0.0.1:4179/'), findsOneWidget);
// Its own close control, and no way to end an agent from it.
expect(find.byTooltip('Close viewer'), findsOneWidget);
- // The ASCII stop control belongs only to the harness. Viewer visibility
+ // Stop remains a command, not a pane-header control. Viewer visibility
// is also available through View and command search.
- expect(find.byTooltip('Stop Harness'), findsOneWidget);
+ expect(find.byTooltip('Stop Harness'), findsNothing);
expect(
find.descendant(
of: find.byType(WebPanePanel),
@@ -371,7 +371,7 @@ void main() {
expect(find.text('1 warning'), findsNothing, reason: 'the phase wins');
expect(find.textContaining('· Viewer'), findsNothing);
await tester.tap(find.byTooltip('Close viewer'));
- await tester.pump();
+ await tester.pumpAndSettle();
expect(_viewers(app), isEmpty);
expect(tester.takeException(), isNull);
});
diff --git a/desktop/test/workspace_pull_request_test.dart b/desktop/test/workspace_pull_request_test.dart
index d2c28d5c8..090dfd228 100644
--- a/desktop/test/workspace_pull_request_test.dart
+++ b/desktop/test/workspace_pull_request_test.dart
@@ -20,7 +20,7 @@ void main() {
for (final state in ['Draft', 'Open', 'Merged', 'Closed']) {
expect(
PullRequestStatus.fromResult(found(298, state))!.label,
- 'PR #298 · $state',
+ '#298 $state',
);
}
for (final invalid in [
diff --git a/desktop/test/workspace_start_guide_test.dart b/desktop/test/workspace_start_guide_test.dart
index b3a9084e7..aa46dc84a 100644
--- a/desktop/test/workspace_start_guide_test.dart
+++ b/desktop/test/workspace_start_guide_test.dart
@@ -464,7 +464,7 @@ void main() {
expectGuideFixed(find.byKey(const ValueKey('new-harness-form')));
await key(tester, LogicalKeyboardKey.escape);
await tester.pump();
- await key(tester, LogicalKeyboardKey.keyW, cmd: true);
+ await key(tester, LogicalKeyboardKey.keyW, cmd: true, shift: true);
await tester.pump();
expect(app.swarms, [first, second]);
app.selectSwarm(first.id);
diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dart
index 8604876df..2c9ec27aa 100644
--- a/desktop/test/workspace_status_test.dart
+++ b/desktop/test/workspace_status_test.dart
@@ -47,7 +47,80 @@ class _PRConnection extends WsConn {
}
}
+class _PaneModelConnection extends _PRConnection {
+ final retargets = <Map<String, dynamic>>[];
+ @override
+ Future<Map<String, dynamic>> request(
+ String type, {
+ Map<String, dynamic> payload = const {},
+ Duration timeout = const Duration(seconds: 20),
+ }) async {
+ if (type == 'agent_retarget') {
+ retargets.add(payload);
+ return {};
+ }
+ if (type == 'grid_models_list') {
+ return {
+ 'gridName': 'fixture',
+ 'models': [
+ {'id': 'Local-Test-Model', 'node': 'local', 'grid': 'fixture'},
+ ],
+ };
+ }
+ return super.request(type, payload: payload, timeout: timeout);
+ }
+}
+
void main() {
+ testWidgets(
+ 'each pane model selector targets its own harness and stays off the tab bar',
+ (tester) async {
+ final connection = _PaneModelConnection();
+ final app = createApp(connectionForTest: (_) => connection);
+ addTearDown(app.dispose);
+ app.machineStates['m']!.nodeOnline = true;
+ app.machineStates['m']!.agents = [
+ Agent.fromJson({
+ 'id': 'a0',
+ 'engine': 'claude',
+ 'selectedModel': 'runtime-v1:a0:claude:fable@high',
+ 'terminal': {'available': true},
+ }),
+ Agent.fromJson({
+ 'id': 'a1',
+ 'engine': 'codex',
+ 'selectedModel': 'runtime-v1:a1:codex:gpt-6-astra@high',
+ 'terminal': {'available': true},
+ }),
+ ];
+ final first = app.adoptSessionForTest(terminal('a0', []));
+ final second = app.adoptSessionForTest(terminal('a1', []));
+ await mount(tester, app);
+ expect(app.focusedPane, same(second));
+ final selectors = find.byType(GridModelPicker);
+ expect(selectors, findsNWidgets(2));
+ expect(find.text('Fable'), findsOneWidget);
+ expect(find.text('GPT-6 Astra'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('workspace-status-bar')),
+ matching: selectors,
+ ),
+ findsNothing,
+ );
+ final own = find.byKey(const ValueKey(('pane-model', 'm', 'a0')));
+ await tester.tap(own);
+ await tester.pumpAndSettle();
+ await tester.tap(find.text('Local-Test-Model'));
+ await tester.pumpAndSettle();
+ expect(connection.retargets.single['agentId'], 'a0');
+ expect(connection.retargets.single['gridModel'], 'Local-Test-Model');
+ expect(app.panes, containsAll([first, second]));
+ expect(second.session!.agentId, 'a1');
+ await tester.pumpWidget(const SizedBox());
+ },
+ );
+
for (final native in [false, true]) {
testWidgets(
'focused PR uses every selected theme without duplicate pane lookups (native=$native)',
@@ -96,7 +169,7 @@ void main() {
await tester.pump();
if (native) {
final pr = updates.last['pullRequest'] as Map;
- expect(pr['text'], 'PR #298 · Merged');
+ expect(pr['text'], '#298 Merged');
expect(pr['url'], 'https://github.com/acme/repo/pull/298');
expect(pr['segmented'], style.segmented);
expect(
@@ -111,7 +184,7 @@ void main() {
find.descendant(of: badge, matching: find.byType(StatusLine)),
);
expect(rendered.parts.style, style);
- expect(rendered.parts.text, 'PR #298 · Merged');
+ expect(rendered.parts.text, '#298 Merged');
for (final width in [520.0, 1280.0]) {
tester.view.physicalSize = Size(width, 800);
await tester.pump(const Duration(milliseconds: 100));
@@ -226,7 +299,7 @@ void main() {
);
app.activeSwarm.focusedPaneId = 1;
final context = WorkspacePaneContext.focused(app)!;
- expect(context.text, 'OpenAI Test host:api (fix)');
+ expect(context.text, 'Test host:api (fix)');
expect(context.detail, contains('/worktrees/random-name'));
for (final style in StatusLineStyle.values) {
final text = context.format(PromptPrefs(statusStyle: style)).text;
@@ -461,12 +534,12 @@ void main() {
]);
tab.focusedPaneId = 1;
final owner = WorkspacePaneContext.focused(app)!;
- expect(owner.text, 'Anthropic Test host:scene (lighting)');
+ expect(owner.text, 'Test host:scene (lighting)');
tab.focusedPaneId = 2;
expect(WorkspacePaneContext.focused(app)!.text, owner.text);
expect(WorkspacePaneContext.focused(app)!.agentId, 'a');
tab.focusedPaneId = 3;
- expect(WorkspacePaneContext.focused(app)!.text, 'OpenAI Test host:notes');
+ expect(WorkspacePaneContext.focused(app)!.text, 'Test host:notes');
tab.panes.clear();
expect(WorkspacePaneContext.focused(app), isNull);
});
@@ -498,7 +571,7 @@ void main() {
of: find.byType(TerminalPanel),
matching: find.byType(GridModelPicker),
),
- findsNothing,
+ findsOneWidget,
);
await tester.tap(find.text('1:code'));
await tester.pump(const Duration(milliseconds: 350));
@@ -536,14 +609,8 @@ void main() {
await mount(tester, app, nativeTabs: true);
final tab = (updates.last['tabs'] as List).single as Map;
expect(tab['label'], '1:code');
- expect(
- (updates.last['focusedContext'] as Map)['text'],
- 'OpenAI Test host',
- );
- expect(
- updates.last['terminalStyle'],
- containsPair('family', isA<String>()),
- );
+ expect((updates.last['focusedContext'] as Map)['text'], 'Test host');
+ expect(updates.last['barStyle'], containsPair('family', isA<String>()));
final originalPrefs = appearancePrefsStore.value;
addTearDown(() => appearancePrefsStore.value = originalPrefs);
appearancePrefsStore.value = originalPrefs.copyWith(
@@ -554,8 +621,8 @@ void main() {
),
);
await tester.pump();
- expect((updates.last['focusedContext'] as Map)['text'], 'OpenAI');
- final colors = updates.last['terminalStyle'] as Map;
+ expect((updates.last['focusedContext'] as Map)['text'], '');
+ final colors = updates.last['barStyle'] as Map;
final segments =
(updates.last['focusedContext'] as Map)['segments'] as List;
expect(
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 671390cda..1f70c97b0 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -117,10 +117,10 @@ private extension SwarmTabStrip {
update(["tabs": [["id": "font-tab", "name": "Typography", "label": "1:code"],
["id": "other", "name": "Other", "label": "2:blender"]],
"activeId": "font-tab", "enabled": true,
- "terminalStyle": ["family": "Menlo", "size": 16.0,
+ "barStyle": ["family": ".AppleSystemUIFontMonospaced", "size": 13.0,
"foreground": Int64(0xffd0d0d0), "selection": Int64(0xff444444)]])
- try checkTitlebar(tabs[0].labelFont.pointSize == 16 && tabs[0].labelFont.familyName == "Menlo",
- "Numbered tabs follow the selected terminal font and size")
+ try checkTitlebar(tabs[0].labelFont == NSFont.monospacedSystemFont(ofSize: 13, weight: .regular),
+ "Numbered tabs use 13 pt SF Mono regular")
try checkTitlebar(tabs[0].drawnFont == tabs[1].drawnFont && contextButton.font == tabs[0].labelFont,
"Active tabs, inactive tabs, and pane context share one font")
try checkTitlebar(tabs[0].frame.width < tabs[1].frame.width,
@@ -168,12 +168,12 @@ private extension SwarmTabStrip {
["tabs": rows, "activeId": active, "enabled": enabled,
"focusedContext": ["text": "OpenAI M2:~/code/harness (main)",
"segments": [["text": "OpenAI M2:~/code/harness (main)", "foreground": Int64(0xffdddddd)]],
- "detail": "Full project context", "canSelectModel": true]]
+ "detail": "Full project context", "interactive": false]]
}
var prState = state(rows, active: "swarm-11")
- prState["pullRequest"] = ["text": "PR #298 · Merged", "segmented": true,
- "segments": [["text": "PR #298 · Merged", "foreground": Int64(0xffeeeeee), "background": Int64(0xffbc3fbc)]],
- "url": "https://github.com/acme/repo/pull/298", "canSelectModel": true]
+ prState["pullRequest"] = ["text": "#298 Merged", "segmented": true,
+ "segments": [["text": "#298 Merged", "foreground": Int64(0xffeeeeee), "background": Int64(0xffbc3fbc)]],
+ "url": "https://github.com/acme/repo/pull/298", "interactive": true]
update(prState)
try checkTitlebar(!pullRequestButton.isHidden && pullRequestButton.isEnabled,
"A focused PR has a separate enabled action")
@@ -184,7 +184,7 @@ private extension SwarmTabStrip {
["text": "OpenAI M2", "foreground": Int64(0xffeeeeee), "background": Int64(0xff000000)],
["text": "app", "foreground": Int64(0xffeeeeee), "background": Int64(0xff3465a4)],
["text": "main", "foreground": Int64(0xff000000), "background": Int64(0xff4e9a06)],
- ], "canSelectModel": true]
+ ], "interactive": false]
let originalSize = frame.size
for width in [CGFloat(520), CGFloat(1280)] {
setFrameSize(NSSize(width: width, height: originalSize.height))
@@ -199,7 +199,7 @@ private extension SwarmTabStrip {
setFrameSize(originalSize)
update(prState)
let mergedPixels = pullRequestButton.renderedPixels()
- try checkTitlebar(!mergedPixels.isEmpty && pullRequestButton.accessibilityValue() as? String == "PR #298 · Merged",
+ try checkTitlebar(!mergedPixels.isEmpty && pullRequestButton.accessibilityValue() as? String == "#298 Merged",
"Segmented PR renders and exposes its full state")
pullRequestButton.performClick(nil)
try checkTitlebar(events.last == "focusedPullRequest", "PR opens its own action rather than the model picker")
@@ -259,7 +259,7 @@ private extension SwarmTabStrip {
contextButton.performClick(nil)
newButton.performClick(nil)
original.clickBothActions()
- try checkTitlebar(events == ["focusedModel", "new", "select", "close"], "Visible controls dispatch their actions once")
+ try checkTitlebar(events == ["new", "select", "close"], "Visible controls dispatch their actions once")
events.removeAll()
update(state(rows, active: "swarm-0", enabled: false))
try checkTitlebar(!contextButton.isEnabled && !newButton.isEnabled, "Modal state disables status-bar actions")
@@ -710,6 +710,10 @@ private extension SwarmTitlebar {
canFind = true
try checkTitlebar(validateMenuItem(movePane), "Move Pane to Tab is available with a focused pane")
try checkTitlebar(agent.items.contains { $0.title == "Close Tab" && $0.representedObject as? String == "closeActive" }, "Close Tab preserves its command")
+ let closeTabShortcut = agent.items.first { $0.representedObject as? String == "closeActive" }!
+ let closePaneShortcut = agent.items.first { $0.representedObject as? String == "closePane" }!
+ try checkTitlebar(closeTabShortcut.keyEquivalent == "w" && closeTabShortcut.keyEquivalentModifierMask == [.command, .shift], "Close Tab defaults to Command-Shift-W")
+ try checkTitlebar(closePaneShortcut.keyEquivalent == "w" && closePaneShortcut.keyEquivalentModifierMask == [.command], "Close Pane defaults to Command-W")
let commands = edit.submenu!.items.first(where: { $0.representedObject as? String == "commands" })!
try checkTitlebar(commands.keyEquivalent == "p" && commands.keyEquivalentModifierMask == [.command], "Command search keeps its native menu owner")
try checkTitlebar(edit.submenu!.items.allSatisfy { $0.representedObject as? String != "jump" }, "Edit has no Navigate action")