The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Tabs named by their project, text only, and more air in the title bar (#296)
Dee012e5cd5e174
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex 6bba1222e..516e45097 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -5877,9 +5877,7 @@ class AppNotifier extends ChangeNotifier {if (!tab.nameIsCustom &&tab.titleMachineId == machine.machine.machineId &&tab.titleAgentId == agent.id) {- final title = agent.displayName == kUntitledPane- ? Swarm.defaultName- : agent.displayName;+ final title = Swarm.titleFor(agent);if (tab.name != title) {tab.name = title;changed = true;@@ -8916,9 +8914,7 @@ class AppNotifier extends ChangeNotifier {.firstOrNull;target.titleMachineId = machineId;target.titleAgentId = agentId;- target.name = agent == null || agent.displayName == kUntitledPane- ? Swarm.defaultName- : agent.displayName;+ target.name = Swarm.titleFor(agent);}if (replaced != null && !allPanes.contains(replaced)) {// Release just the desktop stream. The CLI agent process keeps running.@@ -9482,9 +9478,7 @@ class AppNotifier extends ChangeNotifier {.firstOrNull;target.titleMachineId = pane.machineId;target.titleAgentId = pane.agentId;- target.name = agent == null || agent.displayName == kUntitledPane- ? Swarm.defaultName- : agent.displayName;+ target.name = Swarm.titleFor(agent);}for (final viewer in viewers) {if (target.panes.length >= maxPanes) break;diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dartindex 28b3c1607..ce33587b6 100644--- a/desktop/lib/state/swarm.dart+++ b/desktop/lib/state/swarm.dart@@ -1,6 +1,7 @@import 'dart:ui' show Size;-import '../core/models.dart' show isAutomaticHarnessName;+import '../core/models.dart'+ show Agent, isAutomaticHarnessName, kUntitledPane;import 'pane_preset.dart';import 'pane_arrangement.dart';import 'terminal_pane.dart';@@ -37,10 +38,10 @@ class Swarm {String? orchestratorId, orchestratorMachineId;static const storeName = 'Harness Store';- static const defaultName = 'Untitled Tab';- // 'New Harness' was the default until 2026-09-15 and 'New Agent' for a day- // after; a layout saved then still carries one, and it must read as the same- // fresh tab.+ static const defaultName = 'New Tab';+ // 'New Harness' was the default until 2026-09-15, 'New Agent' for a day+ // after, and 'Untitled Tab' until 2026-09-24; a layout saved then still+ // carries one, and it must read as the same fresh tab.static String normalizeName(String name) =>const {'New swarm',@@ -48,6 +49,7 @@ class Swarm {'New Tab','New Harness','New Agent',+ 'Untitled Tab',}.contains(name) ||isAutomaticHarnessName(name)? defaultName@@ -72,6 +74,18 @@ class Swarm {int? gridColumns;final Map<int, int> pinnedSlots = {};+ /// What a tab is called after the first harness opened into it: that+ /// harness's project — the folder it works in, as the pane header shows it —+ /// because a tab holds a piece of work, and the work is where the harness is+ /// (owner, 2026-09-24). A harness with no project falls back to its own name,+ /// and one with neither leaves the tab new.+ static String titleFor(Agent? agent) {+ final project = agent?.project?.label.trim();+ if (project != null && project.isNotEmpty) return project;+ if (agent == null || agent.displayName == kUntitledPane) return defaultName;+ return agent.displayName;+ }+bool get isEmptyStarter =>name == defaultName && panes.isEmpty && presets.isEmpty;diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex f8eef2acb..5fb703648 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -1507,16 +1507,6 @@ private final class SwarmTabStrip: NSView {let tab = previous[id] ?? SwarmTabButton(id: id)tab.palette = palettetab.name = row["name"] as? String ?? "New Tab"- let count = row["agentCount"] as? Int ?? 0- // The Harness Store tab holds no agents; without its own mark it would wear New Tab's plus.- let store = row["kind"] as? String == "store"- tab.icon = store- ? icons.image(engine: "store", asset: row["iconAsset"] as? String)- : count == 1- ? icons.image(engine: row["engine"] as? String, asset: row["iconAsset"] as? String)- : count > 1- ? SwarmIdentity.menuIcon- : NSImage(systemSymbolName: "plus", accessibilityDescription: "New Tab")tab.selected = id == activeIdtab.actionsEnabled = actionsEnabledtab.attention = (row["attention"] as? Int ?? 0) > 0@@ -1612,7 +1602,13 @@ private final class SwarmTabStrip: NSView {// (owner, 2026-09-15); tabs shrink and then scroll instead of taking it.let grip: CGFloat = spacious ? 84 : 44// Reserve three adjacent controls: Machines, Models, Harnesses.- let available = max(32, bounds.width - leading - trailing - (newButton.isHidden ? 0 : 36) - grip - storeWidth - modelsWidth - 88)+ // Air between Machines, Models, Harnesses and the Store pill. 16, not 8: the+ // marks are ~17pt wide, and 8 left about one mark's width between them+ // where the menu bar leaves about one and a half (measured, owner+ // 2026-09-24) — they read as a clump rather than as three controls.+ let actionGap: CGFloat = 16+ let available = max(32, bounds.width - leading - trailing - (newButton.isHidden ? 0 : 36) - grip - storeWidth - modelsWidth+ - 28 * 2 - actionGap * 3 - 8)// As in Chrome, tabs keep shrinking until they are only their mark, so thirty tabs still sit in// one strip with nothing hidden; only past that does the strip scroll (the wheel scrolls it).let width = min(220, max(min(SwarmTabButton.minimumWidth, available), available / CGFloat(max(1, tabs.count))))@@ -1628,9 +1624,9 @@ private final class SwarmTabStrip: NSView {let buttonY = (bounds.height - 28) / 2newButton.frame = NSRect(x: leading + occupied + 4, y: buttonY, width: 28, height: 28)storeButton.frame = NSRect(x: bounds.width - trailing - storeWidth, y: buttonY, width: storeWidth, height: 28)- sessionsButton.frame = NSRect(x: storeButton.frame.minX - 36, y: buttonY, width: 28, height: 28)- modelsButton.frame = NSRect(x: sessionsButton.frame.minX - modelsWidth - 8, y: buttonY, width: modelsWidth, height: 28)- machinesButton.frame = NSRect(x: modelsButton.frame.minX - 36, y: buttonY, width: 28, height: 28)+ sessionsButton.frame = NSRect(x: storeButton.frame.minX - actionGap - 28, y: buttonY, width: 28, height: 28)+ modelsButton.frame = NSRect(x: sessionsButton.frame.minX - actionGap - modelsWidth, y: buttonY, width: modelsWidth, height: 28)+ machinesButton.frame = NSRect(x: modelsButton.frame.minX - actionGap - 28, y: buttonY, width: 28, height: 28)let geometryChanged = scroll.frame.size != previousScrollSize || document.frame.size != previousDocumentSizeif let active, revealActiveAfterLayout || (activeWasVisible && (geometryChanged || tabOrderChanged)) {document.scrollToVisible(active.frame)@@ -1720,11 +1716,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiprivate let selectButton = SwarmSelectButton()/// Whether the middle button went down on THIS tab — see otherMouseUp.private var middleDown = false- private let iconView = NSImageView()- var icon: NSImage? {- get { iconView.image }- set { iconView.image = newValue }- }/// A tab is named in the system face, like every other Mac window's tabs —/// Safari's, Ghostty's, Finder's. The terminal's face belongs to the terminal/// and to the chrome drawn around it inside the window (owner, 2026-09-23).@@ -1754,10 +1745,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatisuper.init(frame: .zero)setAccessibilityElement(true)setAccessibilityRole(.group)- iconView.imageScaling = .scaleProportionallyDown- iconView.contentTintColor = NSColor(white: 0.85, alpha: 1)- iconView.setAccessibilityElement(false)- addSubview(iconView)selectButton.owner = selfcloseButton.owner = selfselectButton.title = ""@@ -1790,9 +1777,6 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatioverride func layout() {super.layout()let compact = self.compact- iconView.frame = compact- ? NSRect(x: ((bounds.width - 16) / 2).rounded(), y: contentCenterY - 8, width: 16, height: 16)- : NSRect(x: 22, y: contentCenterY - 8, width: 16, height: 16)closeButton.isHidden = compactselectButton.frame = NSRect(x: 0, y: 0, width: max(0, compact ? bounds.width : bounds.width - 36), height: bounds.height)closeButton.frame = NSRect(x: bounds.width - 36, y: contentCenterY - 12, width: 24, height: 24)@@ -1828,8 +1812,11 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiif let cachedLabel { return cachedLabel }let paragraph = NSMutableParagraphStyle()paragraph.lineBreakMode = .byTruncatingTail+ // One weight for every tab: the selected one is already told apart by its+ // fill and its brighter ink, and a bold name also changes width, so the+ // strip re-truncated whenever the selection moved (owner, 2026-09-24).let label = NSAttributedString(string: name,- attributes: [.font: selected ? NSFontManager.shared.convert(labelFont, toHaveTrait: .boldFontMask) : labelFont,+ attributes: [.font: labelFont,.foregroundColor: selected ? NSColor.white : NSColor(white: 0.76, alpha: 1), .paragraphStyle: paragraph])cachedLabel = labelreturn label@@ -1879,13 +1866,25 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatilet trailing = shortcut.map { value inmax(42, ceil(("⌘\(value)" as NSString).size(withAttributes: [.font: badgeFont]).width) + 22)} ?? 42- label.draw(in: NSRect(x: 46, y: contentCenterY - labelHeight / 2,- width: max(0, bounds.width - 46 - trailing), height: labelHeight))+ // A tab is its name: no mark, not even the engine's or the Store's —+ // the pane header says what runs there (owner, 2026-09-24).+ label.draw(in: NSRect(x: 22, y: contentCenterY - labelHeight / 2,+ width: max(0, bounds.width - 22 - trailing), height: labelHeight))+ }+ // Too narrow for the name: its first letter, centred.+ var initialFrame = NSRect(x: bounds.midX, y: contentCenterY, width: 0, height: 0)+ if compact, label.length > 0 {+ let initial = NSAttributedString(string: String(name.prefix(1)),+ attributes: label.attributes(at: 0, effectiveRange: nil))+ let size = initial.size()+ initialFrame = NSRect(x: ((bounds.width - size.width) / 2).rounded(),+ y: contentCenterY - size.height / 2, width: size.width, height: size.height)+ initial.draw(at: initialFrame.origin)}if attention {NSColor.systemOrange.setFill()let dot = compact- ? NSRect(x: iconView.frame.maxX - 1, y: iconView.frame.maxY - 3, width: 5, height: 5)+ ? NSRect(x: initialFrame.maxX + 1, y: initialFrame.maxY - 6, width: 5, height: 5): NSRect(x: 13, y: contentCenterY - 2, width: 4, height: 4)NSBezierPath(ovalIn: dot).fill()}diff --git a/desktop/test/harness_placement_test.dart b/desktop/test/harness_placement_test.dartindex f67bf4743..7eee1229b 100644--- a/desktop/test/harness_placement_test.dart+++ b/desktop/test/harness_placement_test.dart@@ -937,7 +937,23 @@ void main() {await tester.pump();expect(app.swarms, contains(original));expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);- expect(find.text(placement.title), findsNothing);+ // No chooser titled after the placement. An empty tab is itself+ // called "New Tab", so its own name in the strip does not count.+ bool inTab(Element element) {+ var inside = false;+ element.visitAncestorElements((ancestor) {+ final key = ancestor.widget.key;+ inside = key is ValueKey<String> &&+ app.swarms.any((swarm) => swarm.id == key.value);+ return !inside;+ });+ return inside;+ }++ expect(+ find.text(placement.title).evaluate().where((e) => !inTab(e)),+ isEmpty,+ );await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();expect(app.swarms.length, placement == HarnessPlacement.newTab ? 2 : 1);diff --git a/desktop/test/harness_titles_test.dart b/desktop/test/harness_titles_test.dartindex 0559fef43..ea6093874 100644--- a/desktop/test/harness_titles_test.dart+++ b/desktop/test/harness_titles_test.dart@@ -1,6 +1,7 @@import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/state/app_state.dart';+import 'package:harness/state/swarm.dart';import 'swarm_state_test.dart' show createApp, MemoryStore;@@ -51,6 +52,44 @@ void main() {},);+ test('a tab is named after its first harness\'s project', () async {+ final app = createApp(store: MemoryStore());+ app.machineStates['m']!.agents = const [+ Agent(+ id: 'a0',+ name: automaticName,+ title: 'Review API changes',+ engine: 'codex',+ terminalAvailable: true,+ project: AgentProject(+ name: 'harness',+ cwd: '/src/harness/desktop',+ root: '/src/harness',+ ),+ ),+ Agent(+ id: 'a1',+ name: 'second',+ engine: 'claude',+ terminalAvailable: true,+ project: AgentProject(name: 'website', cwd: '/src/website'),+ ),+ ];+ await app.addAgentToSwarm('m', 'a0');+ // The folder as the pane header shows it: a subfolder of a checkout is+ // itself, not the repository around it — and the project wins over the+ // session's title.+ expect(app.activeSwarm.name, 'desktop');+ expect(app.activeSwarm.nameIsCustom, isFalse);+ await app.addAgentToSwarm('m', 'a1');+ expect(app.activeSwarm.name, 'desktop', reason: 'the FIRST pane names it');+ });++ test('a tab saved as Untitled Tab restores as New Tab', () {+ expect(Swarm.normalizeName('Untitled Tab'), Swarm.defaultName);+ expect(Swarm.defaultName, 'New Tab');+ });+test('tab follows its first harness until an explicit rename, including after restore', () async {final store = MemoryStore();final app = createApp(store: store);@@ -63,7 +102,7 @@ void main() {),];await app.addAgentToSwarm('m', 'a0');- expect(app.activeSwarm.name, 'Untitled Tab');+ expect(app.activeSwarm.name, 'New Tab');expect(app.activeSwarm.nameIsCustom, isFalse);await sessionTitle(app, 'Review API changes');expect(app.activeSwarm.name, 'Review API changes');diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dartindex 4892370c8..474df2f84 100644--- a/desktop/test/swarm_screen_test.dart+++ b/desktop/test/swarm_screen_test.dart@@ -429,7 +429,7 @@ void main() {final app = createApp();final tab = app.activeSwarm;await mount(tester, app, nativeTabs: native);- expect(tab.name, 'Untitled Tab');+ expect(tab.name, 'New Tab');expect(find.byKey(const ValueKey('harness-start-search')),findsOneWidget,diff --git a/desktop/test/swarm_state_test.dart b/desktop/test/swarm_state_test.dartindex 79de0684b..579c28834 100644--- a/desktop/test/swarm_state_test.dart+++ b/desktop/test/swarm_state_test.dart@@ -152,7 +152,7 @@ void main() {final restored = createApp(store: store);addTearDown(restored.dispose);await restored.restorePaneLayoutForTest();- expect(restored.activeSwarm.name, 'Untitled Tab');+ expect(restored.activeSwarm.name, 'New Tab');await restored.addAgentToSwarm('m', 'a0');expect(restored.activeSwarm.name, 'Agent 0');},diff --git a/desktop/test/terminal_catalog_test.dart b/desktop/test/terminal_catalog_test.dartindex aa102b606..058d4ac0f 100644--- a/desktop/test/terminal_catalog_test.dart+++ b/desktop/test/terminal_catalog_test.dart@@ -103,7 +103,8 @@ void main() {await key(tester, LogicalKeyboardKey.enter);final sharedTab = app.activeSwarm;expect(sharedTab, isNot(same(source)));- expect(sharedTab.name, 'Fix login redirect');+ // Named after the harness's project, not the harness itself.+ expect(sharedTab.name, 'openharness');expect(sharedTab.panes.single.session, same(claude));expect(source.panes, [firstPane, secondPane]);await key(tester, LogicalKeyboardKey.keyW, cmd: true);diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swiftindex 1a2451d60..990aa8476 100644--- a/desktop/tool/swarm_titlebar_checks.swift+++ b/desktop/tool/swarm_titlebar_checks.swift@@ -39,6 +39,9 @@ private extension SwarmSubscriptionView {}private extension SwarmTabButton {+ // `label` is private to the tab; a same-file extension reads what it draws.+ var drawnFont: NSFont? { label.attribute(.font, at: 0, effectiveRange: nil) as? NSFont }+func checkDoubleClickIsolation() throws {let parent = nextResponderlet originalEmit = emit@@ -109,14 +112,14 @@ private extension SwarmTabStrip {if let engine { row["engine"] = engine }update(["tabs": [row], "activeId": "agent-tab", "enabled": true])}+ func marks() -> Bool { tabs[0].subviews.contains { $0 is NSImageView } }show(1, engine: "claude")let tab = tabs[0]- let engineIcon = tab.icon- try checkTitlebar(engineIcon != nil && engineIcon?.isTemplate == false, "A single-agent tab shows its engine mark")+ try checkTitlebar(!marks(), "A tab of one harness is its name alone, without the engine's mark")show(2)- try checkTitlebar(tabs[0] === tab && tab.icon === SwarmIdentity.menuIcon, "Adding an agent changes the icon while retaining the tab control")- show(1, engine: "claude")- try checkTitlebar(tabs[0] === tab && tab.icon === engineIcon, "Closing back to one agent restores the cached engine icon")+ try checkTitlebar(tabs[0] === tab && !marks(), "A tab of several harnesses is its name alone, and keeps the tab control")+ show(0)+ try checkTitlebar(tabs[0] === tab && !marks(), "An empty tab is its name alone")}func checkSharedTypography() throws {@@ -126,6 +129,12 @@ private extension SwarmTabStrip {let tab = tabs[0]try checkTitlebar(tab.labelFont.pointSize == system.pointSize && tab.labelFont.familyName == system.familyName,"A tab is named in the system face, like every other Mac window's tabs")+ update(["tabs": [["id": "font-tab", "name": "Typography"], ["id": "other-tab", "name": "Other"]],+ "activeId": "font-tab", "enabled": true])+ let selectedFont = tabs[0].drawnFont+ let restingFont = tabs[1].drawnFont+ try checkTitlebar(selectedFont != nil && selectedFont == restingFont,+ "The selected tab keeps the same weight; its fill and ink mark it")try checkTitlebar(storeButton.font?.pointSize == system.pointSize && storeButton.font?.familyName == system.familyName,"The Store action beside the tabs takes the same face")try checkTitlebar(tab.menu?.font.familyName == menuFont.familyName && tab.menu?.font.pointSize == menuFont.pointSize,