Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

desktop: Agent Messages leave the tab for one Settings ▸ Agents switch (#1264)

Dee6275e4471ae6
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index 3fb46323d..4f6037232 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -317,13 +317,17 @@ Experimental switches are account state. `AppNotifier.experimentalFeatures` bind
identifies the account, clears on sign-out/account change, and rejects stale responses. It uses
`/api/experimental-settings`, refreshes on account invalidations and a 30-second fallback poll, and
shows changes only after server acknowledgement. Do not restore the old unscoped local keys at startup.
-Agent Messages (docs/design/2026-10-10-agent-messages.md) replaced Swarm collaboration: its
-flag is per tab, not an Experimental switch — `GET /api/agent-messages` and
-`PATCH /api/agent-messages/tabs/:tabId` through the CLI like the desk, read after sign-in, after a
-toggle, on `desk_changed`, the desk safety-net poll and the backend coming back; a 404 (an older CLI
-or backend) offers no 💬 at all, and the 💬 waits for the first answer (`agentMessagesOffered`, which
-also needs a desk tab). Traffic arrives as `messages_changed` — but a daemon sends that only to its
-own computer's windows, so `AgentMessagesRemoteWatch` reads the last messages of each tab that is on
+Agent Messages (docs/design/2026-10-10-agent-messages.md) replaced Swarm collaboration. Whether
+agents may message is each computer's Settings ▸ Agents switch (`agentMessages`, on by default,
+kept by its daemon), not a tab's and not an Experimental one: the tab's own 💬 beside its × was
+easy to hit by mistake and turned the tab off, failing a waiting message (owner, 2026-10-12), so
+the tab, its menu, File and ⇧⌘P have no on/off. The app reads `GET /api/agent-messages` through
+the CLI like the desk only to learn that the daemon and backend have Agent Messages — once the desk
+is joined, from the desk safety-net poll until one has answered, and when the backend comes back;
+each tab's `enabled` in the answer is not read. A 404 (an older CLI or backend) offers no Show
+Agent Messages (`agentMessagesOffered`, which also needs a desk tab). Traffic arrives as
+`messages_changed` — but a daemon sends that only to its own computer's windows, so
+`AgentMessagesRemoteWatch` reads the last messages of each desk tab with two or more harnesses
from its other machines every 15 s while the window is in front. A tab's log is the
`agent_messages` `history` request to every daemon with a pane in it, merged by message id. The creature switch opens the account's
`ZooController` collection; disabling it hides the creature without deleting eggs, individuals or progress.
@@ -449,13 +453,13 @@ add a kind there, not at the call site.
- The [workspace status bar](design/workspace-status-bar.md) places system-font tabs and global actions at the top,
with harness, machine and installed local model counts plus subscription allowance remaining at the bottom left and focused machine/repo/branch/PR at the bottom right.
Tabs center their name/status group and show no shortcut hint (Command changes nothing on
- them). Hovering a tab shows Agent Messages' 💬 — grey off, accent blue on — just
- left of ×; traffic between its agents shows nothing on the tab, whose status slot keeps its
- own status (owner, 2026-10-12: messages arrive when they arrive)
- (`lib/agent_messages/`, `AgentMessagesController` on `AppNotifier.agentMessages`, its own
- notifier so traffic never rebuilds the workspace; `SwarmTabButton` mirrors it natively).
- At rest the name has the whole tab; hovered, it moves left only as far as 💬
- and × need. Tab and pane close
+ them). Hovering a tab shows only its ×. Agent Messages has nothing on a tab: no 💬 (it was
+ easy to hit by mistake and turned the tab off, owner 2026-10-12; Settings ▸ Agents holds the
+ switch) and no traffic, so its status slot keeps its own status (messages arrive when they
+ arrive). A tab's log is its menu's and File's Show Agent Messages (`lib/agent_messages/`,
+ `AgentMessagesController` on `AppNotifier.agentMessages`, its own notifier so traffic never
+ rebuilds the workspace; `SwarmTabButton` mirrors the tab natively).
+ At rest the name has the whole tab; hovered, it moves left only as far as × needs. Tab and pane close
marks are small and quiet, with larger click targets. Terminal panes end with matching
plain-text agent/model selectors and close at every width. Hovering the right
or bottom edge reveals its split icon; zoom stays in commands, menus and keyboard
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.md
index 1c28cd655..bb94741f1 100644
--- a/desktop/design/desktop-design-system.md
+++ b/desktop/design/desktop-design-system.md
@@ -334,10 +334,12 @@ the status bar and terminal font. Center the name and its adjacent
status as one compact group, without permanent number prefixes. Navigation ink
follows 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, and Agent Messages' 💬 just left
-of it. This puts the cross's center 16 points inside the curved body edge. At
-rest the name and status have the whole tab; on hover a name that would run into
-💬 and × moves left only as far as they need, then truncates, so hover never
+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
+Messages' 💬 that sat left of it was removed, since it was easy to hit by mistake
+and turned the tab off (owner, 2026-10-12); Settings ▸ Agents holds that switch
+now. At rest the name and status have the whole tab; on hover a name that would run
+into × moves left only as far as it needs, then truncates, so hover never
crowds the name or status. Tabs show no shortcut hint, and holding Command
changes nothing on them. An idle tab has no empty status slot; its name centers
on its own. Hover never changes tab width. Long names truncate and retain a
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 124009aee..35b86d142 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -120,24 +120,22 @@ shared 10-point upper corners, 8-point outward lower shoulders and 6-point top
inset. Keep space after `+` available for dragging the window. Scroll overflow
and reveal the selected tab on keyboard navigation. Narrow viewports can show
smaller tabs while preserving their controls.
-Hovering a tab reveals Agent Messages' 💬 and × at its right, 💬 just left of ×
-([Agent Messages](../../docs/design/2026-10-10-agent-messages.md)); its status
-stays. Tabs show no shortcut hint, and holding Command changes nothing on them.
-At rest a tab shows only its name and status; traffic between its agents shows
-nothing on it, since messages arrive when they arrive. The hover 💬 is grey while
-off and in Agent Messages' color (the accent blue, `AppPalette.accentOnSurface`)
-while on; its tooltip says what a click
-does ("Agent messages off · click to turn on", "Agent messages on · click to
-turn off"), and a click toggles that
-tab's flag at once, going back — with a notice — if the backend refuses. Only a
-tab the desk holds has a 💬 (not the Store, Devices, Companions, an orchestrator
-or a draft tab), and only once the daemon and backend have answered for Agent
-Messages; an older CLI or backend shows none. Hovering never changes the tab
-width. At rest the name and status have the whole tab, so a 128-point tab shows
-an ordinary name whole beside its status; hovered, a name that would run into 💬
-and × moves left only as far as they need, then gives up its tail. × and 💬 are
-16-point-wide, 32-point-tall targets with a 3-point dead gap between them. The tab's menu and File carry Agent Messages (a checkmark)
-and Show Agent Messages beside Rename Tab and Close Tab. Cmd-W, remapped
+Hovering a tab reveals × at its right; its status stays. Tabs show no shortcut
+hint, and holding Command changes nothing on them. A tab shows nothing of
+[Agent Messages](../../docs/design/2026-10-10-agent-messages.md), at rest or
+hovered: traffic between its agents shows nothing on it, since messages arrive
+when they arrive, and there is no on/off on the tab. Its 💬 beside × was easy to
+hit by mistake and turned the tab off, failing a message that was waiting
+(owner, 2026-10-12); whether agents in the same tab may message each other is
+now one switch per computer, Settings ▸ Agents, on by default. Hovering never
+changes the tab width. At rest the name and status have the whole tab, so a
+128-point tab shows an ordinary name whole beside its status; hovered, a name
+that would run into × moves left only as far as it needs, then gives up its
+tail. × is a 20-point-wide, 32-point-tall target. The tab's menu and File carry
+Show Agent Messages beside Rename Tab and Close Tab, only for a tab the desk
+holds (not the Store, Devices, Companions, an orchestrator or a draft tab) and
+only once the daemon and backend have answered for Agent Messages; an older CLI
+or backend shows none. Cmd-W, remapped
shortcuts, native menu access, and middle-click closing remain available.
Preserve reorder, rename, keyboard focus, and terminal sessions. Cmd-T opens a
tab. Cmd-O opens the shared picker with `#` for projects; Cmd-P opens it directly
diff --git a/desktop/lib/agent_messages/agent_messages.dart b/desktop/lib/agent_messages/agent_messages.dart
index f334ddda3..d898c7955 100644
--- a/desktop/lib/agent_messages/agent_messages.dart
+++ b/desktop/lib/agent_messages/agent_messages.dart
@@ -4,11 +4,14 @@ import 'dart:math' as math;
import 'package:flutter/foundation.dart';
/// Agent Messages (docs/design/2026-10-10-agent-messages.md) as this window
-/// sees them: harnesses in a tab with Agent Messages on message each other with
-/// `harness send`, and the daemons deliver. The window only shows it — each
-/// tab's flag (the backend's, off unless a person turned it on), the traffic
-/// the daemons report as `messages_changed`, a tab's log, and the marks a
-/// message leaves on its panes. Nothing here composes or sends.
+/// sees them: harnesses in the same tab message each other with `harness send`,
+/// and the daemons deliver. Whether they may is each computer's own setting
+/// (Settings ▸ Agents, `agentMessages`, on unless a person turned it off), not
+/// the tab's: a tab's switch, a 💬 beside its ×, was easy to hit by mistake and
+/// turned the tab off, failing a message that was waiting (owner, 2026-10-12).
+/// The window only shows what moved — the traffic the daemons report as
+/// `messages_changed`, a tab's log, and the marks a message leaves on its
+/// panes. Nothing here composes, sends or turns anything on.
/// What became of a message for one recipient. A message never expires: it
/// stays queued until it is delivered, or fails for a reason a person can read.
@@ -201,7 +204,8 @@ typedef AgentMessageLog = ({
bool complete,
});
-/// A tab with Agent Messages on, and the machines to ask for its traffic.
+/// A tab whose harnesses may message each other, and the machines to ask for
+/// its traffic.
typedef AgentMessagesRemoteTab = ({String tabId, List<String> machineIds});
/// The short note a message leaves in a pane's header: `→ api` on the
@@ -222,29 +226,20 @@ class PaneMessageMark {
final bool warning;
}
-/// How a tab's 💬 reads. Traffic is not one of them: a tab never shows it. A
-/// moving 💬 sent the owner looking in the panes for messages that agents
-/// take at their tool calls; they arrive when they arrive (owner, 2026-10-12).
-enum TabMessagesState { off, on }
-
typedef AgentMessageTabsRead = Future<Map<String, dynamic>?> Function();
-typedef AgentMessagesWrite = Future<Map<String, dynamic>> Function(
- String tabId,
- bool enabled,
-);
typedef AgentMessagesRequest = Future<Map<String, dynamic>> Function(
String machineId,
Map<String, dynamic> payload,
);
typedef AgentNameOf = String? Function(String machineId, String agentId);
-/// Each tab's flag, the traffic the daemons report, and the pane marks it
-/// leaves. Its own notifier, as `AgentAlerts` is: a message arriving must not
-/// rebuild the workspace, only the 💬 and the marks that listen here.
+/// Whether this account has Agent Messages at all, the traffic the daemons
+/// report, and the pane marks it leaves. Its own notifier, as `AgentAlerts`
+/// is: a message arriving must not rebuild the workspace, only the marks and
+/// an open log that listen here. A tab shows nothing of it.
class AgentMessagesController extends ChangeNotifier {
AgentMessagesController({
required this.read,
- required this.write,
required this.request,
required this.nameOf,
DateTime Function()? now,
@@ -252,8 +247,10 @@ class AgentMessagesController extends ChangeNotifier {
this.markLife = const Duration(seconds: 5),
}) : now = now ?? DateTime.now;
+ /// The account's desk tabs as the daemon proxies them from the backend
+ /// (`GET /api/agent-messages`). Only whether it answers is used: each tab's
+ /// `enabled` an older daemon or backend still sends is not read.
final AgentMessageTabsRead read;
- final AgentMessagesWrite write;
final AgentMessagesRequest request;
final AgentNameOf nameOf;
@@ -270,10 +267,6 @@ class AgentMessagesController extends ChangeNotifier {
/// How long a pane's mark stays, unless the pane is focused first.
final Duration markLife;
- final _enabled = <String, bool>{};
- final _pending = <String, bool>{};
- final _failed = <String, String>{};
- final _writes = <String, int>{};
final _traffic = <String, int>{};
final _seenMessages = <String>{};
// A mark holds the timer that ends it, so nothing has to compare clocks to
@@ -285,24 +278,11 @@ class AgentMessagesController extends ChangeNotifier {
/// Whether the daemon and backend answered for this account's tabs. Until
/// they have — and for good, with an older CLI or backend that does not know
- /// Agent Messages (404) — there is no 💬 and no menu row: "off" would be a
- /// guess, and a click could not take.
+ /// Agent Messages (404) — there is no Show Agent Messages: no daemon would
+ /// hold a log to show.
bool get loaded => _loaded;
bool _loaded = false;
- /// On when the person turned it on; off when they did not, and whenever the
- /// backend or daemon cannot say — an older one has no flag to read.
- bool isOn(String tabId) => _pending[tabId] ?? _enabled[tabId] ?? false;
-
- /// A turn on or off is on its way to the backend.
- bool isPending(String tabId) => _pending.containsKey(tabId);
-
- TabMessagesState stateOf(String tabId) =>
- isOn(tabId) ? TabMessagesState.on : TabMessagesState.off;
-
- /// Why the last turn on or off for [tabId] did not take.
- String? failureFor(String tabId) => _failed[tabId];
-
/// Counts the `messages_changed` frames for [tabId], so an open log knows
/// when to read again.
int trafficFor(String tabId) => _traffic[tabId] ?? 0;
@@ -314,13 +294,12 @@ class AgentMessagesController extends ChangeNotifier {
if (!_disposed) notifyListeners();
}
- /// Read every tab's flag again. A failure keeps what was known: one dropped
- /// request must not turn a tab's 💬 off under the person. An answer of null
- /// is a daemon or backend without Agent Messages.
+ /// Ask again whether the daemon and backend know Agent Messages. A failure
+ /// keeps what was known: one dropped request must not take Show Agent
+ /// Messages away. An answer of null is a daemon or backend without them.
Future<void> refresh() async {
if (_disposed) return;
final read = ++_reads, account = _account;
- final writes = Map.of(_writes);
Map<String, dynamic>? answer;
try {
answer = await this.read();
@@ -328,64 +307,12 @@ class AgentMessagesController extends ChangeNotifier {
return;
}
if (_disposed || account != _account || read != _reads) return;
- if (answer == null) {
- if (!_loaded && _enabled.isEmpty) return;
- _loaded = false;
- _enabled.clear();
- _notify();
- return;
- }
- final tabs = answer['tabs'];
- final next = <String, bool>{
- for (final tab in tabs is List ? tabs : const [])
- if (tab is Map && tab['id'] is String)
- tab['id'] as String: tab['enabled'] == true,
- };
- // A write that landed while this read was out is newer than its answer.
- for (final MapEntry(:key, :value) in _writes.entries) {
- if (writes[key] != value && _enabled.containsKey(key)) {
- next[key] = _enabled[key]!;
- }
- }
- _enabled
- ..clear()
- ..addAll(next);
- _loaded = true;
+ final loaded = answer != null;
+ if (loaded == _loaded) return;
+ _loaded = loaded;
_notify();
}
- /// Turn Agent Messages on or off for [tabId]. Shown at once, put back if
- /// the backend refuses or cannot be reached. Answers whether it took.
- Future<bool> setEnabled(String tabId, bool enabled) async {
- if (_disposed || _pending.containsKey(tabId)) return false;
- final account = _account;
- _pending[tabId] = enabled;
- _failed.remove(tabId);
- _notify();
- var saved = false;
- try {
- final answer = await write(tabId, enabled);
- if (_disposed || account != _account) return false;
- final confirmed = answer['enabled'];
- _enabled[tabId] = confirmed is bool ? confirmed : enabled;
- saved = _enabled[tabId] == enabled;
- } catch (_) {
- if (_disposed || account != _account) return false;
- }
- _pending.remove(tabId);
- _writes[tabId] = (_writes[tabId] ?? 0) + 1;
- if (!saved) {
- _failed[tabId] =
- 'Agent Messages could not be turned ${enabled ? 'on' : 'off'}. '
- 'Check that Harness is signed in and online, then try again.';
- }
- _notify();
- unawaited(refresh());
- return saved;
- }
-
- Future<bool> toggle(String tabId) => setEnabled(tabId, !isOn(tabId));
-
/// A `messages_changed` frame from a daemon: a message moved, or a sender
/// hit the rate limit.
void handleEvent(Map<String, dynamic> payload) {
@@ -608,10 +535,6 @@ class AgentMessagesController extends ChangeNotifier {
void reset() {
_account++;
_reads++;
- _enabled.clear();
- _pending.clear();
- _failed.clear();
- _writes.clear();
_traffic.clear();
_seenMessages.clear();
_polling.clear();
@@ -642,7 +565,8 @@ class AgentMessagesRemoteWatch {
final AgentMessagesController controller;
final ValueListenable<bool> foreground;
- /// The tabs to ask about now: on, with a harness on another machine.
+ /// The tabs to ask about now: those whose harnesses may message each
+ /// other, with a harness on another machine.
final List<AgentMessagesRemoteTab> Function() tabs;
final Duration every;
Timer? _timer;
diff --git a/desktop/lib/agent_messages/agent_messages_view.dart b/desktop/lib/agent_messages/agent_messages_view.dart
index 64f81d952..9488d452f 100644
--- a/desktop/lib/agent_messages/agent_messages_view.dart
+++ b/desktop/lib/agent_messages/agent_messages_view.dart
@@ -10,7 +10,9 @@ import '../widgets/terminal_prompt.dart';
import 'agent_messages.dart';
/// Show Agent Messages: [tabId]'s log, newest last. The person reads it here
-/// and types into panes as always; there is nothing to compose.
+/// and types into panes as always; there is nothing to compose, and nothing to
+/// turn on: whether agents may message is Settings ▸ Agents' (owner,
+/// 2026-10-12).
Future<void> showAgentMessages(
BuildContext context,
AppNotifier app, {
@@ -129,8 +131,6 @@ class _AgentMessagesViewState extends State<AgentMessagesView> {
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
final controller = widget.controller;
- final on = controller.isOn(widget.tabId);
- final failure = controller.failureFor(widget.tabId);
final log = _log;
final messages = log?.messages ?? const <AgentMessage>[];
final hint =
@@ -145,7 +145,7 @@ class _AgentMessagesViewState extends State<AgentMessagesView> {
padding: const EdgeInsets.symmetric(vertical: 24),
child: Text(
log.reached
- ? 'No messages yet. Turn on Agent Messages, then agents use '
+ ? 'No messages yet. Agents in this tab send them with '
'`harness send`.'
: 'Could not read this tab’s messages. Check that Harness is '
'running on this computer, then try again.',
@@ -193,47 +193,6 @@ class _AgentMessagesViewState extends State<AgentMessagesView> {
title: '${widget.tabName} · Agent Messages',
onClose: widget.onClose,
),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 24),
- child: Row(
- children: [
- Expanded(
- child: Text(
- 'Agent Messages',
- style: DesktopChrome.control(medium: true),
- ),
- ),
- Semantics(
- label: 'Agent Messages',
- child: Switch(
- key: const ValueKey('agent-messages-switch'),
- value: on,
- onChanged: controller.isPending(widget.tabId)
- ? null
- : (value) => unawaited(
- controller.setEnabled(
- widget.tabId,
- value,
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- if (failure != null)
- Padding(
- padding: const EdgeInsets.fromLTRB(24, 4, 24, 0),
- child: Semantics(
- liveRegion: true,
- child: Text(
- failure,
- style: DesktopChrome.metadata(
- color: Theme.of(context).colorScheme.error,
- ),
- ),
- ),
- ),
// A machine with a harness here that did not answer
// (offline, or gone from the tab) holds its own part of
// the log.
diff --git a/desktop/lib/api/api_client.dart b/desktop/lib/api/api_client.dart
index 592ac11d8..a28ef3916 100644
--- a/desktop/lib/api/api_client.dart
+++ b/desktop/lib/api/api_client.dart
@@ -134,34 +134,23 @@ class ApiClient {
return unwrapApiResponse(res) as Map<String, dynamic>?;
}
- // -- Agent Messages: which desk tabs let their harnesses message each other (proxied like the desk) --
-
- /// `{revision, machines, tabs: [{id, name, enabled, panes}]}` (backend routes/agentMessages.ts). Null
- /// when the daemon or backend predates Agent Messages (404): the app then offers none. Signed out
- /// (401) or a backend out of reach (503) throws [ApiException], a moment the app waits out.
+ // -- Agent Messages: the account's desk tabs, as the daemon proxies them like the desk --
+
+ /// `{revision, machines, tabs: [{id, name, panes}]}` (backend routes/agentMessages.ts). The app
+ /// reads it only to know the daemon and backend have Agent Messages, which Show Agent Messages
+ /// waits for: each tab's `enabled` a backend may still answer is not read, since whether agents
+ /// may message is Settings ▸ Agents' `agentMessages` now. Null when the daemon or backend
+ /// predates Agent Messages (404): the app then offers none. Signed out (401) or a backend out of
+ /// reach (503) throws [ApiException], a moment the app waits out.
Future<Map<String, dynamic>?> readAgentMessageTabs() async {
final res = await _dio.get('/api/agent-messages');
if (res.statusCode == 404) return null;
return unwrapApiResponse(res) as Map<String, dynamic>?;
}
- /// Turn Agent Messages on or off for one tab; answers `{tabId, enabled, revision}`. A local write
- /// to the daemon, like [deskOps].
- Future<Map<String, dynamic>> setAgentMessages(
- String tabId,
- bool enabled,
- ) async {
- final res = await _dio.patch(
- '/api/agent-messages/tabs/${Uri.encodeComponent(tabId)}',
- data: {'enabled': enabled},
- options: Options(headers: {'x-adapter-local': '1'}),
- );
- return Map<String, dynamic>.from(unwrapApiResponse(res) as Map);
- }
-
// -- what agents may do on this computer (Settings ▸ Agents), kept by this computer's daemon --
- /// `{agentsStartAgents, pullRequestLine?}` as this computer's daemon keeps them
+ /// `{agentsStartAgents, pullRequestLine?, agentMessages?}` as this computer's daemon keeps them
/// (cli/src/lib/agentSettings.ts). A key a daemon predates is absent. Null when the daemon predates
/// the route altogether (404). The daemon answers the settings bare, not in `{success, data}`.
Future<Map<String, dynamic>?> agentSettings() async {
diff --git a/desktop/lib/screens/swarm_menu_bus.dart b/desktop/lib/screens/swarm_menu_bus.dart
index 61225c4e1..36c8cdf4f 100644
--- a/desktop/lib/screens/swarm_menu_bus.dart
+++ b/desktop/lib/screens/swarm_menu_bus.dart
@@ -84,9 +84,9 @@ class SwarmMenuState extends ChangeNotifier {
bool canGoBack = false;
bool canGoForward = false;
- /// Whether Agent Messages is on in the active tab; null where it has none
- /// (the Store). File's Agent Messages row shows it as a checkmark.
- bool? agentMessages;
+ /// Whether the active tab has an Agent Messages log to show: not the Store,
+ /// and not with an older CLI or backend. File's Show Agent Messages needs it.
+ bool canShowAgentMessages = false;
List<SwarmMenuEntry> history = const [];
List<SwarmMenuEntry> closedHistory = const [];
@@ -109,7 +109,7 @@ class SwarmMenuState extends ChangeNotifier {
canClosePane = args['canClosePane'] as bool? ?? false;
canGoBack = args['canGoBack'] as bool? ?? false;
canGoForward = args['canGoForward'] as bool? ?? false;
- agentMessages = args['activeAgentMessages'] as bool?;
+ canShowAgentMessages = args['canShowAgentMessages'] as bool? ?? false;
history = _parseEntries(args['history'], closed: false);
closedHistory = _parseEntries(args['closedHistory'], closed: true);
paneActions = {
@@ -134,7 +134,7 @@ class SwarmMenuState extends ChangeNotifier {
canClosePane = false;
canGoBack = false;
canGoForward = false;
- agentMessages = null;
+ canShowAgentMessages = false;
history = const [];
closedHistory = const [];
paneActions = const {};
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 13cb38da0..d792e9440 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -2043,20 +2043,15 @@ class _SwarmScreenState extends State<SwarmScreen> {
activity,
color: activityInk(activity),
),
- // Agent Messages' 💬; absent where a tab has none
- // (AppNotifier.agentMessagesOffered). The flag only: a tab
- // never shows traffic.
+ // The tab menu's Show Agent Messages; absent where a tab has no
+ // log (AppNotifier.agentMessagesOffered). Nothing of Agent
+ // Messages shows on the tab itself.
if (app.agentMessagesOffered(swarm.id))
- 'agentMessages': app.agentMessages.isOn(swarm.id),
+ 'canShowAgentMessages': true,
},
],
- // Agent Messages' color: the 💬 while on. The design system's one
- // accent, blue, as a mark.
- 'agentMessagesInk': grid.AppPalette.accentOnSurface.toARGB32(),
- // The File menu's Agent Messages checkmark, for the active tab.
- 'activeAgentMessages': app.agentMessagesOffered(app.activeSwarmId)
- ? app.agentMessages.isOn(app.activeSwarmId)
- : null,
+ // File's Show Agent Messages, for the active tab.
+ 'canShowAgentMessages': app.agentMessagesOffered(app.activeSwarmId),
};
final encoded = jsonEncode(payload);
if (encoded == _nativeState) return;
@@ -2381,15 +2376,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (args['id'] is String) unawaited(_rename(args['id']));
case 'renameActive':
unawaited(_rename(app.activeSwarmId));
- case 'toggleAgentMessages':
- // From a tab's 💬 or its menu (with its id), or the File menu (the
- // active tab).
- unawaited(
- _toggleAgentMessages(
- args['id'] is String ? args['id'] as String : app.activeSwarmId,
- ),
- );
case 'showAgentMessages':
+ // From a tab's menu (with its id), or the File menu (the active tab).
unawaited(
_showAgentMessages(
args['id'] is String ? args['id'] as String : app.activeSwarmId,
@@ -2543,7 +2531,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
'new',
'rename',
'renameActive',
- 'toggleAgentMessages',
'showAgentMessages',
'commands',
'notifications',
@@ -2741,19 +2728,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
if (name != null) app.renameSwarm(id, name);
});
- /// Turn Agent Messages on or off for [id]. The 💬 follows at once and goes
- /// back if the backend does not take it — and then says so where the click
- /// was, since a 💬 that quietly flips back reads as a click that missed.
- Future<void> _toggleAgentMessages(String id) async {
- if (!app.agentMessagesOffered(id)) return;
- if (await app.agentMessages.toggle(id) || !mounted) return;
- final failure = app.agentMessages.failureFor(id);
- if (failure == null) return;
- ScaffoldMessenger.maybeOf(context)
- ?..hideCurrentSnackBar()
- ..showSnackBar(SnackBar(content: Text(failure)));
- }
-
/// [id]'s Agent Messages log.
Future<void> _showAgentMessages(String id) => _dialog(() async {
final swarm = app.swarms.where((s) => s.id == id).firstOrNull;
@@ -6808,8 +6782,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
'pane.focus_$i': () => app.focusPaneByIndex(i - 1),
'navigation.commands': _showSearchCommands,
'agent_messages.show': () => _showAgentMessages(app.activeSwarmId),
- 'agent_messages.toggle': () =>
- unawaited(_toggleAgentMessages(app.activeSwarmId)),
'app.customize': () => unawaited(_customize()),
'pane.toggle_shading': () => unawaited(
appearancePrefsStore.setShadeInactivePanes(
@@ -7072,10 +7044,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
: command.id == 'agent.restart' &&
isTerminalEngine(_focusedAgent?.engine)
? 'Restart Terminal'
- : command.id == 'agent_messages.toggle'
- ? app.agentMessages.isOn(app.activeSwarmId)
- ? 'Agent Messages: turn off for this tab'
- : 'Agent Messages: turn on for this tab'
: command.label,
detail: command.group.label,
swarmId: null,
@@ -7954,8 +7922,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
];
final toolHeight = workspaceBarControlHeight(context);
final prefs = appearancePrefsStore.value.prompt;
- // Agent Messages' color: the design system's accent blue, as a mark.
- final messagesColor = grid.AppPalette.accentOnSurface;
final storeWidth = math.min(
WorkspaceStoreButton.widthOf(context),
math.max(0.0, constraints.maxWidth - cell.width * 22),
@@ -8075,11 +8041,8 @@ class _SwarmScreenState extends State<SwarmScreen> {
unawaited(app.requestCloseSwarm(swarm.id));
}
},
- // Only the tab listens to Agent Messages: its traffic
- // must not rebuild the workspace.
- child: ListenableBuilder(
- listenable: app.agentMessages,
- builder: (context, _) {
+ child: Builder(
+ builder: (context) {
final nameHint = workspaceTabTooltip(
labels[index],
swarm.name,
@@ -8110,16 +8073,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
app.requestCloseSwarm(swarm.id),
)
: null,
- agentMessages:
- app.agentMessagesOffered(swarm.id)
- ? app.agentMessages.stateOf(swarm.id)
- : null,
- onToggleAgentMessages: _shortcutsEnabled
- ? () => unawaited(
- _toggleAgentMessages(swarm.id),
- )
- : null,
- messagesColor: messagesColor,
activity:
activity == null || activity.mark.isEmpty
? null
diff --git a/desktop/lib/settings/agent_settings.dart b/desktop/lib/settings/agent_settings.dart
index 9a7e9844f..5668a0c1c 100644
--- a/desktop/lib/settings/agent_settings.dart
+++ b/desktop/lib/settings/agent_settings.dart
@@ -19,6 +19,16 @@ enum AgentSetting {
'Mark pull requests from agent-started harnesses',
'A harness another agent started adds one line to the pull requests it opens: '
'🤝 Started by another agent in Harness.',
+ ),
+
+ /// Agent Messages (docs/design/2026-10-10-agent-messages.md). It replaced each tab's own switch, a
+ /// 💬 beside its × that was easy to hit by mistake and turned the tab off, failing a message that
+ /// was waiting (owner, 2026-10-12): one setting for the computer, on by default.
+ agentMessages(
+ 'agentMessages',
+ 'Agents in the same tab can message each other',
+ 'Claude Code and Codex in one tab can send each other messages with harness send. Turn off '
+ 'to keep them from messaging.',
);
const AgentSetting(this.key, this.label, this.description);
diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dart
index eb6bbed5b..a75db5789 100644
--- a/desktop/lib/shared/theme/app_icons.dart
+++ b/desktop/lib/shared/theme/app_icons.dart
@@ -1,4 +1,3 @@
-import 'package:flutter/material.dart' show Icons;
import 'package:lucide_icons_flutter/lucide_icons.dart';
/// One outline family for app actions, navigation, and status.
@@ -116,11 +115,6 @@ abstract final class AppIcons {
static const messageCircleQuestionMark =
LucideIcons.messageCircleQuestionMark400;
static const messagesSquare = LucideIcons.messagesSquare400;
-
- /// A tab's Agent Messages on and off: Lucide has no filled chat, and one outline in two tints read alike (owner,
- /// 2026-10-12). Material's pair is filled and outlined in one drawing, as AppKit's `bubble.left.and.bubble.right`.
- static const agentMessagesOn = Icons.forum;
- static const agentMessagesOff = Icons.forum_outlined;
static const messageSquareText = LucideIcons.messageSquareText400;
static const minimize = LucideIcons.minimize400;
static const minus = LucideIcons.minus400;
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index aa73edc17..f387a4b54 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -495,7 +495,8 @@ final harnessCommands = <HarnessCommand>[
action: ShortcutAction.orchestrate,
),
// Agent Messages (docs/design/2026-10-10-agent-messages.md): the active
- // tab's log, and its flag. Their native menu rows are File's.
+ // tab's log; its native menu row is File's. There is no turning it on or
+ // off for a tab: that is Settings ▸ Agents', for the whole computer.
const HarnessCommand(
'agent_messages.show',
'Show Agent Messages',
@@ -503,13 +504,6 @@ final harnessCommands = <HarnessCommand>[
nativeAction: 'showAgentMessages',
keywords: _agentMessagesKeywords,
),
- const HarnessCommand(
- 'agent_messages.toggle',
- 'Agent Messages: turn on or off for this tab',
- ShortcutGroup.actions,
- nativeAction: 'toggleAgentMessages',
- keywords: _agentMessagesKeywords,
- ),
const HarnessCommand(
'app.customize',
'Appearance',
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 3cf1d2577..755beb99d 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1476,12 +1476,13 @@ class AppNotifier extends ChangeNotifier {
Iterable<TerminalPane> get allPanes => swarms.expand((s) => s.panes).toSet();
String get activeSwarmId => activeSwarm.id;
- /// Agent Messages (docs/design/2026-10-10-agent-messages.md): each tab's
- /// flag, the traffic the daemons push as `messages_changed`, and the marks it
- /// leaves on panes. Its own notifier, so traffic never rebuilds the workspace.
+ /// Agent Messages (docs/design/2026-10-10-agent-messages.md): whether the
+ /// account has them, the traffic the daemons push as `messages_changed`, and
+ /// the marks it leaves on panes. Its own notifier, so traffic never rebuilds
+ /// the workspace. Whether agents may message is each computer's setting
+ /// (Settings ▸ Agents), not a tab's.
late final agentMessages = AgentMessagesController(
read: () => api.readAgentMessageTabs(),
- write: (tabId, enabled) => api.setAgentMessages(tabId, enabled),
request: (machineId, payload) => _conn(machineId).request(
'agent_messages',
payload: payload,
@@ -1494,11 +1495,11 @@ class AppNotifier extends ChangeNotifier {
?.displayName,
);
- /// Whether [tabId] has Agent Messages to offer: a tab the desk holds, since
- /// the backend keeps the flag per desk tab, once the daemon and backend have
- /// answered for it. The Store, Devices and Companions, an orchestrator or a
- /// draft tab, a window before it joins the desk, and an older CLI or backend
- /// get no 💬, menu row or command.
+ /// Whether [tabId] has an Agent Messages log to show: a tab the desk holds,
+ /// since the daemons know a tab by its desk id, once the daemon and backend
+ /// have answered for Agent Messages. The Store, Devices and Companions, an
+ /// orchestrator or a draft tab, a window before it joins the desk, and an
+ /// older CLI or backend get no Show Agent Messages row or command.
bool agentMessagesOffered(String tabId) {
final swarm = swarms.where((s) => s.id == tabId).firstOrNull;
return swarm != null &&
@@ -1541,15 +1542,18 @@ class AppNotifier extends ChangeNotifier {
expected: _agentMessageMembers(tabId),
);
- /// The tabs with Agent Messages on, each with its connected machines other
+ /// The desk tabs with two or more of the owner's harnesses — the fewest
+ /// that can message each other — each with its connected machines other
/// than this computer: their daemons' `messages_changed` reaches only their
/// own computer's windows, so [agentMessagesRemote] asks them instead. In a
- /// browser every machine is another computer.
+ /// browser every machine is another computer. No tab has a switch to wait
+ /// for: a computer whose Settings ▸ Agents turned messaging off just answers
+ /// with nothing new.
List<AgentMessagesRemoteTab> agentMessagesRemoteTabs() {
final local = localMachineState?.machine.machineId;
return [
for (final swarm in swarms)
- if (agentMessagesOffered(swarm.id) && agentMessages.isOn(swarm.id))
+ if (agentMessagesOffered(swarm.id) && _messagingHarnesses(swarm) >= 2)
if ([
for (final id in agentMessageMachines(swarm.id))
if (id != local) id,
@@ -1559,6 +1563,14 @@ class AppNotifier extends ChangeNotifier {
];
}
+ /// How many of the owner's harnesses [swarm] holds, each once.
+ int _messagingHarnesses(Swarm swarm) => {
+ for (final pane in swarm.panes)
+ if (pane.agentId case final agentId?
+ when machineStates[pane.machineId]?.machine.isShared != true)
+ agentMessageKey(pane.machineId, agentId),
+ }.length;
+
/// Polls [agentMessagesRemoteTabs] while the window is in front; the
/// workspace starts it.
late final agentMessagesRemote = AgentMessagesRemoteWatch(
@@ -7179,8 +7191,12 @@ class AppNotifier extends ChangeNotifier {
_desk.pending.isEmpty) {
unawaited(_deskFetch());
}
- // So are Agent Messages' flags (desk_changed); this catches a missed one.
- if (!_disposed && status == AppStatus.authenticated && _desk.enabled) {
+ // Agent Messages' first answer, when the read beside the desk failed
+ // (a backend away at sign-in) and no backend-online flip followed.
+ if (!_disposed &&
+ status == AppStatus.authenticated &&
+ _desk.enabled &&
+ !agentMessages.loaded) {
unawaited(agentMessages.refresh());
}
unawaited(_rereadMachinesInBackground(pushed: false));
@@ -15684,7 +15700,8 @@ class AppNotifier extends ChangeNotifier {
return;
}
_desk.enabled = true;
- // Each tab's Agent Messages flag lives beside the desk, read once it is.
+ // Whether the daemon and backend have Agent Messages, which Show Agent
+ // Messages waits for, is read once the desk is.
unawaited(agentMessages.refresh());
// Tabs from before the desk carry per-window ids (`swarm-N`) two computers
// would both mint. Give them desk ids once; the layout store keys by the
@@ -17272,11 +17289,6 @@ class AppNotifier extends ChangeNotifier {
break;
case 'desk_changed':
unawaited(experimentalFeatures.refresh());
- // Turning Agent Messages on or off for a tab says `desk_changed` too,
- // with the desk itself unchanged (backend routes/agentMessages.ts).
- if (status == AppStatus.authenticated) {
- unawaited(agentMessages.refresh());
- }
// Another window — on another computer, or this one — changed the
// tabs. The payload is only the revision; the document is fetched.
final deskRevision = payload['revision'];
diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dart
index 6c0d35088..0adac2e57 100644
--- a/desktop/lib/widgets/desktop_workspace_tab.dart
+++ b/desktop/lib/widgets/desktop_workspace_tab.dart
@@ -3,19 +3,19 @@ import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
-import '../agent_messages/agent_messages.dart';
import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import 'box_chrome.dart';
import 'desktop_chrome.dart';
/// The Flutter counterpart of the AppKit tab: a centered name/status group
-/// and, at its trailing edge, Agent Messages' 💬 and the close action.
+/// and, at its trailing edge, the close action.
///
-/// At rest the name and status have the whole tab. Hovering reveals 💬 — grey
-/// while Agent Messages is off, [messagesColor] while on — and ×. Traffic
-/// between its agents shows nothing on the tab: messages arrive when they
-/// arrive.
+/// At rest the name and status have the whole tab; hovering reveals ×. Agent
+/// Messages has nothing on a tab: traffic between its agents shows nothing,
+/// since messages arrive when they arrive, and its on/off is Settings ▸
+/// Agents'. The 💬 that sat beside × was easy to hit by mistake and turned
+/// the tab off, failing a message that was waiting (owner, 2026-10-12).
class DesktopWorkspaceTab extends StatefulWidget {
const DesktopWorkspaceTab({
super.key,
@@ -29,23 +29,12 @@ class DesktopWorkspaceTab extends StatefulWidget {
this.activityLabel,
this.highlighted = false,
this.onRename,
- this.agentMessages,
- this.messagesColor,
- this.onToggleAgentMessages,
});
final String id, label;
final bool selected, highlighted;
final VoidCallback? onSelect, onClose;
final VoidCallback? onRename;
-
- /// This tab's Agent Messages, or null where a tab has none (the Store).
- final TabMessagesState? agentMessages;
-
- /// Agent Messages' color, for the 💬 while on: the accent blue
- /// (`AppPalette.accentOnSurface`), the design system's color for "on".
- final Color? messagesColor;
- final VoidCallback? onToggleAgentMessages;
final String? tooltip, activityLabel;
/// The status cell: an [ActivityMark].
@@ -63,27 +52,19 @@ class DesktopWorkspaceTab extends StatefulWidget {
return width;
}
- // × and, left of it, 💬, inside the tab's curved body, with a dead gap
- // between them so a click just off × never toggles 💬. They show only on
- // hover; at rest the name and status have the whole tab. 20pt targets 8pt
- // apart: 16pt ones 3pt apart were easy to click by mistake (owner, 2026-10-12).
- static const closeWidth = 20.0, messagesWidth = 20.0, accessoryGap = 8.0;
+ // × 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;
static const _restingInset = grid.AppDesktop.tabShoulder + 6;
- static const _revealedInset =
- closeWidth + accessoryGap + messagesWidth + grid.AppDesktop.tabCloseInset;
+ static const _revealedInset = closeWidth + grid.AppDesktop.tabCloseInset;
static const _statusWidth = 16.0, _indicatorGap = 6.0;
- /// What the 💬 says it does, in each state.
- static String agentMessagesTooltip(TabMessagesState state) => switch (state) {
- TabMessagesState.off => 'Agent messages off · click to turn on',
- TabMessagesState.on => 'Agent messages on · click to turn off',
- };
-
static double labelWidth(BuildContext context, String label) =>
_measure(context, label, DesktopChrome.control());
- /// The width that shows [label] whole while hovered, when 💬 and × take
- /// their room — where a tooltip appears.
+ /// The width that shows [label] whole while hovered, when × takes its room
+ /// — where a tooltip appears.
static double naturalWidth(
BuildContext context,
String label, {
@@ -95,8 +76,8 @@ class DesktopWorkspaceTab extends StatefulWidget {
(hasActivity ? _statusWidth + _indicatorGap : 0);
/// The name's left edge and width: centered with its status, and when
- /// revealed moved left only as far as 💬 and × need, then shortened. A name
- /// with room never moves.
+ /// revealed moved left only as far as × needs, then shortened. A name with
+ /// room never moves.
static (double, double) titleLayout({
required double tabWidth,
required double labelWidth,
@@ -135,8 +116,8 @@ class DesktopWorkspaceTab extends StatefulWidget {
class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
bool _hovered = false, _focused = false;
- /// One of the tab's trailing controls: shown, it takes the pointer, focus
- /// and semantics; hidden, it keeps its place and none of them.
+ /// The tab's trailing control: shown, it takes the pointer, focus and
+ /// semantics; hidden, it keeps its place and none of them.
Widget _accessory({
required bool visible,
required double width,
@@ -201,8 +182,6 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
? foreground
: muted
: foreground.withValues(alpha: .38);
- final messages = widget.agentMessages;
- final messagesOn = messages != null && messages != TabMessagesState.off;
Widget tab = Padding(
padding: const EdgeInsets.only(top: grid.AppDesktop.tabTopInset),
child: DecoratedBox(
@@ -243,13 +222,6 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
if (widget.onClose != null)
const CustomSemanticsAction(label: 'Close tab'):
widget.onClose!,
- if (messages != null &&
- widget.onToggleAgentMessages != null)
- CustomSemanticsAction(
- label: messagesOn
- ? 'Turn Agent Messages off'
- : 'Turn Agent Messages on',
- ): widget.onToggleAgentMessages!,
},
child: FocusableActionDetector(
enabled: enabled,
@@ -308,55 +280,24 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
right: grid.AppDesktop.tabCloseInset,
top: 0,
bottom: 0,
- child: Row(
- children: [
- _accessory(
- visible: messages != null && revealed,
- width: DesktopWorkspaceTab.messagesWidth,
- child: messages == null
- ? const SizedBox.shrink()
- : _AgentMessagesButton(
- key: ValueKey(
- 'tab-agent-messages:${widget.id}',
- ),
- state: messages,
- onPressed: widget.onToggleAgentMessages,
- // Filled at full strength while on, a quieter
- // outline while off (AppKit's SwarmTitlebar too).
- style: messagesOn
- ? _accessoryStyle(
- widget.messagesColor ?? foreground,
- 1,
- )
- : _accessoryStyle(
- foreground,
- MediaQuery.highContrastOf(context)
- ? .7
- : .35,
- ),
- ),
- ),
- const SizedBox(width: DesktopWorkspaceTab.accessoryGap),
- _accessory(
- visible: revealed,
+ child: _accessory(
+ visible: revealed,
+ width: DesktopWorkspaceTab.closeWidth,
+ child: IconButton(
+ key: ValueKey('tab-close:${widget.id}'),
+ tooltip: 'Close tab',
+ onPressed: widget.onClose,
+ padding: EdgeInsets.zero,
+ constraints: const BoxConstraints.tightFor(
width: DesktopWorkspaceTab.closeWidth,
- child: IconButton(
- key: ValueKey('tab-close:${widget.id}'),
- tooltip: 'Close tab',
- onPressed: widget.onClose,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints.tightFor(
- width: DesktopWorkspaceTab.closeWidth,
- height: 32,
- ),
- style: _accessoryStyle(foreground, quietOpacity),
- icon: const Icon(
- AppIcons.close,
- size: AppIcons.closeSize,
- ),
- ),
+ height: 32,
+ ),
+ style: _accessoryStyle(foreground, quietOpacity),
+ icon: const Icon(
+ AppIcons.close,
+ size: AppIcons.closeSize,
),
- ],
+ ),
),
),
],
@@ -382,53 +323,3 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
);
}
}
-
-/// Agent Messages' 💬: grey while off, in its color while on. Its tooltip says
-/// what a click does.
-class _AgentMessagesButton extends StatelessWidget {
- const _AgentMessagesButton({
- super.key,
- required this.state,
- required this.onPressed,
- required this.style,
- });
-
- final TabMessagesState state;
- final VoidCallback? onPressed;
- final ButtonStyle style;
-
- @override
- Widget build(BuildContext context) {
- final tooltip = DesktopWorkspaceTab.agentMessagesTooltip(state);
- // One node that says what it is and whether it is on; the tooltip's
- // sentence is its hint, not a second label.
- return Semantics(
- container: true,
- button: true,
- toggled: state != TabMessagesState.off,
- label: 'Agent Messages',
- hint: tooltip,
- onTap: onPressed,
- excludeSemantics: true,
- child: Tooltip(
- message: tooltip,
- excludeFromSemantics: true,
- child: IconButton(
- onPressed: onPressed,
- padding: EdgeInsets.zero,
- constraints: const BoxConstraints.tightFor(
- width: DesktopWorkspaceTab.messagesWidth,
- height: 32,
- ),
- style: style,
- icon: Icon(
- state == TabMessagesState.off
- ? AppIcons.agentMessagesOff
- : AppIcons.agentMessagesOn,
- size: 14,
- ),
- ),
- ),
- );
- }
-}
diff --git a/desktop/lib/widgets/linux_menu_bar.dart b/desktop/lib/widgets/linux_menu_bar.dart
index b32de8594..ca003ecce 100644
--- a/desktop/lib/widgets/linux_menu_bar.dart
+++ b/desktop/lib/widgets/linux_menu_bar.dart
@@ -348,21 +348,14 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {
label: 'Close Tab',
action: 'closeActive',
),
- // The active tab's Agent Messages: the tab's 💬, and its log.
- _swarmRow(
- key: 'menu-bar-agent-messages',
- icon: AppIcons.messagesSquare,
- label: 'Agent Messages',
- action: 'toggleAgentMessages',
- selected: state.agentMessages == true,
- enabled: state.enabled && state.agentMessages != null,
- ),
+ // The active tab's Agent Messages log. Whether agents may message is
+ // Settings ▸ Agents', not a tab's, so there is no on/off row here.
_swarmRow(
key: 'menu-bar-show-agent-messages',
icon: AppIcons.messageSquareText,
label: 'Show Agent Messages',
action: 'showAgentMessages',
- enabled: state.enabled && state.agentMessages != null,
+ enabled: state.enabled && state.canShowAgentMessages,
),
const AppMenuDivider(),
_swarmRow(
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index 94f3d7bdb..f814fe2f0 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -29,8 +29,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
private var canFind = false
private var canClosePane = false
private var paneActions: [String: Bool] = [:]
- /// Whether Agent Messages is on in the active tab; nil where it has none.
- private var activeAgentMessages: Bool?
+ /// Whether the active tab has an Agent Messages log to show (File's Show Agent Messages).
+ private var canShowAgentMessages = false
private let historyMenu = NSMenu(title: "History")
private var historyMenuNeedsRebuild = false
private var historyMenuIsOpen = false
@@ -73,7 +73,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
self.canFind = state["canFind"] as? Bool == true
self.canClosePane = state["canClosePane"] as? Bool == true
self.paneActions = state["paneActions"] as? [String: Bool] ?? [:]
- self.activeAgentMessages = state["activeAgentMessages"] as? Bool
+ self.canShowAgentMessages = state["canShowAgentMessages"] as? Bool == true
self.canGoBack = state["canGoBack"] as? Bool == true
self.canGoForward = state["canGoForward"] as? Bool == true
self.updateHistory(state["history"] as? [[String: Any]] ?? [], closed: state["closedHistory"] as? [[String: Any]] ?? [])
@@ -131,7 +131,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
}
private func sendTabAction(_ method: String, arguments: Any?) {
- guard ["daemon", "subscriptions", "focusedContext", "harnessControls", "resourceMonitor", "machineControls", "modelControls", "select", "close", "toggleAgentMessages", "new", "rename", "commands", "notifications", "notificationInbox", "openStatusHarness", "store", "devices", "sessions", "models", "addAgent", "newAgent", "newTerminal", "cloneAgent", "restartAgent", "shareAgent", "toggleViewer", "toggleComposer", "movePaneToTab", "runLocalModel", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines", "machineList"].contains(method) else {
+ 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", "toggleViewer", "toggleComposer", "movePaneToTab", "runLocalModel", "splitRight", "splitDown", "zoomPane", "pinPane", "machineDestination", "machineAgent", "manageMachines", "machineList"].contains(method) else {
channel.invokeMethod(method, arguments: arguments)
return
}
@@ -306,7 +306,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
"cloneAgent": "plus.square.on.square", "restartAgent": "arrow.clockwise",
"shareAgent": "square.and.arrow.up",
"renameActive": "pencil", "closeActive": "xmark",
- "toggleAgentMessages": "bubble.left.and.bubble.right", "showAgentMessages": "text.bubble",
+ "showAgentMessages": "text.bubble",
"splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",
"zoomPane": "viewfinder", "movePaneToTab": "arrow.right.square", "closePane": "xmark",
"commands": "command", "notifications": "bell",
@@ -338,8 +338,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
add(file, "New Tab", "t", "new")
add(file, "Rename Tab", "r", "renameActive", [.command, .shift])
add(file, "Close Tab", "w", "closeActive")
- // The active tab's Agent Messages: its 💬 (a checkmark here) and its log.
- add(file, "Agent Messages", "", "toggleAgentMessages")
+ // The active tab's Agent Messages log. No on/off row: whether agents may message is Settings ▸ Agents',
+ // for the whole computer, since the tab's own switch was easy to hit by mistake (owner, 2026-10-12).
add(file, "Show Agent Messages", "", "showAgentMessages")
file.addItem(.separator())
add(file, "Split Right", "r", "splitRight")
@@ -513,10 +513,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {
if ["restartAgent", "shareAgent", "toggleViewer", "toggleComposer"].contains(action) {
return actionsEnabled && paneActions[action] == true
}
- if action == "toggleAgentMessages" || action == "showAgentMessages" {
- if action == "toggleAgentMessages" { menuItem.state = activeAgentMessages == true ? .on : .off }
- return actionsEnabled && activeAgentMessages != nil
- }
+ if action == "showAgentMessages" { return actionsEnabled && canShowAgentMessages }
if menuItem.action == #selector(machineAction(_:)) {
return actionsEnabled && machines.contains(where: { $0.id == action })
}
@@ -2343,9 +2340,6 @@ private final class SwarmTabStrip: NSView {
let tabsFocused = state["tabsFocused"] as? Bool == true
revealActiveAfterLayout = revealActiveAfterLayout || nextActiveId != activeId
activeId = nextActiveId
- // Agent Messages' color: its 💬 when on. Flutter sends the accent blue
- // (AppPalette.accentOnSurface).
- let messagesColor = statusColor(state["agentMessagesInk"], fallback: .controlAccentColor)
let ids = rows.compactMap { $0["id"] as? String }
let previousOrder = tabs.map(\.swarmId)
tabOrderChanged = tabOrderChanged || ids != previousOrder
@@ -2368,8 +2362,7 @@ private final class SwarmTabStrip: NSView {
tab.actionsEnabled = actionsEnabled
tab.attention = (row["attention"] as? Int ?? 0) > 0
tab.activity = HarnessNativeActivity(row["activity"] as? [String: Any])
- tab.agentMessages = (row["agentMessages"] as? Bool).map { SwarmTabMessages(on: $0) }
- tab.messagesColor = messagesColor
+ tab.canShowAgentMessages = row["canShowAgentMessages"] as? Bool == true
tab.emit = { [weak self, weak tab] method, args in
guard let self, let tab, self.actionsEnabled,
self.tabs.contains(where: { $0 === tab }) else { return }
@@ -2736,19 +2729,17 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
private static let upperRadius: CGFloat = 10
private static let shoulder: CGFloat = 8
private static let topInset: CGFloat = 6
- // Mirror AppDesktop.tabCloseInset and DesktopWorkspaceTab: × and, left of
- // it, Agent Messages' 💬, as 32pt-tall targets inside the curved tab body,
- // with a dead gap between them so a click just off × never toggles 💬. They
- // show only on hover; at rest the name and status have the whole tab. 20pt
- // targets 8pt apart: 16pt ones 3pt apart were "really easy to click by
- // mistake" (owner, 2026-10-12).
+ // 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 ▸ Agents 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 accessoryGap: CGFloat = 8
- private static let messagesWidth: CGFloat = 20
private static let restingInset: CGFloat = shoulder + 6
- private static let revealedInset: CGFloat = trailingInset + closeWidth + accessoryGap + messagesWidth
+ private static let revealedInset: CGFloat = trailingInset + closeWidth
private static let gap: CGFloat = 6
private static let activityWidth: CGFloat = 16
@@ -2758,26 +2749,15 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
let swarmId: String
var name = "New Tab" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }
var displayLabel = "New Tab" { didSet { if displayLabel != oldValue { invalidateLabel() } } }
- /// Agent Messages (docs/design/2026-10-10-agent-messages.md): the hover 💬;
- /// nil where the row carries none (the Store tab). Traffic between agents
- /// shows nothing on the tab: messages arrive when they arrive.
- var agentMessages: SwarmTabMessages? {
- didSet {
- guard agentMessages != oldValue else { return }
- updateMessagesControls()
- invalidateLabel()
- updateAccessibility()
- }
- }
- /// Agent Messages' color: the 💬 when on.
- var messagesColor = NSColor.controlAccentColor {
- didSet { if messagesColor != oldValue { updateMessagesControls() } }
+ /// Whether the tab's menu offers Show Agent Messages (docs/design/2026-10-10-agent-messages.md): false
+ /// where the row says nothing (the Store tab). The tab itself shows nothing of Agent Messages.
+ var canShowAgentMessages = false {
+ didSet { if canShowAgentMessages != oldValue { updateMessagesItems() } }
}
var foreground = NSColor(white: 0.85, alpha: 1) {
didSet {
if foreground != oldValue { invalidateLabel() }
closeButton.foreground = foreground
- updateMessagesControls()
}
}
/// The status slot: the activity mark.
@@ -2804,7 +2784,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
return attention ? "?" : nil
}
/// The name, centered with its status. Revealed, it moves left only as far
- /// as 💬 and × need, then gives up its tail; a name with room never moves.
+ /// 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 width = min(naturalTitleWidth, max(0, bounds.width - Self.restingInset - right - statusSpace))
@@ -2828,7 +2808,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
var isHovered: Bool { hovered && actionsEnabled }
private let selectButton = SwarmSelectButton()
private let closeButton = SwarmPlainIconButton()
- private let messagesButton = SwarmPlainIconButton()
private var messagesItems: [NSMenuItem] = []
/// Whether the middle button went down on THIS tab — see otherMouseUp.
private var middleDown = false
@@ -2854,7 +2833,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
didSet {
selectButton.isEnabled = actionsEnabled
closeButton.isEnabled = actionsEnabled
- messagesButton.isEnabled = actionsEnabled
updateAccessoryVisibility()
needsDisplay = true
}
@@ -2891,16 +2869,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
closeButton.action = #selector(closeSwarm)
closeButton.isHidden = true
addSubview(closeButton)
- messagesButton.title = ""
- messagesButton.isBordered = false
- messagesButton.image = HarnessControlSymbols.image("bubble.left.and.bubble.right")
- messagesButton.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 10, weight: .regular)
- messagesButton.imagePosition = .imageOnly
- messagesButton.foreground = foreground
- messagesButton.target = self
- messagesButton.action = #selector(toggleMessages)
- messagesButton.isHidden = true
- addSubview(messagesButton)
let menu = NSMenu()
func item(_ title: String, _ action: Selector) -> NSMenuItem {
let item = NSMenuItem(title: title, action: action, keyEquivalent: "")
@@ -2911,13 +2879,12 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
_ = item("Rename Tab…", #selector(renameSwarm))
let separator = NSMenuItem.separator()
menu.addItem(separator)
- // Agent Messages carries a checkmark while on (validateMenuItem).
- messagesItems = [separator, item("Agent Messages", #selector(toggleMessages)),
- item("Show Agent Messages", #selector(showMessages))]
+ // The tab's Agent Messages log, where it has one. No on/off row: that is Settings ▸ Agents'.
+ messagesItems = [separator, item("Show Agent Messages", #selector(showMessages))]
menu.addItem(.separator())
_ = item("Close Tab", #selector(closeSwarm))
self.menu = menu
- updateMessagesControls()
+ updateMessagesItems()
updateAccessibility()
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@@ -2927,9 +2894,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
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)
- messagesButton.frame = NSRect(x: max(0, closeX - Self.accessoryGap - Self.messagesWidth),
- y: contentCenterY - Self.accessoryHeight / 2,
- width: min(Self.messagesWidth, bounds.width), height: Self.accessoryHeight)
let fullName = name.trimmingCharacters(in: .whitespacesAndNewlines)
var hints: [String] = []
// A tooltip shows under the pointer, where the name has its revealed room.
@@ -2956,30 +2920,14 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
needsDisplay = true
hoverChanged?()
}
- /// Hovering reveals the tab's 💬 and ×; at rest it shows its name and status.
+ /// Hovering reveals the tab's ×; at rest it shows its name and status.
var isRevealed: Bool { actionsEnabled && hovered }
private func updateAccessoryVisibility() {
closeButton.isHidden = !isRevealed
- messagesButton.isHidden = agentMessages == nil || !isRevealed
- }
- /// The 💬's look, tooltip and accessibility, and the menu rows, for its state:
- /// filled in Agent Messages' color while on, a quiet outline while off. One
- /// outline in two tints read alike: "really hard to see on/off states"
- /// (owner, 2026-10-12), who chose filled over a blue pill and a slash.
- private func updateMessagesControls() {
- for item in messagesItems { item.isHidden = agentMessages == nil }
- if let state = agentMessages {
- messagesButton.image = HarnessControlSymbols.image(state.on ? "bubble.left.and.bubble.right.fill" : "bubble.left.and.bubble.right")
- messagesButton.foreground = state.on ? messagesColor : foreground
- messagesButton.restingOpacity = state.on ? 1 : 0.35
- messagesButton.highContrastRestingOpacity = state.on ? 1 : 0.7
- messagesButton.toolTip = state.tooltip
- messagesButton.setAccessibilityLabel("Agent Messages")
- messagesButton.setAccessibilityValue(state.on ? "On" : "Off")
- messagesButton.setAccessibilityHelp(state.tooltip)
- }
- updateAccessoryVisibility()
- needsDisplay = true
+ }
+ /// The menu's Show Agent Messages and its separator, only where the tab has a log.
+ private func updateMessagesItems() {
+ for item in messagesItems { item.isHidden = !canShowAgentMessages }
}
private func invalidateLabel() {
cachedLabel = nil
@@ -3082,10 +3030,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
selectButton.setAccessibilityHelp(help.isEmpty ? nil : help.joined(separator: ". "))
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
- if menuItem.action == #selector(toggleMessages) {
- menuItem.state = agentMessages?.on == true ? .on : .off
- }
- return actionsEnabled
+ actionsEnabled
}
override func mouseDown(with event: NSEvent) {
guard actionsEnabled else { return }
@@ -3137,25 +3082,13 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
}
func draggingSession(_ session: NSDraggingSession, sourceOperationMaskFor context: NSDraggingContext) -> NSDragOperation { .move }
override func accessibilityChildren() -> [Any]? {
- [selectButton, messagesButton, closeButton].filter { !$0.isHidden }
+ [selectButton, closeButton].filter { !$0.isHidden }
}
@objc private func selectSwarm() { if actionsEnabled { emit?("select", ["id": swarmId]) } }
@objc private func closeSwarm() { if actionsEnabled { emit?("close", ["id": swarmId]) } }
@objc private func renameSwarm() { if actionsEnabled { emit?("rename", ["id": swarmId]) } }
- @objc private func toggleMessages() {
- if actionsEnabled && agentMessages != nil { emit?("toggleAgentMessages", ["id": swarmId]) }
- }
@objc private func showMessages() {
- if actionsEnabled && agentMessages != nil { emit?("showAgentMessages", ["id": swarmId]) }
- }
-}
-
-/// A tab's Agent Messages, as the `update` payload's row says it.
-struct SwarmTabMessages: Equatable {
- var on: Bool
- /// What the 💬 says a click does; the Flutter tab says the same.
- var tooltip: String {
- on ? "Agent messages on · click to turn off" : "Agent messages off · click to turn on"
+ if actionsEnabled && canShowAgentMessages { emit?("showAgentMessages", ["id": swarmId]) }
}
}
diff --git a/desktop/test/agent_messages_commands_test.dart b/desktop/test/agent_messages_commands_test.dart
index 725e86561..31f53fe0d 100644
--- a/desktop/test/agent_messages_commands_test.dart
+++ b/desktop/test/agent_messages_commands_test.dart
@@ -9,15 +9,16 @@ import 'swarm_interactions_test.dart' show chord;
import 'swarm_screen_test.dart' show mount;
import 'swarm_state_test.dart' show createApp;
-/// ⇧⌘P: "Show Agent Messages" (this tab's log) and "Agent Messages: turn on/off
-/// for this tab" replace Swarm's "Tab conversation".
+/// ⇧⌘P: "Show Agent Messages" (this tab's log) replaces Swarm's "Tab
+/// conversation". There is no command to turn Agent Messages on or off for a
+/// tab: whether agents may message is Settings ▸ Agents' (owner, 2026-10-12).
void main() {
- test('the commands are named for Agent Messages, and Swarm\'s is gone', () {
+ test('Show Agent Messages is the one command, and Swarm\'s is gone', () {
expect(
harnessCommandById['agent_messages.show']?.label,
'Show Agent Messages',
);
- expect(harnessCommandById['agent_messages.toggle'], isNotNull);
+ expect(harnessCommandById['agent_messages.toggle'], isNull);
expect(harnessCommandById['team.open'], isNull);
});
@@ -30,35 +31,23 @@ void main() {
await tester.pump();
}
- testWidgets('the palette turns Agent Messages on for this tab', (
+ testWidgets('the palette offers the log and nothing to turn on', (
tester,
) async {
final app = createApp();
addTearDown(app.dispose);
- final api = await joinAgentMessagesDesk(app);
+ await joinAgentMessagesDesk(app);
await mount(tester, app);
- final tab = app.activeSwarmId;
await search(tester, '> agent messages');
// The row, and the preview of the chosen one.
expect(find.text('Show Agent Messages'), findsWidgets);
- expect(find.text('Agent Messages: turn on for this tab'), findsWidgets);
+ expect(find.textContaining('for this tab'), findsNothing);
expect(find.textContaining('Tab conversation'), findsNothing);
- await tester.tap(
- find.text('Agent Messages: turn on for this tab').hitTestable().first,
- );
- await tester.pump();
- await tester.pump(const Duration(milliseconds: 100));
- expect(api.writes, [(tab, true)]);
- expect(app.agentMessages.isOn(tab), isTrue);
- await search(tester, '> agent messages');
- expect(find.text('Agent Messages: turn off for this tab'), findsWidgets);
await tester.pumpWidget(const SizedBox());
});
- testWidgets('a tab without Agent Messages lists neither command', (
- tester,
- ) async {
- // Before the desk is joined there is no flag to show or set.
+ testWidgets('a tab without Agent Messages lists no command', (tester) async {
+ // Before the desk is joined there is no log to show.
final app = createApp()..status = AppStatus.authenticated;
addTearDown(app.dispose);
await mount(tester, app);
diff --git a/desktop/test/agent_messages_tab_test.dart b/desktop/test/agent_messages_tab_test.dart
index d5a104335..f2d7dd38d 100644
--- a/desktop/test/agent_messages_tab_test.dart
+++ b/desktop/test/agent_messages_tab_test.dart
@@ -1,10 +1,7 @@
-import 'dart:ui' show Tristate;
-
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:harness/agent_messages/agent_messages.dart';
import 'package:harness/shared/theme/app_icons.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/widgets/desktop_workspace_tab.dart';
@@ -13,18 +10,17 @@ import 'support/agent_messages_api.dart';
import 'swarm_screen_test.dart' show mount;
import 'swarm_state_test.dart' show createApp;
-/// The tab's Agent Messages (docs/design/2026-10-10-agent-messages.md, "The
-/// tab"): hovering a tab reveals 💬 — grey while off, its color while on — and
-/// ×. Traffic between its agents shows nothing on the tab.
-typedef _Spec = ({String id, TabMessagesState? messages, bool working});
-
-const _messagesColor = Color(0xffbc3fbc);
+/// A tab has nothing of Agent Messages (docs/design/2026-10-10-agent-messages.md):
+/// at rest and hovered it shows only its name, its status and ×. The 💬 that
+/// sat beside × was easy to hit by mistake and turned the tab off, failing a
+/// message that was waiting (owner, 2026-10-12); whether agents may message is
+/// Settings ▸ Agents' now. Traffic between its agents shows nothing either.
+typedef _Spec = ({String id, bool working});
Widget _host(
List<_Spec> tabs, {
Brightness brightness = Brightness.dark,
- void Function(String id)? onToggle,
- void Function(String id)? onSelect,
+ void Function(String id)? onClose,
}) => MaterialApp(
debugShowCheckedModeBanner: false,
theme: grid.buildAppTheme(brightness: brightness),
@@ -40,14 +36,12 @@ Widget _host(
SizedBox(
width: 240,
child: DesktopWorkspaceTab(
+ key: ValueKey('tab:${tab.id}'),
id: tab.id,
label: tab.id,
selected: index == 0,
- onSelect: () => onSelect?.call(tab.id),
- onClose: () {},
- agentMessages: tab.messages,
- messagesColor: _messagesColor,
- onToggleAgentMessages: () => onToggle?.call(tab.id),
+ onSelect: () {},
+ onClose: () => onClose?.call(tab.id),
activityLabel: tab.working ? 'Working' : null,
activity: tab.working
? SizedBox(
@@ -65,31 +59,22 @@ Widget _host(
),
);
-Finder _messages(String id) => find.byKey(ValueKey('tab-agent-messages:$id'));
+Finder _tab(String id) => find.byKey(ValueKey('tab:$id'));
Finder _close(String id) => find.byKey(ValueKey('tab-close:$id'));
Finder _label(String id) => find.byKey(ValueKey('tab-label:$id'));
+Finder _status(String id) => find.byKey(ValueKey('status:$id'));
-Finder _glyphOf(String id) =>
- find.descendant(of: _messages(id), matching: find.byType(Icon));
-
-/// The ink the 💬 glyph is drawn in, while the pointer is not on it.
-Color _glyph(WidgetTester tester, String id) =>
- IconTheme.of(tester.element(_glyphOf(id))).color!;
-
-/// Which 💬 is drawn: filled while on, an outline while off (owner, 2026-10-12:
-/// one outline in two tints read alike).
-IconData _drawn(WidgetTester tester, String id) =>
- tester.widget<Icon>(_glyphOf(id)).icon!;
-
-String _tooltip(WidgetTester tester, String id) => tester
- .widget<Tooltip>(
- find.descendant(of: _messages(id), matching: find.byType(Tooltip)).first,
- )
- .message!;
+/// Every glyph the tab draws.
+List<IconData?> _icons(WidgetTester tester, String id) => [
+ for (final icon in tester.widgetList<Icon>(
+ find.descendant(of: _tab(id), matching: find.byType(Icon)),
+ ))
+ icon.icon,
+];
-Future<TestGesture> _hover(WidgetTester tester, String id) async {
+Future<TestGesture> _hover(WidgetTester tester, Finder target) async {
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: tester.getCenter(_label(id)));
+ await mouse.addPointer(location: tester.getCenter(target));
addTearDown(mouse.removePointer);
await tester.pump();
return mouse;
@@ -97,177 +82,108 @@ Future<TestGesture> _hover(WidgetTester tester, String id) async {
void main() {
for (final brightness in Brightness.values) {
- testWidgets('off: nothing at rest; hovered, a grey 💬 beside × '
+ testWidgets('at rest a name and status; hovered, × and nothing else '
'(${brightness.name})', (tester) async {
- final toggled = <String>[];
+ final closed = <String>[];
await tester.pumpWidget(
_host(
- [(id: 'app', messages: TabMessagesState.off, working: false)],
+ [(id: 'app', working: true)],
brightness: brightness,
- onToggle: toggled.add,
+ onClose: closed.add,
),
);
- expect(_messages('app').hitTestable(), findsNothing);
expect(_close('app').hitTestable(), findsNothing);
+ expect(_status('app'), findsOneWidget);
final title = tester.getRect(_label('app'));
- await _hover(tester, 'app');
- expect(_messages('app').hitTestable(), findsOneWidget);
+ await _hover(tester, _label('app'));
expect(_close('app').hitTestable(), findsOneWidget);
- final grey = _glyph(tester, 'app');
- expect(grey.a, closeTo(.35, .01));
- expect(_drawn(tester, 'app'), AppIcons.agentMessagesOff);
+ expect(_icons(tester, 'app'), [
+ AppIcons.close,
+ ], reason: 'the only control a tab draws is ×');
expect(
- grey.withValues(alpha: 1),
- grid.AppTheme.surfacePalette.foreground,
- reason: 'off is the tab ink, quiet: grey',
+ find.byKey(const ValueKey('tab-agent-messages:app')),
+ findsNothing,
);
+ expect(_status('app'), findsOneWidget, reason: 'hover keeps the status');
expect(find.text('⌘1'), findsNothing, reason: 'tabs show no shortcut');
- expect(_tooltip(tester, 'app'), 'Agent messages off · click to turn on');
- final messages = tester.getRect(_messages('app'));
- final close = tester.getRect(_close('app'));
- expect(
- close.left - messages.right,
- DesktopWorkspaceTab.accessoryGap,
- reason: '💬 sits left of ×, past a gap that neither takes',
- );
- await tester.tapAt(Offset(close.left - 1.5, close.center.dy));
- await tester.pump();
- expect(toggled, isEmpty, reason: 'a click just off × toggles nothing');
- expect(messages.size, const Size(DesktopWorkspaceTab.messagesWidth, 32));
expect(
tester.getRect(_label('app')),
title,
reason: 'a name with room never moves',
);
+ final close = tester.getRect(_close('app'));
+ expect(close.size, const Size(DesktopWorkspaceTab.closeWidth, 32));
+ expect(
+ tester.getRect(_tab('app')).right - close.right,
+ grid.AppDesktop.tabCloseInset,
+ reason: '× keeps its inset inside the curved body',
+ );
+ await tester.tap(_close('app'));
+ await tester.pump();
+ expect(closed, ['app']);
});
}
- testWidgets('on: hovered, 💬 in Agent Messages\' color', (tester) async {
- await tester.pumpWidget(
- _host([(id: 'app', messages: TabMessagesState.on, working: true)]),
- );
- expect(_messages('app').hitTestable(), findsNothing);
- expect(find.byKey(const ValueKey('status:app')), findsOneWidget);
- await _hover(tester, 'app');
- expect(_messages('app').hitTestable(), findsOneWidget);
- final ink = _glyph(tester, 'app');
- expect(ink.withValues(alpha: 1), _messagesColor);
- expect(ink.a, closeTo(1, .01));
- expect(_drawn(tester, 'app'), AppIcons.agentMessagesOn);
- expect(_tooltip(tester, 'app'), 'Agent messages on · click to turn off');
- expect(
- find.byKey(const ValueKey('status:app')),
- findsOneWidget,
- reason: 'hover keeps the status',
- );
- });
-
- testWidgets('hover reveals only its own tab', (tester) async {
- await tester.pumpWidget(
- _host([
- (id: 'one', messages: TabMessagesState.off, working: false),
- (id: 'two', messages: TabMessagesState.on, working: true),
- (id: 'store', messages: null, working: false),
- ]),
- );
- final mouse = await _hover(tester, 'one');
- expect(_close('one').hitTestable(), findsOneWidget);
- expect(_close('two').hitTestable(), findsNothing);
- expect(_messages('two').hitTestable(), findsNothing);
- await mouse.moveTo(tester.getCenter(_label('store')));
- await tester.pump();
- expect(_close('store').hitTestable(), findsOneWidget);
+ testWidgets('hovered, a long name moves left only as far as × needs', (
+ tester,
+ ) async {
+ const id = 'a-name-long-enough-to-reach-the-close-mark';
+ await tester.pumpWidget(_host([(id: id, working: true)]));
+ await _hover(tester, _label(id));
+ final status = tester.getRect(_status(id));
+ final close = tester.getRect(_close(id));
+ expect(status.right, lessThanOrEqualTo(close.left + .01));
expect(
- _messages('store'),
- findsNothing,
- reason: 'the Store tab has no Agent Messages',
+ close.left - status.right,
+ lessThan(1),
+ reason: 'no room is kept for a control that is gone',
);
});
- testWidgets('clicking 💬 toggles that tab without selecting it', (
+ testWidgets('the tab offers Close tab and no Agent Messages action', (
tester,
) async {
- final toggled = <String>[], selected = <String>[];
- await tester.pumpWidget(
- _host(
- [
- (id: 'one', messages: TabMessagesState.off, working: false),
- (id: 'two', messages: TabMessagesState.on, working: false),
- ],
- onToggle: toggled.add,
- onSelect: selected.add,
- ),
- );
- await _hover(tester, 'two');
- await tester.tap(_messages('two'));
- await tester.pump();
- expect(toggled, ['two']);
- expect(selected, isEmpty);
- });
-
- testWidgets('the 💬 has a label and a state', (tester) async {
final semantics = tester.ensureSemantics();
- await tester.pumpWidget(
- _host([
- (id: 'app', messages: TabMessagesState.on, working: false),
- (id: 'off', messages: TabMessagesState.off, working: false),
- ]),
- );
- // Hidden at rest: off the semantics tree until revealed, but the tab
- // itself still offers the action.
+ await tester.pumpWidget(_host([(id: 'app', working: false)]));
+ await _hover(tester, _label('app'));
expect(find.semantics.byLabel('Agent Messages').evaluate(), isEmpty);
- final mouse = await _hover(tester, 'app');
- final on = tester.getSemantics(_messages('app'));
- expect(on.label, 'Agent Messages');
- expect(on.hint, 'Agent messages on · click to turn off');
- expect(on.getSemanticsData().flagsCollection.isToggled, Tristate.isTrue);
- await mouse.moveTo(tester.getCenter(_label('off')));
- await tester.pump();
- final off = tester.getSemantics(_messages('off'));
- expect(off.getSemanticsData().flagsCollection.isToggled, Tristate.isFalse);
- final tab = tester.getSemantics(find.bySemanticsLabel(RegExp(r'^off$')));
+ final tab = tester.getSemantics(find.bySemanticsLabel(RegExp(r'^app$')));
final actions = [
for (final id in tab.getSemanticsData().customSemanticsActionIds!)
CustomSemanticsAction.getAction(id)!.label,
];
- expect(actions, containsAll(['Close tab', 'Turn Agent Messages on']));
+ expect(actions, ['Close tab']);
semantics.dispose();
});
- testWidgets(
- 'the workspace strip offers 💬 only on desk tabs, once answered',
- (tester) async {
- final app = createApp();
- addTearDown(app.dispose);
- await mount(tester, app);
- final before = app.activeSwarmId;
- expect(_messages(before), findsNothing, reason: 'before the desk');
- await tester.pumpWidget(const SizedBox());
- final api = await joinAgentMessagesDesk(app);
- await mount(tester, app);
- final tab = app.activeSwarmId;
- expect(_messages(tab), findsOneWidget);
- app.openStore();
- await tester.pump();
- expect(app.activeSwarm.isStore, isTrue);
- expect(_messages(app.activeSwarmId), findsNothing, reason: 'the Store');
- api.unsupported = true;
- await app.agentMessages.refresh();
- await tester.pump();
- expect(_messages(tab), findsNothing, reason: 'an older CLI or backend');
- await tester.pumpWidget(const SizedBox());
- },
- );
+ testWidgets('a desk tab with Agent Messages shows none of it, hovered or '
+ 'not', (tester) async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ await joinAgentMessagesDesk(app);
+ await mount(tester, app);
+ final tab = app.activeSwarmId;
+ expect(
+ app.agentMessagesOffered(tab),
+ isTrue,
+ reason: 'the tab has a log to show',
+ );
+ expect(find.byKey(ValueKey('tab-agent-messages:$tab')), findsNothing);
+ await _hover(tester, _label(tab));
+ expect(_close(tab).hitTestable(), findsOneWidget);
+ expect(find.byKey(ValueKey('tab-agent-messages:$tab')), findsNothing);
+ expect(find.byIcon(Icons.forum), findsNothing);
+ expect(find.byIcon(Icons.forum_outlined), findsNothing);
+ await tester.pumpWidget(const SizedBox());
+ });
testWidgets('a message moving in a tab changes nothing on it', (
tester,
) async {
final app = createApp();
addTearDown(app.dispose);
- final api = await joinAgentMessagesDesk(app);
+ await joinAgentMessagesDesk(app);
final tab = app.activeSwarmId;
- api.flags[tab] = true;
- await app.agentMessages.refresh();
await mount(tester, app);
List<String?> tooltips() => [
for (final tooltip in tester.widgetList<Tooltip>(
@@ -288,15 +204,13 @@ void main() {
});
await tester.pump();
expect(app.agentMessages.trafficFor(tab), 1);
- expect(app.agentMessages.stateOf(tab), TabMessagesState.on);
expect(
tester.getRect(_label(tab)),
label,
reason: 'no status slot opens beside the name',
);
expect(tooltips(), hints);
- expect(_messages(tab).hitTestable(), findsNothing, reason: 'no 💬 at rest');
- expect(find.byIcon(AppIcons.agentMessagesOn).hitTestable(), findsNothing);
+ expect(find.byIcon(Icons.forum), findsNothing);
// Let the pane marks lapse before the test ends.
await tester.pump(app.agentMessages.markLife);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/agent_messages_test.dart b/desktop/test/agent_messages_test.dart
index fac52bca3..9e3722508 100644
--- a/desktop/test/agent_messages_test.dart
+++ b/desktop/test/agent_messages_test.dart
@@ -13,16 +13,16 @@ import 'package:harness/terminal/terminal_session.dart';
import 'support/agent_messages_api.dart';
/// Agent Messages as the window keeps it (docs/design/2026-10-10-agent-messages.md):
-/// each tab's flag, the traffic `messages_changed` reports, the pane marks it
-/// leaves, and a tab's log merged from every daemon that holds part of it.
+/// whether the account has them, the traffic `messages_changed` reports, the
+/// pane marks it leaves, and a tab's log merged from every daemon that holds
+/// part of it. A tab has no flag here: whether agents may message is each
+/// computer's Settings ▸ Agents (owner, 2026-10-12).
class _Backend {
+ /// Each tab's old flag, which a backend still answers and nothing reads.
Map<String, bool> tabs = {};
int reads = 0;
Object? readError;
bool readNull = false;
- Completer<Map<String, dynamic>>? pendingWrite;
- Object? writeError;
- final writes = <(String, bool)>[];
Future<Map<String, dynamic>?> read() async {
reads++;
@@ -37,14 +37,6 @@ class _Backend {
],
};
}
-
- Future<Map<String, dynamic>> write(String tabId, bool enabled) async {
- writes.add((tabId, enabled));
- if (pendingWrite case final pending?) return pending.future;
- if (writeError case final error?) throw error;
- tabs[tabId] = enabled;
- return {'tabId': tabId, 'enabled': enabled, 'revision': writes.length};
- }
}
Map<String, dynamic> _sent({
@@ -94,7 +86,6 @@ void main() {
AgentNameOf? nameOf,
}) => AgentMessagesController(
read: backend.read,
- write: backend.write,
request: request ?? (_, _) async => throw StateError('offline'),
nameOf: nameOf ?? (_, agentId) => names[agentId],
);
@@ -103,29 +94,27 @@ void main() {
backend = _Backend();
});
- group('the flag', () {
- test('reads each tab, and off is the default', () async {
+ group('whether the account has Agent Messages', () {
+ test('an answer says so, whatever a tab\'s old flag says', () async {
backend.tabs = {'on': true, 'off': false};
final messages = controller();
addTearDown(messages.dispose);
- expect(messages.isOn('on'), isFalse, reason: 'unknown until read');
+ expect(messages.loaded, isFalse, reason: 'unknown until read');
+ var notified = 0;
+ messages.addListener(() => notified++);
await messages.refresh();
expect(messages.loaded, isTrue);
- expect(messages.isOn('on'), isTrue);
- expect(messages.isOn('off'), isFalse);
- expect(messages.isOn('never-seen'), isFalse);
- expect(messages.stateOf('on'), TabMessagesState.on);
- expect(messages.stateOf('off'), TabMessagesState.off);
+ expect(notified, 1);
+ await messages.refresh();
+ expect(notified, 1, reason: 'the same answer again changes nothing');
});
test('an older daemon or backend (404) offers nothing, for good', () async {
- backend.tabs = {'tab': true};
final messages = controller();
addTearDown(messages.dispose);
backend.readNull = true;
await messages.refresh();
expect(messages.loaded, isFalse);
- expect(messages.isOn('tab'), isFalse);
backend.readNull = false;
await messages.refresh();
expect(messages.loaded, isTrue);
@@ -135,7 +124,6 @@ void main() {
messages.addListener(() => notified++);
await messages.refresh();
expect(messages.loaded, isFalse);
- expect(messages.isOn('tab'), isFalse);
expect(notified, 1);
});
@@ -145,91 +133,23 @@ void main() {
backend.readError = StateError('daemon down');
await messages.refresh();
expect(messages.loaded, isFalse);
- expect(messages.isOn('tab'), isFalse);
});
test('a failed read keeps what was known', () async {
- backend.tabs = {'tab': true};
final messages = controller();
addTearDown(messages.dispose);
await messages.refresh();
backend.readError = StateError('one dropped request');
await messages.refresh();
- expect(messages.isOn('tab'), isTrue);
- });
-
- test('a toggle shows at once, then reads again', () async {
- final messages = controller();
- addTearDown(messages.dispose);
- await messages.refresh();
- backend.pendingWrite = Completer();
- final saved = messages.toggle('tab');
- expect(messages.isOn('tab'), isTrue, reason: 'optimistic');
- expect(messages.isPending('tab'), isTrue);
- expect(
- await messages.toggle('tab'),
- isFalse,
- reason: 'one write at a time',
- );
- backend.pendingWrite!.complete({'tabId': 'tab', 'enabled': true});
- backend.tabs['tab'] = true;
- final readsBefore = backend.reads;
- expect(await saved, isTrue);
- expect(messages.isPending('tab'), isFalse);
- expect(messages.isOn('tab'), isTrue);
- expect(messages.failureFor('tab'), isNull);
- await pumpEventQueue();
- expect(backend.reads, readsBefore + 1, reason: 're-read after a toggle');
- expect(backend.writes, [('tab', true)]);
- });
-
- test('a refused toggle goes back and says why', () async {
- final messages = controller();
- addTearDown(messages.dispose);
- var notified = 0;
- messages.addListener(() => notified++);
- backend.writeError = StateError('backend unreachable');
- final saved = messages.setEnabled('tab', true);
- expect(messages.isOn('tab'), isTrue);
- expect(await saved, isFalse);
- expect(messages.isOn('tab'), isFalse);
- expect(messages.failureFor('tab'), contains('could not be turned on'));
- expect(notified, greaterThanOrEqualTo(2));
- backend.writeError = null;
- expect(await messages.setEnabled('tab', true), isTrue);
- expect(messages.failureFor('tab'), isNull);
- });
-
- test('a read that started before a toggle landed cannot undo it', () async {
- final messages = controller();
- addTearDown(messages.dispose);
- final stale = Completer<Map<String, dynamic>?>();
- final reading = AgentMessagesController(
- read: () => stale.future,
- write: backend.write,
- request: (_, _) async => {},
- nameOf: (_, _) => null,
- );
- addTearDown(reading.dispose);
- final read = reading.refresh();
- await reading.setEnabled('tab', true);
- stale.complete({
- 'tabs': [
- {'id': 'tab', 'enabled': false},
- ],
- });
- await read;
- expect(reading.isOn('tab'), isTrue);
+ expect(messages.loaded, isTrue);
});
test('signing out forgets the account', () async {
- backend.tabs = {'tab': true};
final messages = controller();
addTearDown(messages.dispose);
await messages.refresh();
messages.handleEvent(_sent());
messages.reset();
- expect(messages.isOn('tab'), isFalse);
expect(messages.trafficFor('tab'), 0);
expect(messages.markFor('studio', 'lead'), isNull);
expect(messages.loaded, isFalse);
@@ -237,9 +157,8 @@ void main() {
});
group('traffic', () {
- test('a message counts as traffic and leaves the tab as it was', () {
+ test('a message counts as traffic, so an open log reads again', () {
fakeAsync((async) {
- backend.tabs = {'tab': true};
final messages = controller();
unawaited(messages.refresh());
async.flushMicrotasks();
@@ -247,15 +166,9 @@ void main() {
messages.addListener(() => notified++);
messages.handleEvent(_sent());
expect(messages.trafficFor('tab'), 1);
- expect(
- messages.stateOf('tab'),
- TabMessagesState.on,
- reason: 'a tab never shows traffic: messages arrive when they arrive',
- );
expect(notified, 1, reason: 'an open log reads again');
messages.handleEvent(_sent(state: 'delivered'));
expect(messages.trafficFor('tab'), 2);
- expect(messages.stateOf('tab'), TabMessagesState.on);
messages.dispose();
expect(async.pendingTimers, isEmpty);
});
@@ -485,7 +398,6 @@ void main() {
final asked = <(String, Map<String, dynamic>)>[];
final messages = AgentMessagesController(
read: backend.read,
- write: backend.write,
request: (machineId, payload) async {
asked.add((machineId, payload));
return {
@@ -528,7 +440,6 @@ void main() {
test('older messages are remembered, not announced', () async {
final messages = AgentMessagesController(
read: backend.read,
- write: backend.write,
request: (_, _) async => {
'messages': [recent('m0000003', ago: const Duration(minutes: 2))],
},
@@ -554,7 +465,6 @@ void main() {
final asked = <String>[];
final messages = AgentMessagesController(
read: backend.read,
- write: backend.write,
request: (machineId, payload) {
asked.add('$machineId/${payload['tabId']}');
return machineId == 'laptop'
@@ -585,7 +495,6 @@ void main() {
var rounds = 0;
final messages = AgentMessagesController(
read: backend.read,
- write: backend.write,
request: (_, _) async {
rounds++;
return {'messages': const []};
@@ -612,7 +521,7 @@ void main() {
expect(rounds, 3);
tabs = [];
async.elapse(const Duration(seconds: 15));
- expect(rounds, 3, reason: 'no tab is on with remote harnesses');
+ expect(rounds, 3, reason: 'no tab has remote harnesses to message');
tabs = [
(tabId: 'tab', machineIds: ['laptop']),
];
@@ -681,17 +590,18 @@ void main() {
},
);
- test('flags are read when the desk is joined, on desk_changed, and '
+ test('Agent Messages is asked about once the desk is joined, and '
'forgotten on sign-out', () async {
final api = await joinAgentMessagesDesk(app);
expect(api.reads, 1);
expect(app.agentMessages.loaded, isTrue);
+ // desk_changed no longer means a tab's flag moved: nothing to read.
await app.handleEventForTest('studio', {
'type': 'desk_changed',
'payload': {'revision': 0},
});
await pumpEventQueue();
- expect(api.reads, 2);
+ expect(api.reads, 1);
app.expireSessionForTest('Signed out');
expect(app.agentMessages.loaded, isFalse);
});
@@ -721,7 +631,8 @@ void main() {
);
});
- test('a tab that is on polls its harnesses on other machines', () async {
+ test('a desk tab with two harnesses polls those on other machines, '
+ 'with no flag to turn on', () async {
const laptop = Machine(
machineId: 'laptop',
authMode: MachineAuthMode.remote,
@@ -734,26 +645,25 @@ void main() {
..agents = [
const Agent(id: 'web', name: 'Web', terminalAvailable: true),
];
- final api = await joinAgentMessagesDesk(app);
- for (final (machineId, agentId) in [
- ('studio', 'lead'),
- ('laptop', 'web'),
- ]) {
- app.adoptSessionForTest(
- TerminalSession(
- machineId: machineId,
- agentId: agentId,
- agentName: agentId,
- engineId: 'codex',
- send: (_, _) async => true,
- sendBinary: (_) async => true,
- ),
- );
- }
+ await joinAgentMessagesDesk(app);
+ void adopt(String machineId, String agentId) => app.adoptSessionForTest(
+ TerminalSession(
+ machineId: machineId,
+ agentId: agentId,
+ agentName: agentId,
+ engineId: 'codex',
+ send: (_, _) async => true,
+ sendBinary: (_) async => true,
+ ),
+ );
final tab = app.activeSwarmId;
- expect(app.agentMessagesRemoteTabs(), isEmpty, reason: 'off');
- api.flags[tab] = true;
- await app.agentMessages.refresh();
+ adopt('studio', 'lead');
+ expect(
+ app.agentMessagesRemoteTabs(),
+ isEmpty,
+ reason: 'one harness has nobody to message',
+ );
+ adopt('laptop', 'web');
final remote = app.agentMessagesRemoteTabs().single;
expect(remote.tabId, tab);
// No daemon of this computer in this fixture: every machine is remote.
diff --git a/desktop/test/agent_messages_view_test.dart b/desktop/test/agent_messages_view_test.dart
index b5c9dbbb8..14d3cc7e7 100644
--- a/desktop/test/agent_messages_view_test.dart
+++ b/desktop/test/agent_messages_view_test.dart
@@ -6,8 +6,9 @@ import 'package:harness/agent_messages/agent_messages_view.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/widgets/terminal_prompt.dart';
-/// Show Agent Messages: a tab's log, newest last, with its On/Off switch. Enter
-/// opens the recipient's pane; Esc closes; nothing is composed here.
+/// Show Agent Messages: a tab's log, newest last. Enter opens the recipient's
+/// pane; Esc closes; nothing is composed or turned on here — whether agents may
+/// message is Settings ▸ Agents' (owner, 2026-10-12).
AgentMessage _message(
String id,
DateTime at, {
@@ -39,24 +40,10 @@ AgentMessage _message(
void main() {
late AgentMessagesController controller;
- late Map<String, bool> saved;
- late Object? writeError;
setUp(() {
- saved = {};
- writeError = null;
controller = AgentMessagesController(
- read: () async => {
- 'tabs': [
- for (final MapEntry(:key, :value) in saved.entries)
- {'id': key, 'enabled': value},
- ],
- },
- write: (tabId, enabled) async {
- if (writeError case final error?) throw error;
- saved[tabId] = enabled;
- return {'tabId': tabId, 'enabled': enabled};
- },
+ read: () async => {'tabs': const []},
request: (_, _) async => {},
nameOf: (_, agentId) => agentId,
);
@@ -195,17 +182,15 @@ void main() {
expect(opened, isEmpty);
});
- testWidgets('an empty log says how to start; an unreachable one says so', (
- tester,
- ) async {
+ testWidgets('an empty log says how messages come; an unreachable one says '
+ 'so', (tester) async {
await open(
tester,
() async => (reached: true, complete: true, messages: <AgentMessage>[]),
);
expect(
find.text(
- 'No messages yet. Turn on Agent Messages, then agents use '
- '`harness send`.',
+ 'No messages yet. Agents in this tab send them with `harness send`.',
),
findsOneWidget,
);
@@ -281,24 +266,15 @@ void main() {
expect(state.data, contains('worker-0 delivered · worker-1 queued'));
});
- testWidgets('the switch turns Agent Messages on, and back when refused', (
+ testWidgets('the log has no switch: nothing here turns anything on', (
tester,
) async {
await open(
tester,
() async => (reached: true, complete: true, messages: <AgentMessage>[]),
);
- final toggle = find.byKey(const ValueKey('agent-messages-switch'));
- expect(tester.widget<Switch>(toggle).value, isFalse);
- await tester.tap(toggle);
- await tester.pumpAndSettle();
- expect(tester.widget<Switch>(toggle).value, isTrue);
- expect(saved, {'tab': true});
- writeError = StateError('offline');
- await tester.tap(toggle);
- await tester.pumpAndSettle();
- expect(tester.widget<Switch>(toggle).value, isTrue, reason: 'reverted');
- expect(find.textContaining('could not be turned off'), findsOneWidget);
+ expect(find.byType(Switch), findsNothing);
+ expect(find.byKey(const ValueKey('agent-messages-switch')), findsNothing);
});
testWidgets('traffic in this tab reads the log again', (tester) async {
diff --git a/desktop/test/agents_section_test.dart b/desktop/test/agents_section_test.dart
index 6abbb81aa..95fde5fe8 100644
--- a/desktop/test/agents_section_test.dart
+++ b/desktop/test/agents_section_test.dart
@@ -170,6 +170,64 @@ void main() {
},
);
+ // Agent Messages left the tab for this row: the tab's 💬 was easy to hit by
+ // mistake and turned the tab off, failing a waiting message (owner,
+ // 2026-10-12).
+ testWidgets('Agent Messages is one row, on by default, and a toggle writes '
+ 'agentMessages', (tester) async {
+ final daemon = _Daemon({
+ 'agentsStartAgents': true,
+ 'pullRequestLine': true,
+ 'agentMessages': true,
+ });
+ await open(tester, daemon.store());
+ expect(
+ find.text('Agents in the same tab can message each other'),
+ findsOneWidget,
+ );
+ expect(
+ find.text(
+ 'Claude Code and Codex in one tab can send each other messages with '
+ 'harness send. Turn off to keep them from messaging.',
+ ),
+ findsOneWidget,
+ );
+ expect(switchFor(tester, AgentSetting.agentMessages).value, isTrue);
+ await tester.tap(
+ find.byKey(const ValueKey('agent-setting-switch-agentMessages')),
+ );
+ await tester.pumpAndSettle();
+ expect(daemon.writes, [('agentMessages', false)]);
+ expect(switchFor(tester, AgentSetting.agentMessages).value, isFalse);
+ // Turned back on, as `harness settings agent-messages on` would.
+ await tester.tap(
+ find.byKey(const ValueKey('agent-setting-switch-agentMessages')),
+ );
+ await tester.pumpAndSettle();
+ expect(daemon.writes.last, ('agentMessages', true));
+ expect(switchFor(tester, AgentSetting.agentMessages).value, isTrue);
+ });
+
+ testWidgets(
+ 'a daemon that does not name agentMessages does not get its row',
+ (tester) async {
+ // A daemon from before the setting: it read each tab's own switch.
+ await open(tester, _Daemon().store());
+ expect(
+ find.text('Mark pull requests from agent-started harnesses'),
+ findsOneWidget,
+ );
+ expect(
+ find.text('Agents in the same tab can message each other'),
+ findsNothing,
+ );
+ expect(
+ find.byKey(const ValueKey('agent-setting-agentMessages')),
+ findsNothing,
+ );
+ },
+ );
+
testWidgets('a daemon that predates the settings is told to update', (
tester,
) async {
diff --git a/desktop/test/api_client_test.dart b/desktop/test/api_client_test.dart
index 4b0438ec3..a06a3468f 100644
--- a/desktop/test/api_client_test.dart
+++ b/desktop/test/api_client_test.dart
@@ -128,9 +128,7 @@ void main() {
status == 200
? {
'success': true,
- 'data': request.method == 'GET'
- ? {'revision': 1, 'machines': [], 'tabs': []}
- : {'tabId': 'tab-1', 'enabled': true, 'revision': 2},
+ 'data': {'revision': 1, 'machines': [], 'tabs': []},
}
: {
'success': false,
@@ -153,17 +151,8 @@ void main() {
'machines': [],
'tabs': [],
});
- expect(await api.setAgentMessages('tab-1', true), {
- 'tabId': 'tab-1',
- 'enabled': true,
- 'revision': 2,
- });
- expect(seen.last, (
- 'PATCH',
- '/api/agent-messages/tabs/tab-1',
- '1',
- jsonEncode({'enabled': true}),
- ));
+ expect(seen.last.$1, 'GET');
+ expect(seen.last.$2, '/api/agent-messages');
status = 404;
expect(await api.readAgentMessageTabs(), isNull);
for (final transient in [401, 503]) {
@@ -175,10 +164,6 @@ void main() {
),
);
}
- await expectLater(
- api.setAgentMessages('tab-1', false),
- throwsA(isA<ApiException>()),
- );
} finally {
await subscription.cancel();
await server.close(force: true);
diff --git a/desktop/test/desk_sync_test.dart b/desktop/test/desk_sync_test.dart
index 0021cf4ff..128aac6c3 100644
--- a/desktop/test/desk_sync_test.dart
+++ b/desktop/test/desk_sync_test.dart
@@ -73,7 +73,7 @@ class _DeskApi extends ApiClient {
return _json(doc!);
}
- /// Agent Messages' flags are read once the desk is; this proxy has none.
+ /// Agent Messages is asked about once the desk is; this proxy has none.
@override
Future<Map<String, dynamic>?> readAgentMessageTabs() async => null;
}
diff --git a/desktop/test/desktop_workspace_tab_test.dart b/desktop/test/desktop_workspace_tab_test.dart
index 9913d6734..76312379f 100644
--- a/desktop/test/desktop_workspace_tab_test.dart
+++ b/desktop/test/desktop_workspace_tab_test.dart
@@ -221,8 +221,8 @@ void main() {
await tester.pumpAndSettle();
expect(_close('Desktop').hitTestable(), findsOneWidget);
expect(mark, findsOneWidget, reason: 'hover keeps the status');
- // Eight tabs are narrow: the name moves left only as far as 💬 and ×
- // need, never right.
+ // Eight tabs are narrow: the name moves left only as far as × needs,
+ // never right.
expect(
tester.getRect(_label('Desktop')).left,
lessThanOrEqualTo(title.left),
@@ -304,8 +304,8 @@ void main() {
final status = tester.getRect(find.byKey(const ValueKey('status:website')));
expect(
status.right,
- lessThanOrEqualTo(close.left - DesktopWorkspaceTab.messagesWidth),
- reason: 'revealed, the name and status clear 💬 and ×',
+ lessThanOrEqualTo(close.left),
+ reason: 'revealed, the name and status clear ×',
);
expect(
tester.getRect(_label('website')).left,
diff --git a/desktop/test/linux_menu_bar_test.dart b/desktop/test/linux_menu_bar_test.dart
index 8eed96c80..20654ea3b 100644
--- a/desktop/test/linux_menu_bar_test.dart
+++ b/desktop/test/linux_menu_bar_test.dart
@@ -4,7 +4,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:harness/screens/swarm_menu_bus.dart';
import 'package:harness/shared/theme/app_theme.dart';
-import 'package:harness/shared/widgets/app_menu.dart';
import 'package:harness/widgets/linux_menu_bar.dart';
/// The Linux menu bar's wiring.
@@ -161,31 +160,27 @@ void main() {
expect(swarmCalls.last.method, 'closeActive');
});
- testWidgets('Agent Messages rows act on the active tab', (tester) async {
- swarmMenuBus.send('update', {'enabled': true, 'activeAgentMessages': true});
+ testWidgets('File shows the active tab\'s Agent Messages, with no on/off '
+ 'row', (tester) async {
+ swarmMenuBus.send('update', {
+ 'enabled': true,
+ 'canShowAgentMessages': true,
+ });
await pumpBar(tester);
await tap(tester, 'menu-bar-file');
- expect(
- tester
- .widget<AppMenuItem>(find.byKey(const Key('menu-bar-agent-messages')))
- .selected,
- isTrue,
- reason: 'a checkmark while on',
- );
- await tap(tester, 'menu-bar-agent-messages');
- expect(swarmCalls.last.method, 'toggleAgentMessages');
- expect(swarmCalls.last.arguments, isNull, reason: 'the active tab');
-
- await tap(tester, 'menu-bar-file');
+ // Whether agents may message is Settings ▸ Agents': the tab's on/off was
+ // easy to hit by mistake (owner, 2026-10-12).
+ expect(find.byKey(const Key('menu-bar-agent-messages')), findsNothing);
+ expect(find.text('Agent Messages'), findsNothing);
await tap(tester, 'menu-bar-show-agent-messages');
expect(swarmCalls.last.method, 'showAgentMessages');
+ expect(swarmCalls.last.arguments, isNull, reason: 'the active tab');
- // The Store tab has no Agent Messages: both rows go quiet.
+ // The Store tab has no log: the row goes quiet.
swarmMenuBus.send('update', {'enabled': true});
await tester.pump();
await tap(tester, 'menu-bar-file');
- expect(find.byKey(const Key('menu-bar-agent-messages')), findsNothing);
expect(find.byKey(const Key('menu-bar-show-agent-messages')), findsNothing);
expect(find.text('Show Agent Messages'), findsOneWidget);
});
diff --git a/desktop/test/native_toolbar_sync_test.dart b/desktop/test/native_toolbar_sync_test.dart
index f1d44f8ad..92c46a512 100644
--- a/desktop/test/native_toolbar_sync_test.dart
+++ b/desktop/test/native_toolbar_sync_test.dart
@@ -219,7 +219,7 @@ void main() {
},
);
- testWidgets('tabs carry Agent Messages, and its actions reach the tab', (
+ testWidgets('tabs carry Show Agent Messages and nothing to turn on', (
tester,
) async {
final app = _App();
@@ -230,13 +230,17 @@ void main() {
final tab = app.activeSwarmId;
Map row() => (updates().last['tabs'] as List).single as Map;
- // Traffic rebuilds no workspace, and the row carries only the flag: a tab
- // never shows agents messaging.
+ // The row says only that the tab has a log: no flag, no color, no
+ // traffic. The tab's 💬 was easy to hit by mistake and turned the tab
+ // off, failing a waiting message (owner, 2026-10-12).
app.agentMessages.handleEvent({'tabId': tab, 'messageId': 'm0000001'});
await tester.idle();
- expect(row()['agentMessages'], isFalse);
+ expect(row()['canShowAgentMessages'], isTrue);
+ expect(row().containsKey('agentMessages'), isFalse);
expect(row().containsKey('agentMessagesFlowing'), isFalse);
- expect(updates().last['activeAgentMessages'], isFalse);
+ expect(updates().last['canShowAgentMessages'], isTrue);
+ expect(updates().last.containsKey('activeAgentMessages'), isFalse);
+ expect(updates().last.containsKey('agentMessagesInk'), isFalse);
Future<void> native(String method) =>
tester.binding.defaultBinaryMessenger.handlePlatformMessage(
@@ -246,24 +250,14 @@ void main() {
),
(_) {},
);
- // 💬 or the tab's menu turns it on for that tab.
- unawaited(native('toggleAgentMessages'));
- await tester.pumpAndSettle();
- expect(api.writes, [(tab, true)]);
- expect(row()['agentMessages'], isTrue);
- expect(updates().last['activeAgentMessages'], isTrue);
- app.agentMessages.handleEvent({'tabId': tab, 'messageId': 'm0000002'});
- await tester.idle();
- expect(row().containsKey('agentMessagesFlowing'), isFalse);
-
- // A refused turn off goes back, and says so where the click was.
- api.writeError = StateError('offline');
+ // An old on/off action does nothing: nothing asks the backend, and no
+ // notice or dialog opens.
+ final reads = api.reads;
unawaited(native('toggleAgentMessages'));
await tester.pumpAndSettle();
- expect(app.agentMessages.isOn(tab), isTrue);
- expect(row()['agentMessages'], isTrue);
- expect(find.textContaining('could not be turned off'), findsOneWidget);
- api.writeError = null;
+ expect(api.reads, reads);
+ expect(find.byType(SnackBar), findsNothing);
+ expect(find.textContaining('Agent Messages'), findsNothing);
// Show Agent Messages opens the tab's log.
unawaited(native('showAgentMessages'));
@@ -273,12 +267,12 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Before · Agent Messages'), findsNothing);
- // An older CLI or backend: no 💬, no menu row.
+ // An older CLI or backend: no log to show.
api.unsupported = true;
await app.agentMessages.refresh();
await tester.idle();
- expect(row().containsKey('agentMessages'), isFalse);
- expect(updates().last['activeAgentMessages'], isNull);
+ expect(row().containsKey('canShowAgentMessages'), isFalse);
+ expect(updates().last['canShowAgentMessages'], isFalse);
await tester.pumpWidget(const SizedBox());
});
@@ -289,8 +283,8 @@ void main() {
await tester.pumpAndSettle();
expect(app.agentMessagesOffered(app.activeSwarmId), isFalse);
final row = (updates().last['tabs'] as List).single as Map;
- expect(row.containsKey('agentMessages'), isFalse);
- expect(updates().last['activeAgentMessages'], isNull);
+ expect(row.containsKey('canShowAgentMessages'), isFalse);
+ expect(updates().last['canShowAgentMessages'], isFalse);
unawaited(
tester.binding.defaultBinaryMessenger.handlePlatformMessage(
'harness/swarm_tabs',
diff --git a/desktop/test/support/agent_messages_api.dart b/desktop/test/support/agent_messages_api.dart
index 3c9d3f430..04e04915f 100644
--- a/desktop/test/support/agent_messages_api.dart
+++ b/desktop/test/support/agent_messages_api.dart
@@ -5,13 +5,13 @@ import 'package:harness/state/app_state.dart';
import 'package:harness/state/desk_sync.dart';
/// The daemon's desk and Agent Messages proxies, scripted: a window's tabs
-/// live on a desk, and each desk tab has an Agent Messages flag beside it
-/// (backend routes/agentMessages.ts).
+/// live on a desk, and the Agent Messages read answers for its tabs (backend
+/// routes/agentMessages.ts). The backend still says each tab's old flag, off
+/// unless someone turned it on; the app no longer reads it.
class AgentMessagesApi extends ApiClient {
AgentMessagesApi() : super(config: AppConfig.dev, session: AuthSession());
DeskDoc doc = const DeskDoc(revision: 0, tabs: []);
- final flags = <String, bool>{};
int reads = 0;
/// A daemon or backend that predates Agent Messages (404).
@@ -19,8 +19,6 @@ class AgentMessagesApi extends ApiClient {
/// A daemon whose backend is away: the read throws.
Object? readError;
- Object? writeError;
- final writes = <(String, bool)>[];
Map<String, dynamic> _json(DeskDoc d) => {
'revision': d.revision,
@@ -49,29 +47,13 @@ class AgentMessagesApi extends ApiClient {
'machines': const [],
'tabs': [
for (final tab in doc.tabs)
- {
- 'id': tab.id,
- 'name': tab.name,
- 'enabled': flags[tab.id] ?? false,
- 'panes': const [],
- },
+ {'id': tab.id, 'name': tab.name, 'enabled': false, 'panes': const []},
],
};
}
-
- @override
- Future<Map<String, dynamic>> setAgentMessages(
- String tabId,
- bool enabled,
- ) async {
- writes.add((tabId, enabled));
- if (writeError case final error?) throw error;
- flags[tabId] = enabled;
- return {'tabId': tabId, 'enabled': enabled, 'revision': writes.length};
- }
}
-/// Signs [app] in on [api] and joins its desk, so its tabs can have Agent
+/// Signs [app] in on [api] and joins its desk, so its tabs can show Agent
/// Messages; [AppNotifier.agentMessagesOffered] holds for its desk tabs after.
Future<AgentMessagesApi> joinAgentMessagesDesk(
AppNotifier app, [
@@ -82,8 +64,9 @@ Future<AgentMessagesApi> joinAgentMessagesDesk(
..api = fake
..status = AppStatus.authenticated;
await app.deskStartForTest();
- // The flags are read beside the desk, after it is joined: let that read
- // land without a timer, so widget and plain tests alike can call this.
+ // Agent Messages is asked about beside the desk, after it is joined: let
+ // that read land without a timer, so widget and plain tests alike can call
+ // this.
for (var i = 0; i < 10 && !app.agentMessages.loaded; i++) {
await Future<void>.value();
}
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index 0ed0f9c86..6eb5419b3 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -109,8 +109,8 @@ void main() {
await mouse.moveTo(tester.getCenter(label));
await tester.pumpAndSettle();
expect(close.hitTestable(), findsOneWidget);
- // Hover reveals × (and 💬 where offered); tabs show no shortcut, and a
- // name with room keeps its place.
+ // Hover reveals ×; tabs show no shortcut, and a name with room keeps
+ // its place.
expect(find.text('⌘1'), findsNothing);
expect(find.text('⌘2'), findsNothing);
expect(tester.getRect(label), nameBounds);
diff --git a/desktop/tool/agent_messages_preview.swift b/desktop/tool/agent_messages_preview.swift
index dbbef1d60..b3c528b61 100644
--- a/desktop/tool/agent_messages_preview.swift
+++ b/desktop/tool/agent_messages_preview.swift
@@ -1,6 +1,10 @@
-// Agent Messages' tab states, drawn by the actual AppKit title bar and menus
-// with synthetic tabs (docs/design/2026-10-10-agent-messages.md). The window is
-// never shown; no Flutter, daemon, account or saved app data is involved.
+// Tabs and menus as Agent Messages leaves them, drawn by the actual AppKit title
+// bar and menus with synthetic tabs (docs/design/2026-10-10-agent-messages.md):
+// a tab shows only its name, status and ×, and its menu and File offer Show
+// Agent Messages, with no on/off row. The 💬 beside × went because it was easy
+// to hit by mistake and turned a tab off, failing a waiting message (owner,
+// 2026-10-12). The window is never shown; no Flutter, daemon, account or saved
+// app data is involved.
// HARNESS_AGENT_MESSAGES_PREVIEW_DIR=<dir> bash tool/check_swarm_titlebar.sh <flutter> --agent-messages-preview
private final class PreviewMessenger: NSObject, FlutterBinaryMessenger {
private var handlers: [String: FlutterBinaryMessageHandler] = [:]
@@ -30,7 +34,6 @@ private extension SwarmTabStrip {
private extension SwarmTabButton {
var previewMenu: NSMenu? { menu }
- func previewPointOnMessages() { messagesButton.mouseEntered(with: previewHover) }
}
private let previewHover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
@@ -38,7 +41,8 @@ private let previewHover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero
private struct PreviewTab {
let id: String
- var messages: Bool?
+ /// Whether the tab has an Agent Messages log to show (not the Store).
+ var log = true
var activity: ((Bool) -> [String: Any])? = nil
}
@@ -73,11 +77,9 @@ private func mark(_ glyph: String, _ label: String, dark: Int64, light: Int64) -
private let working = mark("⠋", "Working", dark: 0xff11a8cd, light: 0xff1b7c83)
private let needsInput = mark("?", "Needs your input", dark: 0xffe5e510, light: 0xff4d2d00)
private let ready = mark("✓", "Finished · unread", dark: 0xff0dbc79, light: 0xff116329)
-// AppPalette.accentOnSurface: AppDesktop.focusDark, and the accent in light.
-private func messagesInk(_ dark: Bool) -> Int64 { dark ? 0xff8ba9ff : 0xff2f5bea }
-private func previewWindow(width: CGFloat, palette: [String: Any], tabs: [PreviewTab], active: String,
- activeMessages: Bool?) -> (NSWindow, SwarmTitlebar) {
+private func previewWindow(width: CGFloat, palette: [String: Any], tabs: [PreviewTab],
+ active: String) -> (NSWindow, SwarmTitlebar) {
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: width, height: 200),
styleMask: [.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)
window.isReleasedWhenClosed = false
@@ -87,13 +89,12 @@ private func previewWindow(width: CGFloat, palette: [String: Any], tabs: [Previe
messenger.receive("configure", ["palette": palette])
let rows: [[String: Any]] = tabs.map { tab in
var row: [String: Any] = ["id": tab.id, "name": tab.id, "label": tab.id]
- if let messages = tab.messages { row["agentMessages"] = messages }
+ if tab.log { row["canShowAgentMessages"] = true }
if let activity = tab.activity { row["activity"] = activity(palette["dark"] as? Int64 == 1) }
return row
}
- var state: [String: Any] = ["enabled": true, "activeId": active, "tabs": rows, "palette": palette,
- "footerCovered": true, "agentMessagesInk": messagesInk(palette["dark"] as? Int64 == 1)]
- if let activeMessages { state["activeAgentMessages"] = activeMessages }
+ let state: [String: Any] = ["enabled": true, "activeId": active, "tabs": rows, "palette": palette,
+ "footerCovered": true, "canShowAgentMessages": tabs.first(where: { $0.id == active })?.log == true]
messenger.receive("update", state)
window.layoutIfNeeded()
return (window, titlebar)
@@ -150,18 +151,18 @@ private func captureMenu(_ menu: NSMenu, _ name: String, dark: Bool) {
}
private let sceneTabs: [PreviewTab] = [
- PreviewTab(id: "app", messages: true, activity: working),
- PreviewTab(id: "desktop", messages: true, activity: ready),
- PreviewTab(id: "website", messages: false, activity: needsInput),
- PreviewTab(id: "notes", messages: false),
+ PreviewTab(id: "app", activity: working),
+ PreviewTab(id: "desktop", activity: ready),
+ PreviewTab(id: "website", activity: needsInput),
+ PreviewTab(id: "notes"),
+ PreviewTab(id: "store", log: false),
]
for (theme, palette) in previewPalettes {
let dark = theme == "dark"
func scene(_ name: String, tabs: [PreviewTab] = sceneTabs, width: CGFloat = 1280, crop: CGFloat? = nil,
after: (SwarmTabStrip) -> Void = { _ in }, _ act: (SwarmTabStrip) -> Void = { _ in }) {
- let (window, titlebar) = previewWindow(width: width, palette: palette, tabs: tabs, active: "app",
- activeMessages: tabs.first?.messages)
+ let (window, titlebar) = previewWindow(width: width, palette: palette, tabs: tabs, active: "app")
act(titlebar.previewStrip)
titlebar.previewStrip.layoutSubtreeIfNeeded()
window.contentView!.superview!.layoutSubtreeIfNeeded()
@@ -170,30 +171,26 @@ for (theme, palette) in previewPalettes {
capture(window, "\(name)-\(theme)", width: crop)
window.close()
}
- // A tab shows no traffic between its agents, so at rest there is one scene.
- scene("01-rest-quiet")
+ // A tab shows nothing of Agent Messages, so at rest there is one scene.
+ scene("01-rest")
// The working spinner, frame by frame, for the review page to play.
for frame in 0..<10 {
scene("anim-working-\(frame)", crop: 600, after: { $0.previewTabs[0].activityFrame = frame })
}
- scene("03-hover-off") { $0.previewTabs[2].mouseEntered(with: previewHover) }
- scene("04-hover-on-quiet") { $0.previewTabs[1].mouseEntered(with: previewHover) }
- scene("06-pointer-on-arrows-off") {
- $0.previewTabs[2].mouseEntered(with: previewHover)
- $0.previewTabs[2].previewPointOnMessages()
- }
+ // Hovered: the name, its status and ×, and nothing else.
+ scene("03-hover") { $0.previewTabs[2].mouseEntered(with: previewHover) }
let crowded = (1...9).map { index in
PreviewTab(id: ["app", "desktop", "website", "notes", "cli", "backend", "phone", "docs", "infra"][index - 1],
- messages: index % 3 != 0, activity: index % 2 == 0 ? working : nil)
+ activity: index % 2 == 0 ? working : nil)
}
scene("08-crowded-rest", tabs: crowded, width: 1280)
scene("09-crowded-hover", tabs: crowded, width: 1280) { $0.previewTabs[1].mouseEntered(with: previewHover) }
- let (window, titlebar) = previewWindow(width: 1280, palette: palette, tabs: sceneTabs, active: "app",
- activeMessages: true)
+ let (window, titlebar) = previewWindow(width: 1280, palette: palette, tabs: sceneTabs, active: "app")
let tabs = titlebar.previewStrip.previewTabs
- captureMenu(tabs[0].previewMenu!, "10-tab-menu-on-\(theme)", dark: dark)
- captureMenu(tabs[2].previewMenu!, "11-tab-menu-off-\(theme)", dark: dark)
+ captureMenu(tabs[0].previewMenu!, "10-tab-menu-\(theme)", dark: dark)
+ // The Store has no log: Rename Tab… and Close Tab only.
+ captureMenu(tabs[4].previewMenu!, "11-tab-menu-store-\(theme)", dark: dark)
if let file = previewApp.mainMenu?.item(withTitle: "File")?.submenu {
captureMenu(file, "12-file-menu-\(theme)", dark: dark)
}
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 16b00fbc0..f4cc1ca44 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -125,8 +125,7 @@ private extension SwarmTabButton {
fresh.name = name
fresh.displayLabel = displayLabel
fresh.foreground = foreground
- fresh.agentMessages = agentMessages
- fresh.messagesColor = messagesColor
+ fresh.canShowAgentMessages = canShowAgentMessages
fresh.labelFont = labelFont
fresh.selected = selected
fresh.attention = attention
@@ -158,13 +157,9 @@ private extension SwarmTabButton {
labelFont = font
try compareWithFresh("Change font")
}
- for state in [SwarmTabMessages(on: true), SwarmTabMessages(on: false), nil] as [SwarmTabMessages?] {
- agentMessages = state
- try compareWithFresh("Agent Messages \(String(describing: state))")
- }
- for color in [NSColor.systemPurple, NSColor.systemGreen] {
- messagesColor = color
- try compareWithFresh("Change Agent Messages' color")
+ for log in [true, false] {
+ canShowAgentMessages = log
+ try compareWithFresh("Agent Messages log \(log)")
}
for color in [NSColor.systemRed, NSColor.black, NSColor.white] {
foreground = color
@@ -504,8 +499,8 @@ private extension SwarmTabButton {
}
try checkTitlebar(hasActivityInk && selectButton.accessibilityHelp() == "Working",
"Hover keeps the activity mark: no shortcut takes its place")
- try checkTitlebar(titleRect == title && activityRect.maxX <= messagesButton.frame.minX && preferredWidth == width,
- "A name with room keeps its place on hover, its status clear of 💬 and ×")
+ try checkTitlebar(titleRect == title && activityRect.maxX <= closeButton.frame.minX && preferredWidth == width,
+ "A name with room keeps its place on hover, its status clear of ×")
mouseExited(with: hover)
try checkTitlebar(closeButton.isHidden && accessibilityChildren()?.count == 1,
"Leaving returns the tab to its quiet state")
@@ -633,116 +628,62 @@ private extension SwarmTabButton {
"The resting title and adjacent status form a centered group")
let revealed = titleRect(revealed: true)
try checkTitlebar(revealed.minX <= resting.minX && revealed.minX >= 14 &&
- revealed.maxX + statusSpace <= messagesButton.frame.minX + 0.01,
- "Revealed, the title moves only left, and only as far as 💬 and × need")
+ revealed.maxX + statusSpace <= closeButton.frame.minX + 0.01,
+ "Revealed, the title moves only left, and only as far as × needs")
try checkTitlebar(selectButton.frame == bounds, "Selection and drag retain the whole tab target beneath its accessory")
- try checkTitlebar(subviews.count == 3 && closeButton.frame.maxX == bounds.maxX - 8 &&
- closeButton.frame.minX - messagesButton.frame.maxX == 8,
- "The close action, and 💬 left of it past a dead gap, stay inset inside the tab's curved body")
+ try checkTitlebar(subviews.count == 2 && closeButton.frame.maxX == bounds.maxX - 8,
+ "The close action alone stays inset inside the tab's curved body")
}
- /// Agent Messages (docs/design/2026-10-10-agent-messages.md): the hover 💬,
- /// grey while off and in its color while on; a click and the tab's menu.
- /// Traffic between agents shows nothing on the tab.
+ /// Agent Messages (docs/design/2026-10-10-agent-messages.md) has nothing on
+ /// a tab: no 💬 at rest or hovered, and no on/off row in its menu, since the
+ /// 💬 beside × was easy to hit by mistake and turned the tab off, failing a
+ /// waiting message (owner, 2026-10-12). Its menu keeps Show Agent Messages.
func checkAgentMessages() throws {
frame = NSRect(x: 0, y: 0, width: 240, height: 40)
contentCenterY = 20
name = "app"
displayLabel = "app"
activity = nil
- messagesColor = NSColor(srgbRed: 1, green: 0, blue: 1, alpha: 1)
layoutSubtreeIfNeeded()
var events: [(String, String?)] = []
emit = { method, args in events.append((method, (args as? [String: Any])?["id"] as? String)) }
defer { emit = nil }
let hover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
timestamp: 0, windowNumber: 0, context: nil, eventNumber: 0, clickCount: 0, pressure: 0)!
- /// Which symbol the button draws: filled while on, outlined while off (owner, 2026-10-12).
- func drawn(_ button: NSButton, _ symbol: String) -> Bool {
- button.image?.tiffRepresentation == HarnessControlSymbols.image(symbol)?.tiffRepresentation
- }
- func hasMessagesInk(_ view: NSView? = nil) -> Bool {
- let bitmap = (view ?? self).renderedBitmap()
- return (0..<bitmap.pixelsWide).contains { x in
- (0..<bitmap.pixelsHigh).contains { y in
- guard let pixel = bitmap.colorAt(x: x, y: y)?.usingColorSpace(.sRGB), pixel.alphaComponent > 0.5
- else { return false }
- return pixel.redComponent > 0.7 && pixel.blueComponent > 0.7 && pixel.greenComponent < 0.3
- }
- }
- }
let rows = menu?.items ?? []
- try checkTitlebar(rows.map(\.title) == ["Rename Tab…", "", "Agent Messages", "Show Agent Messages", "", "Close Tab"],
- "The tab menu: Rename Tab…, Agent Messages, Show Agent Messages, Close Tab")
- try checkTitlebar(rows[1...3].allSatisfy(\.isHidden), "A tab without Agent Messages (the Store) lists neither row")
- mouseEntered(with: hover)
- try checkTitlebar(messagesButton.isHidden && !closeButton.isHidden, "A tab without Agent Messages shows no 💬")
- mouseExited(with: hover)
+ try checkTitlebar(rows.map(\.title) == ["Rename Tab…", "", "Show Agent Messages", "", "Close Tab"],
+ "The tab menu: Rename Tab…, Show Agent Messages, Close Tab; no Agent Messages on/off row")
+ try checkTitlebar(rows[1...2].allSatisfy(\.isHidden), "A tab without a log (the Store) lists no Show Agent Messages")
+ try checkTitlebar(subviews.count == 2, "A tab holds only its selection target and ×")
- agentMessages = SwarmTabMessages(on: false)
- try checkTitlebar(rows[1...3].allSatisfy { !$0.isHidden }, "A tab with Agent Messages lists both rows")
- try checkTitlebar(messagesButton.isHidden && closeButton.isHidden,
- "Off, at rest, a tab shows nothing extra")
+ canShowAgentMessages = true
+ try checkTitlebar(rows[1...2].allSatisfy { !$0.isHidden }, "A tab with a log lists Show Agent Messages")
+ try checkTitlebar(closeButton.isHidden && accessibilityChildren()?.count == 1,
+ "At rest a tab shows only its name and status")
let title = titleRect
mouseEntered(with: hover)
- try checkTitlebar(!messagesButton.isHidden && !closeButton.isHidden &&
- closeButton.frame.minX - messagesButton.frame.maxX == 8 &&
- messagesButton.foreground == foreground && messagesButton.restingOpacity == 0.35 &&
- drawn(messagesButton, "bubble.left.and.bubble.right") && !hasMessagesInk(messagesButton),
- "Hovered and off: a quiet outlined 💬, 8pt clear of ×")
- let gap = NSPoint(x: closeButton.frame.minX - 1.5, y: closeButton.frame.midY)
- try checkTitlebar(!messagesButton.frame.contains(gap) && !closeButton.frame.contains(gap),
- "A click between 💬 and × lands on neither")
- try checkTitlebar(titleRect == title, "A name with room keeps its place when revealed")
- try checkTitlebar(messagesButton.toolTip == "Agent messages off · click to turn on" &&
- messagesButton.accessibilityLabel() == "Agent Messages" &&
- messagesButton.accessibilityValue() as? String == "Off" &&
- accessibilityChildren()?.count == 3,
- "The 💬 says what it is, its state and what a click does")
- messagesButton.performClick(nil)
- try checkTitlebar(events.count == 1 && events[0] == ("toggleAgentMessages", swarmId),
- "Clicking 💬 asks to toggle this tab's Agent Messages, without selecting it")
- mouseExited(with: hover)
- try checkTitlebar(messagesButton.isHidden && closeButton.isHidden, "Leaving hides them again")
-
- agentMessages = SwarmTabMessages(on: true)
- try checkTitlebar(messagesButton.isHidden && statusSpace == 0 && !hasMessagesInk(),
- "On, a tab at rest shows nothing extra")
- mouseEntered(with: hover)
- try checkTitlebar(!messagesButton.isHidden && messagesButton.foreground == messagesColor &&
- messagesButton.restingOpacity == 1 && drawn(messagesButton, "bubble.left.and.bubble.right.fill") &&
- hasMessagesInk(messagesButton) && !hasMessagesInk() &&
- messagesButton.toolTip == "Agent messages on · click to turn off" &&
- messagesButton.accessibilityValue() as? String == "On",
- "Hovered and on: 💬 filled in Agent Messages' color, which turns it off")
+ try checkTitlebar(!closeButton.isHidden && accessibilityChildren()?.count == 2 && titleRect == title,
+ "Hovered, a tab shows its name, status and ×, and nothing else")
mouseExited(with: hover)
activity = HarnessNativeActivity(["mark": "?", "label": "Needs your input", "color": Int64(0xffe5e510)])
layoutSubtreeIfNeeded()
- try checkTitlebar(!hasMessagesInk() && selectButton.accessibilityHelp() == "Needs your input",
- "On, the status slot keeps the tab's own status")
+ try checkTitlebar(selectButton.accessibilityHelp() == "Needs your input",
+ "The status slot keeps the tab's own status")
activity = nil
- let toggle = rows[2]
- _ = validateMenuItem(toggle)
- try checkTitlebar(toggle.state == .on, "The menu's Agent Messages row is checked while on")
- _ = (toggle.target as AnyObject).perform(toggle.action, with: toggle)
- let show = rows[3]
+ let show = rows[2]
+ try checkTitlebar(validateMenuItem(show) && show.state == .off, "Show Agent Messages is a plain row, never checked")
_ = (show.target as AnyObject).perform(show.action, with: show)
- try checkTitlebar(events.suffix(2).map(\.0) == ["toggleAgentMessages", "showAgentMessages"] &&
- events.suffix(2).allSatisfy { $0.1 == swarmId },
- "The tab menu's rows act on this tab")
- agentMessages = SwarmTabMessages(on: false)
- _ = validateMenuItem(toggle)
- try checkTitlebar(toggle.state == .off, "The row's checkmark follows the flag")
+ try checkTitlebar(events.count == 1 && events[0] == ("showAgentMessages", swarmId),
+ "The tab menu's Show Agent Messages opens this tab's log")
actionsEnabled = false
- agentMessages = SwarmTabMessages(on: true)
- mouseEntered(with: hover)
- let before = events.count
- messagesButton.performClick(nil)
- try checkTitlebar(messagesButton.isHidden && events.count == before, "A modal hides and disables the 💬")
- mouseExited(with: hover)
+ _ = (show.target as AnyObject).perform(show.action, with: show)
+ try checkTitlebar(!validateMenuItem(show) && events.count == 1, "A modal disables Show Agent Messages")
actionsEnabled = true
- agentMessages = nil
+ canShowAgentMessages = false
+ _ = (show.target as AnyObject).perform(show.action, with: show)
+ try checkTitlebar(rows[2].isHidden && events.count == 1, "Without a log the row is gone and asks nothing")
}
/// At the 128pt minimum, a tab draws its whole name beside a status at
@@ -760,8 +701,8 @@ private extension SwarmTabButton {
timestamp: 0, windowNumber: 0, context: nil, eventNumber: 0, clickCount: 0, pressure: 0)!
mouseEntered(with: hover)
layoutSubtreeIfNeeded()
- try checkTitlebar(titleRect.width >= 16 && titleRect.maxX + statusSpace <= messagesButton.frame.minX + 0.01,
- "Hovered, a 128pt tab keeps 16pt of its name, clear of 💬 and ×")
+ try checkTitlebar(titleRect.width >= 16 && titleRect.maxX + statusSpace <= closeButton.frame.minX + 0.01,
+ "Hovered, a 128pt tab keeps 16pt of its name, clear of ×")
mouseExited(with: hover)
try checkCenteredLabel()
}
@@ -1559,15 +1500,15 @@ private extension SwarmTabStrip {
["id": "unbound", "name": "Notes", "label": "Notes", "shortcutHint": NSNull()],
]
var messageRows = rows
- messageRows[0]["agentMessages"] = true
- messageRows[1]["agentMessages"] = false
- update(["enabled": true, "activeId": "work", "tabs": messageRows, "agentMessagesInk": Int64(0xffbc3fbc)])
- try checkTitlebar(tabs.map(\.agentMessages) == [SwarmTabMessages(on: true), SwarmTabMessages(on: false), nil, nil],
- "Each row's Agent Messages reaches its tab; a row without one has no 💬")
- try checkTitlebar(tabs.allSatisfy { $0.messagesColor == statusColor(Int64(0xffbc3fbc), fallback: .clear) },
- "Every tab takes Agent Messages' color from the update")
+ messageRows[0]["canShowAgentMessages"] = true
+ messageRows[1]["canShowAgentMessages"] = true
+ update(["enabled": true, "activeId": "work", "tabs": messageRows])
+ try checkTitlebar(tabs.map(\.canShowAgentMessages) == [true, true, false, false],
+ "Each row's Show Agent Messages reaches its tab; a row without one has none")
+ try checkTitlebar(tabs.allSatisfy { $0.subviews.count == 2 },
+ "No tab gains a control for Agent Messages")
try checkTitlebar(!visibleAnimatedTabs.contains { $0 === tabs[0] },
- "A tab with Agent Messages on animates nothing; only a working tab's spinner moves")
+ "A tab with an Agent Messages log animates nothing; only a working tab's spinner moves")
update(["enabled": true, "activeId": "work", "tabs": rows])
try checkTitlebar(tabs.map(\.displayLabel) == ["New Tab", "Desktop", "1: Release planning", "Notes"],
"Clean labels preserve numeric-looking custom names and omit generated prefixes")
@@ -2433,7 +2374,7 @@ private extension SwarmTitlebar {
"New Terminal stays off the File menu; its chord lives in the keymap")
let historyMenu = main.item(withTitle: "History")!.submenu!
try checkTitlebar(agent.items.contains { $0.title == "Clone Harness" && $0.representedObject as? String == "cloneAgent" }, "Clone Harness preserves its action")
- try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["newAgent", "sessions", "addAgent", "cloneAgent", "restartAgent", "shareAgent", "separator", "new", "renameActive", "closeActive", "toggleAgentMessages", "showAgentMessages", "separator", "splitRight", "splitDown", "zoomPane", "movePaneToTab", "closePane"], "File groups harness, tab and pane actions, harnesses first")
+ try checkTitlebar(agent.items.map { $0.isSeparatorItem ? "separator" : ($0.representedObject as? String ?? "") } == ["newAgent", "sessions", "addAgent", "cloneAgent", "restartAgent", "shareAgent", "separator", "new", "renameActive", "closeActive", "showAgentMessages", "separator", "splitRight", "splitDown", "zoomPane", "movePaneToTab", "closePane"], "File groups harness, tab and pane actions, harnesses first")
for (action, title, menu) in [
("restartAgent", "Restart Harness", agent),
("shareAgent", "Share Harness", agent),
@@ -2478,27 +2419,23 @@ private extension SwarmTitlebar {
canFind = true
try checkTitlebar(validateMenuItem(movePane), "Move Pane to Tab is available with a focused pane")
try checkTitlebar(agent.items.contains { $0.title == "Close Tab" && $0.representedObject as? String == "closeActive" }, "Close Tab preserves its command")
- // Agent Messages for the active tab: a checkmark row and its log.
- let messagesRow = agent.items.first { $0.representedObject as? String == "toggleAgentMessages" }!
+ // The active tab's Agent Messages log. No on/off row: that is Settings ▸ Agents'.
+ try checkTitlebar(!agent.items.contains { $0.title == "Agent Messages" },
+ "File has no Agent Messages on/off row")
let showMessagesRow = agent.items.first { $0.representedObject as? String == "showAgentMessages" }!
- try checkTitlebar(messagesRow.title == "Agent Messages" && showMessagesRow.title == "Show Agent Messages",
- "File names Agent Messages and Show Agent Messages")
+ try checkTitlebar(showMessagesRow.title == "Show Agent Messages", "File names Show Agent Messages")
actionsEnabled = true
- activeAgentMessages = nil
- try checkTitlebar(!validateMenuItem(messagesRow) && !validateMenuItem(showMessagesRow),
- "A tab without Agent Messages (the Store) leaves both rows unavailable")
- activeAgentMessages = true
- try checkTitlebar(validateMenuItem(messagesRow) && messagesRow.state == .on && validateMenuItem(showMessagesRow),
- "Agent Messages carries a checkmark while on in the active tab")
- activeAgentMessages = false
- try checkTitlebar(validateMenuItem(messagesRow) && messagesRow.state == .off, "The checkmark follows the active tab")
- for row in [messagesRow, showMessagesRow] {
- menuAction(row)
- try checkTitlebar(messenger.calls.last?.method == row.representedObject as? String,
- "\(row.title) dispatches to Flutter for the active tab")
- }
+ canShowAgentMessages = false
+ try checkTitlebar(!validateMenuItem(showMessagesRow),
+ "A tab without a log (the Store) leaves Show Agent Messages unavailable")
+ canShowAgentMessages = true
+ try checkTitlebar(validateMenuItem(showMessagesRow) && showMessagesRow.state == .off,
+ "Show Agent Messages is available for a tab with a log, and never checked")
+ menuAction(showMessagesRow)
+ try checkTitlebar(messenger.calls.last?.method == "showAgentMessages",
+ "Show Agent Messages dispatches to Flutter for the active tab")
actionsEnabled = false
- try checkTitlebar(!validateMenuItem(messagesRow), "Agent Messages respects modal state")
+ try checkTitlebar(!validateMenuItem(showMessagesRow), "Show Agent Messages respects modal state")
actionsEnabled = true
let closeTabShortcut = agent.items.first { $0.representedObject as? String == "closeActive" }!
let closePaneShortcut = agent.items.first { $0.representedObject as? String == "closePane" }!