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.

Agent Messages tabs: no shortcut hints, ⇄ grey or colored, messaging in the status slot (#1167)

Dee5e1101daeaa3
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.md
index 3065dc9a3..ff82bf467 100644
--- a/desktop/CLAUDE.md
+++ b/desktop/CLAUDE.md
@@ -298,7 +298,7 @@ Agent Messages (docs/design/2026-10-10-agent-messages.md) replaced Swarm collabo
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
+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
from its other machines every 15 s while the window is in front. A tab's log is the
@@ -422,12 +422,13 @@ add a kind there, not at the call site.
repaint on a theme flip.
- 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 without permanent number prefixes. One revealed state
- — hovering a tab, or holding Command for every tab — replaces the status with the resolved
- shortcut and shows Agent Messages' ⇄ just left of ×; at rest only a tab whose agents are
- messaging keeps a bright ⇄ (`lib/agent_messages/`, `AgentMessagesController` on
- `AppNotifier.agentMessages`, its own notifier so traffic never rebuilds the workspace;
- `SwarmTabButton` mirrors it natively). Revealing never moves the title. Tab and pane close
+ 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 ×; while its agents message, the status slot shows an animated 💬 for 10 s instead
+ (`lib/agent_messages/`, `AgentMessagesController` on `AppNotifier.agentMessages`, its own
+ notifier so traffic never rebuilds the workspace; `MessagingMark`; `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
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/agent-messages-review/01-rest-quiet-dark.png b/desktop/design/agent-messages-review/01-rest-quiet-dark.png
new file mode 100644
index 000000000..3bd5992a9
Binary files /dev/null and b/desktop/design/agent-messages-review/01-rest-quiet-dark.png differ
diff --git a/desktop/design/agent-messages-review/01-rest-quiet-light.png b/desktop/design/agent-messages-review/01-rest-quiet-light.png
new file mode 100644
index 000000000..18ff47a55
Binary files /dev/null and b/desktop/design/agent-messages-review/01-rest-quiet-light.png differ
diff --git a/desktop/design/agent-messages-review/02-rest-messaging-dark.png b/desktop/design/agent-messages-review/02-rest-messaging-dark.png
new file mode 100644
index 000000000..dffdfd4eb
Binary files /dev/null and b/desktop/design/agent-messages-review/02-rest-messaging-dark.png differ
diff --git a/desktop/design/agent-messages-review/02-rest-messaging-light.png b/desktop/design/agent-messages-review/02-rest-messaging-light.png
new file mode 100644
index 000000000..c8f57306c
Binary files /dev/null and b/desktop/design/agent-messages-review/02-rest-messaging-light.png differ
diff --git a/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-dark.png b/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-dark.png
new file mode 100644
index 000000000..6d83002cb
Binary files /dev/null and b/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-dark.png differ
diff --git a/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-light.png b/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-light.png
new file mode 100644
index 000000000..1357523ee
Binary files /dev/null and b/desktop/design/agent-messages-review/02b-rest-messaging-next-frame-light.png differ
diff --git a/desktop/design/agent-messages-review/03-hover-off-dark.png b/desktop/design/agent-messages-review/03-hover-off-dark.png
new file mode 100644
index 000000000..d4a38185d
Binary files /dev/null and b/desktop/design/agent-messages-review/03-hover-off-dark.png differ
diff --git a/desktop/design/agent-messages-review/03-hover-off-light.png b/desktop/design/agent-messages-review/03-hover-off-light.png
new file mode 100644
index 000000000..83856b1a0
Binary files /dev/null and b/desktop/design/agent-messages-review/03-hover-off-light.png differ
diff --git a/desktop/design/agent-messages-review/04-hover-on-quiet-dark.png b/desktop/design/agent-messages-review/04-hover-on-quiet-dark.png
new file mode 100644
index 000000000..4e60539bf
Binary files /dev/null and b/desktop/design/agent-messages-review/04-hover-on-quiet-dark.png differ
diff --git a/desktop/design/agent-messages-review/04-hover-on-quiet-light.png b/desktop/design/agent-messages-review/04-hover-on-quiet-light.png
new file mode 100644
index 000000000..5f5f5ca65
Binary files /dev/null and b/desktop/design/agent-messages-review/04-hover-on-quiet-light.png differ
diff --git a/desktop/design/agent-messages-review/05-hover-on-messaging-dark.png b/desktop/design/agent-messages-review/05-hover-on-messaging-dark.png
new file mode 100644
index 000000000..77ac5740a
Binary files /dev/null and b/desktop/design/agent-messages-review/05-hover-on-messaging-dark.png differ
diff --git a/desktop/design/agent-messages-review/05-hover-on-messaging-light.png b/desktop/design/agent-messages-review/05-hover-on-messaging-light.png
new file mode 100644
index 000000000..b3cefe9f2
Binary files /dev/null and b/desktop/design/agent-messages-review/05-hover-on-messaging-light.png differ
diff --git a/desktop/design/agent-messages-review/06-pointer-on-arrows-off-dark.png b/desktop/design/agent-messages-review/06-pointer-on-arrows-off-dark.png
new file mode 100644
index 000000000..0ffbba0e5
Binary files /dev/null and b/desktop/design/agent-messages-review/06-pointer-on-arrows-off-dark.png differ
diff --git a/desktop/design/agent-messages-review/06-pointer-on-arrows-off-light.png b/desktop/design/agent-messages-review/06-pointer-on-arrows-off-light.png
new file mode 100644
index 000000000..30871f5e7
Binary files /dev/null and b/desktop/design/agent-messages-review/06-pointer-on-arrows-off-light.png differ
diff --git a/desktop/design/agent-messages-review/08-crowded-rest-dark.png b/desktop/design/agent-messages-review/08-crowded-rest-dark.png
new file mode 100644
index 000000000..3464b7a9b
Binary files /dev/null and b/desktop/design/agent-messages-review/08-crowded-rest-dark.png differ
diff --git a/desktop/design/agent-messages-review/08-crowded-rest-light.png b/desktop/design/agent-messages-review/08-crowded-rest-light.png
new file mode 100644
index 000000000..8c5573c34
Binary files /dev/null and b/desktop/design/agent-messages-review/08-crowded-rest-light.png differ
diff --git a/desktop/design/agent-messages-review/09-crowded-hover-dark.png b/desktop/design/agent-messages-review/09-crowded-hover-dark.png
new file mode 100644
index 000000000..18fa3323d
Binary files /dev/null and b/desktop/design/agent-messages-review/09-crowded-hover-dark.png differ
diff --git a/desktop/design/agent-messages-review/09-crowded-hover-light.png b/desktop/design/agent-messages-review/09-crowded-hover-light.png
new file mode 100644
index 000000000..4c20de6cf
Binary files /dev/null and b/desktop/design/agent-messages-review/09-crowded-hover-light.png differ
diff --git a/desktop/design/agent-messages-review/10-tab-menu-on-dark.png b/desktop/design/agent-messages-review/10-tab-menu-on-dark.png
new file mode 100644
index 000000000..34624f1b0
Binary files /dev/null and b/desktop/design/agent-messages-review/10-tab-menu-on-dark.png differ
diff --git a/desktop/design/agent-messages-review/10-tab-menu-on-light.png b/desktop/design/agent-messages-review/10-tab-menu-on-light.png
new file mode 100644
index 000000000..63b1d8a4b
Binary files /dev/null and b/desktop/design/agent-messages-review/10-tab-menu-on-light.png differ
diff --git a/desktop/design/agent-messages-review/11-tab-menu-off-dark.png b/desktop/design/agent-messages-review/11-tab-menu-off-dark.png
new file mode 100644
index 000000000..2e7d06f5f
Binary files /dev/null and b/desktop/design/agent-messages-review/11-tab-menu-off-dark.png differ
diff --git a/desktop/design/agent-messages-review/11-tab-menu-off-light.png b/desktop/design/agent-messages-review/11-tab-menu-off-light.png
new file mode 100644
index 000000000..0b26c2b6d
Binary files /dev/null and b/desktop/design/agent-messages-review/11-tab-menu-off-light.png differ
diff --git a/desktop/design/agent-messages-review/12-file-menu-light.png b/desktop/design/agent-messages-review/12-file-menu-light.png
new file mode 100644
index 000000000..d5f6c67d0
Binary files /dev/null and b/desktop/design/agent-messages-review/12-file-menu-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-messaging-0-dark.png b/desktop/design/agent-messages-review/anim/anim-messaging-0-dark.png
new file mode 100644
index 000000000..7eeab9b83
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-messaging-0-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-messaging-0-light.png b/desktop/design/agent-messages-review/anim/anim-messaging-0-light.png
new file mode 100644
index 000000000..5cfa810b7
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-messaging-0-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-messaging-5-dark.png b/desktop/design/agent-messages-review/anim/anim-messaging-5-dark.png
new file mode 100644
index 000000000..67248b41d
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-messaging-5-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-messaging-5-light.png b/desktop/design/agent-messages-review/anim/anim-messaging-5-light.png
new file mode 100644
index 000000000..2f3c34857
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-messaging-5-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-0-dark.png b/desktop/design/agent-messages-review/anim/anim-working-0-dark.png
new file mode 100644
index 000000000..2b8a216d7
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-0-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-0-light.png b/desktop/design/agent-messages-review/anim/anim-working-0-light.png
new file mode 100644
index 000000000..a672f4d2e
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-0-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-1-dark.png b/desktop/design/agent-messages-review/anim/anim-working-1-dark.png
new file mode 100644
index 000000000..c0329f8b8
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-1-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-1-light.png b/desktop/design/agent-messages-review/anim/anim-working-1-light.png
new file mode 100644
index 000000000..12c006c67
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-1-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-2-dark.png b/desktop/design/agent-messages-review/anim/anim-working-2-dark.png
new file mode 100644
index 000000000..6168c1123
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-2-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-2-light.png b/desktop/design/agent-messages-review/anim/anim-working-2-light.png
new file mode 100644
index 000000000..00b528991
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-2-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-3-dark.png b/desktop/design/agent-messages-review/anim/anim-working-3-dark.png
new file mode 100644
index 000000000..4e8974c92
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-3-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-3-light.png b/desktop/design/agent-messages-review/anim/anim-working-3-light.png
new file mode 100644
index 000000000..2fbe905d5
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-3-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-4-dark.png b/desktop/design/agent-messages-review/anim/anim-working-4-dark.png
new file mode 100644
index 000000000..067197737
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-4-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-4-light.png b/desktop/design/agent-messages-review/anim/anim-working-4-light.png
new file mode 100644
index 000000000..94ba873c2
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-4-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-5-dark.png b/desktop/design/agent-messages-review/anim/anim-working-5-dark.png
new file mode 100644
index 000000000..2893ccc11
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-5-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-5-light.png b/desktop/design/agent-messages-review/anim/anim-working-5-light.png
new file mode 100644
index 000000000..0e9ba53ee
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-5-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-6-dark.png b/desktop/design/agent-messages-review/anim/anim-working-6-dark.png
new file mode 100644
index 000000000..ec2789257
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-6-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-6-light.png b/desktop/design/agent-messages-review/anim/anim-working-6-light.png
new file mode 100644
index 000000000..857173ac3
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-6-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-7-dark.png b/desktop/design/agent-messages-review/anim/anim-working-7-dark.png
new file mode 100644
index 000000000..27b43d913
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-7-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-7-light.png b/desktop/design/agent-messages-review/anim/anim-working-7-light.png
new file mode 100644
index 000000000..2cdf2a37b
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-7-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-8-dark.png b/desktop/design/agent-messages-review/anim/anim-working-8-dark.png
new file mode 100644
index 000000000..68e3b7445
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-8-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-8-light.png b/desktop/design/agent-messages-review/anim/anim-working-8-light.png
new file mode 100644
index 000000000..334343a57
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-8-light.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-9-dark.png b/desktop/design/agent-messages-review/anim/anim-working-9-dark.png
new file mode 100644
index 000000000..5d6cc8027
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-9-dark.png differ
diff --git a/desktop/design/agent-messages-review/anim/anim-working-9-light.png b/desktop/design/agent-messages-review/anim/anim-working-9-light.png
new file mode 100644
index 000000000..ddeb50b0b
Binary files /dev/null and b/desktop/design/agent-messages-review/anim/anim-working-9-light.png differ
diff --git a/desktop/design/agent-messages-review/before/08-crowded-rest-dark.png b/desktop/design/agent-messages-review/before/08-crowded-rest-dark.png
new file mode 100644
index 000000000..dedd5cbe6
Binary files /dev/null and b/desktop/design/agent-messages-review/before/08-crowded-rest-dark.png differ
diff --git a/desktop/design/agent-messages-review/index.html b/desktop/design/agent-messages-review/index.html
new file mode 100644
index 000000000..2d8d4c6ea
--- /dev/null
+++ b/desktop/design/agent-messages-review/index.html
@@ -0,0 +1,176 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Agent Messages Tabs</title>
+<style>
+ :root {
+ --bg: #fafaf9; --fg: #1f1f1d; --muted: #6b6b66; --line: #e2e2df; --card: #ffffff;
+ --note-bg: #eef3fb; --note-line: #b9c9e6;
+ }
+ @media (prefers-color-scheme: dark) {
+ :root:not([data-theme="light"]) {
+ --bg: #181818; --fg: #f5f5f5; --muted: #a3a3a0; --line: #2c2c2c; --card: #1e1e1e;
+ --note-bg: #1b2230; --note-line: #34425e;
+ }
+ }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--bg); color: var(--fg);
+ font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
+ main { max-width: 1320px; margin: 0 auto; padding: 32px 16px 64px; }
+ h1 { font-size: 24px; margin: 0 0 4px; }
+ h2 { font-size: 18px; margin: 40px 0 8px; }
+ p { margin: 4px 0 12px; max-width: 80ch; }
+ ul { margin: 4px 0 12px; padding-left: 20px; max-width: 80ch; }
+ .muted { color: var(--muted); }
+ .scene { margin: 20px 0 28px; }
+ .scene h3 { font-size: 15px; margin: 0 0 2px; }
+ .scene p { margin: 0 0 8px; color: var(--muted); }
+ .bar { display: block; width: 100%; max-width: 1280px; height: auto; border-radius: 8px;
+ border: 1px solid var(--line); margin: 6px 0; }
+ .menus { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
+ .menus img { border-radius: 8px; border: 1px solid var(--line); height: auto; }
+ .tag { display: inline-block; font-size: 12px; color: var(--muted); }
+ .note { background: var(--note-bg); border: 1px solid var(--note-line); border-radius: 10px;
+ padding: 16px; margin: 16px 0; }
+ .note h2 { margin-top: 0; }
+ code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
+ .player { display: grid; gap: 12px; margin: 12px 0 8px; }
+ .player img { display: block; width: 100%; max-width: 600px; height: auto; border-radius: 8px;
+ border: 1px solid var(--line); }
+ .player-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
+ .anim-label { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); min-width: 30ch; }
+ .track { width: 100%; max-width: 600px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
+ .track > div { height: 100%; width: 0; background: #2f5bea; }
+ button { font: inherit; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--line);
+ background: var(--card); color: var(--fg); cursor: pointer; }
+</style>
+</head>
+<body>
+<main>
+ <h1>Agent Messages: the tab bar</h1>
+ <p class="muted">The real macOS title bar and menus (<code>SwarmTitlebar.swift</code>), drawn with sample tabs by
+ <code>tool/agent_messages_preview.swift</code>. In every scene <b>lamp</b> and <b>desktop</b> have Agent Messages
+ on, while <b>website</b> and <b>notes</b> have it off. Traffic lights are grey because the render window is never brought to the front, and tooltips
+ can't be captured.</p>
+
+ <div class="note">
+ <h2>What changed from your review</h2>
+ <ul>
+ <li>No ⌘1/⌘2/⌘3 on tabs. The shortcuts still work, and holding ⌘ no longer changes the tabs.</li>
+ <li>The tab icon is now a <b>chat icon</b>, two speech bubbles for agents talking, instead of ⇄. It's <b>grey</b> when off and <b>blue</b> when on. Blue is the design system's one accent, used for selection and "on", and no status mark uses it. In menus, Show Agent Messages uses a bubble with text lines.</li>
+ <li>While agents message each other, the <b>status slot</b> (where the spinner, ✓ and ? sit) shows the chat icon, its two bubbles swapping sides every half second, for
+ <b>10 seconds</b> after the last message, then goes back to working, done or question.</li>
+ <li>At rest, names use the whole tab again. On hover, a name only moves left as far as 💬 and × need.</li>
+ </ul>
+ </div>
+
+ <h2>The animation</h2>
+ <p>Frames rendered from the real title bar, played at the real timing. A message moves, and lamp's status
+ slot shows the chat icon, its bubbles swapping sides every half second. Ten seconds after the last message,
+ lamp goes back to its working spinner. This loops; each new message would start the ten seconds again.
+ With Reduce Motion on, the icon holds still.</p>
+ <div class="player">
+ <img id="anim-dark" src="anim/anim-messaging-0-dark.png" alt="lamp tab, dark, animating">
+ <img id="anim-light" src="anim/anim-messaging-0-light.png" alt="lamp tab, light, animating">
+ <div class="track" title="Review page only"><div id="anim-progress"></div></div>
+ <span class="tag">The bar and countdown are only on this page, to show the timing; the app shows just the tab.</span>
+ <div class="player-row">
+ <span class="anim-label" id="anim-label">Agents messaging</span>
+ <button id="anim-replay" type="button">Replay</button>
+ </div>
+ </div>
+
+ <h2>Dark (Graphite)</h2>
+ <div class="scene"><h3>1 · At rest, quiet</h3>
+ <p>Name and status only.</p>
+ <img class="bar" src="01-rest-quiet-dark.png" alt=""></div>
+ <div class="scene"><h3>2 · At rest, lamp's agents are messaging</h3>
+ <p>lamp's status slot shows the chat icon in blue, flipping between the two frames below every half second, as if the agents take turns. After 10 s it goes back to lamp's spinner.</p>
+ <img class="bar" src="02-rest-messaging-dark.png" alt="">
+ <img class="bar" src="02b-rest-messaging-next-frame-dark.png" alt=""></div>
+ <div class="scene"><h3>3 · Hover website (off)</h3>
+ <p>Grey 💬 and ×. The status stays. Clicking 💬 turns Agent Messages on.</p>
+ <img class="bar" src="03-hover-off-dark.png" alt=""></div>
+ <div class="scene"><h3>4 · Hover desktop (on, quiet)</h3>
+ <p>💬 in blue. Clicking it turns Agent Messages off.</p>
+ <img class="bar" src="04-hover-on-quiet-dark.png" alt=""></div>
+ <div class="scene"><h3>5 · Hover lamp (on, messaging)</h3>
+ <img class="bar" src="05-hover-on-messaging-dark.png" alt=""></div>
+ <div class="scene"><h3>6 · Pointer on website's 💬</h3>
+ <p>The grey 💬 brightens under the pointer. Its tooltip reads “Agent messages off · click to turn on”.</p>
+ <img class="bar" src="06-pointer-on-arrows-off-dark.png" alt=""></div>
+ <div class="scene"><h3>7 · Nine tabs, at rest, then hovering desktop</h3>
+ <img class="bar" src="08-crowded-rest-dark.png" alt="">
+ <img class="bar" src="09-crowded-hover-dark.png" alt=""></div>
+ <div class="scene"><h3>Nine tabs at rest: before Agent Messages, main today, this change</h3>
+ <span class="tag">before Agent Messages</span><img class="bar" src="before/08-crowded-rest-dark.png" alt="">
+ <span class="tag">main today</span><img class="bar" src="main/08-crowded-rest-dark.png" alt="">
+ <span class="tag">this change</span><img class="bar" src="08-crowded-rest-dark.png" alt=""></div>
+ <div class="scene"><h3>8 · Menus: right-click lamp (on), right-click website (off), File</h3>
+ <div class="menus">
+ <img src="10-tab-menu-on-dark.png" width="177" alt="Tab menu, on">
+ <img src="11-tab-menu-off-dark.png" width="169" alt="Tab menu, off">
+ <img src="12-file-menu-light.png" width="265" alt="File menu (macOS draws it in the system appearance)">
+ </div></div>
+
+ <h2>Light (Paper)</h2>
+ <div class="scene"><h3>1 · At rest, quiet</h3><img class="bar" src="01-rest-quiet-light.png" alt=""></div>
+ <div class="scene"><h3>2 · At rest, lamp's agents are messaging</h3>
+ <img class="bar" src="02-rest-messaging-light.png" alt="">
+ <img class="bar" src="02b-rest-messaging-next-frame-light.png" alt=""></div>
+ <div class="scene"><h3>3 · Hover website (off)</h3><img class="bar" src="03-hover-off-light.png" alt=""></div>
+ <div class="scene"><h3>4 · Hover desktop (on, quiet)</h3><img class="bar" src="04-hover-on-quiet-light.png" alt=""></div>
+ <div class="scene"><h3>5 · Hover lamp (on, messaging)</h3><img class="bar" src="05-hover-on-messaging-light.png" alt=""></div>
+ <div class="scene"><h3>6 · Pointer on website's 💬</h3><img class="bar" src="06-pointer-on-arrows-off-light.png" alt=""></div>
+ <div class="scene"><h3>7 · Nine tabs, at rest, then hovering desktop</h3>
+ <img class="bar" src="08-crowded-rest-light.png" alt="">
+ <img class="bar" src="09-crowded-hover-light.png" alt=""></div>
+ <div class="scene"><h3>8 · Menus</h3>
+ <div class="menus">
+ <img src="10-tab-menu-on-light.png" width="177" alt="Tab menu, on">
+ <img src="11-tab-menu-off-light.png" width="169" alt="Tab menu, off">
+ <img src="12-file-menu-light.png" width="265" alt="File menu">
+ </div></div>
+
+ <p class="muted">Re-render: <code>HARNESS_AGENT_MESSAGES_PREVIEW_DIR=&lt;dir&gt; bash desktop/tool/check_swarm_titlebar.sh &lt;flutter-sdk&gt; --agent-messages-preview</code>.
+ The “before” image comes from the same tool run against the title bar at #1159 (3a97ef3ed4). “main today” is #1161.</p>
+</main>
+<script>
+(() => {
+ const MESSAGING_MS = 10000, STATUS_MS = 4000, CYCLE = MESSAGING_MS + STATUS_MS;
+ const themes = ['dark', 'light'];
+ const frames = {};
+ for (const theme of themes) {
+ frames[theme] = {
+ messaging: [0, 5].map(f => `anim/anim-messaging-${f}-${theme}.png`),
+ working: Array.from({ length: 10 }, (_, f) => `anim/anim-working-${f}-${theme}.png`),
+ };
+ for (const src of [...frames[theme].messaging, ...frames[theme].working]) new Image().src = src;
+ }
+ const label = document.getElementById('anim-label');
+ const progress = document.getElementById('anim-progress');
+ let start = performance.now();
+ function tick(now) {
+ const t = (now - start) % CYCLE;
+ const messaging = t < MESSAGING_MS;
+ for (const theme of themes) {
+ const set = frames[theme];
+ const src = messaging ? set.messaging[Math.floor(t / 500) % 2]
+ : set.working[Math.floor((t - MESSAGING_MS) / 100) % 10];
+ const img = document.getElementById(`anim-${theme}`);
+ if (img.getAttribute('src') !== src) img.setAttribute('src', src);
+ }
+ label.textContent = messaging
+ ? `Agents messaging · ${((MESSAGING_MS - t) / 1000).toFixed(1)} s left`
+ : 'Quiet again · back to its status: Working';
+ progress.style.width = messaging ? `${(100 * t) / MESSAGING_MS}%` : '0%';
+ requestAnimationFrame(tick);
+ }
+ requestAnimationFrame(tick);
+ document.getElementById('anim-replay').addEventListener('click', () => { start = performance.now(); });
+})();
+</script>
+</body>
+</html>
diff --git a/desktop/design/agent-messages-review/main/08-crowded-rest-dark.png b/desktop/design/agent-messages-review/main/08-crowded-rest-dark.png
new file mode 100644
index 000000000..7c6ebfa8e
Binary files /dev/null and b/desktop/design/agent-messages-review/main/08-crowded-rest-dark.png differ
diff --git a/desktop/design/desktop-design-system.md b/desktop/design/desktop-design-system.md
index e30dfce4d..1c28cd655 100644
--- a/desktop/design/desktop-design-system.md
+++ b/desktop/design/desktop-design-system.md
@@ -326,7 +326,7 @@ its clone action and an invalid submission reveals inline validation. Do not
add a duplicate example line or an empty results area beneath an empty field.
**Workspace tabs and pane frames** — tabs share one width, independent of label
-length, selection, activity and shortcut hints. Divide the available tab area
+length, selection and activity. Divide the available tab area
equally, capped at 256 points; shrink together down to 128 points, then scroll.
A tab area narrower than 128 points can show one clipped tab. Mirror these limits
in Flutter and AppKit. Tabs use the 13-point system control face, independent of
@@ -334,13 +334,14 @@ 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. This puts the cross's center
-16 points inside the curved body edge. Reserve that space before truncating
-the title so hover never crowds the name or status. Holding Command
-temporarily replaces the status with the actual remapped shortcut beside the
-name. An idle tab has no empty status slot; its name centers on its own. Hover
-never moves the name, and Command never changes tab width. Long names truncate
-and retain a full-name tooltip. Selection, dragging, middle-click close and the
+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
+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
+full-name tooltip. Selection, dragging, middle-click close and the
existing keyboard commands keep their meaning.
Devices and Harness Store use compact 28-point capsules, centered in the
diff --git a/desktop/design/workspace-status-bar.md b/desktop/design/workspace-status-bar.md
index 306195cd0..01514a163 100644
--- a/desktop/design/workspace-status-bar.md
+++ b/desktop/design/workspace-status-bar.md
@@ -96,7 +96,7 @@ Ties within one trait use pane order. Focus does not affect the name.
This keeps `blender` useful beside coding tabs, uses project names when all work
is code, and uses machine names for the same project on different computers.
Tabs with identical contents can still share a name; their positions distinguish
-them, and holding Command reveals their actual shortcut hints. Preserve the full name for inspection when its visible label is truncated.
+them. Preserve the full name for inspection when its visible label is truncated.
Center each name and its adjacent status as one group in compact, content-sized
tabs, capped at 240 points. An idle name centers on its own. Use the
@@ -104,24 +104,24 @@ 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.
-A tab has one revealed state: hovering it reveals that tab, holding Command
-reveals every tab. Revealed, the actual shortcut replaces the status beside the
-name, and Agent Messages' ⇄ and × show at the right, ⇄ just left of ×
-([Agent Messages](../../docs/design/2026-10-10-agent-messages.md)). At rest a tab
-shows only its name and status, plus a bright ⇄ for about a minute after its
-agents last messaged each other while Agent Messages are on. The ⇄ is dim and
-struck through while off, dim while on and quiet; its tooltip says what a click
+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. While its agents message each
+other, the status slot shows 💬 in Agent Messages' color (the accent blue,
+`AppPalette.accentOnSurface`), mirrored every half second, for 10 seconds after
+the last message, then the tab's status again. The hover 💬 is grey while off and in that color
+while on; its tooltip says what a click
does ("Agent messages off · click to turn on", "Agent messages on · click to
turn off", "Agents messaging · 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
+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. Revealing never changes the tab
-width or moves the title: an idle tab shows its shortcut after the name, and
-only a name that would run into ⇄ gives up its tail. × and ⇄ are 16-point-wide,
-32-point-tall targets with a 3-point dead gap between them, reserved on both
-sides of the centered name, so a 128-point tab still draws its name beside a
-status. The tab's menu and File carry Agent Messages (a checkmark)
+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
shortcuts, native menu access, and middle-click closing remain available.
Preserve reorder, rename, keyboard focus, and terminal sessions. Cmd-T opens a
diff --git a/desktop/lib/agent_messages/agent_messages.dart b/desktop/lib/agent_messages/agent_messages.dart
index dfd2d39ce..89b5b537a 100644
--- a/desktop/lib/agent_messages/agent_messages.dart
+++ b/desktop/lib/agent_messages/agent_messages.dart
@@ -222,7 +222,7 @@ class PaneMessageMark {
final bool warning;
}
-/// How a tab's ⇄ reads.
+/// How a tab's 💬 reads.
enum TabMessagesState { off, on, flowing }
typedef AgentMessageTabsRead = Future<Map<String, dynamic>?> Function();
@@ -238,7 +238,7 @@ 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.
+/// rebuild the workspace, only the 💬 and the marks that listen here.
class AgentMessagesController extends ChangeNotifier {
AgentMessagesController({
required this.read,
@@ -246,7 +246,8 @@ class AgentMessagesController extends ChangeNotifier {
required this.request,
required this.nameOf,
DateTime Function()? now,
- this.flowingFor = const Duration(seconds: 60),
+ this.flowingFor = const Duration(seconds: 10),
+ this.remoteRecency = const Duration(seconds: 60),
this.markLife = const Duration(seconds: 5),
}) : now = now ?? DateTime.now;
@@ -259,9 +260,16 @@ class AgentMessagesController extends ChangeNotifier {
/// moved ([pollRemote]); lifetimes here run on timers.
final DateTime Function() now;
- /// How long a tab's ⇄ stays bright after the last message moved in it.
+ /// How long a tab's status shows 💬 after the last message moved in it,
+ /// before it goes back to the tab's working, done or question mark.
final Duration flowingFor;
+ /// How recent another machine's message must be to count as traffic when a
+ /// poll first sees it ([pollRemote]): longer than the remote watch's 15 s
+ /// round, so no message falls between two rounds, yet old history does not
+ /// light a tab up.
+ final Duration remoteRecency;
+
/// How long a pane's mark stays, unless the pane is focused first.
final Duration markLife;
@@ -271,7 +279,7 @@ class AgentMessagesController extends ChangeNotifier {
final _writes = <String, int>{};
final _traffic = <String, int>{};
final _seenMessages = <String>{};
- // What has a lifetime holds the timer that ends it — a tab's ⇄ dims, a
+ // What has a lifetime holds the timer that ends it — a tab's 💬 stops, a
// mark goes — so nothing has to compare clocks to know it is over.
final _flowing = <String, Timer>{};
final _marks = <String, (PaneMessageMark, Timer)>{};
@@ -281,7 +289,7 @@ 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
+ /// Agent Messages (404) — there is no 💬 and no menu row: "off" would be a
/// guess, and a click could not take.
bool get loaded => _loaded;
bool _loaded = false;
@@ -317,7 +325,7 @@ class AgentMessagesController extends ChangeNotifier {
}
/// 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
+ /// request must not turn a tab's 💬 off under the person. An answer of null
/// is a daemon or backend without Agent Messages.
Future<void> refresh() async {
if (_disposed) return;
@@ -424,11 +432,12 @@ class AgentMessagesController extends ChangeNotifier {
_notify();
}
- /// [tabId]'s ⇄ is bright for [flowingFor] from now, and an open log reads
+ /// [tabId]'s status shows 💬 for [flowingFor] from now — longer when the
+ /// traffic was only read from another machine's log — and an open log reads
/// again.
- void _flow(String tabId) {
+ void _flow(String tabId, [Duration extra = Duration.zero]) {
_flowing.remove(tabId)?.cancel();
- _flowing[tabId] = Timer(flowingFor, () {
+ _flowing[tabId] = Timer(flowingFor + extra, () {
_flowing.remove(tabId);
_notify();
});
@@ -447,10 +456,15 @@ class AgentMessagesController extends ChangeNotifier {
/// Ask [tabs]' machines for what they hold: a daemon tells `messages_changed`
/// only to the windows on its own computer (the core's `clients.windows`), so
/// traffic between harnesses on other machines would never reach this one.
- /// A message new to this window that moved within [flowingFor] counts as
- /// traffic, exactly as if its frame had arrived. One request at a time per
- /// machine; a machine still answering the last round is skipped.
- Future<void> pollRemote(Iterable<AgentMessagesRemoteTab> tabs) async {
+ /// A message new to this window that moved within [remoteRecency] counts as
+ /// traffic, exactly as if its frame had arrived, and flows for one [round]
+ /// longer: the next round can only renew it a round later, so 💬 would
+ /// otherwise lapse between rounds while agents keep talking. One request at
+ /// a time per machine; a machine still answering the last round is skipped.
+ Future<void> pollRemote(
+ Iterable<AgentMessagesRemoteTab> tabs, {
+ Duration round = Duration.zero,
+ }) async {
if (_disposed) return;
final byMachine = <String, List<String>>{};
for (final tab in tabs) {
@@ -460,11 +474,15 @@ class AgentMessagesController extends ChangeNotifier {
}
await Future.wait([
for (final MapEntry(key: machineId, value: tabIds) in byMachine.entries)
- if (!_polling.contains(machineId)) _poll(machineId, tabIds),
+ if (!_polling.contains(machineId)) _poll(machineId, tabIds, round),
]);
}
- Future<void> _poll(String machineId, List<String> tabIds) async {
+ Future<void> _poll(
+ String machineId,
+ List<String> tabIds,
+ Duration round,
+ ) async {
final account = _account;
_polling.add(machineId);
try {
@@ -476,12 +494,12 @@ class AgentMessagesController extends ChangeNotifier {
var moved = false;
for (final message in messages) {
if (!_remember(message.id)) continue;
- if (now().difference(message.at) >= flowingFor) continue;
+ if (now().difference(message.at) >= remoteRecency) continue;
moved = true;
_markPanes(message.from, message.to);
}
if (moved) {
- _flow(tabId);
+ _flow(tabId, round);
_notify();
}
}
@@ -678,7 +696,7 @@ class AgentMessagesRemoteWatch {
_timer = null;
if (_disposed || !foreground.value) return;
final targets = tabs();
- if (targets.isNotEmpty) await controller.pollRemote(targets);
+ if (targets.isNotEmpty) await controller.pollRemote(targets, round: every);
if (!_disposed && _started && foreground.value && _timer == null) {
_timer = Timer(every, () => unawaited(poll()));
}
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 6ab0624f5..76c01f59c 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -388,7 +388,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
// editor mounted so its text-input connection and composition survive.
late GlobalKey _searchInputKey;
final _tabScroll = ScrollController();
- final _tabShortcutHints = ValueNotifier(false);
({String activeId, List<String> order, double viewport, List<double> widths})?
_tabGeometry;
bool _tabRevealScheduled = false;
@@ -605,7 +604,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
},
onHide: app.announceWindowForeground,
onInactive: () {
- _tabShortcutHints.value = false;
app.announceWindowForeground();
},
// Whether the app is in front of anyone decides whether the model surfaces refresh at all
@@ -891,7 +889,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
_searchDialogScope.dispose();
_searchText.dispose();
_tabScroll.dispose();
- _tabShortcutHints.dispose();
_canvasFocus.dispose();
_shellFocus.dispose();
_startSearchFocus.dispose();
@@ -2038,7 +2035,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
activity,
color: activityInk(activity),
),
- // Agent Messages' ⇄; absent where a tab has none
+ // Agent Messages' 💬; absent where a tab has none
// (AppNotifier.agentMessagesOffered). Flowing only while on.
if (app.agentMessagesOffered(swarm.id)) ...{
'agentMessages': app.agentMessages.isOn(swarm.id),
@@ -2048,6 +2045,9 @@ class _SwarmScreenState extends State<SwarmScreen> {
},
},
],
+ // Agent Messages' color: the 💬 while on, and a tab's status slot while
+ // its agents message. 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)
@@ -2373,7 +2373,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
case 'renameActive':
unawaited(_rename(app.activeSwarmId));
case 'toggleAgentMessages':
- // From a tab's ⇄ or its menu (with its id), or the File menu (the
+ // From a tab's 💬 or its menu (with its id), or the File menu (the
// active tab).
unawaited(
_toggleAgentMessages(
@@ -2732,9 +2732,9 @@ 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
+ /// 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.
+ /// 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;
@@ -4075,8 +4075,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
bool _noteKey(KeyEvent event) {
- // Paint hints only; the existing keymap still owns every shortcut.
- _tabShortcutHints.value = HardwareKeyboard.instance.isMetaPressed;
// Off, this is not here at all: every key goes where it went before.
if (event is! KeyDownEvent || _zoo.daemons == DaemonsSwitch.off) {
return false;
@@ -6324,7 +6322,10 @@ class _SwarmScreenState extends State<SwarmScreen> {
}
if (machineId == null || start == null) {
spoken?.cancelled();
- await _newAgent(task: plan.prompt, placement: HarnessPlacement.currentTab);
+ await _newAgent(
+ task: plan.prompt,
+ placement: HarnessPlacement.currentTab,
+ );
return;
}
final mode = taskRoutePermission(app, engine);
@@ -7728,6 +7729,8 @@ 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),
@@ -7806,24 +7809,23 @@ class _SwarmScreenState extends State<SwarmScreen> {
final swarm = shown[index];
final selected = app.activeSwarmId == swarm.id;
final activity = activities[index];
- final nameHint = workspaceTabTooltip(
- labels[index],
- swarm.name,
- clipped:
- DesktopWorkspaceTab.naturalWidth(
- context,
- labels[index],
- shortcutHint: _keymap.hint(
- 'swarm.select_${index + 1}',
- ),
- hasActivity: activity != null,
- ) >
- _tabWidths[index],
- );
- final tabHint = [
- ?nameHint,
- if (activity != null) activity.label,
- ].join('\n');
+ // A status cell animates only while its tab is in view.
+ Widget tabStatus(Widget Function(bool visible) mark) =>
+ ListenableBuilder(
+ listenable: _tabScroll,
+ builder: (context, _) {
+ final left = _tabWidths
+ .take(index)
+ .fold(0.0, (a, b) => a + b);
+ final offset = _tabScroll.hasClients
+ ? _tabScroll.offset
+ : 0.0;
+ return mark(
+ left < offset + tabsWidth &&
+ left + _tabWidths[index] > offset,
+ );
+ },
+ );
return ReorderableDragStartListener(
key: ValueKey(swarm.id),
index: index,
@@ -7844,46 +7846,72 @@ class _SwarmScreenState extends State<SwarmScreen> {
// must not rebuild the workspace.
child: ListenableBuilder(
listenable: app.agentMessages,
- builder: (context, _) => DesktopWorkspaceTab(
- id: swarm.id,
- onRename: () => _rename(swarm.id),
- label: labels[index],
- selected: selected,
- showShortcuts: _tabShortcutHints,
- shortcutHint: _keymap.hint(
- 'swarm.select_${index + 1}',
- ),
- tooltip: tabHint.isEmpty ? null : tabHint,
- activityLabel: activity?.label,
- onSelect: _shortcutsEnabled
- ? () => app.selectSwarm(swarm.id)
- : null,
- onClose: _shortcutsEnabled
- ? () => unawaited(
- app.requestCloseSwarm(swarm.id),
- )
- : null,
- agentMessages: app.agentMessagesOffered(swarm.id)
- ? app.agentMessages.stateOf(swarm.id)
- : null,
- onToggleAgentMessages: _shortcutsEnabled
- ? () => unawaited(
- _toggleAgentMessages(swarm.id),
- )
- : null,
- activity:
- activity == null || activity.mark.isEmpty
- ? null
- : ListenableBuilder(
- listenable: _tabScroll,
- builder: (context, _) {
- final left = _tabWidths
- .take(index)
- .fold(0.0, (a, b) => a + b);
- final offset = _tabScroll.hasClients
- ? _tabScroll.offset
- : 0.0;
- return ActivityMark(
+ builder: (context, _) {
+ // While its agents message, the status slot
+ // shows 💬 in place of the tab's status, and
+ // the tooltip and screen readers say so.
+ final messaging =
+ app.agentMessagesOffered(swarm.id) &&
+ app.agentMessages.stateOf(swarm.id) ==
+ TabMessagesState.flowing;
+ final status = [
+ if (messaging) agentsMessagingLabel,
+ ?activity?.label,
+ ];
+ final nameHint = workspaceTabTooltip(
+ labels[index],
+ swarm.name,
+ clipped:
+ DesktopWorkspaceTab.naturalWidth(
+ context,
+ labels[index],
+ hasActivity:
+ activity != null || messaging,
+ ) >
+ _tabWidths[index],
+ );
+ final tabHint = [?nameHint, ...status].join('\n');
+ return DesktopWorkspaceTab(
+ id: swarm.id,
+ onRename: () => _rename(swarm.id),
+ label: labels[index],
+ selected: selected,
+ tooltip: tabHint.isEmpty ? null : tabHint,
+ activityLabel: status.isEmpty
+ ? null
+ : status.join(', '),
+ onSelect: _shortcutsEnabled
+ ? () => app.selectSwarm(swarm.id)
+ : null,
+ onClose: _shortcutsEnabled
+ ? () => unawaited(
+ 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: messaging
+ ? tabStatus(
+ (visible) => MessagingMark(
+ key: ValueKey(
+ 'tab-messaging:${swarm.id}',
+ ),
+ color: messagesColor,
+ visible: visible,
+ ),
+ )
+ : activity == null || activity.mark.isEmpty
+ ? null
+ : tabStatus(
+ (visible) => ActivityMark(
key: ValueKey(
'tab-activity:${swarm.id}',
),
@@ -7895,13 +7923,11 @@ class _SwarmScreenState extends State<SwarmScreen> {
),
emphasized: selected,
tooltip: false,
- visible:
- left < offset + tabsWidth &&
- left + _tabWidths[index] > offset,
- );
- },
- ),
- ),
+ visible: visible,
+ ),
+ ),
+ );
+ },
),
),
);
diff --git a/desktop/lib/shared/theme/app_icons.dart b/desktop/lib/shared/theme/app_icons.dart
index 1f9a328c7..3b98e7901 100644
--- a/desktop/lib/shared/theme/app_icons.dart
+++ b/desktop/lib/shared/theme/app_icons.dart
@@ -115,6 +115,7 @@ abstract final class AppIcons {
static const messageCircleQuestionMark =
LucideIcons.messageCircleQuestionMark400;
static const messagesSquare = LucideIcons.messagesSquare400;
+ static const messageSquareText = LucideIcons.messageSquareText400;
static const minimize = LucideIcons.minimize400;
static const minus = LucideIcons.minus400;
static const monitor = LucideIcons.monitor400;
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index ad60febd6..9203ef3b1 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1412,7 +1412,7 @@ class AppNotifier extends ChangeNotifier {
/// 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.
+ /// get no 💬, menu row or command.
bool agentMessagesOffered(String tabId) {
final swarm = swarms.where((s) => s.id == tabId).firstOrNull;
return swarm != null &&
diff --git a/desktop/lib/widgets/desktop_workspace_tab.dart b/desktop/lib/widgets/desktop_workspace_tab.dart
index d6a157525..10fde669a 100644
--- a/desktop/lib/widgets/desktop_workspace_tab.dart
+++ b/desktop/lib/widgets/desktop_workspace_tab.dart
@@ -1,6 +1,5 @@
import 'dart:math' as math;
-import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
@@ -11,40 +10,45 @@ 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, Agent Messages' 💬 and the close action.
///
-/// One revealed state: hovering the tab, or holding Command (every tab).
-/// Revealed, the shortcut replaces the status and ⇄ and × both show; at rest
-/// only a tab whose agents are messaging keeps its ⇄, bright.
+/// At rest the name and status have the whole tab. Hovering reveals 💬 — grey
+/// while Agent Messages is off, [messagesColor] while on — and ×. While agents
+/// message, the caller passes a [MessagingMark] as [activity].
class DesktopWorkspaceTab extends StatefulWidget {
const DesktopWorkspaceTab({
super.key,
required this.id,
required this.label,
required this.selected,
- required this.showShortcuts,
required this.onSelect,
required this.onClose,
- this.shortcutHint,
this.tooltip,
this.activity,
this.activityLabel,
this.highlighted = false,
this.onRename,
this.agentMessages,
+ this.messagesColor,
this.onToggleAgentMessages,
});
final String id, label;
final bool selected, highlighted;
- final ValueListenable<bool> showShortcuts;
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? shortcutHint, tooltip, activityLabel;
+ final String? tooltip, activityLabel;
+
+ /// The status cell: an [ActivityMark], or a [MessagingMark] while agents
+ /// message.
final Widget? activity;
static double _measure(BuildContext context, String text, TextStyle style) {
@@ -59,57 +63,58 @@ 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 ⇄. Their width is
- // reserved on both sides, keeping the name centered and clear of them;
- // narrow enough that a 128pt tab still shows its name beside a status.
+ // × 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.
static const closeWidth = 16.0, messagesWidth = 16.0, accessoryGap = 3.0;
- static const _contentInset =
+ static const _restingInset = grid.AppDesktop.tabShoulder + 6;
+ static const _revealedInset =
closeWidth + accessoryGap + messagesWidth + grid.AppDesktop.tabCloseInset;
- static const _indicatorGap = 6.0;
+ static const _statusWidth = 16.0, _indicatorGap = 6.0;
- /// What the ⇄ says it does, in each state.
+ /// 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',
TabMessagesState.flowing => 'Agents messaging · click to turn off',
};
- static TextStyle _hintStyle({Color? color}) =>
- DesktopChrome.metadata(color: color).copyWith(
- fontFamilyFallback: [...grid.AppType.sansFallback, 'Apple Symbols'],
- );
-
- static double indicatorWidth(
- BuildContext context,
- String? hint, {
- required bool hasActivity,
- }) => math
- .max(
- hasActivity ? 16.0 : 0.0,
- hint == null || hint.isEmpty
- ? 0.0
- : _measure(context, hint, _hintStyle()),
- )
- .clamp(0.0, 72.0);
-
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.
static double naturalWidth(
BuildContext context,
String label, {
- String? shortcutHint,
bool hasActivity = false,
+ }) =>
+ labelWidth(context, label) +
+ _restingInset +
+ _revealedInset +
+ (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.
+ static (double, double) titleLayout({
+ required double tabWidth,
+ required double labelWidth,
+ required bool hasActivity,
+ required bool revealed,
}) {
- final indicator = indicatorWidth(
- context,
- shortcutHint,
- hasActivity: hasActivity,
+ final status = hasActivity ? _statusWidth + _indicatorGap : 0.0;
+ final right = revealed ? _revealedInset : _restingInset;
+ final width = math.min(
+ labelWidth,
+ math.max(0.0, tabWidth - _restingInset - right - status),
);
- return labelWidth(context, label) +
- _contentInset * 2 +
- (indicator == 0 ? 0 : indicator + _indicatorGap);
+ final group = width + status;
+ final left = math.max(
+ _restingInset,
+ math.min((tabWidth - group) / 2, tabWidth - right - group),
+ );
+ return (left, width);
}
/// Tabs share the available width, then scroll at their readable minimum.
@@ -198,7 +203,6 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
: foreground.withValues(alpha: .38);
final messages = widget.agentMessages;
final messagesOn = messages != null && messages != TabMessagesState.off;
- final flowing = messages == TabMessagesState.flowing;
Widget tab = Padding(
padding: const EdgeInsets.only(top: grid.AppDesktop.tabTopInset),
child: DecoratedBox(
@@ -215,195 +219,147 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
explicitChildNodes: true,
selected: widget.selected,
child: LayoutBuilder(
- builder: (context, constraints) => ValueListenableBuilder(
- valueListenable: widget.showShortcuts,
- builder: (context, showHints, _) {
- // Hovering this tab, or holding Command, reveals it.
- final revealed = enabled && (_hovered || showHints);
- final showHint =
- revealed && (widget.shortcutHint?.isNotEmpty ?? false);
- final indicator = DesktopWorkspaceTab.indicatorWidth(
+ builder: (context, constraints) {
+ final revealed = enabled && _hovered;
+ final hasActivity = widget.activity != null;
+ final (groupLeft, labelWidth) = DesktopWorkspaceTab.titleLayout(
+ tabWidth: constraints.maxWidth,
+ labelWidth: DesktopWorkspaceTab.labelWidth(
context,
- widget.shortcutHint,
- hasActivity: widget.activity != null,
- );
- // The name sits where it rests, so revealing never moves it.
- // A tab with a status shows the shortcut in that slot; an idle
- // one shows it after the name, shortening only a name that
- // would otherwise run into ⇄.
- final restingSpace = widget.activity != null
- ? indicator + DesktopWorkspaceTab._indicatorGap
- : 0.0;
- final contentRight =
- constraints.maxWidth - DesktopWorkspaceTab._contentInset;
- final restingWidth = math.min(
- DesktopWorkspaceTab.labelWidth(context, widget.label),
- math.max(
- 0.0,
- contentRight -
- DesktopWorkspaceTab._contentInset -
- restingSpace,
- ),
- );
- final groupLeft =
- (constraints.maxWidth - restingWidth - restingSpace) / 2;
- var labelWidth = restingWidth;
- if (showHint && widget.activity == null) {
- final overflow =
- groupLeft +
- restingWidth +
- DesktopWorkspaceTab._indicatorGap +
- indicator -
- contentRight;
- if (overflow > 0) {
- labelWidth = math.max(0.0, restingWidth - overflow);
- }
- }
- return Stack(
- children: [
- Positioned.fill(
- child: Semantics(
- button: true,
+ widget.label,
+ ),
+ hasActivity: hasActivity,
+ revealed: revealed,
+ );
+ return Stack(
+ children: [
+ Positioned.fill(
+ child: Semantics(
+ button: true,
+ enabled: enabled,
+ label: [widget.label, ?widget.activityLabel].join(', '),
+ onTap: widget.onSelect,
+ customSemanticsActions: {
+ 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,
- label: [widget.label, ?widget.activityLabel].join(', '),
- onTap: widget.onSelect,
- customSemanticsActions: {
- 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!,
+ onShowFocusHighlight: (value) =>
+ setState(() => _focused = value),
+ actions: {
+ ActivateIntent: CallbackAction<ActivateIntent>(
+ onInvoke: (_) {
+ widget.onSelect?.call();
+ return null;
+ },
+ ),
},
- child: FocusableActionDetector(
- enabled: enabled,
- onShowFocusHighlight: (value) =>
- setState(() => _focused = value),
- actions: {
- ActivateIntent: CallbackAction<ActivateIntent>(
- onInvoke: (_) {
- widget.onSelect?.call();
- return null;
- },
- ),
- },
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: widget.onSelect,
- onDoubleTap: widget.onRename,
- child: ExcludeSemantics(
- child: Stack(
- children: [
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: widget.onSelect,
+ onDoubleTap: widget.onRename,
+ child: ExcludeSemantics(
+ child: Stack(
+ children: [
+ Positioned(
+ left: groupLeft,
+ width: labelWidth,
+ top: 0,
+ bottom: 0,
+ child: Center(
+ child: Text(
+ widget.label,
+ key: ValueKey('tab-label:${widget.id}'),
+ textAlign: TextAlign.center,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.control(color: ink),
+ ),
+ ),
+ ),
+ if (widget.activity case final activity?)
Positioned(
- left: groupLeft,
- width: labelWidth,
+ left:
+ groupLeft +
+ labelWidth +
+ DesktopWorkspaceTab._indicatorGap,
+ width: DesktopWorkspaceTab._statusWidth,
top: 0,
bottom: 0,
- child: Center(
- child: Text(
- widget.label,
- key: ValueKey('tab-label:${widget.id}'),
- textAlign: TextAlign.center,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.control(
- color: ink,
- ),
- ),
- ),
+ child: Center(child: activity),
),
- if (widget.activity != null || showHint)
- Positioned(
- left:
- groupLeft +
- labelWidth +
- DesktopWorkspaceTab._indicatorGap,
- width: indicator,
- top: 0,
- bottom: 0,
- child: Center(
- child: showHint
- ? Text(
- widget.shortcutHint!,
- key: ValueKey(
- 'tab-shortcut:${widget.id}',
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style:
- DesktopWorkspaceTab._hintStyle(
- color: ink,
- ),
- )
- : widget.activity,
- ),
- ),
- ],
- ),
+ ],
),
),
),
),
),
- Positioned(
- right: grid.AppDesktop.tabCloseInset,
- top: 0,
- bottom: 0,
- child: Row(
- children: [
- _accessory(
- visible:
- messages != null &&
- enabled &&
- (revealed || flowing),
- width: DesktopWorkspaceTab.messagesWidth,
- child: messages == null
- ? const SizedBox.shrink()
- : _AgentMessagesButton(
- key: ValueKey(
- 'tab-agent-messages:${widget.id}',
- ),
- state: messages,
- onPressed: widget.onToggleAgentMessages,
- style: _accessoryStyle(
- foreground,
- flowing ? 1 : quietOpacity,
- ),
+ ),
+ Positioned(
+ 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}',
),
- ),
- const SizedBox(
- width: DesktopWorkspaceTab.accessoryGap,
- ),
- _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,
- height: 32,
- ),
- style: _accessoryStyle(foreground, quietOpacity),
- icon: const Icon(
- AppIcons.close,
- size: AppIcons.closeSize,
- ),
+ state: messages,
+ onPressed: widget.onToggleAgentMessages,
+ style: messagesOn
+ ? _accessoryStyle(
+ widget.messagesColor ?? foreground,
+ MediaQuery.highContrastOf(context)
+ ? 1
+ : .85,
+ )
+ : _accessoryStyle(
+ foreground,
+ quietOpacity,
+ ),
+ ),
+ ),
+ const SizedBox(width: DesktopWorkspaceTab.accessoryGap),
+ _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,
+ height: 32,
+ ),
+ style: _accessoryStyle(foreground, quietOpacity),
+ icon: const Icon(
+ AppIcons.close,
+ size: AppIcons.closeSize,
),
),
- ],
- ),
+ ),
+ ],
),
- ],
- );
- },
- ),
+ ),
+ ],
+ );
+ },
),
),
),
@@ -425,8 +381,8 @@ class _DesktopWorkspaceTabState extends State<DesktopWorkspaceTab> {
}
}
-/// Agent Messages' ⇄: dim when off (struck through) or on and quiet, bright
-/// while agents are messaging. Its tooltip says what a click does.
+/// 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,
@@ -463,46 +419,9 @@ class _AgentMessagesButton extends StatelessWidget {
height: 32,
),
style: style,
- icon: _MessagesGlyph(struck: state == TabMessagesState.off),
+ icon: const Icon(AppIcons.messagesSquare, size: 13),
),
),
);
}
}
-
-/// ⇄, struck through while Agent Messages are off.
-class _MessagesGlyph extends StatelessWidget {
- const _MessagesGlyph({required this.struck});
- final bool struck;
-
- @override
- Widget build(BuildContext context) {
- const icon = Icon(AppIcons.arrowRightLeft, size: 13);
- if (!struck) return icon;
- return CustomPaint(
- key: const ValueKey('agent-messages-struck'),
- foregroundPainter: _SlashPainter(
- IconTheme.of(context).color ?? DesktopChrome.foreground,
- ),
- child: icon,
- );
- }
-}
-
-class _SlashPainter extends CustomPainter {
- const _SlashPainter(this.color);
- final Color color;
-
- @override
- void paint(Canvas canvas, Size size) => canvas.drawLine(
- Offset(size.width * .15, size.height * .9),
- Offset(size.width * .85, size.height * .1),
- Paint()
- ..color = color
- ..strokeWidth = 1.2
- ..strokeCap = StrokeCap.round,
- );
-
- @override
- bool shouldRepaint(_SlashPainter oldDelegate) => oldDelegate.color != color;
-}
diff --git a/desktop/lib/widgets/harness_activity_mark.dart b/desktop/lib/widgets/harness_activity_mark.dart
index 93f2fc0e8..3bad9b1cf 100644
--- a/desktop/lib/widgets/harness_activity_mark.dart
+++ b/desktop/lib/widgets/harness_activity_mark.dart
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:xterm/xterm.dart' show TerminalTheme;
+import '../shared/theme/app_icons.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/appearance_prefs_store.dart';
import '../shared/theme/workspace_bar_style.dart';
@@ -208,6 +209,109 @@ class _ActivityMarkState extends State<ActivityMark> {
}
}
+/// What a tab says while its agents message one another.
+const agentsMessagingLabel = 'Agents messaging';
+
+/// A tab's status cell while its agents message one another (Agent Messages):
+/// two chat bubbles, mirrored every half second on the same clock as the
+/// spinner so the speakers trade sides; still under Reduce Motion or when
+/// scrolled away.
+class MessagingMark extends StatefulWidget {
+ const MessagingMark({
+ super.key,
+ required this.color,
+ this.visible = true,
+ this.clock,
+ });
+ final Color color;
+ final bool visible;
+ final ActivityClock? clock;
+
+ /// The tab's status slot.
+ static const width = 16.0;
+
+ /// Half a second per side: five of the spinner's 100ms frames.
+ static bool mirroredAt(int frame) => (frame ~/ 5).isOdd;
+
+ @override
+ State<MessagingMark> createState() => _MessagingMarkState();
+}
+
+class _MessagingMarkState extends State<MessagingMark> {
+ ActivityClock get clock => widget.clock ?? _activityClock;
+ bool _listening = false;
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ _sync();
+ }
+
+ @override
+ void didUpdateWidget(MessagingMark oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.clock != widget.clock && _listening) {
+ (oldWidget.clock ?? _activityClock).removeListener(_tick);
+ _listening = false;
+ }
+ _sync();
+ }
+
+ void _sync() {
+ final listen =
+ widget.visible &&
+ TickerMode.valuesOf(context).enabled &&
+ !MediaQuery.disableAnimationsOf(context);
+ if (listen == _listening) return;
+ _listening = listen;
+ if (listen) {
+ clock.addListener(_tick);
+ } else {
+ clock.removeListener(_tick);
+ }
+ }
+
+ void _tick() {
+ if (mounted) setState(() {});
+ }
+
+ @override
+ void dispose() {
+ if (_listening) clock.removeListener(_tick);
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final mirrored = _listening && MessagingMark.mirroredAt(clock.frame);
+ // The tab's 16px status slot, the glyph centered in it: mirroring then
+ // turns the arrows in place instead of moving them.
+ return Semantics(
+ label: agentsMessagingLabel,
+ child: ExcludeSemantics(
+ child: RepaintBoundary(
+ child: SizedBox(
+ width: MessagingMark.width,
+ child: Center(
+ child: Transform.flip(
+ key: ValueKey(
+ 'messaging-mark:${mirrored ? 'mirrored' : 'plain'}',
+ ),
+ flipX: mirrored,
+ child: Icon(
+ AppIcons.messagesSquare,
+ size: 13,
+ color: widget.color,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
/// Pane headers listen to activity and acknowledgement independently of their
/// cached title/controls, so a turn or unread change never rebuilds a terminal.
class HarnessActivityMark extends StatelessWidget {
diff --git a/desktop/lib/widgets/linux_menu_bar.dart b/desktop/lib/widgets/linux_menu_bar.dart
index f2d3f290b..95c45c975 100644
--- a/desktop/lib/widgets/linux_menu_bar.dart
+++ b/desktop/lib/widgets/linux_menu_bar.dart
@@ -348,10 +348,10 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {
label: 'Close Tab',
action: 'closeActive',
),
- // The active tab's Agent Messages: the tab's ⇄, and its log.
+ // The active tab's Agent Messages: the tab's 💬, and its log.
_swarmRow(
key: 'menu-bar-agent-messages',
- icon: AppIcons.arrowRightLeft,
+ icon: AppIcons.messagesSquare,
label: 'Agent Messages',
action: 'toggleAgentMessages',
selected: state.agentMessages == true,
@@ -359,7 +359,7 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {
),
_swarmRow(
key: 'menu-bar-show-agent-messages',
- icon: AppIcons.messagesSquare,
+ icon: AppIcons.messageSquareText,
label: 'Show Agent Messages',
action: 'showAgentMessages',
enabled: state.enabled && state.agentMessages != null,
diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swift
index d576406b1..f7ef15443 100644
--- a/desktop/macos/Runner/SwarmTitlebar.swift
+++ b/desktop/macos/Runner/SwarmTitlebar.swift
@@ -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": "arrow.left.arrow.right", "showAgentMessages": "bubble.left.and.bubble.right",
+ "toggleAgentMessages": "bubble.left.and.bubble.right", "showAgentMessages": "text.bubble",
"splitRight": "rectangle.split.2x1", "splitDown": "rectangle.split.1x2",
"zoomPane": "viewfinder", "movePaneToTab": "arrow.right.square", "closePane": "xmark",
"commands": "command", "notifications": "bell",
@@ -338,7 +338,7 @@ 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.
+ // The active tab's Agent Messages: its 💬 (a checkmark here) and its log.
add(file, "Agent Messages", "", "toggleAgentMessages")
add(file, "Show Agent Messages", "", "showAgentMessages")
file.addItem(.separator())
@@ -1886,8 +1886,6 @@ private final class SwarmTabStrip: NSView {
private var activityTimer: Timer?
private var activityObservers: [NSObjectProtocol] = []
private var motionObserver: NSObjectProtocol?
- private var modifierMonitor: Any?
- private var shortcutHintsVisible = false
private var lastBackgroundClick: (time: TimeInterval, point: NSPoint)?
// Dragging is explicit below. AppKit must not also start a titlebar gesture.
override var mouseDownCanMoveWindow: Bool { false }
@@ -2059,22 +2057,6 @@ private final class SwarmTabStrip: NSView {
forName: NSWorkspace.accessibilityDisplayOptionsDidChangeNotification, object: nil, queue: .main) {
[weak self] _ in self?.syncActivityAnimation()
}
- // Observe only; Flutter/AppKit keep ownership of every shortcut and IME event.
- modifierMonitor = NSEvent.addLocalMonitorForEvents(matching: .flagsChanged) { [weak self] event in
- guard let self, let window = self.window,
- event.window === window || (event.window == nil && window.isKeyWindow) else { return event }
- self.setShortcutHintsVisible(event.modifierFlags.contains(.command))
- return event
- }
- for name in [NSApplication.didResignActiveNotification, NSWindow.didResignKeyNotification] {
- activityObservers.append(NotificationCenter.default.addObserver(forName: name, object: nil, queue: .main) {
- [weak self] notification in
- guard let self else { return }
- if name == NSApplication.didResignActiveNotification || notification.object as? NSWindow === self.window {
- self.setShortcutHintsVisible(false)
- }
- })
- }
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
@@ -2083,23 +2065,17 @@ private final class SwarmTabStrip: NSView {
daemonRevealTimer?.invalidate()
activityObservers.forEach(NotificationCenter.default.removeObserver)
if let motionObserver { NSWorkspace.shared.notificationCenter.removeObserver(motionObserver) }
- if let modifierMonitor { NSEvent.removeMonitor(modifierMonitor) }
}
override func viewDidMoveToWindow() {
super.viewDidMoveToWindow()
if window == nil { setDaemonHover(false) }
syncActivityAnimation()
- setShortcutHintsVisible(window?.isKeyWindow == true && NSEvent.modifierFlags.contains(.command))
}
- private func setShortcutHintsVisible(_ visible: Bool) {
- shortcutHintsVisible = visible
- for tab in tabs { tab.showsShortcutHint = visible && actionsEnabled }
- }
-
- private var visibleWorkingTabs: [SwarmTabButton] {
- tabs.filter { $0.activity?.working == true && scroll.documentVisibleRect.intersects($0.frame) }
+ /// Tabs whose status slot moves: a working spinner, or agents messaging.
+ private var visibleAnimatedTabs: [SwarmTabButton] {
+ tabs.filter { ($0.activity?.working == true || $0.messaging) && scroll.documentVisibleRect.intersects($0.frame) }
}
private func syncActivityAnimation() {
@@ -2110,19 +2086,19 @@ private final class SwarmTabStrip: NSView {
let moving = actionsEnabled && !reduceMotion &&
!NSWorkspace.shared.accessibilityDisplayShouldReduceMotion && NSApp.isActive &&
window?.occlusionState.contains(.visible) == true && !isHiddenOrHasHiddenAncestor &&
- !visibleWorkingTabs.isEmpty
+ !visibleAnimatedTabs.isEmpty
guard moving else {
activityTimer?.invalidate()
activityTimer = nil
for tab in tabs { tab.activityFrame = 0 }
return
}
- for tab in visibleWorkingTabs { tab.activityFrame = harnessActivityFrame() }
+ for tab in visibleAnimatedTabs { tab.activityFrame = harnessActivityFrame() }
guard activityTimer == nil else { return }
let next = (floor(Date().timeIntervalSince1970 * 10) + 1) / 10
let timer = Timer(fire: Date(timeIntervalSince1970: next), interval: 0.1, repeats: true) { [weak self] _ in
guard let self else { return }
- for tab in self.visibleWorkingTabs { tab.activityFrame = harnessActivityFrame() }
+ for tab in self.visibleAnimatedTabs { tab.activityFrame = harnessActivityFrame() }
}
activityTimer = timer
RunLoop.main.add(timer, forMode: .common)
@@ -2252,12 +2228,15 @@ private final class SwarmTabStrip: NSView {
let tabsFocused = state["tabsFocused"] as? Bool == true
revealActiveAfterLayout = revealActiveAfterLayout || nextActiveId != activeId
activeId = nextActiveId
+ // Agent Messages' color: its 💬 when on, and the status slot while agents
+ // message. 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
for tab in tabs where !ids.contains(tab.swarmId) { tab.removeFromSuperview() }
let previous = Dictionary(tabs.map { ($0.swarmId, $0) }, uniquingKeysWith: { first, _ in first })
- tabs = rows.enumerated().compactMap { index, row in
+ tabs = rows.compactMap { row in
guard let id = row["id"] as? String else { return nil }
let tab = previous[id] ?? SwarmTabButton(id: id)
tab.palette = palette
@@ -2268,9 +2247,6 @@ private final class SwarmTabStrip: NSView {
tab.displayLabel = row["label"] != nil && !row.keys.contains("shortcutHint")
? displayLabel.replacingOccurrences(of: #"^\d+:"#, with: "", options: .regularExpression)
: displayLabel
- tab.shortcutHint = row.keys.contains("shortcutHint")
- ? row["shortcutHint"] as? String : (index < 9 ? "⌘\(index + 1)" : nil)
- tab.showsShortcutHint = shortcutHintsVisible && actionsEnabled
tab.foreground = palette.navigationForeground
tab.selected = id == activeId
tab.keyboardFocus = tabsFocused && id == activeId
@@ -2280,6 +2256,7 @@ private final class SwarmTabStrip: NSView {
tab.agentMessages = (row["agentMessages"] as? Bool).map {
SwarmTabMessages(on: $0, flowing: row["agentMessagesFlowing"] as? Bool == true)
}
+ tab.messagesColor = messagesColor
tab.emit = { [weak self, weak tab] method, args in
guard let self, let tab, self.actionsEnabled,
self.tabs.contains(where: { $0 === tab }) else { return }
@@ -2633,16 +2610,16 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
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 ⇄. Their
- // width is reserved on both sides of the centered title, and kept narrow
- // enough that a 128pt tab still draws its name beside a status.
+ // 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.
private static let trailingInset: CGFloat = 8
private static let accessoryHeight: CGFloat = 32
private static let closeWidth: CGFloat = 16
private static let accessoryGap: CGFloat = 3
private static let messagesWidth: CGFloat = 16
- private static let contentInset: CGFloat = trailingInset + closeWidth + accessoryGap + messagesWidth
+ private static let restingInset: CGFloat = shoulder + 6
+ private static let revealedInset: CGFloat = trailingInset + closeWidth + accessoryGap + messagesWidth
private static let gap: CGFloat = 6
private static let activityWidth: CGFloat = 16
@@ -2652,36 +2629,37 @@ 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() } } }
- var shortcutHint: String? { didSet { if shortcutHint != oldValue { invalidateLabel(); updateAccessibility() } } }
- /// Command is held: every tab is revealed, as a hovered one is.
- var showsShortcutHint = false {
+ /// Agent Messages (docs/design/2026-10-10-agent-messages.md): the hover 💬,
+ /// and the status slot while agents message; nil where the row carries none
+ /// (the Store tab).
+ var agentMessages: SwarmTabMessages? {
didSet {
- if showsShortcutHint != oldValue { updateAccessoryVisibility(); needsLayout = true; needsDisplay = true }
+ guard agentMessages != oldValue else { return }
+ updateMessagesControls()
+ invalidateLabel()
+ updateAccessibility()
}
}
- /// Agent Messages' ⇄ (docs/design/2026-10-10-agent-messages.md); nil where
- /// the row carries none (the Store tab).
- var agentMessages: SwarmTabMessages? {
- didSet { if agentMessages != oldValue { updateMessagesControls() } }
+ /// Agent Messages' color: the 💬 when on, and the slot while messaging.
+ var messagesColor = NSColor.controlAccentColor {
+ didSet { if messagesColor != oldValue { updateMessagesControls() } }
}
+ /// Agents in this tab messaged one another a moment ago: the status slot
+ /// shows 💬 in place of the status until it goes quiet.
+ var messaging: Bool { agentMessages?.on == true && agentMessages?.flowing == true }
var foreground = NSColor(white: 0.85, alpha: 1) {
didSet {
if foreground != oldValue { invalidateLabel() }
closeButton.foreground = foreground
- messagesButton.foreground = foreground
+ updateMessagesControls()
}
}
- private var indicatorWidth: CGFloat {
- min(72, max(activityLabel == nil ? 0 : Self.activityWidth, shortcutLayout?.size.width ?? 0))
- }
- private var reservedIndicatorSpace: CGFloat { indicatorWidth == 0 ? 0 : indicatorWidth + Self.gap }
- /// The status slot as the tab rests. The title is placed from it alone, so
- /// revealing the shortcut never moves the title.
- private var activitySpace: CGFloat {
- (activityMark?.isEmpty ?? true) ? 0 : reservedIndicatorSpace
+ /// The status slot: the activity mark, or 💬 while agents message.
+ private var statusSpace: CGFloat {
+ messaging || !(activityMark?.isEmpty ?? true) ? Self.activityWidth + Self.gap : 0
}
private var naturalTitleWidth: CGFloat { max(labelLayout.size.width, emphasizedLabelLayout.size.width) }
- var minimumWidth: CGFloat { Self.contentInset * 2 + reservedIndicatorSpace + 16 }
+ var minimumWidth: CGFloat { Self.restingInset * 2 + statusSpace + 16 }
var preferredWidth: CGFloat { Self.maximumLayoutWidth }
var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }
var attention = false { didSet { if attention != oldValue { invalidateLabel(); updateAccessibility() } } }
@@ -2689,7 +2667,9 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
didSet { if activity != oldValue { invalidateLabel(); updateAccessibility() } }
}
var activityFrame = 0 {
- didSet { if activityFrame != oldValue, activity?.working == true { setNeedsDisplay(activityRect) } }
+ didSet {
+ if activityFrame != oldValue, activity?.working == true || messaging { setNeedsDisplay(activityRect) }
+ }
}
// Keep the old question payload useful for an older Flutter fixture/runner.
private var activityLabel: String? { activity?.label ?? (attention ? "Needs your input" : nil) }
@@ -2697,34 +2677,21 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
if let activity { return activity.symbol(frame: activityFrame) }
return attention ? "?" : nil
}
- private var restingTitleRect: NSRect {
- let width = min(naturalTitleWidth, max(0, bounds.width - Self.contentInset * 2 - activitySpace))
- return NSRect(x: (bounds.width - width - activitySpace) / 2, y: 0,
- width: width, height: bounds.height)
- }
- /// An idle tab shows its shortcut after the title when revealed; only a
- /// title that would run into ⇄ gives up its tail for it.
- private var titleRect: NSRect {
- var rect = restingTitleRect
- if displaysShortcut && activitySpace == 0 {
- let overflow = rect.maxX + reservedIndicatorSpace - (bounds.width - Self.contentInset)
- if overflow > 0 { rect.size.width = max(0, rect.width - overflow) }
- }
- return rect
- }
- private var indicatorRect: NSRect {
- if bounds.width < minimumWidth {
- let width = min(indicatorWidth, max(0, bounds.width - 16))
- return NSRect(x: bounds.midX - width / 2, y: 0, width: width, height: bounds.height)
- }
- return NSRect(x: titleRect.maxX + Self.gap, y: 0, width: indicatorWidth, height: bounds.height)
+ /// 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.
+ 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))
+ let group = width + statusSpace
+ let x = max(Self.restingInset, min((bounds.width - group) / 2, bounds.width - right - group))
+ return NSRect(x: x, y: 0, width: width, height: bounds.height)
}
+ private var titleRect: NSRect { titleRect(revealed: isRevealed) }
private var activityRect: NSRect {
if bounds.width < minimumWidth {
return NSRect(x: bounds.midX - Self.activityWidth / 2, y: 0, width: Self.activityWidth, height: bounds.height)
}
- return NSRect(x: indicatorRect.midX - Self.activityWidth / 2,
- y: 0, width: Self.activityWidth, height: bounds.height)
+ return NSRect(x: titleRect.maxX + Self.gap, y: 0, width: Self.activityWidth, height: bounds.height)
}
/// Flutter holds the keyboard after Close; accessibility explains Return.
var keyboardFocus = false { didSet { if keyboardFocus != oldValue { needsDisplay = true; updateAccessibility() } } }
@@ -2735,7 +2702,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
var isHovered: Bool { hovered && actionsEnabled }
private let selectButton = SwarmSelectButton()
private let closeButton = SwarmPlainIconButton()
- private let messagesButton = SwarmMessagesButton()
+ private let messagesButton = SwarmPlainIconButton()
private var messagesItems: [NSMenuItem] = []
/// Whether the middle button went down on THIS tab — see otherMouseUp.
private var middleDown = false
@@ -2746,7 +2713,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
// Animation only changes the activity mark. Keep the three bounded text
// measurements with their attributed strings until label inputs change;
// AppKit's size() otherwise repeats text layout throughout each dirty-rect
- // calculation and paint, even while Command hints are not being displayed.
+ // calculation and paint.
private struct MeasuredLabel {
let text: NSAttributedString
let size: NSSize
@@ -2757,7 +2724,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
}
private var cachedLabel: MeasuredLabel?
private var cachedEmphasizedLabel: MeasuredLabel?
- private var cachedShortcutLabel: MeasuredLabel?
var actionsEnabled = true {
didSet {
selectButton.isEnabled = actionsEnabled
@@ -2800,7 +2766,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
addSubview(closeButton)
messagesButton.title = ""
messagesButton.isBordered = false
- messagesButton.image = HarnessControlSymbols.image("arrow.left.arrow.right")
+ messagesButton.image = HarnessControlSymbols.image("bubble.left.and.bubble.right")
messagesButton.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 10, weight: .regular)
messagesButton.imagePosition = .imageOnly
messagesButton.foreground = foreground
@@ -2839,8 +2805,10 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
width: min(Self.messagesWidth, bounds.width), height: Self.accessoryHeight)
let fullName = name.trimmingCharacters(in: .whitespacesAndNewlines)
var hints: [String] = []
- if naturalTitleWidth > restingTitleRect.width { hints.append(displayLabel) }
+ // A tooltip shows under the pointer, where the name has its revealed room.
+ if naturalTitleWidth > titleRect(revealed: true).width { hints.append(displayLabel) }
if !fullName.isEmpty && fullName != displayLabel { hints.append(name) }
+ if messaging { hints.append(SwarmTabMessages.messagingLabel) }
if let activityLabel { hints.append(activityLabel) }
toolTip = hints.isEmpty ? nil : hints.joined(separator: "\n")
}
@@ -2862,25 +2830,20 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
needsDisplay = true
hoverChanged?()
}
- /// One revealed state: hovering this tab, or holding Command (every tab).
- /// Revealed, the shortcut replaces the status and ⇄ and × both show.
- var isRevealed: Bool { actionsEnabled && (hovered || showsShortcutHint) }
- private var displaysShortcut: Bool { isRevealed && shortcutHint?.isEmpty == false }
+ /// Hovering reveals the tab's 💬 and ×; at rest it shows its name and status.
+ var isRevealed: Bool { actionsEnabled && hovered }
private func updateAccessoryVisibility() {
closeButton.isHidden = !isRevealed
- // At rest only a tab whose agents are messaging keeps its ⇄ — on, since
- // traffic seen as it was turned off says nothing about this tab now.
- let flowing = agentMessages?.on == true && agentMessages?.flowing == true
- messagesButton.isHidden = agentMessages == nil || !(isRevealed || (actionsEnabled && flowing))
+ messagesButton.isHidden = agentMessages == nil || !isRevealed
}
- /// The ⇄'s look, tooltip and accessibility, and the menu rows, for its state.
+ /// The 💬's look, tooltip and accessibility, and the menu rows, for its state:
+ /// grey while off, Agent Messages' color while on.
private func updateMessagesControls() {
for item in messagesItems { item.isHidden = agentMessages == nil }
if let state = agentMessages {
- messagesButton.struck = !state.on
- let bright = state.on && state.flowing
- messagesButton.restingOpacity = bright ? 1 : 0.45
- messagesButton.highContrastRestingOpacity = bright ? 1 : 0.7
+ messagesButton.foreground = state.on ? messagesColor : foreground
+ messagesButton.restingOpacity = state.on ? 0.85 : 0.45
+ messagesButton.highContrastRestingOpacity = state.on ? 1 : 0.7
messagesButton.toolTip = state.tooltip
messagesButton.setAccessibilityLabel("Agent Messages")
messagesButton.setAccessibilityValue(state.on ? "On" : "Off")
@@ -2892,14 +2855,12 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
private func invalidateLabel() {
cachedLabel = nil
cachedEmphasizedLabel = nil
- cachedShortcutLabel = nil
updateAccessoryVisibility()
needsDisplay = true
needsLayout = true
}
private var label: NSAttributedString { labelLayout.text }
private var emphasizedLabel: NSAttributedString { emphasizedLabelLayout.text }
- private var shortcutLabel: NSAttributedString? { shortcutLayout?.text }
private var labelLayout: MeasuredLabel {
if let cachedLabel { return cachedLabel }
let paragraph = NSMutableParagraphStyle()
@@ -2920,18 +2881,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
cachedEmphasizedLabel = measured
return measured
}
- private var shortcutLayout: MeasuredLabel? {
- guard let shortcutHint, !shortcutHint.isEmpty else { return nil }
- if let cachedShortcutLabel { return cachedShortcutLabel }
- let paragraph = NSMutableParagraphStyle()
- paragraph.alignment = .center
- paragraph.lineBreakMode = .byTruncatingTail
- let measured = MeasuredLabel(NSAttributedString(string: shortcutHint, attributes: [
- .font: NSFont.systemFont(ofSize: 12, weight: .regular),
- .foregroundColor: foreground.withAlphaComponent(0.75), .paragraphStyle: paragraph]))
- cachedShortcutLabel = measured
- return measured
- }
private var tabShape: NSBezierPath {
let path = NSBezierPath()
let top = max(0, bounds.maxY - Self.topInset)
@@ -2983,17 +2932,17 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
text.text.draw(in: NSRect(x: titleRect.minX, y: contentCenterY - text.size.height / 2,
width: titleRect.width, height: text.size.height))
}
- if !displaysShortcut, let activityMark {
+ let status = NSRect(x: activityRect.minX, y: contentCenterY - 8, width: activityRect.width, height: 16)
+ if messaging {
NSGraphicsContext.saveGraphicsState()
bounds.clip()
- HarnessNativeActivity.draw(activityMark,
- in: NSRect(x: activityRect.minX, y: contentCenterY - 8, width: activityRect.width, height: 16),
- color: activity?.color ?? .systemOrange)
+ SwarmTabMessages.drawMessaging(in: status, frame: activityFrame, color: messagesColor)
+ NSGraphicsContext.restoreGraphicsState()
+ } else if let activityMark {
+ NSGraphicsContext.saveGraphicsState()
+ bounds.clip()
+ HarnessNativeActivity.draw(activityMark, in: status, color: activity?.color ?? .systemOrange)
NSGraphicsContext.restoreGraphicsState()
- }
- if displaysShortcut, let shortcut = shortcutLayout {
- shortcut.text.draw(in: NSRect(x: indicatorRect.minX, y: contentCenterY - shortcut.size.height / 2,
- width: indicatorRect.width, height: shortcut.size.height))
}
}
// Overflowed tabs might not be drawn. Their names and selection still need
@@ -3004,7 +2953,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
closeButton.setAccessibilityLabel("Close \(name)")
closeButton.toolTip = "Close Tab"
selectButton.setAccessibilityValue(selected ? "Selected" : "")
- let help = [activityLabel,
+ let help = [messaging ? SwarmTabMessages.messagingLabel : nil, activityLabel,
keyboardFocus ? "Keyboard is on the tabs. Press Return to type in this tab." : nil].compactMap { $0 }
selectButton.setAccessibilityHelp(help.isEmpty ? nil : help.joined(separator: ". "))
}
@@ -3081,35 +3030,34 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati
struct SwarmTabMessages: Equatable {
var on: Bool
var flowing: Bool
- /// What the ⇄ says a click does; the Flutter tab says the same.
+ static let messagingLabel = "Agents messaging"
+ /// The status slot while agents message: two chat bubbles, mirrored every
+ /// half second on the activity clock so the speakers trade sides; still at
+ /// frame 0 (Reduce Motion).
+ static func drawMessaging(in rect: NSRect, frame: Int, color: NSColor) {
+ guard let symbol = NSImage(systemSymbolName: "bubble.left.and.bubble.right", accessibilityDescription: nil)?
+ .withSymbolConfiguration(NSImage.SymbolConfiguration(pointSize: 10, weight: .medium)) else { return }
+ let glyph = NSRect(x: rect.midX - symbol.size.width / 2, y: rect.midY - symbol.size.height / 2,
+ width: symbol.size.width, height: symbol.size.height)
+ NSGraphicsContext.current?.cgContext.beginTransparencyLayer(auxiliaryInfo: nil)
+ if (frame / 5) % 2 == 1 {
+ let mirror = NSAffineTransform()
+ mirror.translateX(by: glyph.midX * 2, yBy: 0)
+ mirror.scaleX(by: -1, yBy: 1)
+ mirror.concat()
+ }
+ symbol.draw(in: glyph)
+ color.setFill()
+ glyph.fill(using: .sourceIn)
+ NSGraphicsContext.current?.cgContext.endTransparencyLayer()
+ }
+ /// What the 💬 says a click does; the Flutter tab says the same.
var tooltip: String {
!on ? "Agent messages off · click to turn on"
: flowing ? "Agents messaging · click to turn off" : "Agent messages on · click to turn off"
}
}
-/// ⇄, struck through while Agent Messages are off.
-private final class SwarmMessagesButton: SwarmPlainIconButton {
- var struck = false { didSet { if struck != oldValue { needsDisplay = true } } }
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- guard struck, let symbol = image?.withSymbolConfiguration(symbolConfiguration ?? HarnessControlSymbols.configuration)
- else { return }
- let glyph = NSRect(x: (bounds.width - symbol.size.width) / 2, y: (bounds.height - symbol.size.height) / 2,
- width: symbol.size.width, height: symbol.size.height)
- let emphasized = isEnabled && (hovered || hasKeyboardFocus || isHighlighted)
- let quiet = NSWorkspace.shared.accessibilityDisplayShouldIncreaseContrast
- ? highContrastRestingOpacity ?? restingOpacity : restingOpacity
- foreground.withAlphaComponent(isEnabled ? (emphasized ? 1 : quiet) : 0.28).setStroke()
- let slash = NSBezierPath()
- slash.move(to: NSPoint(x: glyph.minX + glyph.width * 0.1, y: glyph.minY - 1))
- slash.line(to: NSPoint(x: glyph.maxX - glyph.width * 0.1, y: glyph.maxY + 1))
- slash.lineWidth = 1.2
- slash.lineCapStyle = .round
- slash.stroke()
- }
-}
-
/// The full tab remains a selection/drag target; the hover close button sits
/// above its trailing slot. Native menu actions and Command-W remain available.
private class SwarmTabActionButton: SwarmIconButton {
diff --git a/desktop/test/agent_messages_tab_test.dart b/desktop/test/agent_messages_tab_test.dart
index f06b6a331..aa205c840 100644
--- a/desktop/test/agent_messages_tab_test.dart
+++ b/desktop/test/agent_messages_tab_test.dart
@@ -7,19 +7,22 @@ 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/state/harness_activity.dart' show activityFrameInterval;
import 'package:harness/widgets/desktop_workspace_tab.dart';
+import 'package:harness/widgets/harness_activity_mark.dart';
import 'support/agent_messages_api.dart';
import 'swarm_screen_test.dart' show mount;
import 'swarm_state_test.dart' show createApp;
-/// The tab's ⇄ and the one revealed state (docs/design/2026-10-10-agent-messages.md,
-/// "The tab"): hovering a tab or holding Command reveals the shortcut, ⇄ and ×;
-/// at rest only a tab whose agents are messaging keeps a bright ⇄.
+/// 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
+/// ×; while agents message, the status slot shows 💬 in place of the status.
typedef _Spec = ({String id, TabMessagesState? messages, bool working});
+const _messagesColor = Color(0xffbc3fbc);
+
Widget _host(
- ValueNotifier<bool> command,
List<_Spec> tabs, {
Brightness brightness = Brightness.dark,
void Function(String id)? onToggle,
@@ -42,11 +45,10 @@ Widget _host(
id: tab.id,
label: tab.id,
selected: index == 0,
- shortcutHint: '⌘${index + 1}',
- showShortcuts: command,
onSelect: () => onSelect?.call(tab.id),
onClose: () {},
agentMessages: tab.messages,
+ messagesColor: _messagesColor,
onToggleAgentMessages: () => onToggle?.call(tab.id),
activityLabel: tab.working ? 'Working' : null,
activity: tab.working
@@ -68,21 +70,16 @@ Widget _host(
Finder _messages(String id) => find.byKey(ValueKey('tab-agent-messages:$id'));
Finder _close(String id) => find.byKey(ValueKey('tab-close:$id'));
Finder _label(String id) => find.byKey(ValueKey('tab-label:$id'));
-Finder _hint(String id) => find.byKey(ValueKey('tab-shortcut:$id'));
-Finder _struck(String id) => find.descendant(
- of: _messages(id),
- matching: find.byKey(const ValueKey('agent-messages-struck')),
-);
-/// The ink the ⇄ glyph is drawn in, while the pointer is not on it.
-double _glyphAlpha(WidgetTester tester, String id) => IconTheme.of(
+/// The ink the 💬 glyph is drawn in, while the pointer is not on it.
+Color _glyph(WidgetTester tester, String id) => IconTheme.of(
tester.element(
find.descendant(
of: _messages(id),
- matching: find.byIcon(AppIcons.arrowRightLeft),
+ matching: find.byIcon(AppIcons.messagesSquare),
),
),
-).color!.a;
+).color!;
String _tooltip(WidgetTester tester, String id) => tester
.widget<Tooltip>(
@@ -90,146 +87,120 @@ String _tooltip(WidgetTester tester, String id) => tester
)
.message!;
-void main() {
- late ValueNotifier<bool> command;
- setUp(() => command = ValueNotifier(false));
- tearDown(() => command.dispose());
+Future<TestGesture> _hover(WidgetTester tester, String id) async {
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: tester.getCenter(_label(id)));
+ addTearDown(mouse.removePointer);
+ await tester.pump();
+ return mouse;
+}
+void main() {
for (final brightness in Brightness.values) {
- testWidgets(
- 'off: nothing at rest; revealed, ⌘1 and a struck dim ⇄ beside × '
- '(${brightness.name})',
- (tester) async {
- final toggled = <String>[];
- await tester.pumpWidget(
- _host(
- command,
- [(id: 'app', messages: TabMessagesState.off, working: false)],
- brightness: brightness,
- onToggle: toggled.add,
- ),
- );
- expect(_messages('app').hitTestable(), findsNothing);
- expect(_close('app').hitTestable(), findsNothing);
- expect(_hint('app'), findsNothing);
- final title = tester.getRect(_label('app'));
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: title.center);
- addTearDown(mouse.removePointer);
- await tester.pump();
- expect(_hint('app'), findsOneWidget);
- expect(_messages('app').hitTestable(), findsOneWidget);
- expect(_close('app').hitTestable(), findsOneWidget);
- expect(_struck('app'), findsOneWidget);
- expect(_glyphAlpha(tester, 'app'), closeTo(.45, .01));
- 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: 'never moves');
- expect(
- tester.getRect(_hint('app')).right,
- lessThanOrEqualTo(messages.left),
- );
- },
- );
+ testWidgets('off: nothing at rest; hovered, a grey 💬 beside × '
+ '(${brightness.name})', (tester) async {
+ final toggled = <String>[];
+ await tester.pumpWidget(
+ _host(
+ [(id: 'app', messages: TabMessagesState.off, working: false)],
+ brightness: brightness,
+ onToggle: toggled.add,
+ ),
+ );
+ expect(_messages('app').hitTestable(), findsNothing);
+ expect(_close('app').hitTestable(), findsNothing);
+ final title = tester.getRect(_label('app'));
+ await _hover(tester, 'app');
+ expect(_messages('app').hitTestable(), findsOneWidget);
+ expect(_close('app').hitTestable(), findsOneWidget);
+ final grey = _glyph(tester, 'app');
+ expect(grey.a, closeTo(.45, .01));
+ expect(
+ grey.withValues(alpha: 1),
+ grid.AppTheme.surfacePalette.foreground,
+ reason: 'off is the tab ink, quiet: grey',
+ );
+ 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',
+ );
+ });
}
- testWidgets('on and quiet: a dim ⇄ only when revealed', (tester) async {
+ testWidgets('on: hovered, 💬 in Agent Messages\' color', (tester) async {
await tester.pumpWidget(
- _host(command, [
- (id: 'app', messages: TabMessagesState.on, working: true),
- ]),
+ _host([(id: 'app', messages: TabMessagesState.on, working: true)]),
);
expect(_messages('app').hitTestable(), findsNothing);
expect(find.byKey(const ValueKey('status:app')), findsOneWidget);
- command.value = true;
- await tester.pump();
+ await _hover(tester, 'app');
expect(_messages('app').hitTestable(), findsOneWidget);
- expect(_struck('app'), findsNothing);
- expect(_glyphAlpha(tester, 'app'), closeTo(.45, .01));
+ final ink = _glyph(tester, 'app');
+ expect(ink.withValues(alpha: 1), _messagesColor);
+ expect(ink.a, closeTo(.85, .01));
expect(_tooltip(tester, 'app'), 'Agent messages on · click to turn off');
- expect(_hint('app'), findsOneWidget);
- expect(find.byKey(const ValueKey('status:app')), findsNothing);
+ expect(
+ find.byKey(const ValueKey('status:app')),
+ findsOneWidget,
+ reason: 'hover keeps the status',
+ );
});
- testWidgets('flowing: a bright ⇄ at rest, without ×', (tester) async {
+ testWidgets('flowing: no 💬 or × at rest — the status slot says it', (
+ tester,
+ ) async {
await tester.pumpWidget(
- _host(command, [
- (id: 'app', messages: TabMessagesState.flowing, working: false),
- ]),
+ _host([(id: 'app', messages: TabMessagesState.flowing, working: false)]),
);
- expect(_messages('app').hitTestable(), findsOneWidget);
+ expect(_messages('app').hitTestable(), findsNothing);
expect(_close('app').hitTestable(), findsNothing);
- expect(_hint('app'), findsNothing);
- expect(_glyphAlpha(tester, 'app'), 1);
+ await _hover(tester, 'app');
+ expect(_glyph(tester, 'app').withValues(alpha: 1), _messagesColor);
expect(_tooltip(tester, 'app'), 'Agents messaging · click to turn off');
- command.value = true;
- await tester.pump();
- expect(_close('app').hitTestable(), findsOneWidget);
- expect(_glyphAlpha(tester, 'app'), 1);
});
- testWidgets('Command reveals every tab; hover reveals only its own', (
- tester,
- ) async {
+ testWidgets('hover reveals only its own tab', (tester) async {
await tester.pumpWidget(
- _host(command, [
+ _host([
(id: 'one', messages: TabMessagesState.off, working: false),
(id: 'two', messages: TabMessagesState.on, working: true),
(id: 'store', messages: null, working: false),
]),
);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: tester.getCenter(_label('one')));
- addTearDown(mouse.removePointer);
- await tester.pump();
+ final mouse = await _hover(tester, 'one');
expect(_close('one').hitTestable(), findsOneWidget);
expect(_close('two').hitTestable(), findsNothing);
- expect(_hint('two'), findsNothing);
- await mouse.moveTo(const Offset(900, 300));
- await tester.pump();
- command.value = true;
+ expect(_messages('two').hitTestable(), findsNothing);
+ await mouse.moveTo(tester.getCenter(_label('store')));
await tester.pump();
- for (final id in ['one', 'two', 'store']) {
- expect(_close(id).hitTestable(), findsOneWidget, reason: id);
- expect(_hint(id), findsOneWidget, reason: id);
- }
- expect(_messages('one').hitTestable(), findsOneWidget);
- expect(_messages('two').hitTestable(), findsOneWidget);
+ expect(_close('store').hitTestable(), findsOneWidget);
expect(
_messages('store'),
findsNothing,
reason: 'the Store tab has no Agent Messages',
);
- command.value = false;
- await tester.pump();
- for (final id in ['one', 'two', 'store']) {
- expect(_close(id).hitTestable(), findsNothing, reason: id);
- }
});
- testWidgets('clicking ⇄ toggles that tab without selecting it', (
+ testWidgets('clicking 💬 toggles that tab without selecting it', (
tester,
) async {
final toggled = <String>[], selected = <String>[];
await tester.pumpWidget(
_host(
- command,
[
(id: 'one', messages: TabMessagesState.off, working: false),
(id: 'two', messages: TabMessagesState.flowing, working: false),
@@ -238,29 +209,30 @@ void main() {
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 {
+ testWidgets('the 💬 has a label and a state', (tester) async {
final semantics = tester.ensureSemantics();
- final toggled = <String>[];
await tester.pumpWidget(
- _host(command, [
+ _host([
(id: 'app', messages: TabMessagesState.flowing, working: false),
(id: 'off', messages: TabMessagesState.off, working: false),
- ], onToggle: toggled.add),
+ ]),
);
+ // Hidden at rest: off the semantics tree until revealed, but the tab
+ // itself still offers the action.
+ 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, 'Agents messaging · click to turn off');
expect(on.getSemanticsData().flagsCollection.isToggled, Tristate.isTrue);
- // Hidden at rest: off the semantics tree until revealed, but the tab
- // itself still offers the action.
- expect(find.semantics.byLabel('Agent Messages').evaluate(), hasLength(1));
- command.value = true;
+ await mouse.moveTo(tester.getCenter(_label('off')));
await tester.pump();
final off = tester.getSemantics(_messages('off'));
expect(off.getSemanticsData().flagsCollection.isToggled, Tristate.isFalse);
@@ -273,27 +245,117 @@ void main() {
semantics.dispose();
});
- testWidgets('the workspace strip offers ⇄ only on desk tabs, once answered', (
+ testWidgets('the messaging mark trades sides every half second', (
+ tester,
+ ) async {
+ final semantics = tester.ensureSemantics();
+ final clock = ActivityClock(now: tester.binding.clock.now);
+ addTearDown(clock.dispose);
+ Future<void> show({bool reduce = false}) => tester.pumpWidget(
+ MaterialApp(
+ home: MediaQuery(
+ data: MediaQueryData(disableAnimations: reduce),
+ child: Center(
+ child: MessagingMark(color: _messagesColor, clock: clock),
+ ),
+ ),
+ ),
+ );
+ Finder mirrored = find.byKey(const ValueKey('messaging-mark:mirrored'));
+ Finder plain = find.byKey(const ValueKey('messaging-mark:plain'));
+ await show();
+ expect(clock.running, isTrue);
+ final seen = <bool>{};
+ for (var i = 0; i < 10; i++) {
+ expect(
+ mirrored.evaluate().length + plain.evaluate().length,
+ 1,
+ reason: 'one 💬 at a time',
+ );
+ seen.add(mirrored.evaluate().isNotEmpty);
+ expect(
+ mirrored.evaluate().isNotEmpty,
+ MessagingMark.mirroredAt(clock.frame),
+ );
+ await tester.pump(activityFrameInterval);
+ }
+ expect(seen, {true, false}, reason: 'both sides within a second');
+ expect(find.bySemanticsLabel(agentsMessagingLabel), findsOneWidget);
+ // Centered in the tab's 16px slot, so mirroring turns it in place.
+ final slot = tester.getRect(find.byType(MessagingMark));
+ expect(slot.width, MessagingMark.width);
+ expect(tester.getCenter(find.byType(Icon)), slot.center);
+ await show(reduce: true);
+ for (var i = 0; i < 10; i++) {
+ expect(plain, findsOneWidget, reason: 'Reduce Motion holds it still');
+ await tester.pump(activityFrameInterval);
+ }
+ await tester.pumpWidget(const SizedBox());
+ 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 messaging tab shows 💬 in its status slot, then its status', (
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;
+ api.flags[tab] = true;
await app.agentMessages.refresh();
+ await mount(tester, app);
+ final messaging = find.byKey(ValueKey('tab-messaging:$tab'));
+ expect(messaging, findsNothing);
+ app.agentMessages.handleEvent({
+ 'tabId': tab,
+ 'messageId': 'm0000001',
+ 'at': 1,
+ 'from': {'machineId': 'studio', 'agentId': 'lead'},
+ 'to': [
+ {'machineId': 'laptop', 'agentId': 'api', 'state': 'queued'},
+ ],
+ });
await tester.pump();
- expect(_messages(tab), findsNothing, reason: 'an older CLI or backend');
+ expect(messaging, findsOneWidget);
+ expect(_messages(tab).hitTestable(), findsNothing, reason: 'no 💬 button');
+ final tooltip = tester.widget<Tooltip>(
+ find.ancestor(of: _label(tab), matching: find.byType(Tooltip)).first,
+ );
+ expect(tooltip.message, contains(agentsMessagingLabel));
+ final semantics = tester.ensureSemantics();
+ expect(
+ find.bySemanticsLabel(RegExp('$agentsMessagingLabel\$')),
+ findsOneWidget,
+ reason: 'the tab says it, as the native tab does',
+ );
+ semantics.dispose();
+ await tester.pump(const Duration(seconds: 10));
+ expect(messaging, findsNothing, reason: 'back to its status');
await tester.pumpWidget(const SizedBox());
});
}
diff --git a/desktop/test/agent_messages_test.dart b/desktop/test/agent_messages_test.dart
index b5f194a59..7ac47a63e 100644
--- a/desktop/test/agent_messages_test.dart
+++ b/desktop/test/agent_messages_test.dart
@@ -237,7 +237,7 @@ void main() {
});
group('traffic', () {
- test('a tab flows for a minute after its last message', () {
+ test('a tab flows for 10 seconds after its last message', () {
fakeAsync((async) {
backend.tabs = {'tab': true};
final messages = controller();
@@ -249,16 +249,20 @@ void main() {
expect(messages.isFlowing('tab'), isTrue);
expect(messages.stateOf('tab'), TabMessagesState.flowing);
expect(messages.trafficFor('tab'), 1);
- async.elapse(const Duration(seconds: 40));
+ async.elapse(const Duration(seconds: 3));
messages.handleEvent(_sent(state: 'delivered'));
expect(messages.trafficFor('tab'), 2);
- async.elapse(const Duration(seconds: 59));
+ async.elapse(const Duration(seconds: 9));
expect(messages.isFlowing('tab'), isTrue);
final before = notified;
async.elapse(const Duration(seconds: 1));
expect(messages.isFlowing('tab'), isFalse);
expect(messages.stateOf('tab'), TabMessagesState.on);
- expect(notified, greaterThan(before), reason: 'the ⇄ dims by itself');
+ expect(
+ notified,
+ greaterThan(before),
+ reason: 'the status slot goes back by itself',
+ );
expect(async.pendingTimers, isEmpty);
messages.dispose();
});
@@ -494,7 +498,9 @@ void main() {
return {
'messages': [
recent('m0000001', ago: const Duration(minutes: 5)),
- recent('m0000002', ago: const Duration(seconds: 10)),
+ // Past the 10 s a tab flows, within a round of the remote
+ // watch's: still news when a round first sees it.
+ recent('m0000002', ago: const Duration(seconds: 30)),
],
};
},
@@ -527,6 +533,33 @@ void main() {
expect(messages.markFor('studio', 'lead'), isNull);
});
+ test('remote traffic flows one round longer, so rounds renew it', () {
+ fakeAsync((async) {
+ final messages = AgentMessagesController(
+ read: backend.read,
+ write: backend.write,
+ request: (_, _) async => {
+ 'messages': [recent('m0000004', ago: const Duration(seconds: 5))],
+ },
+ nameOf: (_, _) => null,
+ now: () => now,
+ );
+ unawaited(
+ messages.pollRemote([
+ (tabId: 'tab', machineIds: ['laptop']),
+ ], round: const Duration(seconds: 15)),
+ );
+ async.flushMicrotasks();
+ expect(messages.isFlowing('tab'), isTrue);
+ async.elapse(const Duration(seconds: 24));
+ expect(messages.isFlowing('tab'), isTrue);
+ async.elapse(const Duration(seconds: 1));
+ expect(messages.isFlowing('tab'), isFalse);
+ messages.dispose();
+ expect(async.pendingTimers, isEmpty);
+ });
+ });
+
test('older messages are remembered, not announced', () async {
final messages = AgentMessagesController(
read: backend.read,
diff --git a/desktop/test/agent_messages_view_test.dart b/desktop/test/agent_messages_view_test.dart
index 5d89eb94f..6a6ad6460 100644
--- a/desktop/test/agent_messages_view_test.dart
+++ b/desktop/test/agent_messages_view_test.dart
@@ -322,8 +322,8 @@ void main() {
await tester.pumpAndSettle();
expect(reads, 2);
expect(find.text('lead → api'), findsNWidgets(2));
- // Let the ⇄'s minute run out before the test ends.
- await tester.pump(const Duration(seconds: 61));
+ // Let the tab's messaging run out before the test ends.
+ await tester.pump(const Duration(seconds: 11));
expect(controller.isFlowing('tab'), isFalse);
});
diff --git a/desktop/test/desktop_workspace_tab_test.dart b/desktop/test/desktop_workspace_tab_test.dart
index 160bed341..9913d6734 100644
--- a/desktop/test/desktop_workspace_tab_test.dart
+++ b/desktop/test/desktop_workspace_tab_test.dart
@@ -12,24 +12,24 @@ import 'package:harness/widgets/desktop_workspace_tab.dart';
import 'support/real_fonts.dart';
-typedef _Tab = ({String name, String? hint, bool working});
+typedef _Tab = ({String name, bool working});
const _eightTabs = <_Tab>[
- (name: 'New Tab', hint: '⌘1', working: false),
- (name: 'Desktop', hint: '⌘2', working: true),
- (name: 'Docs', hint: '⌘3', working: false),
- (name: 'Web', hint: '⌘4', working: false),
- (name: 'Notes', hint: '⌘5', working: false),
- (name: 'API', hint: '⌘6', working: false),
- (name: 'Tests', hint: '⌘7', working: false),
- (name: 'Release', hint: '⌘8', working: false),
+ (name: 'New Tab', working: false),
+ (name: 'Desktop', working: true),
+ (name: 'Docs', working: false),
+ (name: 'Web', working: false),
+ (name: 'Notes', working: false),
+ (name: 'API', working: false),
+ (name: 'Tests', working: false),
+ (name: 'Release', working: false),
];
-Widget _host(
- ValueNotifier<bool> hints, {
+Widget _host({
List<_Tab> tabs = _eightTabs,
Brightness brightness = Brightness.dark,
double scale = 1,
+ double? tabWidth,
GlobalKey? boundary,
VoidCallback? onSelect,
VoidCallback? onClose,
@@ -66,16 +66,16 @@ Widget _host(
for (final tab in tabs)
Builder(
builder: (context) => SizedBox(
- width: DesktopWorkspaceTab.widthForStrip(
- constraints.maxWidth,
- tabs.length,
- ),
+ width:
+ tabWidth ??
+ DesktopWorkspaceTab.widthForStrip(
+ constraints.maxWidth,
+ tabs.length,
+ ),
child: DesktopWorkspaceTab(
id: tab.name,
label: tab.name,
selected: tab.name == 'Desktop',
- shortcutHint: tab.hint,
- showShortcuts: hints,
onSelect: enabled
? (onSelect ?? () {})
: null,
@@ -142,7 +142,6 @@ Future<void> _capture(
}
Finder _label(String name) => find.byKey(ValueKey('tab-label:$name'));
-Finder _hint(String name) => find.byKey(ValueKey('tab-shortcut:$name'));
Finder _close(String name) => find.byKey(ValueKey('tab-close:$name'));
Finder _tab(String name) => find.byWidgetPredicate(
(widget) => widget is DesktopWorkspaceTab && widget.id == name,
@@ -187,16 +186,9 @@ void main() {
tester.view.physicalSize = const Size(1280, 100);
addTearDown(tester.view.reset);
grid.AppTheme.brightness.value = brightness;
- final hints = ValueNotifier(false);
- addTearDown(hints.dispose);
final boundary = GlobalKey();
await tester.pumpWidget(
- _host(
- hints,
- brightness: brightness,
- scale: scale,
- boundary: boundary,
- ),
+ _host(brightness: brightness, scale: scale, boundary: boundary),
);
expect(tester.takeException(), isNull);
if (scale == 1) {
@@ -211,6 +203,15 @@ void main() {
final tabBounds = tester.getRect(_tab('Desktop'));
final mark = find.byKey(const ValueKey('status:Desktop'));
expect(mark, findsOneWidget);
+ final slot = tester.getRect(
+ find.ancestor(of: mark, matching: find.byType(Center)).first,
+ );
+ expect(slot.left - title.right, closeTo(6, .01));
+ expect(
+ (title.left + slot.right) / 2,
+ closeTo(tabBounds.center.dx, .5),
+ reason: 'the name and its status are centered together',
+ );
expect(_close('Desktop').hitTestable(), findsNothing);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: const Offset(1260, 90));
@@ -219,7 +220,18 @@ void main() {
await mouse.moveTo(title.center);
await tester.pumpAndSettle();
expect(_close('Desktop').hitTestable(), findsOneWidget);
- expect(tester.getRect(_label('Desktop')), title);
+ expect(mark, findsOneWidget, reason: 'hover keeps the status');
+ // Eight tabs are narrow: the name moves left only as far as 💬 and ×
+ // need, never right.
+ expect(
+ tester.getRect(_label('Desktop')).left,
+ lessThanOrEqualTo(title.left),
+ );
+ expect(tester.getRect(_tab('Desktop')), tabBounds);
+ expect(
+ tester.getRect(mark).right,
+ lessThanOrEqualTo(tester.getRect(_close('Desktop')).left),
+ );
final icon = tester.widget<Icon>(
find.descendant(of: _close('Desktop'), matching: find.byType(Icon)),
);
@@ -234,39 +246,8 @@ void main() {
boundary,
'tabs-${brightness.name}-$scale-hover',
);
- hints.value = true;
- await tester.pump();
- expect(mark, findsNothing);
- expect(_hint('Desktop'), findsOneWidget);
- expect(_close('Desktop').hitTestable(), findsOneWidget);
- expect(tester.getRect(_label('Desktop')), title);
- expect(tester.getRect(_tab('Desktop')), tabBounds);
- final shortcut = tester.getRect(_hint('Desktop'));
- final indicator = tester.getRect(
- find.ancestor(of: _hint('Desktop'), matching: find.byType(Center)),
- );
- // The stable slot also holds the 16px activity mark. A narrower hint
- // remains centered inside it; its font-dependent glyph edge can be
- // farther from the label than the slot's six-pixel gap.
- expect(indicator.left - title.right, closeTo(6, .5));
- expect(shortcut.center.dx, closeTo(indicator.center.dx, .01));
- expect(
- indicator.right,
- lessThanOrEqualTo(tester.getRect(_close('Desktop')).left),
- );
- expect(
- (title.left + indicator.right) / 2,
- closeTo(tabBounds.center.dx, .5),
- );
- await _capture(
- tester,
- boundary,
- 'tabs-${brightness.name}-$scale-command',
- );
await mouse.removePointer();
- hints.value = false;
await tester.pump();
- expect(mark, findsOneWidget);
expect(tester.getRect(_label('Desktop')), title);
expect(_close('Desktop').hitTestable(), findsNothing);
expect(tester.takeException(), isNull);
@@ -274,116 +255,115 @@ void main() {
}
}
- testWidgets('a narrow hint preserves the centered activity slot', (
+ testWidgets('a wide tab\'s name never moves on hover', (tester) async {
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = const Size(1280, 100);
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ _host(
+ tabs: const [
+ (name: 'Desktop', working: true),
+ (name: 'Docs', working: false),
+ ],
+ ),
+ );
+ for (final name in ['Desktop', 'Docs']) {
+ final title = tester.getRect(_label(name));
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: title.center);
+ await tester.pump();
+ expect(_close(name).hitTestable(), findsOneWidget);
+ expect(tester.getRect(_label(name)), title, reason: name);
+ await mouse.removePointer();
+ await tester.pump();
+ }
+ });
+
+ testWidgets('a narrow tab gives its name the whole tab at rest', (
tester,
) async {
tester.view.devicePixelRatio = 1;
tester.view.physicalSize = const Size(640, 100);
addTearDown(tester.view.reset);
- final hints = ValueNotifier(false);
- addTearDown(hints.dispose);
await tester.pumpWidget(
- _host(hints, tabs: [(name: 'Desktop', hint: '1', working: true)]),
- );
- final title = tester.getRect(_label('Desktop'));
- final slot = tester.getRect(
- find.ancestor(
- of: find.byKey(const ValueKey('status:Desktop')),
- matching: find.byType(Center),
+ _host(
+ tabWidth: grid.AppDesktop.tabMinWidth,
+ tabs: const [(name: 'website', working: true)],
),
);
- expect(slot.width, 16);
- expect(slot.left - title.right, closeTo(6, .01));
- hints.value = true;
+ final natural = DesktopWorkspaceTab.labelWidth(
+ tester.element(_label('website')),
+ 'website',
+ );
+ final title = tester.getRect(_label('website'));
+ expect(title.width, closeTo(natural, .01), reason: 'not cut at rest');
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: title.center);
await tester.pump();
- final shortcut = tester.getRect(_hint('Desktop'));
- expect(shortcut.width, lessThan(slot.width));
- expect(shortcut.left - title.right, greaterThan(6));
- expect(shortcut.center.dx, closeTo(slot.center.dx, .01));
- expect(tester.getRect(_label('Desktop')), title);
+ final close = tester.getRect(_close('website'));
+ 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 ×',
+ );
expect(
- (title.left + slot.right) / 2,
- closeTo(tester.getCenter(_tab('Desktop')).dx, .01),
+ tester.getRect(_label('website')).left,
+ greaterThanOrEqualTo(tester.getRect(_tab('website')).left + 14),
);
+ await mouse.removePointer();
expect(tester.takeException(), isNull);
});
- testWidgets(
- 'resolved remaps replace status and preserve purposeful actions',
- (tester) async {
- final semantics = tester.ensureSemantics();
- final hints = ValueNotifier(false);
- var selections = 0, closes = 0, renames = 0;
- try {
- await tester.pumpWidget(
- _host(
- hints,
- tabs: const [(name: 'Desktop', hint: '⌃⌥⌘R', working: true)],
- onSelect: () => selections++,
- onClose: () => closes++,
- onRename: () => renames++,
- ),
- );
- final title = tester.getRect(_label('Desktop'));
- final status = find.bySemanticsLabel('Desktop, Working');
- expect(status, findsOneWidget);
- expect(
- tester
- .getSemantics(status)
- .getSemanticsData()
- .flagsCollection
- .isButton,
- isTrue,
- );
- hints.value = true;
- await tester.pump();
- expect(find.text('⌃⌥⌘R'), findsOneWidget);
- expect(find.text('⌘1'), findsNothing);
- expect(tester.getRect(_label('Desktop')), title);
- expect(status, findsOneWidget);
- Focus.of(tester.element(_label('Desktop'))).requestFocus();
- await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
- expect(selections, 1);
- final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
- await mouse.addPointer(location: title.center);
- await tester.pump();
- await tester.tap(_close('Desktop'));
- await tester.pump();
- expect(closes, 1);
- expect(selections, 1);
- await tester.tap(_label('Desktop'));
- await tester.pump(const Duration(milliseconds: 80));
- await tester.tap(_label('Desktop'));
- await tester.pumpAndSettle();
- expect(renames, 1);
- await mouse.removePointer();
- } finally {
- await tester.pumpWidget(const SizedBox());
- semantics.dispose();
- hints.dispose();
- }
- },
- );
-
- testWidgets('unbound and disabled tabs advertise no shortcut', (
+ testWidgets('Return selects, × closes, a double click renames', (
tester,
) async {
- final hints = ValueNotifier(true);
- addTearDown(hints.dispose);
- await tester.pumpWidget(
- _host(hints, tabs: const [(name: 'Notes', hint: null, working: true)]),
- );
- expect(_hint('Notes'), findsNothing);
- expect(find.byKey(const ValueKey('status:Notes')), findsOneWidget);
+ final semantics = tester.ensureSemantics();
+ var selections = 0, closes = 0, renames = 0;
+ try {
+ await tester.pumpWidget(
+ _host(
+ tabs: const [(name: 'Desktop', working: true)],
+ onSelect: () => selections++,
+ onClose: () => closes++,
+ onRename: () => renames++,
+ ),
+ );
+ final title = tester.getRect(_label('Desktop'));
+ final status = find.bySemanticsLabel('Desktop, Working');
+ expect(status, findsOneWidget);
+ expect(
+ tester.getSemantics(status).getSemanticsData().flagsCollection.isButton,
+ isTrue,
+ );
+ expect(find.text('⌘1'), findsNothing, reason: 'tabs show no shortcut');
+ Focus.of(tester.element(_label('Desktop'))).requestFocus();
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ expect(selections, 1);
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: title.center);
+ await tester.pump();
+ await tester.tap(_close('Desktop'));
+ await tester.pump();
+ expect(closes, 1);
+ expect(selections, 1);
+ await tester.tap(_label('Desktop'));
+ await tester.pump(const Duration(milliseconds: 80));
+ await tester.tap(_label('Desktop'));
+ await tester.pumpAndSettle();
+ expect(renames, 1);
+ await mouse.removePointer();
+ } finally {
+ await tester.pumpWidget(const SizedBox());
+ semantics.dispose();
+ }
+ });
+
+ testWidgets('a disabled tab reveals nothing', (tester) async {
await tester.pumpWidget(
- _host(
- hints,
- tabs: const [(name: 'Notes', hint: '⌘2', working: true)],
- enabled: false,
- ),
+ _host(tabs: const [(name: 'Notes', working: true)], enabled: false),
);
- expect(_hint('Notes'), findsNothing);
expect(find.byKey(const ValueKey('status:Notes')), findsOneWidget);
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
await mouse.addPointer(location: tester.getCenter(_label('Notes')));
diff --git a/desktop/test/native_toolbar_sync_test.dart b/desktop/test/native_toolbar_sync_test.dart
index 3819e827c..a23d29348 100644
--- a/desktop/test/native_toolbar_sync_test.dart
+++ b/desktop/test/native_toolbar_sync_test.dart
@@ -230,8 +230,8 @@ void main() {
final tab = app.activeSwarmId;
Map row() => (updates().last['tabs'] as List).single as Map;
- // Traffic alone rebuilds no workspace; it reaches the ⇄ only while on,
- // since a struck ⇄ at rest would say nothing true.
+ // Traffic alone rebuilds no workspace; it reaches the tab only while on,
+ // since a tab that is off says nothing about agents messaging.
app.agentMessages.handleEvent({'tabId': tab, 'messageId': 'm0000001'});
await tester.idle();
expect(row()['agentMessages'], isFalse);
@@ -246,7 +246,7 @@ void main() {
),
(_) {},
);
- // ⇄ or the tab's menu turns it on for that tab.
+ // 💬 or the tab's menu turns it on for that tab.
unawaited(native('toggleAgentMessages'));
await tester.pumpAndSettle();
expect(api.writes, [(tab, true)]);
@@ -275,7 +275,7 @@ void main() {
await tester.idle();
expect(row()['agentMessagesFlowing'], isFalse);
- // An older CLI or backend: no ⇄, no menu row.
+ // An older CLI or backend: no 💬, no menu row.
api.unsupported = true;
await app.agentMessages.refresh();
await tester.idle();
diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dart
index e48bb822d..0ed0f9c86 100644
--- a/desktop/test/swarm_screen_test.dart
+++ b/desktop/test/swarm_screen_test.dart
@@ -20,7 +20,6 @@ import 'package:harness/store/store_mark.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/terminal/terminal_session.dart';
import 'package:harness/widgets/pane_grid.dart';
-import 'package:harness/widgets/desktop_workspace_tab.dart';
import 'package:harness/widgets/terminal_panel.dart';
import 'package:harness/ws/local_cli_discovery.dart';
import 'package:xterm/xterm.dart';
@@ -89,7 +88,7 @@ TerminalSession terminal(String id, List<TerminalBinaryFrame> input) =>
void main() {
testWidgets(
- 'tabs show names, reveal hover close and Command hints, and preserve Command-W',
+ 'tabs show names, reveal hover close only, and preserve Command-W',
(tester) async {
final app = createApp();
final first = app.activeSwarm;
@@ -110,35 +109,20 @@ void main() {
await mouse.moveTo(tester.getCenter(label));
await tester.pumpAndSettle();
expect(close.hitTestable(), findsOneWidget);
- // Hover reveals the tab: its shortcut follows the name, which keeps its
- // place (only a name that would run into ⇄ gives up its tail).
+ // Hover reveals × (and 💬 where offered); tabs show no shortcut, and a
+ // name with room keeps its place.
expect(find.text('⌘1'), findsNothing);
- expect(find.text('⌘2'), findsOneWidget);
- final revealedName = tester.getRect(label);
- expect(revealedName.left, nameBounds.left);
+ expect(find.text('⌘2'), findsNothing);
+ expect(tester.getRect(label), nameBounds);
await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
await tester.pump();
- // Command reveals every tab, × included.
- expect(find.text('⌘1'), findsOneWidget);
- expect(find.text('⌘2'), findsOneWidget);
- expect(close.hitTestable(), findsOneWidget);
+ // Command no longer reveals tabs.
+ expect(find.text('⌘1'), findsNothing);
expect(
find.byKey(ValueKey('tab-close:${first.id}')).hitTestable(),
- findsOneWidget,
+ findsNothing,
);
- final commandName = tester.getRect(label);
- final commandHint = tester.getRect(find.text('⌘2'));
- expect(commandHint.left - commandName.right, closeTo(6, .1));
- // Clear of ⇄'s slot, held left of × whether or not ⇄ is offered.
- expect(
- commandHint.right,
- lessThanOrEqualTo(
- tester.getRect(close).left -
- DesktopWorkspaceTab.accessoryGap -
- DesktopWorkspaceTab.messagesWidth,
- ),
- );
- expect(commandName, revealedName);
+ expect(close.hitTestable(), findsOneWidget);
expect(app.activeSwarm, same(second));
await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
await tester.pump();
diff --git a/desktop/tool/agent_messages_preview.swift b/desktop/tool/agent_messages_preview.swift
new file mode 100644
index 000000000..b2b354594
--- /dev/null
+++ b/desktop/tool/agent_messages_preview.swift
@@ -0,0 +1,215 @@
+// 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.
+// 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] = [:]
+ func send(onChannel channel: String, message: Data?) {}
+ func send(onChannel channel: String, message: Data?, binaryReply callback: FlutterBinaryReply?) {
+ callback?(FlutterStandardMethodCodec.sharedInstance().encodeSuccessEnvelope(nil))
+ }
+ func setMessageHandlerOnChannel(_ channel: String, binaryMessageHandler handler: FlutterBinaryMessageHandler?) -> FlutterBinaryMessengerConnection {
+ handlers[channel] = handler
+ return 1
+ }
+ func cleanUpConnection(_ connection: FlutterBinaryMessengerConnection) {}
+ func receive(_ method: String, _ arguments: [String: Any]) {
+ let message = FlutterStandardMethodCodec.sharedInstance().encode(
+ FlutterMethodCall(methodName: method, arguments: arguments))
+ handlers["harness/swarm_tabs"]!(message) { _ in }
+ }
+}
+
+private extension SwarmTitlebar {
+ var previewStrip: SwarmTabStrip { strip }
+}
+
+private extension SwarmTabStrip {
+ var previewTabs: [SwarmTabButton] { tabs }
+}
+
+private extension SwarmTabButton {
+ var previewMenu: NSMenu? { menu }
+ func previewPointOnMessages() { messagesButton.mouseEntered(with: previewHover) }
+}
+
+private let previewHover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
+ timestamp: 0, windowNumber: 0, context: nil, eventNumber: 0, clickCount: 0, pressure: 0)!
+
+private struct PreviewTab {
+ let id: String
+ var messages: Bool?
+ var flowing = false
+ var activity: ((Bool) -> [String: Any])? = nil
+}
+
+private let previewOutput = URL(fileURLWithPath:
+ ProcessInfo.processInfo.environment["HARNESS_AGENT_MESSAGES_PREVIEW_DIR"] ?? "/tmp/harness-agent-messages")
+private let previewApp = NSApplication.shared
+previewApp.setActivationPolicy(.accessory)
+previewApp.finishLaunching()
+try! FileManager.default.createDirectory(at: previewOutput, withIntermediateDirectories: true)
+
+// A stock app menu bar, as Flutter's nib provides, for the title bar to fill in.
+let previewMainMenu = NSMenu(title: "Main")
+for title in ["Harness", "File", "Edit", "View", "Window", "Help"] {
+ let item = NSMenuItem(title: title, action: nil, keyEquivalent: "")
+ item.submenu = NSMenu(title: title)
+ previewMainMenu.addItem(item)
+}
+previewApp.mainMenu = previewMainMenu
+
+// HarnessPalette.graphite (the default) and HarnessPalette.paper.
+private let previewPalettes: [(String, [String: Any])] = [
+ ("dark", ["tabBar": Int64(0xff1c1c1c), "workspace": Int64(0xff282828), "search": Int64(0xff2c2c2c),
+ "accent": Int64(0xffbdcbdc), "foreground": Int64(0xfff5f5f5), "dark": Int64(1)]),
+ ("light", ["tabBar": Int64(0xffeeeeec), "workspace": Int64(0xffe6e6e3), "search": Int64(0xffe2e2df),
+ "accent": Int64(0xff3d5a8a), "foreground": Int64(0xff1f1f1d), "dark": Int64(0)]),
+]
+// Status marks take the pane's terminal colors; these are a dark and a light terminal's.
+private func mark(_ glyph: String, _ label: String, dark: Int64, light: Int64) -> (Bool) -> [String: Any] {
+ { isDark in ["mark": glyph, "label": label, "working": glyph == "⠋", "color": isDark ? dark : light] }
+}
+// darkTerminalTheme and lightTerminalTheme (lib/terminal/terminal_theme.dart).
+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) {
+ 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
+ window.contentView = NSView(frame: NSRect(x: 0, y: 0, width: width, height: 200))
+ let messenger = PreviewMessenger()
+ let titlebar = SwarmTitlebar(window: window, messenger: messenger, installStatusItem: false)
+ 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
+ row["agentMessagesFlowing"] = tab.flowing
+ }
+ 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 }
+ messenger.receive("update", state)
+ window.layoutIfNeeded()
+ return (window, titlebar)
+}
+
+private func capture(_ window: NSWindow, _ name: String, height: CGFloat = 40, width: CGFloat? = nil) {
+ let frame = window.contentView!.superview!
+ frame.layoutSubtreeIfNeeded()
+ let rect = NSRect(x: 0, y: frame.bounds.height - height, width: width ?? frame.bounds.width, height: height)
+ let bitmap = frame.bitmapImageRepForCachingDisplay(in: rect)!
+ frame.cacheDisplay(in: rect, to: bitmap)
+ try! bitmap.representation(using: .png, properties: [:])!
+ .write(to: previewOutput.appendingPathComponent(name + ".png"))
+ print("Rendered \(name): \(Int(rect.width))x\(Int(rect.height))pt")
+}
+
+/// A menu as AppKit pops it: shown for a moment at a screen corner and drawn
+/// from its own window, then dismissed. Nothing is chosen.
+private func captureMenu(_ menu: NSMenu, _ name: String, dark: Bool) {
+ previewApp.appearance = NSAppearance(named: dark ? .darkAqua : .aqua)
+ menu.appearance = previewApp.appearance
+ let before = Set(previewApp.windows.map(ObjectIdentifier.init))
+ var captured = false
+ let timer = Timer(timeInterval: 0.25, repeats: false) { _ in
+ defer { menu.cancelTracking() }
+ for window in previewApp.windows where !before.contains(ObjectIdentifier(window)) {
+ guard let view = window.contentView, window.frame.height > 40,
+ let bitmap = view.bitmapImageRepForCachingDisplay(in: view.bounds) else { continue }
+ view.cacheDisplay(in: view.bounds, to: bitmap)
+ let composed = NSBitmapImageRep(bitmapDataPlanes: nil,
+ pixelsWide: bitmap.pixelsWide, pixelsHigh: bitmap.pixelsHigh,
+ bitsPerSample: 8, samplesPerPixel: 4, hasAlpha: true, isPlanar: false,
+ colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!
+ composed.size = view.bounds.size
+ NSGraphicsContext.saveGraphicsState()
+ NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: composed)
+ // View caching has no window-server backdrop; compose on a neutral surface.
+ NSColor(calibratedWhite: dark ? 0.16 : 0.94, alpha: 1).setFill()
+ view.bounds.fill()
+ let cached = NSImage(size: view.bounds.size)
+ cached.addRepresentation(bitmap)
+ cached.draw(in: view.bounds, from: .zero, operation: .sourceOver, fraction: 1)
+ NSGraphicsContext.restoreGraphicsState()
+ try! composed.representation(using: .png, properties: [:])!
+ .write(to: previewOutput.appendingPathComponent(name + ".png"))
+ print("Rendered \(name): \(view.bounds.size)")
+ captured = true
+ break
+ }
+ }
+ RunLoop.main.add(timer, forMode: .common)
+ menu.popUp(positioning: nil, at: NSPoint(x: 40, y: 900), in: nil)
+ if !captured { print("No menu window for \(name)") }
+}
+
+private let lampTabs: [PreviewTab] = [
+ PreviewTab(id: "lamp", messages: true, activity: working),
+ PreviewTab(id: "desktop", messages: true, activity: ready),
+ PreviewTab(id: "website", messages: false, activity: needsInput),
+ PreviewTab(id: "notes", messages: false),
+]
+
+for (theme, palette) in previewPalettes {
+ let dark = theme == "dark"
+ func scene(_ name: String, tabs: [PreviewTab] = lampTabs, 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: "lamp",
+ activeMessages: tabs.first?.messages)
+ act(titlebar.previewStrip)
+ titlebar.previewStrip.layoutSubtreeIfNeeded()
+ window.contentView!.superview!.layoutSubtreeIfNeeded()
+ // A hidden window's strip holds its animation at frame 0 on layout.
+ after(titlebar.previewStrip)
+ capture(window, "\(name)-\(theme)", width: crop)
+ window.close()
+ }
+ var messaging = lampTabs
+ messaging[0].flowing = true
+ scene("01-rest-quiet")
+ // The status slot's two frames: 💬, then mirrored half a second later.
+ scene("02-rest-messaging", tabs: messaging)
+ scene("02b-rest-messaging-next-frame", tabs: messaging, after: { $0.previewTabs[0].activityFrame = 5 })
+ // The animation, frame by frame, for the review page to play: messaging's
+ // two sides, then the working spinner's ten frames.
+ for frame in [0, 5] {
+ scene("anim-messaging-\(frame)", tabs: messaging, crop: 600,
+ after: { $0.previewTabs[0].activityFrame = frame })
+ }
+ 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("05-hover-on-messaging", tabs: messaging) { $0.previewTabs[0].mouseEntered(with: previewHover) }
+ scene("06-pointer-on-arrows-off") {
+ $0.previewTabs[2].mouseEntered(with: previewHover)
+ $0.previewTabs[2].previewPointOnMessages()
+ }
+ let crowded = (1...9).map { index in
+ PreviewTab(id: ["lamp", "desktop", "website", "notes", "cli", "backend", "phone", "docs", "infra"][index - 1],
+ messages: index % 3 != 0, flowing: index == 1, 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: messaging, active: "lamp",
+ activeMessages: true)
+ 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)
+ if let file = previewApp.mainMenu?.item(withTitle: "File")?.submenu {
+ captureMenu(file, "12-file-menu-\(theme)", dark: dark)
+ }
+ window.close()
+}
diff --git a/desktop/tool/check_swarm_titlebar.sh b/desktop/tool/check_swarm_titlebar.sh
index f5ccf13d4..09607aee7 100644
--- a/desktop/tool/check_swarm_titlebar.sh
+++ b/desktop/tool/check_swarm_titlebar.sh
@@ -40,6 +40,9 @@ fi
if [[ "${2:-}" == "--status-menu-preview" ]]; then
check_source="$desktop_dir/tool/status_menu_preview.swift"
fi
+if [[ "${2:-}" == "--agent-messages-preview" ]]; then
+ check_source="$desktop_dir/tool/agent_messages_preview.swift"
+fi
cat "$desktop_dir/macos/Runner/HarnessKeymap.swift" > "$check_dir/main.swift"
# The title bar shares menu ordering with the window. Include that production
# helper without booting the Flutter window or its account/runtime services.
diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swift
index 0e151091d..65133b42b 100644
--- a/desktop/tool/swarm_titlebar_checks.swift
+++ b/desktop/tool/swarm_titlebar_checks.swift
@@ -119,26 +119,26 @@ private extension SwarmTabButton {
func checkLabelMeasurementChanges() throws {
// Reuse one populated tab through each single-property change. Compare it
// with a newly constructed tab so an unrelated invalidation cannot hide
- // a stale width, stale shortcut, old font, or old foreground color.
+ // a stale width, stale status slot, old font, or old foreground color.
func compareWithFresh(_ reason: String) throws {
let fresh = SwarmTabButton(id: "fresh-label-check")
fresh.name = name
fresh.displayLabel = displayLabel
- fresh.shortcutHint = shortcutHint
fresh.foreground = foreground
+ fresh.agentMessages = agentMessages
+ fresh.messagesColor = messagesColor
fresh.labelFont = labelFont
fresh.selected = selected
fresh.attention = attention
fresh.activity = activity
fresh.activityFrame = activityFrame
- fresh.showsShortcutHint = showsShortcutHint
fresh.actionsEnabled = actionsEnabled
fresh.frame = frame
layoutSubtreeIfNeeded()
fresh.layoutSubtreeIfNeeded()
try checkTitlebar(naturalTitleWidth == max(label.size().width, emphasizedLabel.size().width),
"\(reason): measured title matches AppKit's actual text")
- try checkTitlebar(titleRect == fresh.titleRect && indicatorRect == fresh.indicatorRect &&
+ try checkTitlebar(titleRect == fresh.titleRect && activityRect == fresh.activityRect &&
preferredWidth == fresh.preferredWidth && minimumWidth == fresh.minimumWidth,
"\(reason): retained and fresh tab geometry agree")
try checkTitlebar(toolTip == fresh.toolTip && renderedPixels() == fresh.renderedPixels(),
@@ -146,7 +146,6 @@ private extension SwarmTabButton {
}
frame = NSRect(x: 0, y: 0, width: 230, height: 40)
displayLabel = "desktop"
- shortcutHint = "⌘1"
activity = HarnessNativeActivity(["mark": "⠋", "label": "Working", "working": true,
"color": Int64(0xff64d2ff)])
try compareWithFresh("Initial populated tab")
@@ -159,9 +158,14 @@ private extension SwarmTabButton {
labelFont = font
try compareWithFresh("Change font")
}
- for hint in ["⌃⌥⌘R", nil, "", "⌘8"] as [String?] {
- shortcutHint = hint
- try compareWithFresh("Remap or remove shortcut")
+ for state in [SwarmTabMessages(on: true, flowing: true), SwarmTabMessages(on: false, flowing: false),
+ nil, SwarmTabMessages(on: true, flowing: false)] 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 color in [NSColor.systemRed, NSColor.black, NSColor.white] {
foreground = color
@@ -175,10 +179,6 @@ private extension SwarmTabButton {
activityFrame = tick
try compareWithFresh("Animate frame \(tick)")
}
- for shown in [true, false, true] {
- showsShortcutHint = shown
- try compareWithFresh("Show or hide Command hints")
- }
for enabled in [false, true] {
actionsEnabled = enabled
try compareWithFresh("Enter or leave a modal")
@@ -205,7 +205,7 @@ private extension SwarmTabButton {
let width = preferredWidth
let displayedWidth = frame.width
let rect = activityRect
- try checkTitlebar(label.string == "desktop" && activitySpace >= activityRect.width + 6,
+ try checkTitlebar(label.string == "desktop" && statusSpace >= activityRect.width + 6,
"Activity measures its gap and cell separately from the tab name")
try checkTitlebar(rect.minX >= titleRect.maxX + 6,
"The native activity follows the complete tab name")
@@ -423,7 +423,6 @@ private extension SwarmTabButton {
try checkTitlebar(symbol.renderedPixels() != symbolResting &&
symbol.renderedBitmap().colorAt(x: 1, y: 1)!.alphaComponent == 0,
"Symbols emphasize their ink on hover without changing weight or adding a background")
- shortcutHint = "⌘2"
activity = HarnessNativeActivity(["mark": "⠋", "label": "Working", "color": Int64(0xff64d2ff)])
layoutSubtreeIfNeeded()
let width = preferredWidth
@@ -432,17 +431,8 @@ private extension SwarmTabButton {
let hovered = renderedBitmap()
try checkTitlebar(hovered.colorAt(x: 20, y: 12)!.alphaComponent > 0 && renderedPixels() != resting,
"Hover quietly marks the tab surface")
- try checkTitlebar(preferredWidth == width && !closeButton.isHidden && drawnFont == labelFont && displaysShortcut,
- "Hover reveals the shortcut in place of the status and the right close button, without changing tab width or type")
- let titleBeforeHint = titleRect, closeBeforeHint = closeButton.frame
- showsShortcutHint = true
- layoutSubtreeIfNeeded()
- try checkTitlebar(displaysShortcut && !closeButton.isHidden && renderedPixels() == Data(bytes: hovered.bitmapData!, count: hovered.bytesPerRow * hovered.pixelsHigh),
- "Holding Command over a hovered tab changes nothing: both are the one revealed state")
- try checkTitlebar(titleRect == titleBeforeHint && closeButton.frame == closeBeforeHint && preferredWidth == width,
- "Command hints never move the title, close target or tab boundaries")
- showsShortcutHint = false
- try checkTitlebar(!closeButton.isHidden, "Releasing Command keeps the hovered close action")
+ try checkTitlebar(preferredWidth == width && !closeButton.isHidden && drawnFont == labelFont,
+ "Hover reveals the right close button without changing tab width or type")
mouseExited(with: hover)
selectButton.highlight(true)
try checkTitlebar(renderedPixels() != resting, "Pressing a tab uses the same visible highlight")
@@ -471,17 +461,15 @@ private extension SwarmTabButton {
}
}
- func checkHoverCloseAndShortcutHints() throws {
+ func checkHoverClose() throws {
frame = NSRect(x: 0, y: 0, width: 240, height: 40)
contentCenterY = 20
name = "1: Release planning"
displayLabel = name
- shortcutHint = "⌘2"
activity = HarnessNativeActivity(["mark": "⠋", "label": "Working", "color": Int64(0xff64d2ff)])
layoutSubtreeIfNeeded()
- let title = titleRect, close = closeButton.frame, width = preferredWidth
- try checkTitlebar(closeButton.isHidden && !displaysShortcut,
- "Resting tabs show neither a close icon nor a persistent shortcut")
+ let title = titleRect, width = preferredWidth
+ try checkTitlebar(closeButton.isHidden, "Resting tabs show no close icon")
var events: [String] = []
emit = { method, _ in events.append(method) }
let hover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
@@ -505,38 +493,22 @@ private extension SwarmTabButton {
"The tab close paints a tiny regular cross inside its unchanged target")
closeButton.performClick(nil)
try checkTitlebar(events == ["close"], "Clicking the close control closes once without selecting the tab")
- showsShortcutHint = true
- try checkTitlebar(displaysShortcut && !closeButton.isHidden && shortcutLabel?.string == "⌘2",
- "Command reveals the supplied shortcut beside the name without hiding hover close")
- try checkTitlebar(indicatorRect.minX == titleRect.maxX + 6 &&
- indicatorRect.maxX <= messagesButton.frame.minX,
- "The inline Command hint stays clear of the ⇄ and close targets")
- let commandBitmap = renderedBitmap()
- let hasActivityInk = (0..<commandBitmap.pixelsWide).contains { x in
- (0..<commandBitmap.pixelsHigh).contains { y in
- guard let pixel = commandBitmap.colorAt(x: x, y: y)?.usingColorSpace(.sRGB),
+ let hoveredBitmap = renderedBitmap()
+ let hasActivityInk = (0..<hoveredBitmap.pixelsWide).contains { x in
+ (0..<hoveredBitmap.pixelsHigh).contains { y in
+ guard let pixel = hoveredBitmap.colorAt(x: x, y: y)?.usingColorSpace(.sRGB),
pixel.alphaComponent > 0.2 else { return false }
return pixel.blueComponent - pixel.redComponent > 0.15 &&
pixel.greenComponent - pixel.redComponent > 0.1
}
}
- try checkTitlebar(!hasActivityInk && selectButton.accessibilityHelp() == "Working",
- "Command hides the visual activity mark while retaining its accessible status")
- try checkTitlebar(titleRect == title && closeButton.frame == close && preferredWidth == width,
- "Modifier changes preserve every tab and title boundary")
+ 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 ×")
mouseExited(with: hover)
- try checkTitlebar(displaysShortcut && !closeButton.isHidden,
- "Holding Command reveals the tab without pointer hover: its shortcut and close action")
- showsShortcutHint = false
try checkTitlebar(closeButton.isHidden && accessibilityChildren()?.count == 1,
- "Releasing Command returns an unhovered tab to its quiet state")
- shortcutHint = "⌃⌥⌘R"
- layoutSubtreeIfNeeded()
- showsShortcutHint = true
- try checkTitlebar(shortcutLabel?.string == "⌃⌥⌘R" && indicatorRect.width >= shortcutLabel!.size().width,
- "A remapped shortcut remains exact and fits its inline status position")
- shortcutHint = nil
- try checkTitlebar(!displaysShortcut, "Unbound and unnumbered tabs invent no shortcut hint")
+ "Leaving returns the tab to its quiet state")
actionsEnabled = false
mouseEntered(with: hover)
closeButton.performClick(nil)
@@ -654,89 +626,117 @@ private extension SwarmTabButton {
func checkCenteredLabel() throws {
let paragraph = label.attribute(.paragraphStyle, at: 0, effectiveRange: nil) as? NSParagraphStyle
- let resting = restingTitleRect
- let group = activitySpace == 0 ? resting
- : NSRect(x: resting.minX, y: 0, width: resting.width + activitySpace, height: bounds.height)
+ let resting = titleRect(revealed: false)
+ let group = statusSpace == 0 ? resting
+ : NSRect(x: resting.minX, y: 0, width: resting.width + statusSpace, height: bounds.height)
try checkTitlebar(paragraph?.alignment == .center && abs(group.midX - bounds.midX) < 0.01,
- "The resting title and adjacent indicator form a centered group")
- try checkTitlebar(titleRect.minX == resting.minX, "Revealing a tab never moves its title")
+ "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")
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 == 3,
- "The close action, and ⇄ left of it past a dead gap, stay inset inside the tab's curved body")
+ "The close action, and 💬 left of it past a dead gap, stay inset inside the tab's curved body")
}
- /// Agent Messages' ⇄ (docs/design/2026-10-10-agent-messages.md): one revealed
- /// state, three looks, a click and the tab's menu.
+ /// Agent Messages (docs/design/2026-10-10-agent-messages.md): the hover 💬,
+ /// grey while off and in its color while on; the status slot while agents
+ /// message; a click and the tab's menu.
func checkAgentMessages() throws {
frame = NSRect(x: 0, y: 0, width: 240, height: 40)
contentCenterY = 20
name = "app"
displayLabel = "app"
- shortcutHint = "⌘1"
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)!
+ 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 ⇄")
+ try checkTitlebar(messagesButton.isHidden && !closeButton.isHidden, "A tab without Agent Messages shows no 💬")
mouseExited(with: hover)
agentMessages = SwarmTabMessages(on: false, flowing: false)
try checkTitlebar(rows[1...3].allSatisfy { !$0.isHidden }, "A tab with Agent Messages lists both rows")
- try checkTitlebar(messagesButton.isHidden && closeButton.isHidden && !displaysShortcut,
+ try checkTitlebar(messagesButton.isHidden && closeButton.isHidden,
"Off, at rest, a tab shows nothing extra")
let title = titleRect
mouseEntered(with: hover)
- try checkTitlebar(displaysShortcut && !messagesButton.isHidden && !closeButton.isHidden &&
- closeButton.frame.minX - messagesButton.frame.maxX == 3 && messagesButton.struck &&
- messagesButton.restingOpacity == 0.45,
- "Hovered and off: the shortcut, a dim struck ⇄ just left of ×")
+ try checkTitlebar(!messagesButton.isHidden && !closeButton.isHidden &&
+ closeButton.frame.minX - messagesButton.frame.maxX == 3 &&
+ messagesButton.foreground == foreground && messagesButton.restingOpacity == 0.45 &&
+ !hasMessagesInk(messagesButton),
+ "Hovered and off: a grey 💬 just left 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.minX == title.minX && indicatorRect.minX == titleRect.maxX + 6 &&
- indicatorRect.maxX <= messagesButton.frame.minX,
- "Revealing an idle tab shows its shortcut after the title without moving it")
+ "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")
+ "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")
+ "Clicking 💬 asks to toggle this tab's Agent Messages, without selecting it")
mouseExited(with: hover)
- showsShortcutHint = true
- try checkTitlebar(!messagesButton.isHidden && !closeButton.isHidden && displaysShortcut,
- "Holding Command reveals ⇄ and × as hover does")
- showsShortcutHint = false
- try checkTitlebar(messagesButton.isHidden && closeButton.isHidden, "Releasing Command hides them again")
+ try checkTitlebar(messagesButton.isHidden && closeButton.isHidden, "Leaving hides them again")
- agentMessages = SwarmTabMessages(on: false, flowing: true)
- try checkTitlebar(messagesButton.isHidden && closeButton.isHidden,
- "Off, a tab at rest shows nothing even if its last traffic was recent")
agentMessages = SwarmTabMessages(on: true, flowing: false)
- try checkTitlebar(messagesButton.isHidden, "On and quiet, a tab at rest shows nothing extra")
+ try checkTitlebar(messagesButton.isHidden && !hasMessagesInk(), "On and quiet, a tab at rest shows nothing extra")
mouseEntered(with: hover)
- try checkTitlebar(!messagesButton.isHidden && !messagesButton.struck && messagesButton.restingOpacity == 0.45 &&
+ try checkTitlebar(!messagesButton.isHidden && messagesButton.foreground == messagesColor &&
+ messagesButton.restingOpacity == 0.85 && hasMessagesInk(messagesButton) && !hasMessagesInk() &&
messagesButton.toolTip == "Agent messages on · click to turn off" &&
messagesButton.accessibilityValue() as? String == "On",
- "Revealed, on and quiet: a dim ⇄ that turns it off")
+ "Hovered and on: 💬 in Agent Messages' color, which turns it off")
mouseExited(with: hover)
agentMessages = SwarmTabMessages(on: true, flowing: true)
- try checkTitlebar(!messagesButton.isHidden && closeButton.isHidden && !displaysShortcut &&
- messagesButton.restingOpacity == 1 && messagesButton.toolTip == "Agents messaging · click to turn off",
- "While agents message, a bright ⇄ stays at rest without ×")
- try checkTitlebar(accessibilityChildren()?.count == 2, "The resting ⇄ stays reachable by accessibility")
+ layoutSubtreeIfNeeded()
+ try checkTitlebar(messaging && messagesButton.isHidden && closeButton.isHidden && statusSpace > 0 &&
+ hasMessagesInk() && activityRect.minX == titleRect.maxX + 6,
+ "While agents message, the status slot shows 💬 in its color; no button at rest")
+ let still = renderedPixels()
+ activityFrame = 5
+ try checkTitlebar(renderedPixels() != still, "The slot's 💬 trades sides on the activity clock")
+ activityFrame = 9
+ let mirrored = renderedPixels()
+ activityFrame = 10
+ try checkTitlebar(renderedPixels() == still && mirrored != still, "Half a second per side")
+ activityFrame = 0
+ try checkTitlebar(toolTip?.contains("Agents messaging") == true &&
+ selectButton.accessibilityHelp()?.contains("Agents messaging") == true,
+ "The tooltip and accessibility say agents are messaging")
+ activity = HarnessNativeActivity(["mark": "?", "label": "Needs your input", "color": Int64(0xffe5e510)])
+ try checkTitlebar(hasMessagesInk() && selectButton.accessibilityHelp() == "Agents messaging. Needs your input",
+ "Messaging takes the slot over a status, which accessibility still reads")
+ agentMessages = SwarmTabMessages(on: true, flowing: false)
+ try checkTitlebar(!messaging && !hasMessagesInk(), "Quiet again, the slot goes back to the tab's status")
+ activity = nil
+ agentMessages = SwarmTabMessages(on: false, flowing: true)
+ try checkTitlebar(!messaging && statusSpace == 0 && messagesButton.isHidden,
+ "Off, a tab shows nothing even if its last traffic was recent")
+ agentMessages = SwarmTabMessages(on: true, flowing: true)
let toggle = rows[2]
_ = validateMenuItem(toggle)
try checkTitlebar(toggle.state == .on, "The menu's Agent Messages row is checked while on")
@@ -751,27 +751,34 @@ private extension SwarmTabButton {
try checkTitlebar(toggle.state == .off, "The row's checkmark follows the flag")
actionsEnabled = false
agentMessages = SwarmTabMessages(on: true, flowing: true)
+ mouseEntered(with: hover)
let before = events.count
messagesButton.performClick(nil)
- try checkTitlebar(messagesButton.isHidden && events.count == before, "A modal hides and disables the ⇄")
+ try checkTitlebar(messagesButton.isHidden && events.count == before, "A modal hides and disables the 💬")
+ mouseExited(with: hover)
actionsEnabled = true
agentMessages = nil
}
- /// At the 128pt minimum, a tab still draws its centered name beside a status.
+ /// At the 128pt minimum, a tab draws its whole name beside a status at
+ /// rest, and still 16pt of it when hovered.
func checkMinimumWidth() throws {
frame = NSRect(x: 0, y: 0, width: SwarmTabButton.minimumLayoutWidth, height: 40)
contentCenterY = 20
- name = "app"
- displayLabel = "app"
+ name = "website"
+ displayLabel = "website"
activity = HarnessNativeActivity(["mark": "⠋", "label": "Working", "working": true, "color": Int64(0xff64d2ff)])
- for digit in 1...9 {
- shortcutHint = "⌘\(digit)"
- layoutSubtreeIfNeeded()
- try checkTitlebar(bounds.width >= minimumWidth && titleRect.width >= 16,
- "A 128pt tab keeps 16pt for its name beside ⌘\(digit) and the ⇄ and × reservations")
- try checkCenteredLabel()
- }
+ layoutSubtreeIfNeeded()
+ try checkTitlebar(bounds.width >= minimumWidth && titleRect.width == naturalTitleWidth,
+ "At rest a 128pt tab shows \"website\" whole beside its status")
+ let hover = NSEvent.mouseEvent(with: .mouseMoved, location: .zero, modifierFlags: [],
+ 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 ×")
+ mouseExited(with: hover)
+ try checkCenteredLabel()
}
func checkNameFitsOrHasTooltip() throws {
@@ -1497,15 +1504,17 @@ private extension SwarmTabStrip {
messageRows[0]["agentMessages"] = true
messageRows[0]["agentMessagesFlowing"] = true
messageRows[1]["agentMessages"] = false
- update(["enabled": true, "activeId": "work", "tabs": messageRows])
+ update(["enabled": true, "activeId": "work", "tabs": messageRows, "agentMessagesInk": Int64(0xffbc3fbc)])
try checkTitlebar(tabs.map(\.agentMessages) == [SwarmTabMessages(on: true, flowing: true),
SwarmTabMessages(on: false, flowing: false), nil, nil],
- "Each row's Agent Messages reaches its tab; a row without one has no ⇄")
+ "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")
+ try checkTitlebar(tabs[0].messaging && visibleAnimatedTabs.contains { $0 === tabs[0] },
+ "A messaging tab animates its status slot, as a working tab does")
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")
- try checkTitlebar(tabs.map(\.shortcutHint) == ["⌘1", "⌘2", "⌃⌥⌘R", nil],
- "Native tab hints preserve effective remaps and intentionally unbound shortcuts")
let initial = tabs.map(\.frame)
var statusChanged: [String: Any] = ["enabled": true, "activeId": "work", "tabs": rows,
"barStyle": ["family": "Menlo", "size": 28.0, "foreground": Int64(0xffdddddd)]]
@@ -1524,21 +1533,13 @@ private extension SwarmTabStrip {
let ink = tabs[0].foreground.usingColorSpace(.sRGB)!
try checkTitlebar(name == "light" ? ink.redComponent < 0.2 : ink.redComponent > 0.8,
"Tab labels remain readable on the UI surface with an independently chosen status foreground")
- setShortcutHintsVisible(false)
try captureTabPresentation("native-tabs-\(name)-rest")
tabs[1].mouseEntered(with: hover)
+ try checkTitlebar(tabs.map(\.frame) == initial && tabs.filter(\.isRevealed).count == 1,
+ "Hover reveals one tab without moving any")
try captureTabPresentation("native-tabs-\(name)-hover")
- setShortcutHintsVisible(true)
- try checkTitlebar(tabs.allSatisfy(\.showsShortcutHint) && tabs.map(\.frame) == initial,
- "Holding Command reveals hints across the strip without moving tabs")
- try captureTabPresentation("native-tabs-\(name)-command")
tabs[1].mouseExited(with: hover)
- setShortcutHintsVisible(false)
}
- update(["enabled": false, "activeId": "work", "tabs": rows])
- setShortcutHintsVisible(true)
- try checkTitlebar(tabs.allSatisfy { !$0.showsShortcutHint }, "Disabled native navigation never advertises active shortcuts")
- setShortcutHintsVisible(false)
let crowdedNames = ["New Tab", "Desktop", "Docs", "Web", "Notes", "API", "Tests", "Release"]
let crowdedRows: [[String: Any]] = crowdedNames.enumerated().map { index, name in
["id": "dense-\(index)", "name": name, "label": name, "shortcutHint": "⌘\(index + 1)",
@@ -1558,12 +1559,9 @@ private extension SwarmTabStrip {
try tab.checkCenteredLabel()
try tab.checkNameFitsOrHasTooltip()
}
- setShortcutHintsVisible(true)
- try captureTabPresentation("native-tabs-eight-\(name)-command")
tabs[1].mouseEntered(with: hover)
- try captureTabPresentation("native-tabs-eight-\(name)-command-hover")
+ try captureTabPresentation("native-tabs-eight-\(name)-hover")
tabs[1].mouseExited(with: hover)
- setShortcutHintsVisible(false)
}
}
@@ -2780,7 +2778,7 @@ do {
try checkIconTooltipTracking()
try strip.checkActivityMarks()
try SwarmTabButton(id: "label-measurements").checkLabelMeasurementChanges()
- try SwarmTabButton(id: "close-shortcuts").checkHoverCloseAndShortcutHints()
+ try SwarmTabButton(id: "hover-close").checkHoverClose()
try SwarmTabButton(id: "agent-messages").checkAgentMessages()
try SwarmTabButton(id: "minimum-width").checkMinimumWidth()
try SwarmTabButton(id: "selection-surface").checkSelectionSurface()
diff --git a/docs/design/2026-10-10-agent-messages.md b/docs/design/2026-10-10-agent-messages.md
index 10482cbab..2afe239d1 100644
--- a/docs/design/2026-10-10-agent-messages.md
+++ b/docs/design/2026-10-10-agent-messages.md
@@ -48,14 +48,27 @@ it is not a switchboard. Harness has no roles.
### The tab
-⇄ sits just left of ×. One revealed state replaces today's two (⌘ shows shortcuts, hover shows ×): hover
-reveals one tab, holding ⌘ reveals every tab.
+💬 stands for a chat icon: two speech bubbles (`bubble.left.and.bubble.right` on macOS, Lucide
+`messages-square` elsewhere), agents talking. It replaced ⇄, which read as machines moving data (owner,
+2026-10-11). Show Agent Messages uses a bubble with text lines.
-| State | Not hovered | Hovered or ⌘ held | Click ⇄ |
+💬 sits just left of ×, and hovering a tab shows both. Tabs show no shortcut (⌘1…⌘9 still work), and
+holding ⌘ changes nothing on them (owner, 2026-10-11).
+
+| State | Not hovered | Hovered | Click 💬 |
|---|---|---|---|
-| Off (default) | `app` | `app ⌘1 ⇄̸ ×` | turns on |
-| On, quiet | `app` | `app ⌘1 ⇄ ×` (dim) | turns off |
-| On, messages flowing | `app ⇄` (bright, about a minute after the last message) | `app ⌘1 ⇄ ×` (bright) | turns off |
+| Off (default) | `app ✓` | `app ✓ 💬 ×` (💬 grey) | turns on |
+| On, quiet | `app ✓` | `app ✓ 💬 ×` (💬 in color) | turns off |
+| On, messages flowing | `app 💬` (the status slot, animated) | `app 💬 💬 ×` | turns off |
+
+While agents in the tab message each other, its status slot (where the working spinner, ✓ and ? go)
+shows 💬 in Agent Messages' color, its two bubbles trading sides every half second, for 10 seconds after
+the last message (long enough to catch at a glance, short enough to stay a blip: replies take minutes),
+then the tab's status again. Traffic read from another machine's log lasts one 15 s poll round longer. The color is the design
+system's accent blue (`AppPalette.accentOnSurface`), its one color for "on" and selection; it stays
+clear of the status marks' cyan, green, yellow and red, and the bubbles' shape carries the meaning too. Reduce Motion
+holds it still. At rest a tab gives its name the whole width; when hovered, a name that would run into
+💬 and × moves left only as far as they need, then gives up its tail.
Tooltips: "Agent messages off · click to turn on", "Agent messages on · click to turn off",
"Agents messaging · click to turn off". The tab's right-click menu and the File menu gain **Agent Messages**
@@ -192,7 +205,7 @@ Experimental → Swarm collaboration, the Swarm conversation views on desktop an
1. Daemon, CLI and backend: the service, `harness send`, the hook, the backend record and routes, Swarm's
CLI removed.
-2. Desktop: the tab's ⇄ and revealed state (macOS titlebar and the Flutter tab row), the menus, Show Agent
+2. Desktop: the tab's 💬 and revealed state (macOS titlebar and the Flutter tab row), the menus, Show Agent
Messages, pane marks, and Swarm's views and setting removed.
3. Cleanup: the phone's Swarm views, the backend's `tab_channels`, the core's prompt scopes. The phone shows
no message log: the owner dropped it (October 11, 2026).