The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(desktop): titlebar dropdowns, tab strip, close mark and model picker (#1453)
lingrd72159b7fa37e
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.mdindex f792fea49..926253e0c 100644--- a/desktop/design/desktop-design-system.md+++ b/desktop/design/desktop-design-system.md@@ -198,11 +198,14 @@ icon implementation, not in individual pane widgets.Use 16-point icons beside text, 20 for standalone controls, and 24 for a featureillustration. Center the drawing optically inside its role's target; icon-onlycontrols retain a 32-point target and a descriptive tooltip/accessibility label.-Workspace close marks are a quiet exception: 12-point Lucide × at 45% foreground,-with an optically matched 8-point regular SF Symbol in AppKit, inside the existing-click target. Hover or keyboard focus restores full ink;-Increase Contrast strengthens the resting mark. Tabs reveal the mark on hover,-while pane headers keep it visible. Neither changes geometry on interaction.+Workspace close marks (tabs and pane headers) are full foreground ink at rest+(`AppIcons.closeInk`, mirrored by `HarnessControlSymbols.closeInk`), weighted like+the text beside them: in AppKit the tab's × is the SF Symbol `xmark` at the+title's size and weight (13-point regular, small scale); in Flutter it is the+14-point Lucide × (`AppIcons.closeSize`), whose 1.1-point stroke matches that+text's stems. Both sit in a 28-point square target. Tabs reveal the mark on+hover, while pane headers keep it visible. Neither changes geometry on+interaction.Use the surrounding text's semantic color. Hover changes emphasis or the sharedcontrol fill, never the symbol, weight or position. Disabled icons stay legiblewithout suggesting an action. Agent, provider, service and product logos retain@@ -226,7 +229,8 @@ dots remain solid at their intended size; color is accompanied by status text.| Field / inset row / pane radius | 10 || Tab upper corner / outward lower shoulder | 10 / 8 || Tab top inset | 6 |-| Tab close target inset from outer bounds | 8 |+| Tab close target (square) | 28 |+| Tab close target inset from outer bounds | 11 (the 8-point shoulder + one 3-point gap, equal above, below and beside it) || Pane close target trailing inset | 4 || Dialog content inset | 24 || Group / control gap | 16 / 8 |@@ -254,6 +258,18 @@ then flip or constrain when the window has insufficient room.## Surface families+**Titlebar dropdowns** — the avatar's menu, the bell's inbox and the other+menus a titlebar button opens are built on the shared overlay menu+(`showPaneMenu`): no modal route and no veil, the popover radius and one rim.+A click outside closes the dropdown and lands where it was aimed; Escape+closes it and returns the keyboard; choosing a row closes it; opening another+dropdown, or any titlebar action, closes it first (`dismissTransientMenus`),+and its own button closes it again. A dropdown never disables the titlebar or+dims its controls. It opens fresh: no row is lit when a pointer opened it, the+first is focused only when a key did. The Settings page is a page: the tab+row stays live over it and a click there leaves Settings, then acts. Only a+real modal dialog holds the titlebar.+**Task dialogs** — one heading, optional short explanation, fields, and fixedtrailing actions. Rename, confirmation, linking and sharing use the same type,frame, padding and control states. Content scrolls before actions disappear.@@ -333,9 +349,10 @@ in Flutter and AppKit. Tabs use the 13-point system control face, independent ofthe status bar and terminal font. Center the name and its adjacentstatus as one compact group, without permanent number prefixes. Navigation inkfollows the tab-bar surface, including beside light app content. The default label-is New Tab. A small right-hand close icon appears on hover, with its 32-point-target inset 8 points from the outer tab bounds. This puts the cross's center-16 points inside the curved body edge. × is the tab's only control: Agent+is New Tab. A small right-hand close icon appears on hover, in the pane close+button's 28-point square target, centred on the tab's body with one equal gap+above, below and to the body's straight right side (3 points in the 40-point+row; 11 from the outer tab bounds). × is the tab's only control: AgentMessages' 💬 that sat left of it was removed, since it was easy to hit by mistakeand turned the tab off (owner, 2026-10-12); the account's Settings ▸ Experimentalholds that switch now, off by default. At rest the name and status have the whole tab; on hover a name that would run@@ -382,9 +399,10 @@ hover, without wrapping or reducing the font size. Remove a coding-agent logothat repeats the agent selector; keep a distinct domain-harness mark on the left.The session name and its activity/status remain on the left.-Use the shared 12-point close glyph in a 28-point target, sitting 4 points-inside the header's trailing edge. Resting ink is 45%; hover and keyboard focus-brighten the glyph without a fill, border, or movement. Keep the controls on one+Use the shared close mark (14-point Lucide ×, `AppIcons.closeSize`) in a+28-point target, sitting 4 points inside the header's trailing edge. It is full+foreground ink at rest (`AppIcons.closeInk`), as the tab's ×, with no fill,+border, or movement on hover or keyboard focus. Keep the controls on oneline; the session title yields first, then the model truncates while the agentretains readable identity. Never shrink the close target.diff --git a/desktop/lib/agent_messages/agent_messages_view.dart b/desktop/lib/agent_messages/agent_messages_view.dartindex 798a1b0c8..07f0bef75 100644--- a/desktop/lib/agent_messages/agent_messages_view.dart+++ b/desktop/lib/agent_messages/agent_messages_view.dart@@ -308,6 +308,7 @@ class _AgentMessagesViewState extends State<AgentMessagesView> {elevation: 0,insetPadding: const EdgeInsets.all(16),backgroundColor: Colors.transparent,+ shape: DesktopChrome.bareDialogShape,child: SizedBox(width: 640,child: DesktopDialogSurface(diff --git a/desktop/lib/app_shell.dart b/desktop/lib/app_shell.dartindex 8ac5b9f7e..caaf0ffa5 100644--- a/desktop/lib/app_shell.dart+++ b/desktop/lib/app_shell.dart@@ -35,6 +35,7 @@ import 'widgets/flash_firmware_dialog.dart';import 'widgets/linux_menu_bar.dart';import 'widgets/setup_tour.dart';import 'widgets/sign_in_step.dart';+import 'widgets/transient_menus.dart';import 'core/startup.dart';import 'logging/app_log.dart';import 'logging/install.dart';@@ -329,6 +330,9 @@ class _RootShellState extends ConsumerState<RootShell>// Reserve before the first frame too: held menu shortcuts can arrive// before the new dialog has changed the route's current state._menuDialogOpen = true;+ // An open dropdown is an overlay above every route: close it, or its rows+ // stay live over the dialog (Sign out behind Check for Updates).+ dismissTransientMenus();try {await action();} finally {diff --git a/desktop/lib/measurement/task_feedback.dart b/desktop/lib/measurement/task_feedback.dartindex 51b20aa16..51f951cbe 100644--- a/desktop/lib/measurement/task_feedback.dart+++ b/desktop/lib/measurement/task_feedback.dart@@ -16,6 +16,8 @@ Future<void> showTaskFeedback(context: context,builder: (context) => Dialog(backgroundColor: Colors.transparent,+ elevation: 0,+ shape: DesktopChrome.bareDialogShape,constraints: const BoxConstraints(maxWidth: 520),child: DesktopDialogSurface(child: SingleChildScrollView(diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex c9575fe8c..0c986eb6c 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -450,6 +450,23 @@ class _SwarmScreenState extends State<SwarmScreen> {bool _pickingFolder = false;bool _newHarnessHidden = false;bool _routeIsCurrent = true;++ /// What covers the workspace, as the titlebar sees it: the one source of the+ /// titlebar's state (`enabled`, `stripEnabled`) and of what a titlebar click+ /// clears first ([_onNative]). A titlebar dropdown is an overlay, not a+ /// cover: the titlebar stays as it is, and a click there closes it.+ _TitlebarCover get _titlebarCover {+ if (_spokenPaletteOpen) return _TitlebarCover.modal;+ if (settingsPageOnTop.value != null) return _TitlebarCover.settingsPage;+ if (!_routeIsCurrent || _dialogOpen) return _TitlebarCover.modal;+ return _TitlebarCover.none;+ }++ /// The titlebar dropdown open now (the avatar's menu, the bell's inbox): the+ /// titlebar action of its button, and its closer. That button closes it.+ (String, void Function())? _titlebarDropdown;+ final _accountButtonKey = GlobalKey();+ final _notificationsButtonKey = GlobalKey();bool _footerPreviewCurrent = false;String? _linkDialogMachineId;bool _browserMachineSetupHandled = false;@@ -679,6 +696,7 @@ class _SwarmScreenState extends State<SwarmScreen> {_face.voiceLine.addListener(_voiceChanged);_daemonsPreview?.addListener(_syncDaemon);_experimentalFeatures.addListener(_experimentalFeaturesChanged);+ settingsPageOnTop.addListener(_titlebarCoverChanged);app.agentPulse.addListener(_face.pulse);_face.dialogOpen = () =>_dialogOpen ||@@ -868,6 +886,7 @@ class _SwarmScreenState extends State<SwarmScreen> {HardwareKeyboard.instance.removeHandler(_noteKey);_daemonsPreview?.removeListener(_syncDaemon);_experimentalFeatures.removeListener(_experimentalFeaturesChanged);+ settingsPageOnTop.removeListener(_titlebarCoverChanged);_slotTimer?.cancel();if (_daemonCommandsOn) daemonCommandsActive.value = false;unawaited(_zooPushes?.cancel());@@ -1184,6 +1203,7 @@ class _SwarmScreenState extends State<SwarmScreen> {builder: (context) => Dialog(backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.all(24),child: ConstrainedBox(constraints: const BoxConstraints(maxWidth: 1200, maxHeight: 800),@@ -1911,8 +1931,11 @@ class _SwarmScreenState extends State<SwarmScreen> {final usage = _subscriptionUsage;int activityInk(HarnessActivity activity) =>activityColor(activity, terminalTheme, color: prefs.color).toARGB32();+ final cover = _titlebarCover;final payload = {- 'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,+ // Menus and shortcuts; the tab row and its icons also over Settings.+ 'enabled': cover == _TitlebarCover.none,+ 'stripEnabled': cover != _TitlebarCover.modal,'reduceMotion': _reduceMotion,'activeId': app.activeSwarmId,'searchTooltip': _commandTooltip('Open Harness', 'harnesses.list'),@@ -2291,7 +2314,45 @@ class _SwarmScreenState extends State<SwarmScreen> {);}+ /// What the titlebar tells rather than asks: keys held, the daemon hovered.+ static const _nativeReports = {'keymapPending', 'daemonHover', 'daemonLook'};++ /// Keys, not clicks: the focused picker may own them ([_actOnNative]), so+ /// they do not close it first.+ static const _nativeKeys = {'keymapCommand', 'searchCommand'};++ /// Every titlebar call. The one rule: what it asks for is meant for the+ /// workspace. The button of an open dropdown closes it; any other action+ /// closes every open dropdown first ([dismissTransientMenus]); a row click+ /// pops the Settings page first; a modal still drops it ([_actOnNative]).Future<void> _onNative(MethodCall call) async {+ var action = call;+ final args = call.arguments is Map ? call.arguments as Map : const {};+ // AppKit wraps the row's clicks while its menus are off, which, with the+ // row live, is only over the Settings page.+ final fromRow = call.method == 'rowAction';+ if (fromRow) {+ final method = args['method'];+ if (method is! String) return;+ action = MethodCall(method, args['arguments']);+ }+ if (mounted && !_nativeReports.contains(action.method)) {+ // A dropdown's titlebar button closes it again. Asked to `open` (the+ // menu bar's "View all … notifications"), an open one just stays.+ if (_titlebarDropdown?.$1 == action.method) {+ final wanted = action.arguments is Map ? action.arguments as Map : {};+ if (wanted['open'] != true) _closeTitlebarDropdown(action.method);+ return;+ }+ if (!_nativeKeys.contains(action.method)) dismissTransientMenus();+ if (fromRow && _titlebarCover == _TitlebarCover.settingsPage) {+ await _leaveSettings();+ }+ }+ return _actOnNative(action);+ }++ Future<void> _actOnNative(MethodCall call) async {if (mounted && call.method == 'keymapPending') {final keys = (call.arguments as Map?)?['keys'];if (keys is List &&@@ -2729,6 +2790,9 @@ class _SwarmScreenState extends State<SwarmScreen> {}) async {if (_dialogOpen || _spokenPaletteOpen || !mounted) return;_closeSearch();+ // An open dropdown is an overlay above every route: close it, or its rows+ // stay live over the dialog.+ dismissTransientMenus();_dialogOpen = true;// The route must not restore an old terminal while the destination changes// behind a dialog. Return input explicitly when that dialog finishes.@@ -2823,6 +2887,11 @@ class _SwarmScreenState extends State<SwarmScreen> {return state['detail'] as String? ??'Could not check ${targets[i].$2.displayName}. Nothing else will be stopped.';}+ // An agent the daemon already closed: nothing to ask about or stop.+ if (state['closed'] == true) {+ activities[i] = 'stopped';+ continue;+ }activities[i] =state['keptRunning'] == true ||canStop?.call(targets[i].$1, targets[i].$2.id) == false@@ -2839,11 +2908,15 @@ class _SwarmScreenState extends State<SwarmScreen> {if (!mounted) return false;if (inspectionError != null) return closeAfterError(inspectionError);var stopNow = activities.any(- (activity) => activity != 'idle' && activity != 'kept_running',+ (activity) =>+ activity != 'idle' &&+ activity != 'kept_running' &&+ activity != 'stopped',);if (stopNow && await choose() != 'now') return false;for (var i = 0; i < requests.length; i++) {if (!mounted) return false;+ if (activities[i] == 'stopped') continue;var result = await request(i, stopNow ? 'now' : 'idle');if (!mounted) return false;if (result['keptRunning'] == true) {@@ -3189,13 +3262,16 @@ class _SwarmScreenState extends State<SwarmScreen> {onPressed: _shortcutsEnabled ? () => unawaited(_signIn()) : null,)else- WorkspaceAvatarButton(- key: const ValueKey('swarm-account-button'),- initial: _accountInitial,- tooltip: _accountTooltip,- onPressed: _shortcutsEnabled- ? () => unawaited(_showAccountMenu())- : null,+ KeyedSubtree(+ key: _accountButtonKey,+ child: WorkspaceAvatarButton(+ key: const ValueKey('swarm-account-button'),+ initial: _accountInitial,+ tooltip: _accountTooltip,+ onPressed: _shortcutsEnabled+ ? () => unawaited(_showAccountMenu())+ : null,+ ),),];@@ -3209,20 +3285,22 @@ class _SwarmScreenState extends State<SwarmScreen> {/// Sign in: the sign-in screen, over the desk (`showSignInSheet`).Future<void> _signIn() => _dialog(() => showSignInSheet(context, app));- /// The avatar's menu (`widgets/account_menu.dart`). Its rows open what the- /// app already has, once the menu itself has closed: a [_dialog] made from- /// inside one is refused.+ /// The avatar's menu (`widgets/account_menu.dart`), a titlebar dropdown.+ /// Its rows open what the app already has once it has closed.Future<void> _showAccountMenu() async {+ if (_closeTitlebarDropdown('account')) return;final user = app.currentUser;- AccountMenuChoice? choice;- await _dialog(() async {- choice = await showAccountMenu(+ final choice = await _titlebarDropdownFor(+ 'account',+ (onOpen) => showAccountMenu(context,name: user?.name ?? '',email: user?.email ?? '',topInset: _native ? 0 : _tabBarHeight,- );- });+ onOpen: onOpen,+ ownsPointer: (position) => _owns(_accountButtonKey, position),+ ),+ );if (!mounted) return;switch (choice) {case AccountMenuChoice.addPhone:@@ -3252,6 +3330,54 @@ class _SwarmScreenState extends State<SwarmScreen> {),);+ void _titlebarCoverChanged() {+ if (mounted && _menuHost) _syncNative();+ }++ /// A row click over the Settings page: pop it, and wait for the frame after,+ /// by which its opener ([_dialog]) has finished and the workspace is the+ /// current route again, so the click lands where it was aimed.+ Future<void> _leaveSettings() async {+ final page = settingsPageOnTop.value;+ if (page == null) return;+ page.navigator?.pop();+ await page.popped;+ await WidgetsBinding.instance.endOfFrame;+ }++ /// Shows a titlebar dropdown, remembering it under [opener], the titlebar+ /// action of its button, while it is open.+ Future<T?> _titlebarDropdownFor<T>(+ String opener,+ Future<T?> Function(void Function(void Function() close) onOpen) show,+ ) async {+ (String, void Function())? mine;+ try {+ return await show((close) {+ _titlebarDropdown = mine = (opener, close);+ });+ } finally {+ if (identical(_titlebarDropdown, mine)) _titlebarDropdown = null;+ }+ }++ /// Closes the dropdown [opener]'s button opened; false when it is not open.+ bool _closeTitlebarDropdown(String opener) {+ final open = _titlebarDropdown;+ if (open == null || open.$1 != opener) return false;+ open.$2();+ return true;+ }++ /// Whether [position] is on the button behind [key], which toggles its own+ /// dropdown rather than having the dropdown close under it.+ bool _owns(GlobalKey key, Offset position) {+ final box = key.currentContext?.findRenderObject();+ return box is RenderBox &&+ box.hasSize &&+ (box.localToGlobal(Offset.zero) & box.size).contains(position);+ }+/// Harness ▸ Add Phone… and `> add phone`: the QR a phone scans to sign in/// and pair with this computer. See `widgets/add_phone_dialog.dart`./// [from] is the way in it is counted under ([AddPhoneOpening]).@@ -5859,6 +5985,8 @@ class _SwarmScreenState extends State<SwarmScreen> {_unregisterModels = registerTransientMenu(() => _closeModelsControls(restoreFocus: false),);+ // Its titlebar button closes it again ([_onNative]).+ _titlebarDropdown = ('modelControls', _closeModelsControls);if (_menuHost) _syncNative();setState(() {});}@@ -5867,6 +5995,7 @@ class _SwarmScreenState extends State<SwarmScreen> {if (_modelsOverlay == null) return;_unregisterModels?.call();_unregisterModels = null;+ if (_titlebarDropdown?.$1 == 'modelControls') _titlebarDropdown = null;_modelsOverlay?.remove();_modelsOverlay?.dispose();_modelsOverlay = null;@@ -5887,16 +6016,17 @@ class _SwarmScreenState extends State<SwarmScreen> {_search?.setModelSelection(null, null);_onboarding.acknowledge(OnboardingStep.models);_openResourcePicker(':');- if (_search?.isModelMode == true && initialTab != ModelsTab.all) {- _search!.setQuery(- ':${switch (initialTab) {- ModelsTab.local => 'local',- ModelsTab.shared => 'shared',- ModelsTab.apis => 'api',- ModelsTab.subscriptions => 'subscription',- ModelsTab.all => '',- }}',- );+ // A tab opens on its section with nothing typed: a `:local` filter was+ // text the person had to delete before searching every model.+ final section = switch (initialTab) {+ ModelsTab.local => ModelSearchSection.local,+ ModelsTab.shared => ModelSearchSection.shared,+ ModelsTab.apis => ModelSearchSection.apis,+ ModelsTab.subscriptions => ModelSearchSection.subscriptions,+ ModelsTab.all => null,+ };+ if (section != null && _search?.isModelMode == true) {+ _search!.openModelSection(section);}}@@ -6909,49 +7039,56 @@ class _SwarmScreenState extends State<SwarmScreen> {}}- Future<void> _showNotificationInbox() => _dialog(() async {- await showNotificationInbox(- context,- app: app,- topInset: _native ? 0 : _tabBarHeight,- onOpen: (row) async {- final destination = swarmDestinations(app)- .where(- (item) =>- item.machineId == row.machineId &&- item.agentId == row.agentId,- )- .firstOrNull;- if (destination == null) return false;- final readToken = app.agentUnread.readTokenFor(- row.machineId,- row.agentId,- );- final questionId = app- .questionFor(row.machineId, row.agentId)- ?.requestId;- final opened = await activateSwarmDestination(- app,- destination,- destinationSwarmId: app.activeSwarmId,- );- // Opening acknowledges this notification. Its question stays pending- // until the daemon confirms an answer, independently of unread state.- if (opened &&- app.agentUnread.readTokenFor(row.machineId, row.agentId) ==- readToken &&- app.questionFor(row.machineId, row.agentId)?.requestId ==- questionId) {- app.readAgentNotification(+ /// The bell's inbox, a titlebar dropdown.+ Future<void> _showNotificationInbox() async {+ if (_closeTitlebarDropdown('notificationInbox')) return;+ await _titlebarDropdownFor<void>(+ 'notificationInbox',+ (onOpened) => showNotificationInbox(+ context,+ app: app,+ topInset: _native ? 0 : _tabBarHeight,+ onOpened: onOpened,+ ownsPointer: (position) => _owns(_notificationsButtonKey, position),+ onOpen: (row) async {+ final destination = swarmDestinations(app)+ .where(+ (item) =>+ item.machineId == row.machineId &&+ item.agentId == row.agentId,+ )+ .firstOrNull;+ if (destination == null) return false;+ final readToken = app.agentUnread.readTokenFor(row.machineId,row.agentId,- readToken: readToken,);- }- return opened;- },+ final questionId = app+ .questionFor(row.machineId, row.agentId)+ ?.requestId;+ final opened = await activateSwarmDestination(+ app,+ destination,+ destinationSwarmId: app.activeSwarmId,+ );+ // Opening acknowledges this notification. Its question stays pending+ // until the daemon confirms an answer, independently of unread state.+ if (opened &&+ app.agentUnread.readTokenFor(row.machineId, row.agentId) ==+ readToken &&+ app.questionFor(row.machineId, row.agentId)?.requestId ==+ questionId) {+ app.readAgentNotification(+ row.machineId,+ row.agentId,+ readToken: readToken,+ );+ }+ return opened;+ },+ ),);- });+ }Future<void> _revealForDevice() async {if (!RuntimePlatform.isMacOS ||@@ -8932,13 +9069,15 @@ class _SwarmScreenState extends State<SwarmScreen> {),);- Widget _notificationsButton(TerminalTheme theme) =>- WorkspaceNotificationsButton(- key: const ValueKey('workspace-notifications-button'),- count: _unread,- foreground: theme.foreground,- onPressed: _shortcutsEnabled ? _showNotificationInbox : null,- );+ Widget _notificationsButton(TerminalTheme theme) => KeyedSubtree(+ key: _notificationsButtonKey,+ child: WorkspaceNotificationsButton(+ key: const ValueKey('workspace-notifications-button'),+ count: _unread,+ foreground: theme.foreground,+ onPressed: _shortcutsEnabled ? _showNotificationInbox : null,+ ),+ );/// The tab list, inside the arrows' scroller whenever the host scrolls tabs/// by mouse — drawn only while [arrows], the list overflowing.@@ -9040,3 +9179,17 @@ class _SuperTabClosedTextState extends State<_SuperTabClosedText> {Widget build(BuildContext context) =>const Text('Super Tab closed. Its agents keep running.');}++/// What covers the workspace, as the titlebar sees it+/// ([_SwarmScreenState._titlebarCover]).+enum _TitlebarCover {+ /// Nothing, or only a titlebar dropdown: menus, shortcuts and the row are on.+ none,++ /// The Settings page: the row stays on and pops it before acting; menus and+ /// shortcuts wait.+ settingsPage,++ /// A dialog, the spoken palette or another route: the whole titlebar waits.+ modal,+}diff --git a/desktop/lib/settings/settings_screen.dart b/desktop/lib/settings/settings_screen.dartindex 654d3577e..f060db341 100644--- a/desktop/lib/settings/settings_screen.dart+++ b/desktop/lib/settings/settings_screen.dart@@ -43,12 +43,16 @@ Future<void> showSettingsScreen(PageRouteBuilder<SettingsSection>(// Opaque: it covers the window, and letting the shell show through would// mean compositing four live terminals under it for nothing.- pageBuilder: (context, animation, _) => SettingsScreen(- notifier: notifier,- initialSection: initialSection,- experimentalFeatures: experimentalFeatures,- source: source,- compactBelow: compactBelow,+ // From whichever door opened it, Settings says when it is on top: the+ // title-bar row stays live over it and closes it before acting.+ pageBuilder: (context, animation, _) => _OnTop(+ child: SettingsScreen(+ notifier: notifier,+ initialSection: initialSection,+ experimentalFeatures: experimentalFeatures,+ source: source,+ compactBelow: compactBelow,+ ),),transitionDuration: Duration.zero,reverseTransitionDuration: Duration.zero,@@ -61,6 +65,48 @@ Future<void> showSettingsScreen(}}+/// The Settings page while it is the current route, nothing over it; null+/// otherwise. A page, not a dialog: the workspace keeps its title-bar row live+/// over it, and a click there pops it ([ModalRoute.navigator]) before acting.+final settingsPageOnTop = ValueNotifier<ModalRoute<Object?>?>(null);++class _OnTop extends StatefulWidget {+ const _OnTop({required this.child});++ final Widget child;++ @override+ State<_OnTop> createState() => _OnTopState();+}++class _OnTopState extends State<_OnTop> {+ ModalRoute<Object?>? _route;++ @override+ void didChangeDependencies() {+ super.didChangeDependencies();+ _route = ModalRoute.of(context);+ if (ModalRoute.isCurrentOf(context) ?? false) {+ settingsPageOnTop.value = _route;+ } else {+ _leave();+ }+ }++ void _leave() {+ if (settingsPageOnTop.value == _route) settingsPageOnTop.value = null;+ }++ @override+ void dispose() {+ _leave();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) => widget.child;+}+/// Settings: pick on the left, work on the right.class SettingsScreen extends StatefulWidget {const SettingsScreen({diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dartindex 30fe566e5..8d318acca 100644--- a/desktop/lib/shared/theme/app_icons.dart+++ b/desktop/lib/shared/theme/app_icons.dart@@ -11,8 +11,15 @@ abstract final class AppIcons {static const double controlSize = 20;static const double featureSize = 24;- /// A quiet close mark in tabs and pane headers, inside the full click target.- static const double closeSize = 12;+ /// The close mark in tabs and pane headers, inside the full click target.+ /// 14: its stroke matches the 13pt regular text beside it (1.1pt, measured),+ /// as the native tab's × takes the title's size and weight.+ static const double closeSize = 14;++ /// The close mark's ink at rest, as a share of the foreground: full, as the+ /// text beside it (owner, 2026-10-20). The native tab's × reads the same+ /// value (`HarnessControlSymbols.closeInk`).+ static const double closeInk = 1;static const aArrowDown = LucideIcons.aArrowDown400;static const aArrowUp = LucideIcons.aArrowUp400;diff --git a/desktop/lib/shared/theme/app_theme.dart b/desktop/lib/shared/theme/app_theme.dartindex cd4b97f33..89ca76d0b 100644--- a/desktop/lib/shared/theme/app_theme.dart+++ b/desktop/lib/shared/theme/app_theme.dart@@ -1441,7 +1441,12 @@ abstract final class AppDesktop {static const double tabRadius = 10;static const double tabShoulder = 8;static const double tabTopInset = 6;- static const double tabCloseInset = 8;++ /// A tab's ×: the pane close button's 28pt square target, centred on the+ /// tab's body (the 40pt row less [tabTopInset]) with one 3pt gap above,+ /// below, and to the body's straight right side, [tabShoulder] in.+ static const double tabCloseSize = 28;+ static const double tabCloseInset = tabShoulder + 3;static const double tabMinWidth = 128;static const double tabMaxWidth = 256;static const double tabBarTrailingInset = 12;diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dartindex c2c980392..1839c76c5 100644--- a/desktop/lib/shortcuts/keyboard_practice.dart+++ b/desktop/lib/shortcuts/keyboard_practice.dart@@ -925,6 +925,7 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {key: const ValueKey('keyboard-practice'),backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.all(16),child: ConstrainedBox(constraints: const BoxConstraints(maxWidth: 780, maxHeight: 620),diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex fc1aa259c..40e8b3af4 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -2257,6 +2257,10 @@ class SwarmSearchController extends ChangeNotifier {final first = rows.indexWhere(canSubmit);if (first >= 0) cursor = first;}+ if (_openSection case final section? when isModelMode) {+ final first = rows.indexWhere((row) => modelSection(row) == section);+ if (first >= 0) cursor = first;+ }_selectedId = selected?.id;matchCount = rows.where(@@ -2286,9 +2290,22 @@ class SwarmSearchController extends ChangeNotifier {];}+ /// The model section the picker opened on, with nothing typed: its first row+ /// stays selected as the rows arrive, until somebody types, moves or picks.+ ModelSearchSection? _openSection;++ /// Select the first row of [section], as the footer's Models and+ /// Subscriptions do, instead of typing a filter the person must delete.+ void openModelSection(ModelSearchSection section) {+ _openSection = section;+ _filter();+ notifyListeners();+ }+void setQuery(String value) {if (query == value) return;if (_quickAccessPrefix.hasMatch(value.trimLeft())) _groupScope = null;+ _openSection = null;query = value;if (isStoreMode) _refreshStore();cursor = 0;@@ -2310,6 +2327,7 @@ class SwarmSearchController extends ChangeNotifier {void move(int delta) {if (rows.isEmpty) return;+ _openSection = null;cursor = ((cursor < 0 && delta < 0 ? 0 : cursor) + delta) % rows.length;_selectedId = selected!.id;_chosen = true;@@ -2331,6 +2349,7 @@ class SwarmSearchController extends ChangeNotifier {SwarmSearchSelection? submit([SwarmDestination? row]) {final destination = row ?? selected;if (destination == null || !canSubmit(destination)) return null;+ _openSection = null;if (canExpandApi(destination)) {final api = models!.entries[destination.modelId]!.api!;final opening = expandedApis.add(api.id);diff --git a/desktop/lib/super_tabs/workspace.dart b/desktop/lib/super_tabs/workspace.dartindex 0da5a5abd..db8131627 100644--- a/desktop/lib/super_tabs/workspace.dart+++ b/desktop/lib/super_tabs/workspace.dart@@ -535,7 +535,7 @@ class _PeopleState extends State<_People> {return Dialog(backgroundColor: Colors.transparent,elevation: 0,- shape: const RoundedRectangleBorder(),+ shape: DesktopChrome.bareDialogShape,child: DesktopDialogSurface(child: SizedBox(width: 460,diff --git a/desktop/lib/widgets/account_menu.dart b/desktop/lib/widgets/account_menu.dartindex ef16967c6..cfc9d9280 100644--- a/desktop/lib/widgets/account_menu.dart+++ b/desktop/lib/widgets/account_menu.dart@@ -1,13 +1,10 @@-import 'dart:math' as math;-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';import '../shared/theme/app_icons.dart';import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_menu.dart';import 'desktop_chrome.dart';+import 'pane_menu.dart';import 'workspace_account_button.dart';/// What the account menu was asked for.@@ -22,39 +19,45 @@ enum AccountMenuChoice { addPhone, customize, notifications, settings, signOut }/// native — and Linux get the same one. It hangs from the window's top-right/// corner, under the row the avatar is in; [topInset] is that row's height/// where this app draws it.+///+/// A titlebar dropdown ([showPaneMenu]): an overlay with no veil, so a click+/// outside closes it and lands where it was aimed, and it never holds the+/// titlebar. Each opening is fresh: no row is lit unless [focusFirst] (a key+/// opened it).Future<AccountMenuChoice?> showAccountMenu(BuildContext context, {required String name,required String email,double topInset = 0,-}) => showAppDialog<AccountMenuChoice>(+ bool focusFirst = false,+ void Function(void Function() close)? onOpen,+ bool Function(Offset position)? ownsPointer,+}) => showPaneMenu<AccountMenuChoice>(context: context,- veilTint: Colors.transparent,- builder: (_) => AccountMenu(name: name, email: email, topInset: topInset),+ position: RelativeRect.fromLTRB(0, topInset + 6, 8, 0),+ minWidth: AccountMenu.width,+ maxWidth: AccountMenu.width,+ focusFirst: focusFirst,+ onOpen: onOpen == null ? null : (_, close) => onOpen(close),+ ownsPointer: ownsPointer,+ body: (close) => AccountMenu(name: name, email: email, onChoose: close),);-class AccountMenu extends StatefulWidget {+class AccountMenu extends StatelessWidget {const AccountMenu({super.key,required this.name,required this.email,- this.topInset = 0,+ required this.onChoose,});/// As the account gives it; empty when it has only an email.final String name;final String email;- final double topInset;+ final void Function(AccountMenuChoice? choice) onChoose;static const width = 264.0;- @override- State<AccountMenu> createState() => _AccountMenuState();-}--class _AccountMenuState extends State<AccountMenu> {- final _focus = FocusNode(debugLabel: 'Account menu');-// Add Phone stays once the account has a phone: a second one is added the// same way, and a row that was there at the first opening and gone at the// next read as a fault (1.2.64 learned of the phone only when the menu opened).@@ -65,158 +68,77 @@ class _AccountMenuState extends State<AccountMenu> {(AccountMenuChoice.settings, AppIcons.settings, 'Settings'),(AccountMenuChoice.signOut, AppIcons.logOut, 'Sign out'),];- late final _rowFocus = [- for (final (choice, _, _) in _rows)- FocusNode(debugLabel: 'Account menu: ${choice.name}'),- ];-- @override- void initState() {- super.initState();- // The keys are the menu's from the frame it appears: `autofocus` alone- // loses to the route's own first focus.- WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted) _focus.requestFocus();- });- }-- @override- void dispose() {- _focus.dispose();- for (final node in _rowFocus) {- node.dispose();- }- super.dispose();- }-- void _choose(AccountMenuChoice choice) => Navigator.of(context).pop(choice);-- /// Up and Down walk the rows, round and round. Opened, no row is lit — as a- /// menu a pointer opened is — so the first Down lands on the first and the- /// first Up on the last.- KeyEventResult _onKey(FocusNode node, KeyEvent event) {- if (event is KeyUpEvent) return KeyEventResult.ignored;- final delta = switch (event.logicalKey) {- LogicalKeyboardKey.arrowDown => 1,- LogicalKeyboardKey.arrowUp => -1,- _ => 0,- };- if (delta == 0) return KeyEventResult.ignored;- final current = _rowFocus.indexWhere((row) => row.hasPrimaryFocus);- final next = current < 0- ? (delta > 0 ? 0 : _rowFocus.length - 1)- : (current + delta) % _rowFocus.length;- _rowFocus[next].requestFocus();- return KeyEventResult.handled;- }@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);- final name = widget.name;- final email = widget.email;final title = name.isEmpty ? email : name;+ // The pane menu's surface draws the one rim; Escape, the arrows and+ // where the keyboard goes are its too.return DesktopChrome(- child: CallbackShortcuts(- bindings: {- const SingleActivator(LogicalKeyboardKey.escape): () =>- Navigator.of(context).pop(),- },- child: LayoutBuilder(- builder: (context, constraints) => Dialog(- alignment: Alignment.topRight,- insetPadding: EdgeInsets.fromLTRB(8, widget.topInset + 6, 8, 8),- backgroundColor: Colors.transparent,- surfaceTintColor: Colors.transparent,- elevation: 0,- constraints: BoxConstraints(- maxWidth: math.min(- AccountMenu.width,- math.max(0, constraints.maxWidth - 16),- ),- ),- child: DesktopDialogSurface(- key: const ValueKey('account-menu'),- radius: 12,- elevation: 12,- child: Semantics(- scopesRoute: true,- namesRoute: true,- explicitChildNodes: true,- label: 'Account',- child: Focus(- focusNode: _focus,- autofocus: true,- onKeyEvent: _onKey,- child: SingleChildScrollView(- padding: const EdgeInsets.symmetric(vertical: 6),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(15, 8, 15, 10),- child: Row(- children: [- ExcludeSemantics(- child: AccountAvatar(- initial: accountInitial(name, email),- diameter: 34,- accent: grid.AppPalette.swarmAccent,- ),- ),- const SizedBox(width: 11),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- key: const ValueKey('account-menu-name'),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.control(- medium: true,- ),- ),- // An account with no name says its email- // once, not twice.- if (name.isNotEmpty && email.isNotEmpty)- Text(- email,- key: const ValueKey(- 'account-menu-email',- ),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: DesktopChrome.metadata(),- ),- ],- ),- ),- ],- ),- ),- const AppMenuDivider(),- for (final (index, (choice, icon, label))- in _rows.indexed) ...[- // Sign out stands apart from what opens something.- if (choice == AccountMenuChoice.signOut)- const AppMenuDivider(),- AppMenuItem(- key: ValueKey('account-menu-${choice.name}'),- focusNode: _rowFocus[index],- icon: icon,- label: label,- onPressed: () => _choose(choice),+ child: Semantics(+ key: const ValueKey('account-menu'),+ scopesRoute: true,+ namesRoute: true,+ explicitChildNodes: true,+ label: 'Account',+ child: SingleChildScrollView(+ padding: const EdgeInsets.symmetric(vertical: 6),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Padding(+ padding: const EdgeInsets.fromLTRB(15, 8, 15, 10),+ child: Row(+ children: [+ ExcludeSemantics(+ child: AccountAvatar(+ initial: accountInitial(name, email),+ diameter: 34,+ accent: grid.AppPalette.swarmAccent,+ ),+ ),+ const SizedBox(width: 11),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ key: const ValueKey('account-menu-name'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.control(medium: true),),+ // An account with no name says its email once, not+ // twice.+ if (name.isNotEmpty && email.isNotEmpty)+ Text(+ email,+ key: const ValueKey('account-menu-email'),+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: DesktopChrome.metadata(),+ ),],- ],+ ),),- ),+ ],),),- ),+ const AppMenuDivider(),+ for (final (choice, icon, label) in _rows) ...[+ // Sign out stands apart from what opens something.+ if (choice == AccountMenuChoice.signOut) const AppMenuDivider(),+ AppMenuItem(+ key: ValueKey('account-menu-${choice.name}'),+ icon: icon,+ label: label,+ onPressed: () => onChoose(choice),+ ),+ ],+ ],),),),diff --git a/desktop/lib/widgets/agent_drag.dart b/desktop/lib/widgets/agent_drag.dartindex 6d1d6b4e1..1c2f4cc71 100644--- a/desktop/lib/widgets/agent_drag.dart+++ b/desktop/lib/widgets/agent_drag.dart@@ -128,6 +128,10 @@ class PaneHeaderButton extends StatelessWidget {: .22: emphasized? 1+ // The close mark is full ink at rest (AppIcons.closeInk),+ // as the tabs' ×; the quieter pane controls are not.+ : icon == AppPaneSymbol.close+ ? AppIcons.closeInk: MediaQuery.highContrastOf(context)? .7: .45,diff --git a/desktop/lib/widgets/desktop_chrome.dart b/desktop/lib/widgets/desktop_chrome.dartindex 095daab9a..14e89d8d0 100644--- a/desktop/lib/widgets/desktop_chrome.dart+++ b/desktop/lib/widgets/desktop_chrome.dart@@ -55,12 +55,19 @@ class DesktopChrome extends InheritedWidget {side: BorderSide(color: rim),);+ /// For a transparent [Dialog] that only places a surface drawing its own+ /// frame ([DesktopDialogSurface], [TerminalBox]). The theme's dialog shape+ /// still paints its radius-20 rim on a transparent Dialog, a second arc at+ /// each corner of a surface with another radius.+ static const bareDialogShape = RoundedRectangleBorder();+@overridebool updateShouldNotify(DesktopChrome oldWidget) => false;}/// Shared by creation, search, and their child choosers. A visible frame keeps/// the modal distinct from the workspace without turning it into another page.+/// A [Dialog] around it takes [DesktopChrome.bareDialogShape].class DesktopDialogSurface extends StatelessWidget {const DesktopDialogSurface({super.key,diff --git a/desktop/lib/widgets/desktop_prompt_surface.dart b/desktop/lib/widgets/desktop_prompt_surface.dartindex a3e34adf3..9d100a51f 100644--- a/desktop/lib/widgets/desktop_prompt_surface.dart+++ b/desktop/lib/widgets/desktop_prompt_surface.dart@@ -30,6 +30,7 @@ class DesktopPromptSurface extends StatelessWidget {insetPadding: const EdgeInsets.all(20),backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,child: SizedBox(width: width,child: DesktopDialogSurface(diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dartindex b5d697656..f376deee5 100644--- a/desktop/lib/widgets/desktop_workspace_tab.dart+++ b/desktop/lib/widgets/desktop_workspace_tab.dart@@ -104,9 +104,10 @@ class DesktopWorkspaceTab extends StatefulWidget {}// × inside the tab's curved body, shown only on hover; at rest the name and- // status have the whole tab. A 20pt target: 16pt was easy to click by- // mistake (owner, 2026-10-12).- static const closeWidth = 20.0;+ // status have the whole tab. The pane close button's square target+ // ([grid.AppDesktop.tabCloseSize]): 16pt was easy to click by mistake+ // (owner, 2026-10-12).+ static const closeWidth = grid.AppDesktop.tabCloseSize;static const _restingInset = grid.AppDesktop.tabShoulder + 6;static const _revealedInset = closeWidth + grid.AppDesktop.tabCloseInset;static const _statusWidth = 16.0, _indicatorGap = 6.0;@@ -325,7 +326,8 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {Widget build(BuildContext context) {grid.AppTheme.watch(context);final enabled = widget.onSelect != null;- final quietOpacity = MediaQuery.highContrastOf(context) ? .7 : .45;+ // The × is full ink at rest, as the pane's (AppIcons.closeInk).+ const quietOpacity = AppIcons.closeInk;final focusVisible = _focused || widget.highlighted;// Workspace palettes can stay dark beside light app surfaces. Match the// native tab bar's ink to its own surface, independent of terminal colors.@@ -547,7 +549,7 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {padding: EdgeInsets.zero,constraints: const BoxConstraints.tightFor(width: DesktopWorkspaceTab.closeWidth,- height: 32,+ height: DesktopWorkspaceTab.closeWidth,),style: _accessoryStyle(foreground, quietOpacity),icon: const Icon(diff --git a/desktop/lib/widgets/link_another_machine_dialog.dart b/desktop/lib/widgets/link_another_machine_dialog.dartindex 8222af28c..56c0faff5 100644--- a/desktop/lib/widgets/link_another_machine_dialog.dart+++ b/desktop/lib/widgets/link_another_machine_dialog.dart@@ -12,6 +12,7 @@ import '../shortcuts/keymap_commands.dart' show describeKeyBinding;import '../state/app_state.dart';import '../terminal/terminal_text.dart';import 'box_chrome.dart';+import 'desktop_chrome.dart' show DesktopChrome;import 'link_machine_dialog.dart';import 'link_machine_screen.dart';@@ -661,6 +662,7 @@ class _LinkAnotherMachineDialogState extends State<_LinkAnotherMachineDialog> {insetPadding: const EdgeInsets.fromLTRB(16, 56, 16, 18),elevation: 0,backgroundColor: Colors.transparent,+ shape: DesktopChrome.bareDialogShape,child: _keys(Focus(onKeyEvent: _key,diff --git a/desktop/lib/widgets/link_machine_screen.dart b/desktop/lib/widgets/link_machine_screen.dartindex f39acd3e5..626e15335 100644--- a/desktop/lib/widgets/link_machine_screen.dart+++ b/desktop/lib/widgets/link_machine_screen.dart@@ -37,6 +37,7 @@ Future<void> showLinkMachineScreenDialog(builder: (context) => Dialog(backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.all(20),child: ListenableBuilder(listenable: notifier,diff --git a/desktop/lib/widgets/move_pane_palette.dart b/desktop/lib/widgets/move_pane_palette.dartindex 8237a7764..85d5f472b 100644--- a/desktop/lib/widgets/move_pane_palette.dart+++ b/desktop/lib/widgets/move_pane_palette.dart@@ -183,6 +183,7 @@ class _MovePanePaletteState extends State<_MovePanePalette> {insetPadding: const EdgeInsets.all(24),backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,child: DesktopDialogSurface(child: SizedBox(width: grid.AppDesktop.formWidth,diff --git a/desktop/lib/widgets/new_harness_attachment_chip.dart b/desktop/lib/widgets/new_harness_attachment_chip.dartindex 36cb58225..90e726363 100644--- a/desktop/lib/widgets/new_harness_attachment_chip.dart+++ b/desktop/lib/widgets/new_harness_attachment_chip.dart@@ -18,6 +18,10 @@ class NewHarnessAttachmentChip extends StatelessWidget {final HarnessAttachment file;final VoidCallback? onRemove;+ /// The × in a chip stays small beside its file name; it is not a workspace+ /// close mark ([AppIcons.closeSize]).+ static const removeIconSize = 12.0;+/// A picture shows itself; anything else, the mark of its kind.Widget _mark() {final icon = Icon(@@ -71,7 +75,7 @@ class NewHarnessAttachmentChip extends StatelessWidget {AppIconButton(icon: AppIcons.close,tooltip: 'Remove ${file.name}',- size: AppIcons.closeSize,+ size: removeIconSize,onPressed: onRemove,),],diff --git a/desktop/lib/widgets/notification_inbox.dart b/desktop/lib/widgets/notification_inbox.dartindex fba0301d1..eee51fe2f 100644--- a/desktop/lib/widgets/notification_inbox.dart+++ b/desktop/lib/widgets/notification_inbox.dart@@ -6,23 +6,46 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/app_dialog.dart';import '../state/app_state.dart';import '../state/harness_activity.dart';import '../state/notification_inbox.dart';import 'desktop_chrome.dart';+import 'pane_menu.dart';+/// The bell's inbox, a titlebar dropdown ([showPaneMenu]): an overlay with no+/// veil, so a click outside closes it and lands where it was aimed, and it+/// never holds the titlebar.Future<void> showNotificationInbox(BuildContext context, {required AppNotifier app,required Future<bool> Function(InboxNotification) onOpen,double topInset = 0,-}) => showAppDialog<void>(- context: context,- veilTint: Colors.transparent,- builder: (_) =>- NotificationInbox(app: app, onOpen: onOpen, topInset: topInset),-);+ void Function(void Function() close)? onOpened,+ bool Function(Offset position)? ownsPointer,+}) {+ // A harness the list opened keeps the keyboard it was given; only a list+ // closed without a result gives it back to whoever had it.+ var restoreFocus = true;+ return showPaneMenu<void>(+ context: context,+ position: RelativeRect.fromLTRB(0, topInset + 16, 16, 0),+ minWidth: NotificationInbox.width,+ maxWidth: NotificationInbox.width,+ focusFirst: false,+ onOpen: onOpened == null ? null : (_, close) => onOpened(close),+ ownsPointer: ownsPointer,+ shouldRestoreFocus: () => restoreFocus,+ body: (close) => NotificationInbox(+ app: app,+ onOpen: (row) async {+ final opened = await onOpen(row);+ if (opened) restoreFocus = false;+ return opened;+ },+ onClose: () => close(null),+ ),+ );+}/// The existing unread notifications in a quiet, live list beside the bell.class NotificationInbox extends StatefulWidget {@@ -30,12 +53,14 @@ class NotificationInbox extends StatefulWidget {super.key,required this.app,required this.onOpen,- this.topInset = 0,+ required this.onClose,});final AppNotifier app;final Future<bool> Function(InboxNotification) onOpen;- final double topInset;+ final VoidCallback onClose;++ static const width = 440.0;@overrideState<NotificationInbox> createState() => _NotificationInboxState();@@ -106,7 +131,7 @@ class _NotificationInboxState extends State<NotificationInbox> {final opened = await widget.onOpen(current);if (!mounted) return;if (opened) {- Navigator.of(context).pop();+ widget.onClose();} else {setState(() => _error = 'Could not open this harness. Try again.');}@@ -178,106 +203,74 @@ class _NotificationInboxState extends State<NotificationInbox> {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);+ // The pane menu's surface draws the one rim; Escape is its too.return DesktopChrome(- child: LayoutBuilder(- builder: (context, constraints) {- final width = math.min(- 440.0,- math.max(0.0, constraints.maxWidth - 32),- );- final available = math.max(- 0.0,- constraints.maxHeight - widget.topInset - 32,- );- return Dialog(- alignment: Alignment.topRight,- insetPadding: EdgeInsets.fromLTRB(16, widget.topInset + 16, 16, 16),- backgroundColor: Colors.transparent,- surfaceTintColor: Colors.transparent,- elevation: 0,- constraints: BoxConstraints(maxWidth: width),- child: SizedBox(- key: const ValueKey('notification-inbox'),- width: width,- child: ConstrainedBox(- constraints: BoxConstraints(- maxHeight: math.min(520, available),- ),- child: DesktopDialogSurface(- radius: 12,- elevation: 12,- child: Semantics(- scopesRoute: true,- namesRoute: true,- explicitChildNodes: true,- label: 'Notifications',- child: Focus(- focusNode: _focus,- autofocus: true,- onKeyEvent: _onKey,- child: ListenableBuilder(- listenable: _focus,- builder: (context, _) => Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- _header(),- Divider(height: 1, color: DesktopChrome.rim),- Flexible(- child: _rows.isEmpty- ? Padding(- padding: const EdgeInsets.symmetric(- horizontal: 24,- vertical: 40,- ),- child: Text(- 'No notifications',- textAlign: TextAlign.center,- style: DesktopChrome.control(- color: DesktopChrome.muted,- ),- ),- )- : ListView.builder(- controller: _scroll,- shrinkWrap: true,- itemCount: _rows.length,- padding: const EdgeInsets.all(8),- itemExtent: _rowExtent,- itemBuilder: (context, index) =>- _notificationRow(_rows[index]),- ),- ),- if (_error != null && _rows.isNotEmpty)- Padding(- padding: const EdgeInsets.fromLTRB(- 20,- 4,- 20,- 16,- ),- child: Semantics(- liveRegion: true,- child: Text(- _error!,- style: DesktopChrome.control(- color: Theme.of(context)- .colorScheme- .error,- ),- ),+ child: SizedBox(+ key: const ValueKey('notification-inbox'),+ width: NotificationInbox.width,+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxHeight: 520),+ child: Semantics(+ scopesRoute: true,+ namesRoute: true,+ explicitChildNodes: true,+ label: 'Notifications',+ child: Focus(+ focusNode: _focus,+ autofocus: true,+ onKeyEvent: _onKey,+ child: ListenableBuilder(+ listenable: _focus,+ builder: (context, _) => Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ _header(),+ Divider(height: 1, color: DesktopChrome.rim),+ Flexible(+ child: _rows.isEmpty+ ? Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: 24,+ vertical: 40,+ ),+ child: Text(+ 'No notifications',+ textAlign: TextAlign.center,+ style: DesktopChrome.control(+ color: DesktopChrome.muted,),),- ],+ )+ : ListView.builder(+ controller: _scroll,+ shrinkWrap: true,+ itemCount: _rows.length,+ padding: const EdgeInsets.all(8),+ itemExtent: _rowExtent,+ itemBuilder: (context, index) =>+ _notificationRow(_rows[index]),+ ),+ ),+ if (_error != null && _rows.isNotEmpty)+ Padding(+ padding: const EdgeInsets.fromLTRB(20, 4, 20, 16),+ child: Semantics(+ liveRegion: true,+ child: Text(+ _error!,+ style: DesktopChrome.control(+ color: Theme.of(context).colorScheme.error,+ ),+ ),),),- ),- ),+ ],),),),- );- },+ ),+ ),),);}@@ -313,7 +306,7 @@ class _NotificationInboxState extends State<NotificationInbox> {IconButton(key: const ValueKey('notification-inbox-close'),tooltip: 'Close notifications',- onPressed: () => Navigator.of(context).pop(),+ onPressed: widget.onClose,icon: const Icon(AppIcons.close, size: 18),constraints: const BoxConstraints(minWidth: 32, minHeight: 32),padding: const EdgeInsets.all(6),diff --git a/desktop/lib/widgets/pane_menu.dart b/desktop/lib/widgets/pane_menu.dartindex 05aae2119..e457bb309 100644--- a/desktop/lib/widgets/pane_menu.dart+++ b/desktop/lib/widgets/pane_menu.dart@@ -33,6 +33,9 @@ import 'transient_menus.dart';/// [focusFirst] highlights the first row as the menu opens, for a menu a key opened: Return takes/// it. A menu a click opened passes false — the pointer picks the row, and arrows still start at/// the first one.+///+/// [ownsPointer] names the button that opened the menu: a press there is left to that button,+/// which closes the menu itself, rather than closing it here and opening it again on release.Future<T?> showPaneMenu<T>({required BuildContext context,required RelativeRect position,@@ -41,6 +44,7 @@ Future<T?> showPaneMenu<T>({void Function(OverlayEntry entry, void Function() close)? onOpen,VoidCallback? onClose,bool Function()? shouldRestoreFocus,+ bool Function(Offset position)? ownsPointer,bool focusFirst = true,double minWidth = 340,double maxWidth = 540,@@ -81,7 +85,9 @@ Future<T?> showPaneMenu<T>({Positioned.fill(child: Listener(behavior: HitTestBehavior.translucent,- onPointerDown: (_) => close(null),+ onPointerDown: (event) {+ if (ownsPointer?.call(event.position) != true) close(null);+ },child: const SizedBox.expand(),),),diff --git a/desktop/lib/widgets/remote_folder_picker.dart b/desktop/lib/widgets/remote_folder_picker.dartindex 90d9cb62c..0b807b267 100644--- a/desktop/lib/widgets/remote_folder_picker.dart+++ b/desktop/lib/widgets/remote_folder_picker.dart@@ -533,6 +533,7 @@ class _RemoteFolderPickerDialogState extends State<_RemoteFolderPickerDialog> {key: const ValueKey('desktop-remote-folder-dialog'),backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24),child: ConstrainedBox(constraints: const BoxConstraints(maxWidth: 620, maxHeight: 620),diff --git a/desktop/lib/widgets/resting_model_words.dart b/desktop/lib/widgets/resting_model_words.dartindex 6b8a77d01..84dd1bddf 100644--- a/desktop/lib/widgets/resting_model_words.dart+++ b/desktop/lib/widgets/resting_model_words.dart@@ -57,12 +57,10 @@ String listAge(int seconds) {return '${seconds ~/ 86400}d ago';}-/// The asleep section's subtitle. The age is left off when the daemon did not send one — a list-/// with no known age is still a resting section, and "from ? ago" would be a guess.-String restingSubtitle(int? lastKnownAge) => [- 'Asleep',- if (lastKnownAge != null) listAge(lastKnownAge),-].join(' ');+/// The asleep section's subtitle: how old its list is. No state word — [kRestingTooltip] says why+/// it rests. Null when the daemon sent no age: "from ? ago" would be a guess.+String? restingSubtitle(int? lastKnownAge) =>+ lastKnownAge == null ? null : listAge(lastKnownAge);/// A wake that could not start [section]. The account's own section is "your models" — its name is/// an internal id nobody chose — and a shared one goes by the name it is listed under.diff --git a/desktop/lib/widgets/session_work_dialog.dart b/desktop/lib/widgets/session_work_dialog.dartindex 214c25138..d079e1928 100644--- a/desktop/lib/widgets/session_work_dialog.dart+++ b/desktop/lib/widgets/session_work_dialog.dart@@ -179,6 +179,7 @@ class _SessionWorkDialogState extends State<SessionWorkDialog> {child: Dialog(backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.all(16),child: ConstrainedBox(constraints: BoxConstraints(diff --git a/desktop/lib/widgets/swarm_dialogs.dart b/desktop/lib/widgets/swarm_dialogs.dartindex fb49c3d7f..8360c8eb1 100644--- a/desktop/lib/widgets/swarm_dialogs.dart+++ b/desktop/lib/widgets/swarm_dialogs.dart@@ -133,6 +133,7 @@ class _ProjectDialogState extends State<_ProjectDialog> {return Dialog(backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,insetPadding: const EdgeInsets.all(24),child: SizedBox(width: 508,diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex 8d819c656..f77a312f1 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -88,6 +88,7 @@ class _SwarmHistoryState extends State<_SwarmHistory> {insetPadding: const EdgeInsets.all(20),backgroundColor: Colors.transparent,elevation: 0,+ shape: DesktopChrome.bareDialogShape,child: SizedBox(width: 680,height: 480,diff --git a/desktop/macos/Runner/HarnessStatusMenu.swift b/desktop/macos/Runner/HarnessStatusMenu.swiftindex ed2354eb8..a18b2eb93 100644--- a/desktop/macos/Runner/HarnessStatusMenu.swift+++ b/desktop/macos/Runner/HarnessStatusMenu.swift@@ -227,6 +227,11 @@ final class HarnessStatusMenu: NSObject, NSMenuDelegate {case "clearStatusNotifications":guard enabled, let receipts = item.representedObject as? [[String: Any]] else { return }emit(action, ["receipts": receipts])+ case "notificationInbox":+ // Opens the inbox; only a titlebar button toggles it, so an open one stays.+ guard enabled else { return }+ showWindow()+ emit(action, ["open": true])default:guard enabled else { return }showWindow()diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex 6ab40ae16..bd4019979 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -6,6 +6,8 @@ import ImageIO/// Controls share one optical size; hover changes ink, never the silhouette.enum HarnessControlSymbols {static let size: CGFloat = 16+ /// The close mark's ink at rest, as a share of the foreground (AppIcons.closeInk).+ static let closeInk: CGFloat = 1static let configuration = NSImage.SymbolConfiguration(pointSize: size, weight: .regular)/// The same, in one ink. Device symbols such as `iphone` also carry a filled/// screen layer that the default rendering tints grey, so beside the plain@@ -80,7 +82,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {})strip.emit = { [weak self] method, args inguard let self else { return }- self.sendTabAction(method, arguments: args)+ self.sendTabAction(method, arguments: args, fromRow: true)}channel.setMethodCallHandler { [weak self] call, result inguard let self else { result(nil); return }@@ -111,7 +113,10 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {self.strip.update(state)self.statusMenu?.update(state)self.statusBarHeight?.constant = self.strip.preferredStatusBarHeight- self.window?.backgroundColor = self.strip.palette.tabBar+ // A new background repaints the whole window, title bar included: only on a change.+ if let window = self.window, window.backgroundColor != self.strip.palette.tabBar {+ window.backgroundColor = self.strip.palette.tabBar+ }result(nil)case "machinesState":let state = call.arguments as? [String: Any] ?? [:]@@ -161,16 +166,26 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {observers.forEach(NotificationCenter.default.removeObserver)}- private func sendTabAction(_ method: String, arguments: Any?) {+ private func sendTabAction(_ method: String, arguments: Any?, fromRow: Bool = false) {+ // Menus off with the row still live means Settings is up (Dart's `stripEnabled`). The row's+ // actions then arrive as `rowAction`, so Dart closes Settings before acting, while anything+ // else stays dropped behind it.+ var name = method, payload = arguments+ if fromRow && !actionsEnabled {+ var wrapped: [String: Any] = ["method": method]+ if let arguments { wrapped["arguments"] = arguments }+ name = "rowAction"+ payload = wrapped+ }guard ["daemon", "subscriptions", "focusedContext", "harnessControls", "resourceMonitor", "machineControls", "modelControls", "select", "close", "new", "rename", "commands", "notifications", "notificationInbox", "openStatusHarness", "store", "devices", "sessions", "models", "addAgent", "newAgent", "newTerminal", "cloneAgent", "restartAgent", "shareAgent", "removeFromTab", "toggleLeader", "toggleTabActivity", "toggleViewer", "toggleComposer", "movePaneToTab", "runLocalModel", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines", "machineList"].contains(method) else {- channel.invokeMethod(method, arguments: arguments)+ channel.invokeMethod(name, arguments: payload)return}tabActionGeneration += 1let generation = tabActionGeneration// Keyboard/VoiceOver activation can leave a button as responder. Wait for// Flutter to apply the action before giving the next key to its content.- channel.invokeMethod(method, arguments: arguments) { [weak self, weak responder = window?.firstResponder] result in+ channel.invokeMethod(name, arguments: payload) { [weak self, weak responder = window?.firstResponder] result inguard let self, let window = self.window, generation == self.tabActionGeneration,!(result is FlutterError), result as? NSObject !== FlutterMethodNotImplemented,window.firstResponder === responder || window.firstResponder === window else { return }@@ -1007,12 +1022,21 @@ private class SwarmIconButton: NSButton {var showsHoverFill: Bool { true }override var acceptsFirstResponder: Bool { isEnabled }override var mouseDownCanMoveWindow: Bool { false }+ // Dart restates the titlebar's whole state on every update. Only a change+ // repaints, so an update never flickers a control off and on.override var isEnabled: Bool {- didSet {+ get { super.isEnabled }+ set {+ guard newValue != super.isEnabled else { return }+ super.isEnabled = newValueneedsDisplay = truewindow?.invalidateCursorRects(for: self)}}+ override var font: NSFont? {+ get { super.font }+ set { if newValue != super.font { super.font = newValue } }+ }override func updateTrackingAreas() {super.updateTrackingAreas()@@ -1076,9 +1100,11 @@ private let workspaceBarSpacing = try! NSRegularExpression(pattern: " {3}| ")/// Plain toolbar icons emphasize the glyph without a button well.private class SwarmPlainIconButton: SwarmIconButton {- var foreground = NSColor.white { didSet { needsDisplay = true } }- var restingOpacity: CGFloat = 0.75 { didSet { needsDisplay = true } }- var highContrastRestingOpacity: CGFloat? { didSet { needsDisplay = true } }+ var foreground = NSColor.white { didSet { if foreground != oldValue { needsDisplay = true } } }+ var restingOpacity: CGFloat = 0.75 { didSet { if restingOpacity != oldValue { needsDisplay = true } } }+ var highContrastRestingOpacity: CGFloat? {+ didSet { if highContrastRestingOpacity != oldValue { needsDisplay = true } }+ }override func draw(_ dirtyRect: NSRect) {let emphasized = isEnabled && (hovered || hasKeyboardFocus || isHighlighted)@@ -1104,7 +1130,7 @@ private class SwarmPlainIconButton: SwarmIconButton {/// title stays for accessibility and the tooltip; it is not drawn.private final class SwarmStoreButton: SwarmIconButton {var markSize: CGFloat = 18- var palette = SwarmNativePalette() { didSet { needsDisplay = true } }+ var palette = SwarmNativePalette() { didSet { if palette != oldValue { needsDisplay = true } } }/// The search icon's slot.var preferredWidth: CGFloat { 32 }@@ -1132,10 +1158,10 @@ private final class SwarmStoreButton: SwarmIconButton {/// (WorkspaceSignInButton / WorkspaceAvatarButton in Flutter).private final class SwarmAccountButton: SwarmIconButton {enum Kind { case signIn, avatar }- var kind = Kind.signIn { didSet { needsDisplay = true } }+ var kind = Kind.signIn { didSet { if kind != oldValue { needsDisplay = true } } }/// One letter, or empty while the profile has not been read.- var initial = "" { didSet { needsDisplay = true } }- var palette = SwarmNativePalette() { didSet { needsDisplay = true } }+ var initial = "" { didSet { if initial != oldValue { needsDisplay = true } } }+ var palette = SwarmNativePalette() { didSet { if palette != oldValue { needsDisplay = true } } }static let label = "Sign in"static let avatarDiameter: CGFloat = 24private var labelFont: NSFont { NSFont.systemFont(ofSize: 13, weight: .medium) }@@ -1230,7 +1256,31 @@ private final class SwarmShareButton: SwarmIconButton {}}-private final class SwarmStripScrollView: NSScrollView {+/// The tab row scrolls only sideways. A trackpad swipe's vertical part would otherwise+/// rubber-band the tabs up and down, since AppKit's default vertical elasticity applies+/// even to a document no taller than the row.+final class SwarmStripScrollView: NSScrollView {+ /// Pins the row's vertical offset at 0. Wheel and elastic scrolling ask constrainBoundsRect;+ /// scroll(to:), which scrollToVisible uses, bypasses it.+ private final class ClipView: NSClipView {+ override func constrainBoundsRect(_ proposedBounds: NSRect) -> NSRect {+ var bounds = super.constrainBoundsRect(proposedBounds)+ bounds.origin.y = 0+ return bounds+ }+ override func scroll(to newOrigin: NSPoint) {+ super.scroll(to: NSPoint(x: newOrigin.x, y: 0))+ }+ }++ override init(frame frameRect: NSRect) {+ super.init(frame: frameRect)+ contentView = ClipView()+ verticalScrollElasticity = .none+ horizontalScrollElasticity = .automatic+ }+ required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }+override func scrollWheel(with event: NSEvent) {let dx = event.scrollingDeltaX, dy = event.scrollingDeltaYguard abs(dy) > abs(dx), let document = documentView,@@ -2040,6 +2090,10 @@ private final class SwarmTabStrip: NSView {private var motionObserver: NSObjectProtocol?private var modifierMonitor: Any?private var shortcutHintsVisible = false+ /// Whether the menu shortcuts work (Dart's `enabled`). The tabs' ⌘1… hints teach them, so they+ /// follow these, not the row's `actionsEnabled`, which stays on over Settings.+ private var shortcutsEnabled = false+ private var showsShortcutHints: Bool { shortcutHintsVisible && shortcutsEnabled }private var lastBackgroundClick: (time: TimeInterval, point: NSPoint)?// Dragging is explicit below. AppKit must not also start a titlebar gesture.override var mouseDownCanMoveWindow: Bool { false }@@ -2276,7 +2330,7 @@ private final class SwarmTabStrip: NSView {private func setShortcutHintsVisible(_ visible: Bool) {shortcutHintsVisible = visible- for tab in tabs { tab.showsShortcutHint = visible && actionsEnabled }+ for tab in tabs { tab.showsShortcutHint = showsShortcutHints }}/// Tabs whose status slot moves: a working spinner.@@ -2334,7 +2388,10 @@ private final class SwarmTabStrip: NSView {func update(_ state: [String: Any]) {// Workspace teardown clears its controls without changing appearance.if let palette = state["palette"] as? [String: Any] { updatePalette(palette) }- actionsEnabled = state["enabled"] as? Bool == true+ // The row stays live over Settings, which its actions close first (Dart's `stripEnabled`);+ // menus and shortcuts follow `enabled`.+ actionsEnabled = (state["stripEnabled"] ?? state["enabled"]) as? Bool == true+ shortcutsEnabled = state["enabled"] as? Bool == true// The footer is a sibling above Flutter. Let Flutter's modal backdrop// cover this area too, including hit testing and accessibility.statusBar.isHidden = (state["tabs"] as? [Any])?.isEmpty != false || state["footerCovered"] as? Bool == true@@ -2497,7 +2554,7 @@ private final class SwarmTabStrip: NSView {: displayLabeltab.shortcutHint = row.keys.contains("shortcutHint")? row["shortcutHint"] as? String : (index < 9 ? "⌘\(index + 1)" : nil)- tab.showsShortcutHint = shortcutHintsVisible && actionsEnabled+ tab.showsShortcutHint = showsShortcutHintstab.foreground = palette.navigationForegroundtab.selected = id == activeIdtab.keyboardFocus = tabsFocused && id == activeId@@ -2514,15 +2571,16 @@ private final class SwarmTabStrip: NSView {self.emit?(method, args)}tab.hoverChanged = { [weak self] in self?.updateDividers() }+ // Each property above repaints the tab when it changes; an unchanged row leaves it be.if tab.superview == nil { document.addSubview(tab) }- tab.needsDisplay = truereturn tab}updateDividers()// Moving frames alone leaves AppKit's child traversal in insertion order.document.setAccessibilityChildren(tabs)newButton.isEnabled = actionsEnabled- needsDisplay = true+ // No repaint of the whole row: its own drawing follows the palette+ // (updatePalette), and each control repaints only when it changes.needsLayout = truelayoutSubtreeIfNeeded()syncActivityAnimation()@@ -2684,7 +2742,6 @@ private final class SwarmTabStrip: NSView {var x: CGFloat = 0for (tab, width) in zip(tabs, widths) {tab.frame = NSRect(x: x, y: 0, width: width, height: bounds.height)- tab.contentCenterY = bounds.midYx += width}newButton.frame = NSRect(x: scroll.frame.maxX, y: (bounds.height - toolHeight) / 2,@@ -2876,25 +2933,46 @@ private final class SwarmTabStrip: NSView {}}+/// Where a tab's body, content and × sit in its bounds (AppKit's y-up coordinates).+enum SwarmTabGeometry {+ // Mirrors AppDesktop.tabTopInset: the body starts this far below the strip's top.+ static let topInset: CGFloat = 6+ // Mirrors AppDesktop.tabShoulder: the body's straight sides stand this far in.+ static let shoulder: CGFloat = 8+ // × as the pane's close button (PaneCloseButton), the owner's reference: a 28pt+ // square target (AppDesktop.tabCloseSize) inside the curved tab body, shown+ // only on hover; at rest the name and status have the whole tab. 16pt was+ // "really easy to click by mistake" (owner, 2026-10-12). Agent Messages' 💬 that+ // sat left of it went the same day: easy to hit by mistake, it turned the tab off+ // and failed a message that was waiting. Settings ▸ Experimental holds that switch now.+ static let closeSide: CGFloat = 28+ /// The visible, filled tab body.+ static func shapeRect(in bounds: NSRect) -> NSRect {+ NSRect(x: bounds.minX, y: bounds.minY, width: bounds.width, height: max(0, bounds.height - topInset))+ }+ /// The name, status and × centre on the body, as Flutter's do below its top padding,+ /// not on the whole tab, which would set them topInset / 2 high.+ static func contentCenterY(in bounds: NSRect) -> CGFloat { shapeRect(in: bounds).midY }+ /// The × target: a square as large as the body allows up to closeSide, with one gap above, below+ /// and to the body's straight right side (AppDesktop.tabCloseInset is shoulder + that gap at 40pt).+ static func closeFrame(in bounds: NSRect) -> NSRect {+ let body = shapeRect(in: bounds)+ let side = min(closeSide, body.height)+ let gap = (body.height - side) / 2+ return NSRect(x: max(0, bounds.maxX - shoulder - gap - side), y: body.minY + gap, width: side, height: side)+ }+ /// Room the revealed × takes from the tab's right edge.+ static func closeInset(in bounds: NSRect) -> CGFloat { bounds.maxX - closeFrame(in: bounds).minX }+}+private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidation {// Mirrors AppDesktop.tabMinWidth/tabMaxWidth. Labels never size the tabs.static let minimumLayoutWidth: CGFloat = 128static let maximumLayoutWidth: CGFloat = 256// Mirrors AppDesktop.tabRadius/tabShoulder in desktop-design-system.md.private static let upperRadius: CGFloat = 10- private static let shoulder: CGFloat = 8- private static let topInset: CGFloat = 6- // Mirror AppDesktop.tabCloseInset and DesktopWorkspaceTab: × as a 32pt-tall- // target inside the curved tab body, shown only on hover; at rest the name- // and status have the whole tab. A 20pt target: 16pt was "really easy to- // click by mistake" (owner, 2026-10-12). Agent Messages' 💬 that sat left of- // it went the same day: easy to hit by mistake, it turned the tab off and- // failed a message that was waiting. Settings ▸ Experimental holds that switch now.- private static let trailingInset: CGFloat = 8- private static let accessoryHeight: CGFloat = 32- private static let closeWidth: CGFloat = 20+ private static let shoulder = SwarmTabGeometry.shoulderprivate static let restingInset: CGFloat = shoulder + 6- private static let revealedInset: CGFloat = trailingInset + closeWidthprivate static let gap: CGFloat = 6private static let activityWidth: CGFloat = 16@@ -2985,7 +3063,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati/// The name, centered with its status. Revealed, it moves left only as far/// as × needs, then gives up its tail; a name with room never moves.private func titleRect(revealed: Bool) -> NSRect {- let right = revealed ? Self.revealedInset : Self.restingInset+ let right = revealed ? SwarmTabGeometry.closeInset(in: bounds) : Self.restingInsetlet width = min(naturalTitleWidth, max(0, bounds.width - Self.restingInset - right - trailingSpace))let group = width + trailingSpacelet x = max(Self.restingInset, min((bounds.width - group) / 2, bounds.width - right - group))@@ -3011,7 +3089,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati/// Flutter holds the keyboard after Close; accessibility explains Return.var keyboardFocus = false { didSet { if keyboardFocus != oldValue { needsDisplay = true; updateAccessibility() } } }var showsDivider = false { didSet { if showsDivider != oldValue { needsDisplay = true } } }- var contentCenterY: CGFloat = 20+ private var contentCenterY: CGFloat { SwarmTabGeometry.contentCenterY(in: bounds) }var emit: ((String, Any?) -> Void)?var hoverChanged: (() -> Void)?var isHovered: Bool { hovered && actionsEnabled }@@ -3044,6 +3122,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiprivate var cachedSharedLabel: MeasuredLabel?var actionsEnabled = true {didSet {+ guard actionsEnabled != oldValue else { return }selectButton.isEnabled = actionsEnabledcloseButton.isEnabled = actionsEnabledupdateAccessoryVisibility()@@ -3071,11 +3150,13 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidaticloseButton.title = ""closeButton.isBordered = falsecloseButton.image = HarnessControlSymbols.image("xmark")- // The pane's close mark, 12pt Lucide x: 7pt across with a 1.07pt stroke. 9pt semibold xmark draws 7.2pt- // with 1.04pt (measured); 8pt regular drew 6.2pt with half the stroke, "too small" beside it (owner, 2026-10-12).- closeButton.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 9, weight: .semibold)- closeButton.restingOpacity = 0.45- closeButton.highContrastRestingOpacity = 0.7+ // A symbol beside text takes the text's point size and weight (HIG): the title's 13pt regular, at+ // the small scale. Measured (2026-10-20) it is 8.8pt across with a 1.0pt stroke beside the title's+ // 1.1pt stems; the pane's and the Flutter tab's × (AppIcons.closeSize, 14pt Lucide x) is 8.2pt with+ // 1.1. Full ink at rest (closeInk); emphasis is the glyph's own, never a fill around it.+ closeButton.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: labelFont.pointSize,+ weight: .regular, scale: .small)+ closeButton.restingOpacity = HarnessControlSymbols.closeInkcloseButton.imagePosition = .imageOnlycloseButton.foreground = foregroundcloseButton.target = self@@ -3111,9 +3192,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatioverride func layout() {super.layout()selectButton.frame = bounds- let closeX = max(0, bounds.width - Self.trailingInset - Self.closeWidth)- closeButton.frame = NSRect(x: closeX, y: contentCenterY - Self.accessoryHeight / 2,- width: min(Self.closeWidth, bounds.width), height: Self.accessoryHeight)+ closeButton.frame = SwarmTabGeometry.closeFrame(in: bounds)let fullName = name.trimmingCharacters(in: .whitespacesAndNewlines)var hints: [String] = []// A tooltip shows under the pointer, where the name has its revealed room.@@ -3240,7 +3319,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati}private var tabShape: NSBezierPath {let path = NSBezierPath()- let top = max(0, bounds.maxY - Self.topInset)+ let top = SwarmTabGeometry.shapeRect(in: bounds).maxYlet shoulder = min(Self.shoulder, bounds.width / 4, top / 3)let radius = min(Self.upperRadius, max(0, bounds.width / 2 - shoulder), max(0, (top - shoulder) / 2))let left = bounds.minX + shoulder, right = bounds.maxX - shoulder@@ -3279,7 +3358,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiif actionsEnabled && selectButton.hasKeyboardFocus {NSColor.controlAccentColor.setStroke()let focus = NSBezierPath(roundedRect: NSRect(x: Self.shoulder + 2, y: 3,- width: max(0, bounds.width - 2 * (Self.shoulder + 2)), height: max(0, bounds.height - Self.topInset - 6)),+ width: max(0, bounds.width - 2 * (Self.shoulder + 2)), height: max(0, bounds.height - SwarmTabGeometry.topInset - 6)),xRadius: Self.upperRadius - 2, yRadius: Self.upperRadius - 2)focus.lineWidth = 1.5focus.stroke()diff --git a/desktop/macos/RunnerTests/RunnerTests.swift b/desktop/macos/RunnerTests/RunnerTests.swiftindex 61f3bd1fc..0e83e9987 100644--- a/desktop/macos/RunnerTests/RunnerTests.swift+++ b/desktop/macos/RunnerTests/RunnerTests.swift@@ -1,6 +1,7 @@import Cocoaimport FlutterMacOSimport XCTest+@testable import Harnessclass RunnerTests: XCTestCase {@@ -10,3 +11,229 @@ class RunnerTests: XCTestCase {}}++/// The native tab row: it scrolls only sideways, and each tab's × sits in the middle of the tab's body.+final class SwarmTabStripTests: XCTestCase {+ private func verticalSwipe(_ dy: Int32) -> NSEvent {+ let event = CGEvent(scrollWheelEvent2Source: nil, units: .pixel, wheelCount: 2, wheel1: dy, wheel2: 0, wheel3: 0)!+ return NSEvent(cgEvent: event)!+ }++ func testStripHasNoVerticalElasticity() {+ let scroll = SwarmStripScrollView(frame: NSRect(x: 0, y: 0, width: 300, height: 40))+ XCTAssertEqual(scroll.verticalScrollElasticity, .none)+ XCTAssertEqual(scroll.horizontalScrollElasticity, .automatic)+ }++ // A synthetic wheel event never moves an NSScrollView here (a plain one stays put too), so this+ // drives the two ways an offset reaches the clip view: AppKit's wheel and elastic scrolling ask+ // constrainBoundsRect, and scroll(to:) / scrollToVisible set it directly.+ func testNothingMovesTheStripVertically() {+ let scroll = SwarmStripScrollView(frame: NSRect(x: 0, y: 0, width: 300, height: 40))+ // Taller than the strip, so any vertical offset that gets through is visible.+ let document = NSView(frame: NSRect(x: 0, y: 0, width: 900, height: 80))+ scroll.documentView = document+ let proposed = NSRect(x: 0, y: 20, width: 300, height: 40)+ XCTAssertEqual(scroll.contentView.constrainBoundsRect(proposed).origin.y, 0)+ scroll.contentView.scroll(to: NSPoint(x: 0, y: 20))+ XCTAssertEqual(scroll.contentView.bounds.origin.y, 0)+ document.scrollToVisible(NSRect(x: 600, y: 60, width: 100, height: 20))+ XCTAssertEqual(scroll.contentView.bounds.origin, NSPoint(x: 400, y: 0))+ }++ func testOverflowingTabsStillScrollSidewaysOnAVerticalSwipe() {+ let scroll = SwarmStripScrollView(frame: NSRect(x: 0, y: 0, width: 300, height: 40))+ scroll.documentView = NSView(frame: NSRect(x: 0, y: 0, width: 900, height: 40))+ scroll.scrollWheel(with: verticalSwipe(-30))+ XCTAssertGreaterThan(scroll.contentView.bounds.origin.x, 0)+ XCTAssertEqual(scroll.contentView.bounds.origin.y, 0)+ }++ func testContentAndCloseCentreOnTheTabBody() {+ for height in [40, 30] as [CGFloat] {+ let bounds = NSRect(x: 0, y: 0, width: 200, height: height)+ let body = SwarmTabGeometry.shapeRect(in: bounds)+ let close = SwarmTabGeometry.closeFrame(in: bounds)+ XCTAssertEqual(body.maxY, height - SwarmTabGeometry.topInset)+ XCTAssertEqual(SwarmTabGeometry.contentCenterY(in: bounds), body.midY, "height \(height)")+ XCTAssertEqual(close.midY, body.midY, "height \(height)")+ XCTAssertTrue(body.contains(close), "× \(close) leaves the body \(body)")+ }+ }++ // The pane's close button (PaneCloseButton): a 28pt square, here as large as the tab's body+ // allows, with one gap above, below and to the body's straight right side.+ func testCloseIsASquareWithEvenGaps() {+ for (height, side) in [(40, 28), (30, 24)] as [(CGFloat, CGFloat)] {+ let bounds = NSRect(x: 0, y: 0, width: 200, height: height)+ let body = SwarmTabGeometry.shapeRect(in: bounds)+ let close = SwarmTabGeometry.closeFrame(in: bounds)+ XCTAssertEqual(close.width, close.height, "height \(height)")+ XCTAssertEqual(close.width, side, "height \(height)")+ let below = close.minY - body.minY, above = body.maxY - close.maxY+ let right = bounds.maxX - SwarmTabGeometry.shoulder - close.maxX+ XCTAssertEqual(below, above, "height \(height)")+ XCTAssertEqual(right, above, "height \(height)")+ }+ }+}++/// The titlebar redraws only what an update changes: Dart sends one on nearly every app change, and+/// a control that repaints (or turns off and on) each time flickers like a reload.+final class SwarmTitlebarUpdateTests: XCTestCase {+ private final class Messenger: NSObject, FlutterBinaryMessenger {+ var handlers: [String: FlutterBinaryMessageHandler] = [:]+ func send(onChannel channel: String, message: Data?) {}+ func send(onChannel channel: String, message: Data?, binaryReply callback: FlutterBinaryReply? = nil) {+ callback?(nil)+ }+ func setMessageHandlerOnChannel(_ channel: String,+ binaryMessageHandler handler: FlutterBinaryMessageHandler? = nil)+ -> FlutterBinaryMessengerConnection {+ handlers[channel] = handler+ return 0+ }+ func cleanUpConnection(_ connection: FlutterBinaryMessengerConnection) {}+ func call(_ method: String, _ arguments: Any?) {+ let message = FlutterStandardMethodCodec.sharedInstance()+ .encode(FlutterMethodCall(methodName: method, arguments: arguments))+ handlers["harness/swarm_tabs"]?(message) { _ in }+ }+ }++ private func descendants(of view: NSView) -> [NSView] {+ view.subviews + view.subviews.flatMap(descendants(of:))+ }++ /// Marked for drawing, as AppKit keeps it for a layer-backed view (the row is one).+ private func dirty(_ views: [NSView]) -> [String] {+ views.filter { $0.needsDisplay || $0.layer?.needsDisplay() == true }.map { "\(type(of: $0))" }+ }++ private struct Row {+ let window: NSWindow+ let messenger: Messenger+ let titlebar: SwarmTitlebar+ let strip: NSView+ }++ private func row(_ state: [String: Any]) -> Row? {+ let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1100, height: 600),+ styleMask: [.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)+ window.contentView = NSView()+ let messenger = Messenger()+ let titlebar = SwarmTitlebar(window: window, messenger: messenger, installStatusItem: false)+ messenger.call("configure", [:])+ messenger.call("update", state)+ guard let strip = window.titlebarAccessoryViewControllers.first?.view else {+ XCTFail("the row is not in the title bar")+ return nil+ }+ strip.layoutSubtreeIfNeeded()+ flush(Row(window: window, messenger: messenger, titlebar: titlebar, strip: strip))+ return Row(window: window, messenger: messenger, titlebar: titlebar, strip: strip)+ }++ private func flush(_ row: Row) {+ row.window.layoutIfNeeded()+ row.window.displayIfNeeded()+ // Offscreen, AppKit leaves layer-backed views marked: draw them now.+ for view in [row.strip] + descendants(of: row.strip) { view.layer?.displayIfNeeded() }+ }++ private func state(enabled: Bool = true, stripEnabled: Bool = true) -> [String: Any] {+ [+ "enabled": enabled, "stripEnabled": stripEnabled, "activeId": "a",+ "tabs": [["id": "a", "name": "First"], ["id": "b", "name": "Second"]],+ "account": ["kind": "avatar", "initial": "T"],+ ]+ }++ private func tabs(_ row: Row) -> [NSView] {+ descendants(of: row.strip).filter { "\(type(of: $0))" == "SwarmTabButton" }+ }++ func testAnIdenticalUpdateRedrawsNoControl() {+ guard let row = row(state()) else { return }+ let controls = [row.strip] + descendants(of: row.strip).filter {+ $0 is NSButton || "\(type(of: $0))".hasPrefix("SwarmTab")+ }+ XCTAssertFalse(controls.isEmpty)+ XCTAssertEqual(dirty(controls), [], "drawn once")+ let enabled = controls.compactMap { ($0 as? NSButton)?.isEnabled }+ row.messenger.call("update", state())+ XCTAssertEqual(dirty(controls), [])+ XCTAssertEqual(controls.compactMap { ($0 as? NSButton)?.isEnabled }, enabled)+ withExtendedLifetime(row.titlebar) {}+ }++ private func holdCommand(_ row: Row, _ held: Bool) {+ let event = NSEvent.keyEvent(with: .flagsChanged, location: .zero, modifierFlags: held ? .command : [],+ timestamp: ProcessInfo.processInfo.systemUptime, windowNumber: row.window.windowNumber, context: nil,+ characters: "", charactersIgnoringModifiers: "", isARepeat: false, keyCode: 55)!+ NSApp.sendEvent(event)+ }++ // The tabs' ⌘1… hints teach the menu shortcuts, so they follow the menus (`enabled`), not the row,+ // which stays live over Settings while the shortcuts are off.+ func testShortcutHintsFollowTheMenusNotTheRow() {+ guard let row = row(state()) else { return }+ holdCommand(row, true)+ XCTAssertEqual(dirty(tabs(row)).count, 2, "Command shows each tab's hint")+ holdCommand(row, false)+ row.messenger.call("update", state(enabled: false, stripEnabled: true))+ flush(row)+ holdCommand(row, true)+ XCTAssertEqual(dirty(tabs(row)), [], "over Settings the shortcuts are off: no hints")+ holdCommand(row, false)+ withExtendedLifetime(row.titlebar) {}+ }++ /// The strongest ink a view draws, from 0 to 1.+ private func ink(_ view: NSView) -> CGFloat {+ guard let rep = view.bitmapImageRepForCachingDisplay(in: view.bounds) else { return 0 }+ view.cacheDisplay(in: view.bounds, to: rep)+ var strongest: CGFloat = 0+ for y in 0..<rep.pixelsHigh {+ for x in 0..<rep.pixelsWide { strongest = max(strongest, rep.colorAt(x: x, y: y)?.alphaComponent ?? 0) }+ }+ return strongest+ }++ // The tab's × draws at rest with the ink it has pressed (AppIcons.closeInk in Flutter).+ func testCloseMarkIsFullInkAtRest() {+ guard let row = row(state()),+ let close = descendants(of: row.strip).first(where: {+ "\(type(of: $0))" == "SwarmPlainIconButton" && "\(type(of: $0.superview!))" == "SwarmTabButton"+ }) as? NSButton else { return XCTFail("no tab ×") }+ close.isHidden = false+ let resting = ink(close)+ close.highlight(true)+ let pressed = ink(close)+ XCTAssertGreaterThan(pressed, 0)+ XCTAssertEqual(resting, pressed, accuracy: 0.02)+ XCTAssertEqual(HarnessControlSymbols.closeInk, 1)+ withExtendedLifetime(row.titlebar) {}+ }+}++/// The menu bar's Harness menu.+final class HarnessStatusMenuTests: XCTestCase {+ // "View all N notifications…" opens the inbox; only a titlebar button toggles it, so the row asks+ // for `open`: an inbox already open stays.+ func testViewAllOpensTheInbox() {+ var sent: [(String, Any?)] = []+ let status = HarnessStatusMenu(installStatusItem: false, showWindow: {}, emit: { sent.append(($0, $1)) })+ let entries: [[String: Any]] = (0..<6).map {+ ["machineId": "m", "agentId": "a\($0)", "sessionId": "s\($0)", "readToken": "r\($0)",+ "unread": true, "title": "Harness \($0)"]+ }+ status.update(["enabled": true, "statusMenuEntries": entries])+ status.menuNeedsUpdate(status.menu)+ guard let viewAll = status.menu.items.first(where: { $0.title.hasPrefix("View all") }),+ let action = viewAll.action else { return XCTFail("no View all row") }+ NSApp.sendAction(action, to: viewAll.target, from: viewAll)+ XCTAssertEqual(sent.last?.0, "notificationInbox")+ XCTAssertEqual((sent.last?.1 as? [String: Any])?["open"] as? Bool, true)+ }+}diff --git a/desktop/test/agent_messages_tab_test.dart b/desktop/test/agent_messages_tab_test.dartindex 1c95e631a..b2d4b3639 100644--- a/desktop/test/agent_messages_tab_test.dart+++ b/desktop/test/agent_messages_tab_test.dart@@ -115,12 +115,24 @@ void main() {reason: 'a name with room never moves',);final close = tester.getRect(_close('app'));- expect(close.size, const Size(DesktopWorkspaceTab.closeWidth, 32));+ expect(close.size, const Size.square(DesktopWorkspaceTab.closeWidth));expect(tester.getRect(_tab('app')).right - close.right,grid.AppDesktop.tabCloseInset,reason: '× keeps its inset inside the curved body',);+ // As the pane's ×: one gap above, below and to the body's right side.+ final tab = tester.getRect(_tab('app'));+ final above = close.top - (tab.top + grid.AppDesktop.tabTopInset);+ expect(tab.bottom - close.bottom, above);+ expect(tab.right - grid.AppDesktop.tabShoulder - close.right, above);+ // Full ink at rest, as the pane's × (AppIcons.closeInk).+ final ink = tester+ .widget<IconButton>(_close('app'))+ .style!+ .foregroundColor!+ .resolve(<WidgetState>{})!;+ expect(ink.a, 1);await tester.tap(_close('app'));await tester.pump();expect(closed, ['app']);diff --git a/desktop/test/app_menu_test.dart b/desktop/test/app_menu_test.dartindex 1be3b9013..bacc8c7b7 100644--- a/desktop/test/app_menu_test.dart+++ b/desktop/test/app_menu_test.dart@@ -12,6 +12,7 @@ import 'package:harness/settings/settings_screen.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';import 'package:harness/state/pane_preset.dart';+import 'package:harness/widgets/account_menu.dart';import 'package:harness/widgets/setup_tour.dart';import 'swarm_state_test.dart' show createApp;@@ -133,6 +134,49 @@ void main() {app.dispose();});+ // A dropdown is an overlay entry, which stays above every route: a dialog or+ // page opened while one is up must close it first, or its rows stay live+ // over the modal (Sign out behind Check for Updates).+ testWidgets('a dialog or page that opens closes the open dropdown', (+ tester,+ ) async {+ final app = createApp();+ await _mount(tester, app);+ Future<void> openMenu() async {+ unawaited(+ showAccountMenu(+ tester.element(find.byType(SwarmScreen)),+ name: 'Tim',+ email: '[email protected]',+ ),+ );+ await tester.pump();+ expect(find.byType(AccountMenu), findsOneWidget);+ }++ await openMenu();+ final shortcuts = _menu(tester, 'showShortcuts');+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.byType(Dialog), findsOneWidget);+ expect(find.byType(AccountMenu), findsNothing);+ Navigator.of(tester.element(find.byType(Dialog))).pop();+ await tester.pump(const Duration(milliseconds: 300));+ await shortcuts;++ // Settings from the app menu (a page, not a dialog) too.+ await openMenu();+ final settings = _menu(tester, 'settings');+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.byType(SettingsScreen), findsOneWidget);+ expect(find.byType(AccountMenu), findsNothing);+ Navigator.of(tester.element(find.byType(SettingsScreen))).pop();+ await tester.pump(const Duration(milliseconds: 300));+ await settings;+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+testWidgets('app menu dialogs do not open over Settings', (tester) async {final app = createApp();await _mount(tester, app);diff --git a/desktop/test/desktop_workspace_tab_test.dart b/desktop/test/desktop_workspace_tab_test.dartindex e95c597b2..0c6f661e9 100644--- a/desktop/test/desktop_workspace_tab_test.dart+++ b/desktop/test/desktop_workspace_tab_test.dart@@ -315,10 +315,10 @@ void main() {find.descendant(of: _close('Desktop'), matching: find.byType(Icon)),);expect(icon.icon, AppIcons.close);- expect(icon.size, 12);+ expect(icon.size, AppIcons.closeSize);expect(tester.getSize(_close('Desktop')),- const Size(DesktopWorkspaceTab.closeWidth, 32),+ const Size.square(DesktopWorkspaceTab.closeWidth),);await _capture(tester,diff --git a/desktop/test/file_type_icon_test.dart b/desktop/test/file_type_icon_test.dartindex 15c897272..4984025dd 100644--- a/desktop/test/file_type_icon_test.dart+++ b/desktop/test/file_type_icon_test.dart@@ -72,5 +72,11 @@ void main() {.icon;expect(mark('spec.pdf'), AppIcons.fileText);expect(mark('main.dart'), AppIcons.fileCode);+ // Its remove mark keeps the chip's small size: it is not a workspace close+ // mark (AppIcons.closeSize, which follows the 13-point text of tabs and+ // pane headers).+ final remove = tester.widgetList<Icon>(find.byIcon(AppIcons.close));+ expect(remove, hasLength(2));+ expect(remove.map((icon) => icon.size), everyElement(12));});}diff --git a/desktop/test/local_model_picker_test.dart b/desktop/test/local_model_picker_test.dartindex ee1e521b2..cb9431b93 100644--- a/desktop/test/local_model_picker_test.dart+++ b/desktop/test/local_model_picker_test.dart@@ -390,6 +390,36 @@ void main() {},);+ testWidgets(+ 'the footer Models opens on your models with nothing typed to delete',+ (tester) async {+ final app = await _localFixture();+ try {+ await tester.binding.setSurfaceSize(const Size(1600, 1000));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ await configured.mount(tester, app, MemoryKeymap());+ // The footer's Models, the title bar's and the session picker's all+ // ask the app for the local Models overview.+ unawaited(app.runLocalModel(tester.element(find.byType(Scaffold))));+ await tester.pumpAndSettle();+ final picker = search(tester);+ expect(picker.query, ':');+ expect(picker.rows.first.id, isNot(picker.selected!.id));+ expect(+ picker.selected!.id,+ picker.rows+ .firstWhere(+ (row) => picker.modelSection(row) == ModelSearchSection.local,+ )+ .id,+ );+ } finally {+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ }+ },+ );+testWidgets('the model the harness is on says In use, here and in its preview',(tester) async {diff --git a/desktop/test/models_menu_test.dart b/desktop/test/models_menu_test.dartindex bd4e32637..030790c2c 100644--- a/desktop/test/models_menu_test.dart+++ b/desktop/test/models_menu_test.dart@@ -539,6 +539,8 @@ void main() {tester.widget<TextField>(resourceField).decoration!.hintText,'Search models',);+ // The title bar's Models opens with nothing typed to delete.+ expect(resourceSearch(tester).query, ':');expect(app.sent, isEmpty);await tester.pumpWidget(const SizedBox());app.dispose();diff --git a/desktop/test/native_toolbar_sync_test.dart b/desktop/test/native_toolbar_sync_test.dartindex 244e9be39..29577dff5 100644--- a/desktop/test/native_toolbar_sync_test.dart+++ b/desktop/test/native_toolbar_sync_test.dart@@ -310,12 +310,16 @@ void main() {),);await tester.pumpAndSettle();+ // Only Settings leaves the tab row live (`stripEnabled`); any other+ // covering route takes the row with menus and shortcuts.expect(updates().last['enabled'], isFalse);+ expect(updates().last['stripEnabled'], isFalse);calls.clear();app.renameSwarm(app.activeSwarmId, 'Changed while covered');app.announce();await tester.idle();expect(updates().single['enabled'], isFalse);+ expect(updates().single['stripEnabled'], isFalse);expect((updates().single['tabs'] as List).single['name'],'Changed while covered',@@ -323,6 +327,7 @@ void main() {navigator.pop();await tester.pumpAndSettle();expect(updates().last['enabled'], isTrue);+ expect(updates().last['stripEnabled'], isTrue);await tester.pumpWidget(const SizedBox());},);diff --git a/desktop/test/notification_inbox_test.dart b/desktop/test/notification_inbox_test.dartindex 0be069d67..87b7fb23a 100644--- a/desktop/test/notification_inbox_test.dart+++ b/desktop/test/notification_inbox_test.dart@@ -521,7 +521,11 @@ void main() {expect(tester.getRect(inbox).right, 464);expect(tester.getRect(inbox).top, 56);expect(tester.getSize(inbox).width, 440);- expect(find.byType(DesktopDialogSurface), findsOneWidget);+ // A titlebar dropdown: the shared menu surface is its one rim, with+ // no Dialog route around it.+ expect(find.byKey(const ValueKey('pane-menu-surface')), findsOneWidget);+ expect(find.byType(DesktopDialogSurface), findsNothing);+ expect(find.byType(Dialog), findsNothing);expect(app.agentUnread.count, 2);final title = tester.widget<Text>(find.text('Choose a homepage direction'),diff --git a/desktop/test/resting_model_picker_test.dart b/desktop/test/resting_model_picker_test.dartindex ef06890c8..e7acca9da 100644--- a/desktop/test/resting_model_picker_test.dart+++ b/desktop/test/resting_model_picker_test.dart@@ -126,7 +126,7 @@ void main() {),]);await open(tester);- const subtitle = 'Asleep 9h ago';+ const subtitle = '9h ago';expect(find.text(subtitle), findsOneWidget);expect(find.byTooltip(diff --git a/desktop/test/resting_models_panel_test.dart b/desktop/test/resting_models_panel_test.dartindex be88d2942..7b37ba254 100644--- a/desktop/test/resting_models_panel_test.dart+++ b/desktop/test/resting_models_panel_test.dart@@ -164,7 +164,7 @@ void main() {section('loft', state: 'awake', wakeOutcome: 'nobody_serving'),]);- const subtitle = 'Asleep 2h ago';+ const subtitle = '2h ago';expect(find.text(subtitle), findsOneWidget);expect(find.byTooltip(diff --git a/desktop/test/resting_models_test.dart b/desktop/test/resting_models_test.dartindex 15b699be1..7df130772 100644--- a/desktop/test/resting_models_test.dart+++ b/desktop/test/resting_models_test.dart@@ -161,16 +161,21 @@ void main() {),),);- expect(- asleep.subtitle,- 'Asleep 9h ago',- );+ // How old the list is, and no state word: the tooltip says why it rests.+ expect(asleep.subtitle, '9h ago');expect(asleep.tooltip,'Resting to save resources. It starts by itself when you send a message.',);expect(asleep.sentence, isNull);expect(asleep.offerWake, isFalse);+ // A resting list of no known age has nothing to say beside it.+ expect(+ sectionWords(+ _only(section('team', state: 'asleep', models: served)),+ ),+ SectionWords.none,+ );final noRecord = sectionWords(_only(section('team', state: 'asleep')));expect(noRecord.offerWake, isTrue);@@ -275,8 +280,7 @@ void main() {kSwitchAnyway,kSwitchAnywayAction,kRestingUntilNextMessage,- restingSubtitle(null),- for (final age in [0, 60, 3600, 86400]) restingSubtitle(age),+ for (final age in [0, 60, 3600, 86400]) restingSubtitle(age)!,couldNotStart(own),couldNotStart(shared),offlineRowSentence('Studio'),diff --git a/desktop/test/session_close_test.dart b/desktop/test/session_close_test.dartindex e774b1134..0e03d33be 100644--- a/desktop/test/session_close_test.dart+++ b/desktop/test/session_close_test.dart@@ -29,6 +29,7 @@ class _CloseConnection extends WsConn {final failures = <String, Map<String, dynamic>>{};final targetedFailures = <(String, String), Map<String, dynamic>>{};final requests = <String>[];+ final closedOnInspect = <String>{};Completer<Map<String, dynamic>>? inspecting;/// Runs as the daemon takes a close, before it answers: what the window@@ -62,6 +63,8 @@ class _CloseConnection extends WsConn {);}if (mode == 'inspect') {+ // The daemon answers an agent it already closed with `closed`.+ if (closedOnInspect.contains(agentId)) return {'closed': true};return inspecting?.future ??Future.value({'activity': activities[payload['agentId']] ?? 'idle'});}@@ -161,6 +164,23 @@ void main() {},);+ testWidgets(+ 'a harness the daemon already closed closes its view without asking',+ (tester) async {+ connection.closedOnInspect.add('a0');+ final pane = app.adoptSessionForTest(terminal('a0', []));+ await mount(tester, app);+ unawaited(app.requestClosePane(pane.id));+ await tester.pumpAndSettle();+ expect(find.text('Activity unknown'), findsNothing);+ expect(find.widgetWithText(FilledButton, 'Stop'), findsNothing);+ expect(app.allPanes, isEmpty);+ expect(modes(), ['inspect'], reason: 'nothing left to stop');+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ },+ );+testWidgets('working Close starts with Cancel focused and Enter keeps work alive',(tester) async {diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dartindex 6ddbb2dd9..d4cfdcab9 100644--- a/desktop/test/swarm_interactions_test.dart+++ b/desktop/test/swarm_interactions_test.dart@@ -6,6 +6,7 @@ import 'support/new_agent_project.dart';import 'dart:async';import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';+import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';@@ -15,13 +16,19 @@ import 'package:harness/core/config.dart';import 'package:harness/core/models.dart';import 'package:harness/screens/swarm_screen.dart';import 'package:harness/settings/settings_screen.dart';+import 'package:harness/shared/theme/app_icons.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/shared/widgets/app_choice_picker.dart';import 'package:harness/shared/widgets/app_select_field.dart';import 'package:harness/state/app_state.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/terminal/terminal_binary.dart';+import 'package:harness/models/models_panel.dart';import 'package:harness/widgets/codex_profile_field.dart';+import 'package:harness/widgets/account_menu.dart';+import 'package:harness/widgets/agent_drag.dart' show PaneCloseButton;import 'package:harness/widgets/new_agent_dialog.dart';+import 'package:harness/widgets/notification_inbox.dart';import 'package:harness/widgets/swarm_dialogs.dart';import 'package:harness/widgets/terminal_find_bar.dart';@@ -446,7 +453,7 @@ void main() {},);- testWidgets('native Tab commands cannot mutate the view behind Settings', (+ testWidgets('native Tab commands cannot mutate the view behind a dialog', (tester,) async {const channel = MethodChannel('harness/swarm_tabs');@@ -463,11 +470,11 @@ void main() {null,),);- Future<void> native(String method) {+ Future<void> native(String method, [Object? args]) {final result = Completer<void>();tester.binding.defaultBinaryMessenger.handlePlatformMessage(channel.name,- const StandardMethodCodec().encodeMethodCall(MethodCall(method)),+ const StandardMethodCodec().encodeMethodCall(MethodCall(method, args)),(_) => result.complete(),);return result.future;@@ -489,12 +496,30 @@ void main() {await tester.pump();await tester.pump(const Duration(milliseconds: 300));expect(find.byType(SettingsScreen), findsOneWidget);+ // Settings alone leaves the tab row live (the next test); menus and+ // shortcuts stay off behind it.expect(updates.last['enabled'], isFalse);+ expect(updates.last['stripEnabled'], isTrue);+ // A dialog over Settings is modal: the row waits with everything else.+ final confirm = showDialog<void>(+ context: tester.element(find.byType(SettingsScreen)),+ builder: (_) => const AlertDialog(title: Text('Over Settings')),+ );+ await tester.pump(const Duration(milliseconds: 300));+ expect(updates.last['enabled'], isFalse);+ expect(updates.last['stripEnabled'], isFalse);await native('new');await native('closeActive');await native('notifications');+ await native('rowAction', {'method': 'new'});+ await native('rowAction', {'method': 'notifications'});expect(find.text('Needs input'), findsNothing);expect(app.swarms.single.id, 'swarm-1');+ expect(find.byType(SettingsScreen), findsOneWidget);+ Navigator.of(tester.element(find.byType(AlertDialog))).pop();+ await tester.pump(const Duration(milliseconds: 300));+ await confirm;+ expect(updates.last['stripEnabled'], isTrue);Navigator.of(tester.element(find.byType(SettingsScreen))).pop();await tester.pump(const Duration(milliseconds: 300));await opening;@@ -576,6 +601,374 @@ void main() {app.dispose();});+ testWidgets(+ 'with Settings open, choosing a tab or a title-bar icon closes Settings and acts',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (+ call,+ ) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return null;+ });+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ Future<void> native(String method, [Map<String, Object?>? args]) {+ final result = Completer<void>();+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall(method, args),+ ),+ (_) => result.complete(),+ );+ return result.future;+ }++ final app = createApp();+ final projects = SwarmProjectStore();+ await tester.pumpWidget(+ MaterialApp(+ home: SwarmScreen(+ notifier: app,+ nativeTabs: true,+ projectStore: projects,+ ),+ ),+ );+ await tester.pump();+ final first = app.activeSwarmId;+ app.newSwarm(newTabPage: true);+ await tester.pump();+ final second = app.activeSwarmId;+ expect(second, isNot(first));++ Future<void> openSettings() async {+ unawaited(native('settings'));+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.byType(SettingsScreen), findsOneWidget);+ expect(updates.last['stripEnabled'], isTrue);+ }++ // AppKit sends the row's actions as `rowAction` while the menus are off.+ // Its reply waits for Settings to close and the action to land.+ Future<void> act(String method, [Map<String, Object?>? args]) async {+ final reply = native('rowAction', {+ 'method': method,+ 'arguments': ?args,+ });+ var answered = false;+ unawaited(reply.then((_) => answered = true));+ for (var frame = 0; frame < 5 && !answered; frame++) {+ await tester.pump();+ }+ expect(answered, isTrue, reason: '$method must answer');+ await tester.pump(const Duration(milliseconds: 300));+ }++ await openSettings();+ await act('select', {'id': first});+ expect(find.byType(SettingsScreen), findsNothing);+ expect(app.activeSwarmId, first);+ expect(updates.last['enabled'], isTrue);++ await openSettings();+ await act('notifications');+ expect(find.byType(SettingsScreen), findsNothing);+ expect(resourceScope(''), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();++ await openSettings();+ await act('close', {'id': second});+ expect(find.byType(SettingsScreen), findsNothing);+ expect(app.swarms.map((swarm) => swarm.id), [first]);++ // Menus stay off behind Settings: a plain menu action is still dropped.+ await openSettings();+ await native('new');+ expect(find.byType(SettingsScreen), findsOneWidget);+ expect(app.swarms, hasLength(1));+ // The pointer over the daemon is not an ask: Settings stays.+ await act('daemonHover', {'hovered': true});+ expect(find.byType(SettingsScreen), findsOneWidget);+ Navigator.of(tester.element(find.byType(SettingsScreen))).pop();+ await tester.pump(const Duration(milliseconds: 300));+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ projects.dispose();+ app.dispose();+ },+ );++ testWidgets(+ 'titlebar dropdowns are overlays: the row stays live, one click outside closes and acts, Esc returns focus; Settings from anywhere closes on a row action; a modal still blocks',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (+ call,+ ) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return null;+ });+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ Future<void> native(String method, [Map<String, Object?>? args]) {+ final result = Completer<void>();+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(+ MethodCall(method, args),+ ),+ (_) => result.complete(),+ );+ return result.future;+ }++ // As AppKit sends a row click while the menus are off.+ Future<void> act(String method, [Map<String, Object?>? args]) async {+ final reply = native('rowAction', {+ 'method': method,+ 'arguments': ?args,+ });+ var answered = false;+ unawaited(reply.then((_) => answered = true));+ for (var frame = 0; frame < 5 && !answered; frame++) {+ await tester.pump();+ }+ expect(answered, isTrue, reason: '$method must answer');+ await tester.pump(const Duration(milliseconds: 300));+ }++ // A plain titlebar call, as AppKit sends one while the menus are on.+ Future<void> send(String method, [Map<String, Object?>? args]) async {+ final reply = native(method, args);+ var answered = false;+ unawaited(reply.then((_) => answered = true));+ for (var frame = 0; frame < 5 && !answered; frame++) {+ await tester.pump();+ }+ await tester.pump(const Duration(milliseconds: 300));+ }++ Future<void> open(String method, Finder shown) async {+ unawaited(native(method));+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ expect(shown, findsOneWidget);+ }++ // A row lit by focus or pointer draws its glyph in the selection ink.+ Iterable<String> litRows() => [+ for (final choice in AccountMenuChoice.values)+ if (tester+ .widgetList<Icon>(+ find.descendant(+ of: find.byKey(ValueKey('account-menu-${choice.name}')),+ matching: find.byType(Icon),+ ),+ )+ .any((icon) => icon.color == grid.AppDesktop.onSelection))+ choice.name,+ ];++ final app = createApp();+ final projects = SwarmProjectStore();+ await tester.pumpWidget(+ MaterialApp(+ home: SwarmScreen(+ notifier: app,+ nativeTabs: true,+ projectStore: projects,+ ),+ ),+ );+ await tester.pump();+ final first = app.activeSwarmId;+ app.newSwarm(newTabPage: true);+ await tester.pump();+ final second = app.activeSwarmId;++ // The avatar's menu is a dropdown in the shared overlay, not a route:+ // menus and the row both stay on, and there is no Dialog around it.+ final barriers = find.byType(ModalBarrier).evaluate().length;+ final from = updates.length;+ await open('account', find.byType(AccountMenu));+ expect(updates.last['enabled'], isTrue);+ expect(updates.last['stripEnabled'], isTrue);+ expect(+ find.ancestor(+ of: find.byType(AccountMenu),+ matching: find.byType(Dialog),+ ),+ findsNothing,+ );+ expect(+ find.byType(ModalBarrier),+ findsNWidgets(barriers),+ reason: 'no barrier of its own',+ );+ // One rim, the popover radius (desktop-design-system.md: 16).+ final rims = tester+ .widgetList<Material>(+ find.ancestor(+ of: find.byType(AccountMenu),+ matching: find.byType(Material),+ ),+ )+ .followedBy(+ tester.widgetList<Material>(+ find.descendant(+ of: find.byType(AccountMenu),+ matching: find.byType(Material),+ ),+ ),+ )+ .where(+ (material) =>+ material.shape is RoundedRectangleBorder &&+ (material.shape! as RoundedRectangleBorder).side !=+ BorderSide.none,+ )+ .toList();+ expect(rims, hasLength(1));+ expect(+ (rims.single.shape! as RoundedRectangleBorder).borderRadius,+ BorderRadius.circular(grid.AppDesktop.menuRadius),+ );+ expect(grid.AppDesktop.menuRadius, 16);+ expect(litRows(), isEmpty, reason: 'a pointer opened it: no row lit');++ // A tab click in the native row closes it and chooses the tab, in one+ // plain call.+ await send('select', {'id': first});+ expect(find.byType(AccountMenu), findsNothing);+ expect(app.activeSwarmId, first);+ // Opening and closing it never turned a titlebar control off, even for+ // a frame: that is what flickered the row like a reload.+ expect(+ updates+ .skip(from)+ .where((u) => u['enabled'] != true || u['stripEnabled'] != true),+ isEmpty,+ );++ // The avatar again closes its own menu, as a dropdown's button does.+ await open('account', find.byType(AccountMenu));+ await send('account');+ expect(find.byType(AccountMenu), findsNothing);++ // Escape closes it and gives the keyboard back to whoever had it.+ final before = FocusManager.instance.primaryFocus;+ await open('account', find.byType(AccountMenu));+ expect(FocusManager.instance.primaryFocus, isNot(before));+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();+ expect(find.byType(AccountMenu), findsNothing);+ expect(FocusManager.instance.primaryFocus, before);++ // One click outside closes it AND lands: the start page's field takes it.+ await open('account', find.byType(AccountMenu));+ final field = find.byKey(const ValueKey('harness-start-search'));+ await tester.tap(field);+ await tester.pump();+ expect(find.byType(AccountMenu), findsNothing);+ expect(+ tester+ .widget<EditableText>(+ find.descendant(of: field, matching: find.byType(EditableText)),+ )+ .focusNode+ .hasFocus,+ isTrue,+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();++ // The bell's inbox is the same kind of dropdown.+ await open('notificationInbox', find.byType(NotificationInbox));+ expect(updates.last['enabled'], isTrue);+ expect(+ find.ancestor(+ of: find.byType(NotificationInbox),+ matching: find.byType(Dialog),+ ),+ findsNothing,+ );+ // The menu bar's "View all … notifications" opens it; only a titlebar+ // button toggles. Open already, it stays.+ await send('notificationInbox', {'open': true});+ expect(find.byType(NotificationInbox), findsOneWidget);+ await send('select', {'id': second});+ expect(find.byType(NotificationInbox), findsNothing);+ expect(app.activeSwarmId, second);++ // Settings chosen from the avatar's menu, with the pointer.+ await open('account', find.byType(AccountMenu));+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);+ await mouse.addPointer(location: tester.getCenter(find.text('Settings')));+ await tester.pump();+ await mouse.down(tester.getCenter(find.text('Settings')));+ await mouse.up();+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.byType(SettingsScreen), findsOneWidget);+ expect(updates.last['enabled'], isFalse);+ expect(updates.last['stripEnabled'], isTrue);+ await act('select', {'id': first});+ expect(find.byType(SettingsScreen), findsNothing);+ expect(app.activeSwarmId, first);+ // The pointer went to the native row, out of Flutter's view.+ await mouse.removePointer();+ await tester.pump();+ // Opened again, the menu is fresh: nothing kept from the last time.+ await open('account', find.byType(AccountMenu));+ expect(litRows(), isEmpty);+ await send('account');+ expect(find.byType(AccountMenu), findsNothing);++ // Settings opened by someone else (the app menu, Agent Messages).+ unawaited(+ showSettingsScreen(+ tester.element(find.byType(SwarmScreen)),+ app,+ source: 'test',+ ),+ );+ await tester.pump();+ await tester.pump(const Duration(milliseconds: 300));+ expect(updates.last['stripEnabled'], isTrue);+ await act('select', {'id': second});+ expect(find.byType(SettingsScreen), findsNothing);+ expect(app.activeSwarmId, second);++ // A real dialog (Rename Tab) still holds the row.+ await open('renameActive', find.text('Rename Tab'));+ expect(updates.last['stripEnabled'], isFalse);+ await act('select', {'id': first});+ expect(find.text('Rename Tab'), findsOneWidget);+ expect(app.activeSwarmId, second);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump(const Duration(milliseconds: 300));+ expect(find.text('Rename Tab'), findsNothing);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ projects.dispose();+ app.dispose();+ },+ );+testWidgets('late profile discovery cannot cross a machine switch with identical observed paths',(tester) async {@@ -702,4 +1095,90 @@ void main() {app.dispose();},);++ testWidgets(+ 'every titlebar click closes the open dropdown before it acts; a dropdown\'s own button closes it',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ (call) async => null,+ );+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ Future<void> send(String method) async {+ final reply = Completer<void>();+ tester.binding.defaultBinaryMessenger.handlePlatformMessage(+ channel.name,+ const StandardMethodCodec().encodeMethodCall(MethodCall(method)),+ (_) => reply.complete(),+ );+ for (var frame = 0; frame < 5 && !reply.isCompleted; frame++) {+ await tester.pump();+ }+ await tester.pump(const Duration(milliseconds: 300));+ }++ final app = createApp();+ final projects = SwarmProjectStore();+ await app.modelManager.refresh();+ await tester.pumpWidget(+ MaterialApp(+ home: SwarmScreen(+ notifier: app,+ nativeTabs: true,+ projectStore: projects,+ ),+ ),+ );+ await tester.pump();++ // The daemon's button returns early while it has nothing to show; the+ // open menu still closes.+ await send('account');+ expect(find.byType(AccountMenu), findsOneWidget);+ await send('daemon');+ expect(find.byType(AccountMenu), findsNothing);++ // Models: its button opens it and closes it again; the avatar's closes+ // it on the way to its own menu, and the other way round.+ await send('modelControls');+ expect(find.byType(ModelsPanel), findsOneWidget);+ await send('modelControls');+ expect(find.byType(ModelsPanel), findsNothing);+ await send('modelControls');+ await send('account');+ expect(find.byType(ModelsPanel), findsNothing);+ expect(find.byType(AccountMenu), findsOneWidget);+ await send('modelControls');+ expect(find.byType(AccountMenu), findsNothing);+ expect(find.byType(ModelsPanel), findsOneWidget);+ await send('modelControls');+ expect(find.byType(ModelsPanel), findsNothing);+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ projects.dispose();+ app.dispose();+ },+ );++ testWidgets('the pane × is full ink at rest, as the tab ×', (tester) async {+ final app = createApp();+ addTearDown(app.dispose);+ app.adoptSessionForTest(terminal('a0', []));+ await mount(tester, app);+ final icon = tester.widget<Icon>(+ find.descendant(+ of: find.byType(PaneCloseButton),+ matching: find.byIcon(AppIcons.close),+ ),+ );+ expect(icon.color!.a, AppIcons.closeInk);+ expect(AppIcons.closeInk, 1);+ await tester.pumpWidget(const SizedBox());+ });}diff --git a/desktop/test/workspace_status_test.dart b/desktop/test/workspace_status_test.dartindex 03ae6fd84..d3e6870de 100644--- a/desktop/test/workspace_status_test.dart+++ b/desktop/test/workspace_status_test.dart@@ -10,6 +10,7 @@ import 'package:flutter/rendering.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';+import 'package:harness/models/model_search_catalog.dart';import 'package:harness/state/app_state.dart';import 'package:harness/shared/theme/appearance_prefs_store.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;@@ -640,9 +641,29 @@ void main() {await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('workspace-models')));await tester.pumpAndSettle();- expect(picker().search.query, ':local');+ // Nothing typed for the person to delete: Models opens on its+ // section (local_model_picker_test) instead of filtering to it.+ expect(picker().search.query, ':');picker().onClose();await tester.pumpAndSettle();+ tester.view.physicalSize = const Size(480, 800);+ await tester.pumpAndSettle();+ await tester.tap(+ find.byKey(const ValueKey('workspace-subscriptions-overflow')),+ );+ await tester.pumpAndSettle();+ expect(picker().search.query, ':');+ expect(+ picker().search.selected?.id,+ startsWith('model:subscription:'),+ );+ expect(+ picker().search.modelSection(picker().search.selected!),+ ModelSearchSection.subscriptions,+ );+ picker().onClose();+ tester.view.physicalSize = const Size(1280, 800);+ await tester.pumpAndSettle();await tester.tap(find.byKey(const ValueKey('workspace-subscription:claude:cccccc:0'),@@ -691,7 +712,7 @@ void main() {find.descendant(of: close.first, matching: find.byIcon(AppIcons.close)),);expect(restingIcon.size, AppIcons.closeSize);- expect(restingIcon.color!.a, .45);+ expect(restingIcon.color!.a, AppIcons.closeInk);final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);await mouse.addPointer(location: Offset.zero);await mouse.moveTo(tester.getCenter(titles.first));