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
Make agent entry the primary desktop workflow
deehw16716d032542
diff --git a/desktop/lib/screens/home_screen.dart b/desktop/lib/screens/home_screen.dartindex 2784bcef7..0e503f57a 100644--- a/desktop/lib/screens/home_screen.dart+++ b/desktop/lib/screens/home_screen.dart@@ -16,7 +16,6 @@ import '../widgets/machine_rail_mini.dart';import '../settings/settings_screen.dart';import '../settings/settings_section.dart';import '../shortcuts/app_shortcuts.dart';-import '../widgets/agent_switcher.dart';import '../widgets/new_agent_dialog.dart';import '../widgets/task_palette.dart';import '../widgets/pane_grid.dart';@@ -256,9 +255,6 @@ class _HomeScreenState extends State<HomeScreen> {?.find(TerminalFindAction.previous),ShortcutAction.lastPane: notifier.focusLastPane,ShortcutAction.zoomPane: notifier.toggleZoomPane,- ShortcutAction.switchAgent: () =>- unawaited(showAgentSwitcher(context, notifier)),-ShortcutAction.closePane: _closeFocusedPane,ShortcutAction.newAgent: _newAgent,ShortcutAction.routeTask: () =>diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dartindex e664c8910..a16be6ab4 100644--- a/desktop/lib/screens/swarm_screen.dart+++ b/desktop/lib/screens/swarm_screen.dart@@ -28,6 +28,7 @@ import '../state/swarm_catalog.dart';import '../state/swarm_attention.dart';import '../state/swarm_navigation.dart';import '../state/swarm_search.dart';+import '../state/swarm.dart';import '../widgets/layout_palette.dart';import '../widgets/engine_identity.dart';import '../widgets/link_machine_screen.dart';@@ -35,15 +36,13 @@ import '../widgets/new_agent_dialog.dart';import '../widgets/pane_grid.dart';import '../widgets/shortcuts_sheet.dart';import '../widgets/swarm_dialogs.dart';-import '../widgets/clone_repository_dialog.dart';import '../widgets/swarm_inline_search.dart';-import '../widgets/swarm_navigator.dart';import '../widgets/swarm_search_input.dart';-import '../widgets/swarm_project_agents.dart';import '../widgets/swarm_attention.dart';import '../widgets/swarm_switcher.dart';import '../widgets/swarm_wallpaper.dart';import '../widgets/swarm_welcome.dart';+import '../widgets/swarm_icon.dart';import '../widgets/task_palette.dart';class SwarmScreen extends StatefulWidget {@@ -78,9 +77,8 @@ class _SwarmScreenState extends State<SwarmScreen> {);final _navigation = SwarmNavigationHistory();final _searchCatalog = SwarmSearchCatalog();- final _locationCatalog = SwarmLocationCatalog();final _searchText = TextEditingController();- final _searchFocus = FocusNode(debugLabel: 'Search agents and swarms');+ final _searchFocus = FocusNode(debugLabel: 'Search agents and tabs');SwarmSearchController? _search;OverlayEntry? _searchOverlay;(String, bool)? _searchHeaderState;@@ -219,7 +217,7 @@ class _SwarmScreenState extends State<SwarmScreen> {return;}if (!_canExecuteCommand(id)) return;- if (id != 'navigation.quick_open' && id != 'navigation.commands') {+ if (id != 'navigation.commands') {_closeSearch();}_commands[id]?.call();@@ -261,6 +259,18 @@ class _SwarmScreenState extends State<SwarmScreen> {if (_native) _syncNative();}+ String? _tabEngine(Swarm tab) {+ if (tab.panes.length != 1) return null;+ final pane = tab.panes.single;+ return app+ .stateOf(pane.machineId)+ ?.agents+ .where((agent) => agent.id == pane.agentId)+ .firstOrNull+ ?.engine ??+ pane.session?.engineId;+ }+void _syncNative() {final payload = {'enabled': _routeIsCurrent && !_dialogOpen && !_spokenPaletteOpen,@@ -303,6 +313,9 @@ class _SwarmScreenState extends State<SwarmScreen> {{'id': swarm.id,'name': swarm.name,+ 'agentCount': swarm.panes.length,+ 'engine': _tabEngine(swarm),+ 'iconAsset': engineIdentity(_tabEngine(swarm)).asset,'attention': swarm.panes.where((p) =>@@ -357,6 +370,15 @@ class _SwarmScreenState extends State<SwarmScreen> {return;}if (call.method == 'searchCommand' || call.method == 'keymapCommand') {+ if (call.method == 'keymapCommand') {+ final focus = FocusManager.instance.primaryFocus?.context;+ final region = focus == null ? null : KeymapRegion.of(focus);+ final action = region?.actions?[args['command']];+ if (action != null) {+ if (region?.composing?.call() != true) action();+ return;+ }+ }final search = _search;if (search == null) return;final command =@@ -389,7 +411,7 @@ class _SwarmScreenState extends State<SwarmScreen> {await WidgetsBinding.instance.endOfFrame;return;}- if (call.method != 'jump') _closeSearch(restoreFocus: false);+ _closeSearch(restoreFocus: false);switch (call.method) {case 'new':app.newSwarm();@@ -402,7 +424,7 @@ class _SwarmScreenState extends State<SwarmScreen> {case 'historyForward':_stepHistory(1);case 'showHistory':- await _jump(historyOnly: true);+ await _showHistory();case 'select':if (args['id'] is String) app.selectSwarm(args['id']);case 'close':@@ -439,8 +461,6 @@ class _SwarmScreenState extends State<SwarmScreen> {await _addProject();case 'linkMachine':await _dialog(() => showSwarmLinkDialog(context, app));- case 'jump':- await _jump();case 'commands':_showSearchCommands();case 'historyDestination':@@ -475,7 +495,6 @@ class _SwarmScreenState extends State<SwarmScreen> {'close','new','rename',- 'jump','commands','notifications','newAgent',@@ -518,7 +537,6 @@ class _SwarmScreenState extends State<SwarmScreen> {String? swarmId,PaneSplitRequest? split,bool chooseFolderFirst = false,- bool cloneRepositoryFirst = false,String returnToAddQuery = '',({SwarmSearchDraft search, TextEditingValue editing})? returnToAdd,}) async {@@ -534,7 +552,6 @@ class _SwarmScreenState extends State<SwarmScreen> {machineId == null &&split != null &&!chooseFolderFirst &&- !cloneRepositoryFirst &&focused?.agentId != null;final focusedMachine = inherit? app.machineStates[focused!.machineId]@@ -546,8 +563,7 @@ class _SwarmScreenState extends State<SwarmScreen> {.where((m) =>m.isLocalMachine &&- (!(chooseFolderFirst || cloneRepositoryFirst) ||- (!m.needsLink && m.nodeOnline != false)),+ (!chooseFolderFirst || (!m.needsLink && m.nodeOnline != false)),).firstOrNull;final id =@@ -560,7 +576,7 @@ class _SwarmScreenState extends State<SwarmScreen> {return;}final machine = app.machineStates[id];- if ((chooseFolderFirst || cloneRepositoryFirst) &&+ if (chooseFolderFirst &&(machine == null ||!machine.isLocalMachine ||machine.needsLink ||@@ -580,16 +596,14 @@ class _SwarmScreenState extends State<SwarmScreen> {? null: focusedMachine?.projectOf(focusedAgent)?.cwd);Future<void>? initialEngineProbe;- if ((chooseFolderFirst || cloneRepositoryFirst) &&- machine != null &&- machine.isLocalMachine) {+ if (chooseFolderFirst && machine != null && machine.isLocalMachine) {// Read availability while the user chooses a folder, so the form can// prefer an installed agent without adding a second probe or wait.initialEngineProbe = app.probeEngines(id, force: true);try {- selectedFolder = cloneRepositoryFirst- ? await showCloneRepositoryDialog(context)- : await getDirectoryPath(confirmButtonText: 'Use folder');+ selectedFolder = await getDirectoryPath(+ confirmButtonText: 'Use folder',+ );} catch (error) {if (mounted) {ScaffoldMessenger.of(context).showSnackBar(@@ -614,11 +628,7 @@ class _SwarmScreenState extends State<SwarmScreen> {context,app,id,- source: cloneRepositoryFirst- ? 'first_clone'- : chooseFolderFirst- ? 'first_folder'- : 'swarm',+ source: chooseFolderFirst ? 'first_folder' : 'swarm',initialFolder: selectedFolder,initialEngineProbe: initialEngineProbe,swarmId: targetId,@@ -649,8 +659,8 @@ class _SwarmScreenState extends State<SwarmScreen> {SnackBar(content: Text(!targetExists- ? 'That swarm was closed. Choose a swarm and use Add to find the agent.'- : 'That split changed. Open Add again to choose a position.',+ ? 'That tab was closed. Open New Agent to find the agent.'+ : 'That split changed. Open Add Agent again to choose a position.',),),);@@ -676,13 +686,7 @@ class _SwarmScreenState extends State<SwarmScreen> {_openSearch(adding: true, split: split);}- Future<void> _jump({bool historyOnly = false}) async {- if (!historyOnly) {- if (_search?.adding == true) _closeSearch(restoreFocus: false);- _openSearch();- _focusSearch(selectAll: true);- return;- }+ Future<void> _showHistory() async {final target = app.activeSwarmId;SwarmSearchSelection? selected;await _dialog(() async {@@ -744,14 +748,13 @@ class _SwarmScreenState extends State<SwarmScreen> {_canvasFocus.descendantsAreFocusable = false;_search = SwarmSearchController(app,- adding ? _navigation.recent : _navigation.recentLocations,+ _navigation.recent,projects: _projects,commands: _searchCommands,adding: adding,- navigating: !adding,+ commandsOnly: !adding,split: split,catalog: _searchCatalog,- locations: _locationCatalog,)..setQuery(query);if (draft != null) _search!.restoreDraft(draft);_search!.addListener(_syncSearch);@@ -855,17 +858,11 @@ class _SwarmScreenState extends State<SwarmScreen> {);}- void _addFromNavigation() {- final query = _search?.query ?? '';- _closeSearch(restoreFocus: false);- _openSearch(adding: true, query: query);- }-Widget _buildSearchOverlay(BuildContext context) {final search = _search!;- // Keep Navigate's editor mounted when `>` enters/leaves command mode so- // even the next keystroke retains focus and text editing ownership.- final navigating = search.navigating;+ // Keep the command editor mounted as its query changes so every keystroke+ // retains focus and text editing ownership.+ final commandsOnly = search.commandsOnly;return KeymapProvider(keymap: _keymap,child: LayoutBuilder(@@ -881,10 +878,7 @@ class _SwarmScreenState extends State<SwarmScreen> {Align(alignment: const Alignment(0, -0.12),child: SizedBox(- width: (constraints.maxWidth - 64).clamp(- 280.0,- navigating ? 720.0 : 1040.0,- ),+ width: (constraints.maxWidth - 64).clamp(280.0, 720.0),height: (constraints.maxHeight - 96).clamp(220.0, 540.0),child: Material(key: const ValueKey('swarm-search-results'),@@ -896,44 +890,46 @@ class _SwarmScreenState extends State<SwarmScreen> {side: const BorderSide(color: Colors.white24),),clipBehavior: Clip.antiAlias,- child: navigating- ? SwarmNavigator(- search: search,- editing: _searchText,- focusNode: _searchFocus,- onChoose: _chooseSearch,- onClose: _closeSearch,- onAdd: _addFromNavigation,- onNewAgent: _newAgentFromSearch,- )- : Column(- children: [- SwarmSearchInput(- inputKey: const ValueKey('swarm-search-input'),- controller: _searchText,- focusNode: _searchFocus,- search: search,- onChoose: _chooseSearch,- onClose: _closeSearch,- onChanged: search.setQuery,- showClose: true,- onNewAgent: search.adding- ? _newAgentFromSearch- : null,- ),- const Divider(height: 1, color: Colors.white12),- Expanded(- child: SwarmSearchResults(- search: search,- onChoose: _chooseSearch,- onRefocus: _focusSearch,- onCommands: search.allowsCommands- ? _showSearchCommands- : null,+ child: Column(+ children: [+ if (commandsOnly)+ const Padding(+ padding: EdgeInsets.fromLTRB(20, 16, 20, 12),+ child: Align(+ alignment: Alignment.centerLeft,+ child: Text(+ 'Commands',+ style: TextStyle(+ fontSize: 16,+ fontWeight: FontWeight.w600,),),- ],+ ),),+ SwarmSearchInput(+ inputKey: const ValueKey('swarm-search-input'),+ controller: _searchText,+ focusNode: _searchFocus,+ search: search,+ onChoose: _chooseSearch,+ onClose: _closeSearch,+ onChanged: search.setQuery,+ showClose: true,+ onNewAgent: search.adding ? _newAgentFromSearch : null,+ ),+ const Divider(height: 1, color: Colors.white12),+ Expanded(+ child: SwarmSearchResults(+ search: search,+ onChoose: _chooseSearch,+ onRefocus: _focusSearch,+ onCommands: search.allowsCommands+ ? _showSearchCommands+ : null,+ ),+ ),+ ],+ ),),),),@@ -969,48 +965,6 @@ class _SwarmScreenState extends State<SwarmScreen> {final project = await showSwarmProjectDialog(context, app);if (project != null) await _projects.add(project);});- Future<void> _machine(MachineState machine) async {- if (machine.needsLink) {- await _dialog(- () => showLinkMachineScreenDialog(- context,- app,- machine.machine.machineId,- ),- );- return;- }- if (machine.agents.isEmpty) {- if (machine.nodeOnline == false) {- await _dialog(() => showSwarmLinkDialog(context, app));- } else {- await _newAgent(machineId: machine.machine.machineId);- }- return;- }- await app.seedSwarm(machine.machine.displayName, [- for (final a in machine.agents)- (machineId: machine.machine.machineId, agentId: a.id),- ]);- }-- Future<void> _project(SwarmProjectGroup group) async {- if (group.agents.isEmpty) {- final saved = group.saved;- await _newAgent(machineId: saved?.machineId, folder: saved?.path);- } else {- await app.seedSwarm(group.name, [- for (final a in group.agents)- (machineId: a.machineId, agentId: a.agent.id),- ]);- }- }-- Future<void> _projectAgents(SwarmProjectGroup group) => _dialog(() async {- final project = await showSwarmProjectAgents(context, app, group);- if (project != null) await _projects.add(project);- });-Future<void> _notifications() async {final target = app.activeSwarmId;SwarmAttentionEntry? selected;@@ -1096,7 +1050,7 @@ class _SwarmScreenState extends State<SwarmScreen> {ShortcutAction.movePaneDown: () => app.movePaneDirection(dx: 0, dy: 1),ShortcutAction.nextAgent: () => _stepHistory(1),ShortcutAction.previousAgent: () => _stepHistory(-1),- ShortcutAction.showHistory: () => _jump(historyOnly: true),+ ShortcutAction.showHistory: _showHistory,ShortcutAction.findTerminal: () =>app.focusedPane?.session?.find(TerminalFindAction.open),ShortcutAction.findNext: () =>@@ -1105,7 +1059,6 @@ class _SwarmScreenState extends State<SwarmScreen> {app.focusedPane?.session?.find(TerminalFindAction.previous),ShortcutAction.lastPane: app.focusLastPane,ShortcutAction.zoomPane: app.toggleZoomPane,- ShortcutAction.switchAgent: _jump,ShortcutAction.showAttention: _notifications,ShortcutAction.addAgent: _addAgent,ShortcutAction.closePane: () {@@ -1191,8 +1144,7 @@ class _SwarmScreenState extends State<SwarmScreen> {List<SwarmDestination> _searchCommands() => [for (final command in harnessCommands)- if (command.id != 'navigation.quick_open' &&- command.id != 'navigation.commands' &&+ if (command.id != 'navigation.commands' &&!RegExp(r'^pane\.focus_[1-9]$').hasMatch(command.id) &&_canExecuteCommand(command.id))SwarmDestination(@@ -1235,20 +1187,22 @@ class _SwarmScreenState extends State<SwarmScreen> {backgroundColor: grid.AppPalette.swarmField,floatingActionButtonLocation:FloatingActionButtonLocation.endFloat,- floatingActionButton: Padding(- padding: const EdgeInsets.only(right: 12, bottom: 12),- child: FloatingActionButton.small(- key: const ValueKey('swarm-add-agent-button'),- tooltip: _keymap.hint('agent.add') == null- ? 'Add agent'- : 'Add agent (${_keymap.hint('agent.add')})',- onPressed: () => _openSearch(adding: true),- backgroundColor: grid.AppPalette.swarmAccent,- foregroundColor: grid.AppPalette.swarmField,- shape: const CircleBorder(),- child: const Icon(Icons.add, size: 24),- ),- ),+ floatingActionButton: app.panes.isEmpty+ ? null+ : Padding(+ padding: const EdgeInsets.only(right: 12, bottom: 12),+ child: FloatingActionButton.small(+ key: const ValueKey('swarm-add-agent-button'),+ tooltip: _keymap.hint('agent.add') == null+ ? 'Add agent'+ : 'Add agent (${_keymap.hint('agent.add')})',+ onPressed: () => _openSearch(adding: true),+ backgroundColor: grid.AppPalette.swarmAccent,+ foregroundColor: grid.AppPalette.swarmField,+ shape: const CircleBorder(),+ child: const Icon(Icons.add, size: 24),+ ),+ ),body: Column(children: [if (!_native) _tabStrip(),@@ -1351,34 +1305,9 @@ class _SwarmScreenState extends State<SwarmScreen> {empty: SwarmWelcome(key: ValueKey(app.activeSwarmId),notifier: app,- projects: _projects.projects,onNewAgent: _newAgent,onChooseFirstFolder: () =>_newAgent(chooseFolderFirst: true),- onCloneRepository: () =>- _newAgent(cloneRepositoryFirst: true),- onAgent: (entry) => _activateSearch(- SwarmSearchSelection(- SwarmDestination(- id: agentDestinationId(- entry.machineId,- entry.agent.id,- ),- title: entry.agent.name,- detail: entry- .machine- .machine- .displayName,- swarmId: null,- current: false,- machineId: entry.machineId,- agentId: entry.agent.id,- engine: entry.agent.engine,- ),- SwarmSearchAction.addHere,- ),- app.activeSwarmId,- ),searchField: SwarmInlineSearch(key: ValueKey('welcome-search:${app.activeSwarmId}',@@ -1392,13 +1321,9 @@ class _SwarmScreenState extends State<SwarmScreen> {onNewAgent: (query) =>_newAgent(returnToAddQuery: query),),- onAddProject: _addProject,onLinkMachine: () => _dialog(() => showSwarmLinkDialog(context, app),),- onMachine: _machine,- onProject: _project,- onProjectAgents: _projectAgents,),),),@@ -1461,11 +1386,32 @@ class _SwarmScreenState extends State<SwarmScreen> {? Colors.white: Colors.white70,),- child: Text(- swarm.name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(fontSize: 13),+ child: Row(+ children: [+ if (swarm.panes.length == 1)+ EngineMark(+ key: ValueKey('tab-engine:${swarm.id}'),+ engine: _tabEngine(swarm),+ size: 16,+ )+ else if (swarm.panes.length > 1)+ SwarmIcon(+ key: ValueKey('tab-group:${swarm.id}'),+ size: 16,+ color: Colors.white70,+ )+ else+ const Icon(Icons.add_box_outlined, size: 16),+ const SizedBox(width: 8),+ Expanded(+ child: Text(+ swarm.name,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: const TextStyle(fontSize: 13),+ ),+ ),+ ],),),),@@ -1488,9 +1434,10 @@ class _SwarmScreenState extends State<SwarmScreen> {),),IconButton(+ key: const ValueKey('swarm-new-agent-button'),tooltip: withEffectiveShortcutHint(context,- 'New swarm',+ 'New Agent',ShortcutAction.newSwarm,),onPressed: app.swarms.length < AppNotifier.maxSwarms@@ -1498,16 +1445,6 @@ class _SwarmScreenState extends State<SwarmScreen> {: null,icon: const Icon(Icons.add, size: 18),),- IconButton(- key: const ValueKey('swarm-search-button'),- tooltip: withEffectiveShortcutHint(- context,- 'Navigate',- ShortcutAction.switchAgent,- ),- onPressed: _jump,- icon: const Icon(Icons.explore_outlined, size: 20),- ),IconButton(key: const ValueKey('swarm-notifications-button'),tooltip: withEffectiveShortcutHint(diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dartindex 009900828..e232e0289 100644--- a/desktop/lib/shortcuts/app_shortcuts.dart+++ b/desktop/lib/shortcuts/app_shortcuts.dart@@ -40,9 +40,6 @@ enum ShortcutAction {/// One pane filling the grid, and back. tmux's `prefix z`.zoomPane,- /// Jump to any agent by name, on any machine.- switchAgent,-/// Find a live question and jump to the agent waiting for input.showAttention,@@ -67,7 +64,7 @@ enum ShortcutGroup { navigate, panes, actions }extension ShortcutGroupLabel on ShortcutGroup {String get label => switch (this) {- ShortcutGroup.navigate => 'Navigate',+ ShortcutGroup.navigate => 'Workspace',ShortcutGroup.panes => 'Panes',ShortcutGroup.actions => 'Actions',};@@ -276,7 +273,7 @@ const List<AppShortcut> kAppShortcuts = [AppShortcut(action: ShortcutAction.closePane,activator: SingleActivator(LogicalKeyboardKey.keyW, meta: true),- label: 'Remove the focused agent from this swarm',+ label: 'Close the focused agent pane',group: ShortcutGroup.panes,),AppShortcut(@@ -312,12 +309,6 @@ const List<AppShortcut> kAppShortcuts = [//// ⌘K stays unbound and is now spoken for by the navigation row above — see// the header's note about what the file used to hold it in reserve for.- AppShortcut(- action: ShortcutAction.switchAgent,- activator: SingleActivator(LogicalKeyboardKey.keyP, meta: true),- label: 'Go to an agent by name',- group: ShortcutGroup.navigate,- ),// ⌃⇥ / ⌃⇧⇥ — the one Ctrl pair this app is allowed, and the terminal is made// to let it past on purpose (terminal_view.dart) because no shell or tmux// binding wants it.@@ -357,7 +348,7 @@ const List<AppShortcut> kAppShortcuts = [meta: true,shift: true,),- label: 'New agent',+ label: 'Create Agent',group: ShortcutGroup.actions,),AppShortcut(@@ -406,7 +397,6 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) => [(!const {ShortcutAction.toggleRail,ShortcutAction.closePane,- ShortcutAction.switchAgent,}.contains(shortcut.action) &&!shortcut.activator.control))shortcut,@@ -420,7 +410,7 @@ const kSwarmShortcuts = [AppShortcut(action: ShortcutAction.addAgent,activator: SingleActivator(LogicalKeyboardKey.keyN, meta: true),- label: 'Add agent to this swarm',+ label: 'Add agent to this tab',group: ShortcutGroup.actions,),AppShortcut(@@ -432,7 +422,7 @@ const kSwarmShortcuts = [AppShortcut(action: ShortcutAction.newSwarm,activator: SingleActivator(LogicalKeyboardKey.keyT, meta: true),- label: 'New swarm',+ label: 'New Agent',group: ShortcutGroup.navigate,),AppShortcut(@@ -442,13 +432,13 @@ const kSwarmShortcuts = [meta: true,shift: true,),- label: 'Reopen last closed agent or swarm',+ label: 'Reopen last closed agent or tab',group: ShortcutGroup.navigate,),AppShortcut(action: ShortcutAction.closeSwarm,activator: SingleActivator(LogicalKeyboardKey.keyW, meta: true),- label: 'Close this swarm',+ label: 'Close this tab',group: ShortcutGroup.navigate,),AppShortcut(@@ -458,7 +448,7 @@ const kSwarmShortcuts = [meta: true,shift: true,),- label: 'Rename this swarm',+ label: 'Rename this tab',group: ShortcutGroup.navigate,),AppShortcut(@@ -468,7 +458,7 @@ const kSwarmShortcuts = [meta: true,shift: true,),- label: 'Next swarm',+ label: 'Next tab',group: ShortcutGroup.navigate,),AppShortcut(@@ -478,13 +468,13 @@ const kSwarmShortcuts = [meta: true,shift: true,),- label: 'Previous swarm',+ label: 'Previous tab',group: ShortcutGroup.navigate,),AppShortcut(action: ShortcutAction.nextSwarm,activator: SingleActivator(LogicalKeyboardKey.tab, control: true),- label: 'Next swarm',+ label: 'Next tab',group: ShortcutGroup.navigate,),AppShortcut(@@ -494,13 +484,7 @@ const kSwarmShortcuts = [control: true,shift: true,),- label: 'Previous swarm',- group: ShortcutGroup.navigate,- ),- AppShortcut(- action: ShortcutAction.switchAgent,- activator: SingleActivator(LogicalKeyboardKey.keyP, meta: true),- label: 'Search agents, swarms, machines and projects',+ label: 'Previous tab',group: ShortcutGroup.navigate,),AppShortcut(@@ -520,7 +504,7 @@ const kSwarmShortcuts = [meta: true,shift: true,),- label: 'Remove the focused agent from this swarm',+ label: 'Close the focused agent pane',group: ShortcutGroup.panes,),AppShortcut(diff --git a/desktop/lib/shortcuts/keymap.dart b/desktop/lib/shortcuts/keymap.dartindex 4c48cde33..9f366bc03 100644--- a/desktop/lib/shortcuts/keymap.dart+++ b/desktop/lib/shortcuts/keymap.dart@@ -201,9 +201,11 @@ class KeymapConfig {);}final command = row['command'];- // Output preview is now always visible in Add. An old customization of- // its removed toggle must not invalidate the rest of the user's keymap.- if (command == 'picker.preview' && !commands.contains(command)) continue;+ // Retired actions must not invalidate the user's other custom shortcuts.+ if (const {'picker.preview', 'navigation.quick_open'}.contains(command) &&+ !commands.contains(command)) {+ continue;+ }if (command != null &&(command is! String || !commands.contains(command))) {throw FormatException('Unknown command in bindings[$i]: $command');diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex 3ef0f0152..c9af58688 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -47,13 +47,6 @@ Map<ShortcutAction, List<String>> _readWorkspaceKeys() {}final harnessCommands = <HarnessCommand>[- const HarnessCommand(- 'navigation.quick_open',- 'Navigate to an agent or swarm',- ShortcutGroup.navigate,- action: ShortcutAction.switchAgent,- nativeAction: 'jump',- ),const HarnessCommand('navigation.commands','Search commands',@@ -63,28 +56,28 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('swarm.new',- 'New swarm',+ 'New Agent',ShortcutGroup.navigate,action: ShortcutAction.newSwarm,nativeAction: 'new',),const HarnessCommand('swarm.close',- 'Close this swarm',+ 'Close this tab',ShortcutGroup.navigate,action: ShortcutAction.closeSwarm,nativeAction: 'closeActive',),const HarnessCommand('swarm.reopen',- 'Reopen last closed agent or swarm',+ 'Reopen last closed agent or tab',ShortcutGroup.navigate,action: ShortcutAction.reopenClosedSwarm,nativeAction: 'reopen',),const HarnessCommand('swarm.next',- 'Next swarm',+ 'Next tab',ShortcutGroup.navigate,action: ShortcutAction.nextSwarm,nativeAction: 'next',@@ -92,7 +85,7 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('swarm.previous',- 'Previous swarm',+ 'Previous tab',ShortcutGroup.navigate,action: ShortcutAction.previousSwarm,nativeAction: 'previous',@@ -100,7 +93,7 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('swarm.rename',- 'Rename this swarm',+ 'Rename this tab',ShortcutGroup.actions,action: ShortcutAction.renameSwarm,nativeAction: 'renameActive',@@ -138,7 +131,7 @@ final harnessCommands = <HarnessCommand>[for (var i = 1; i <= 9; i++)HarnessCommand('swarm.select_$i',- i == 9 ? 'Select the last swarm' : 'Select swarm $i',+ i == 9 ? 'Select the last tab' : 'Select tab $i',ShortcutGroup.navigate,),for (var i = 1; i <= 9; i++)@@ -213,7 +206,7 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('pane.close',- 'Remove the focused agent from this swarm',+ 'Close the focused agent pane',ShortcutGroup.panes,action: ShortcutAction.closePane,nativeAction: 'closePane',@@ -281,14 +274,14 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('agent.add',- 'Add agent to this swarm',+ 'Add agent to this tab',ShortcutGroup.actions,action: ShortcutAction.addAgent,nativeAction: 'addAgent',),const HarnessCommand('agent.new',- 'New agent',+ 'Create Agent',ShortcutGroup.actions,action: ShortcutAction.newAgent,nativeAction: 'newAgent',@@ -377,7 +370,7 @@ final harnessCommands = <HarnessCommand>[),const HarnessCommand('picker.add_here',- 'Add the selected agent to this swarm',+ 'Add the selected agent to this tab',ShortcutGroup.actions,extraKeys: ['cmd+enter'],context: KeymapContext.picker,diff --git a/desktop/lib/shortcuts/keymap_store.dart b/desktop/lib/shortcuts/keymap_store.dartindex baee76bb0..de0f13d3b 100644--- a/desktop/lib/shortcuts/keymap_store.dart+++ b/desktop/lib/shortcuts/keymap_store.dart@@ -280,7 +280,7 @@ class KeymapStore extends ChangeNotifier {"bindings": [// Example: move search from Command-P to Command-O.// { "keys": "cmd+p", "command": null },- // { "keys": "cmd+o", "command": "navigation.quick_open" },+ // { "keys": "cmd+o", "command": "swarm.new" },],}diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex e2d2346ef..011d7635d 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -459,7 +459,7 @@ class AppNotifier extends ChangeNotifier {Iterable<TerminalPane> get allPanes => swarms.expand((s) => s.panes).toSet();String get activeSwarmId => activeSwarm.id;- void newSwarm({String name = 'New swarm'}) {+ void newSwarm({String name = 'New Agent'}) {if (swarms.length >= maxSwarms) return;while (swarms.any((s) => s.id == 'swarm-$_nextSwarmId')) {_nextSwarmId++;@@ -557,7 +557,7 @@ class AppNotifier extends ChangeNotifier {// welcome tabs, evicting the real work from recently closed history.if (swarms.length == 1 &&swarms.single.panes.isEmpty &&- swarms.single.name == 'New swarm' &&+ swarms.single.name == 'New Agent' &&swarms.single.presets.isEmpty) {return;}@@ -3718,9 +3718,9 @@ class AppNotifier extends ChangeNotifier {return 'The layout changed. Close this dialog and split the agent again.';}final target = swarms.where((s) => s.id == targetId).firstOrNull;- if (target == null) return 'This swarm was closed';+ if (target == null) return 'This tab was closed';if (target.panes.length >= maxPanes) {- return 'This swarm is full. Open a new swarm to create an agent.';+ return 'This tab is full. Open a new tab to create an agent.';}return null;}@@ -3874,8 +3874,8 @@ class AppNotifier extends ChangeNotifier {notifyListeners();if (_creationPlacementError(targetId, split) != null) {_lastError =- 'The agent was created, but its original swarm or layout changed. '- 'Find it with Add agent.';+ 'The agent was created, but its original tab or layout changed. '+ 'Find it with New Agent.';_lastErrorRetryable = false;notifyListeners();return null;@@ -4312,7 +4312,7 @@ class AppNotifier extends ChangeNotifier {existing == null &&targetPanes.length >= maxPanes) {_lastError =- 'This swarm holds $maxPanes agents. Open another swarm to add more.';+ 'This tab holds $maxPanes agents. Open another tab to add more.';_lastErrorRetryable = false;notifyListeners();return;@@ -4338,7 +4338,7 @@ class AppNotifier extends ChangeNotifier {target.arranged = split.after;target.arrangedKey = key;}- if (firstAgent && target.name == 'New swarm') {+ if (firstAgent && target.name == 'New Agent') {final name = agent.name.trim();if (name.isNotEmpty) {target.name = name.length > 80 ? name.substring(0, 80) : name;@@ -4866,7 +4866,7 @@ class AppNotifier extends ChangeNotifier {0,(raw['name'] as String).length.clamp(0, 80),)- : 'New swarm',+ : 'New Agent',);for (final item in (raw['panes'] as List).take(maxPanes)) {final entry = PaneLayoutEntry.fromJson(item);diff --git a/desktop/lib/state/swarm.dart b/desktop/lib/state/swarm.dartindex 740b62591..ca4ef0c20 100644--- a/desktop/lib/state/swarm.dart+++ b/desktop/lib/state/swarm.dart@@ -8,7 +8,8 @@ import 'terminal_pane.dart';/// Shared agents reuse the same pane/session across swarms, so the daemon has/// exactly one controller and switching tabs cannot take over our own stream.class Swarm {- Swarm({required this.id, this.name = 'New swarm'});+ Swarm({required this.id, String name = 'New Agent'})+ : name = const {'New swarm', 'New tab'}.contains(name) ? 'New Agent' : name;final String id;String name;@@ -172,7 +173,7 @@ class ClosedSwarm extends ClosedWork {bool replacesUntouchedWelcome(Swarm swarm) =>swarm.id == replacementId &&- swarm.name == 'New swarm' &&+ swarm.name == 'New Agent' &&swarm.panes.isEmpty &&swarm.presets.isEmpty;}diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dartindex bed623384..2b199ac05 100644--- a/desktop/lib/state/swarm_navigation.dart+++ b/desktop/lib/state/swarm_navigation.dart@@ -524,7 +524,7 @@ Future<bool> activateSwarmSearchSelection()) {return false;}- if (target.panes.isEmpty && target.name == 'New swarm') {+ if (target.panes.isEmpty && target.name == 'New Agent') {app.renameSwarm(target.id, destination.title);}// Every membership is recorded before awaiting any attachment. A slowdiff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dartindex 51ae5f553..f3ffda1ef 100644--- a/desktop/lib/state/swarm_search.dart+++ b/desktop/lib/state/swarm_search.dart@@ -1,7 +1,4 @@import 'package:flutter/foundation.dart';-import 'package:xterm/xterm.dart';--import '../terminal/search_output_preview.dart';import 'app_state.dart';import 'pane_arrangement.dart';@@ -33,6 +30,7 @@ class SwarmSearchController extends ChangeNotifier {this.commands,this.adding = false,this.navigating = false,+ this.commandsOnly = false,this.split,SwarmSearchCatalog? catalog,SwarmLocationCatalog? locations,@@ -55,9 +53,11 @@ class SwarmSearchController extends ChangeNotifier {final List<SwarmDestination> Function()? commands;final bool adding;final bool navigating;+ final bool commandsOnly;final PaneSplitRequest? split;bool get allowsCommands => split == null && history == null;- bool get isCommandMode => allowsCommands && query.trimLeft().startsWith('>');+ bool get isCommandMode =>+ allowsCommands && (commandsOnly || query.trimLeft().startsWith('>'));final String targetId, targetName;// The workspace can retain normalized metadata across picker openings. Each// read still validates its snapshot; query, selection and output stay local.@@ -70,8 +70,6 @@ class SwarmSearchController extends ChangeNotifier {String query = '';String? _selectedId;int cursor = 0;- SearchOutputPreview? preview;- String? _previewId;bool? _splitCurrent;Set<String> _presentIds = const {};final _checked = <String, SwarmDestination>{};@@ -159,63 +157,16 @@ class SwarmSearchController extends ChangeNotifier {_checked.keys.every(_catalogIds.contains);bool get canAccept => hasSelection ? canSubmitSelection : canSubmit(selected);- bool get canPreview =>- !navigating &&- !isCommandMode &&- history == null &&- selected != null &&- selected?.closedId == null;- bool get previewVisible => canPreview;-- List<SwarmDestination> get previewMembers {- final row = selected;- if (row == null || row.agentId != null) return const [];- final memberIds = row.isGroup- ? row.members- : {- for (final swarm in app.swarms.where(- (swarm) => swarm.id == row.swarmId,- ))- for (final pane in swarm.panes)- if (pane.agentId != null)- agentDestinationId(pane.machineId, pane.agentId!),- };- return _catalog.where((entry) => memberIds.contains(entry.id)).toList();- }-- void _updatePreview() {- if (!previewVisible || selected?.agentId == null) {- preview = null;- _previewId = null;- return;- }- final row = selected!;- // Keep a snapshot while this selection stays put. Query edits and output- // traffic do not read the buffers again. Choosing another result- // captures fresh context, including any replacement session.- if (_previewId == row.id) return;- final terminal = app.allPanes- .where(- (pane) =>- pane.machineId == row.machineId && pane.agentId == row.agentId,- )- .map((pane) => pane.session?.terminal)- .whereType<Terminal>()- .firstOrNull;- _previewId = row.id;- preview = SearchOutputPreview.capture(terminal);- }-SwarmDestination? get selected => rows.isEmpty ? null : rows[cursor];String get hint => isCommandMode? 'Search commands…': history != null? 'Search history…': adding- ? 'Search agents to add…'+ ? 'Find an existing agent…': navigating- ? 'Find an agent or swarm…'- : 'Search agents, swarms, machines, projects…';+ ? 'Find an agent or tab…'+ : 'Search agents, tabs, machines, projects…';bool get canCreate =>history == null &&@@ -225,22 +176,27 @@ class SwarmSearchController extends ChangeNotifier {) &&(split == null || app.isPaneSplitCurrent(split!));+ bool get opensFirstAgent => adding && capacity == AppNotifier.maxPanes;+ String get addVerb => opensFirstAgent ? 'Open' : 'Add';+ String get commandQuery =>+ query.trimLeft().replaceFirst(RegExp(r'^>\s*'), '');+String get primaryAction => switch (split?.axis) {PaneResizeAxis.x => 'Split right',PaneResizeAxis.y => 'Split down',- null => 'Add to this swarm',+ null => opensFirstAgent ? 'Open Agent' : 'Add to this tab',};String actionLabel(SwarmDestination? row) => row?.isCommand == true? action(row!): hasSelection- ? 'Add $checkedCount ${checkedCount == 1 ? 'agent' : 'agents'}'+ ? '$addVerb $checkedCount ${checkedCount == 1 ? 'agent' : 'agents'}': adding? row != null &&row.agentId == null &&split == null &&_missingIds(row).length > 1- ? 'Add ${_missingIds(row).length} agents'+ ? '$addVerb ${_missingIds(row).length} agents': primaryAction: row == null? 'Go to'@@ -250,12 +206,12 @@ class SwarmSearchController extends ChangeNotifier {split != null && !app.isPaneSplitCurrent(split!)? 'The layout changed. Split the agent again.': hasSelection && checkedCount > capacity- ? 'This swarm has room for $capacity more agents.'+ ? 'This tab has room for $capacity more agents.': hasSelection && !canSubmitSelection? 'A selected agent is unavailable. Remove it or search again.': selected != null && alreadyHere(selected!)- ? 'This agent is already in this swarm.'- : 'This swarm has no room for another agent.';+ ? 'This agent is already in this tab.'+ : 'This tab has no room for another agent.';void _refresh() {final next = navigating@@ -295,10 +251,7 @@ class SwarmSearchController extends ChangeNotifier {: const <SwarmDestination>[];_commandIds = {for (final command in availableCommands) command.id};rows = isCommandMode- ? rankSwarmDestinations(- availableCommands,- query.trimLeft().substring(1).trimLeft(),- )+ ? rankSwarmDestinations(availableCommands, commandQuery): navigating? rankSwarmLocations(_catalog, query, recent: recent): rankSwarmDestinations(@@ -329,7 +282,6 @@ class SwarmSearchController extends ChangeNotifier {? index: cursor.clamp(0, rows.length - 1);_selectedId = selected?.id;- _updatePreview();}void setQuery(String value) {@@ -345,7 +297,6 @@ class SwarmSearchController extends ChangeNotifier {if (rows.isEmpty) return;cursor = (cursor + delta) % rows.length;_selectedId = selected!.id;- _updatePreview();notifyListeners();}@@ -414,7 +365,7 @@ class SwarmSearchController extends ChangeNotifier {: row.closedId != null? 'Reopen': row.isGroup || row.isSwarm- ? 'Go to swarm'+ ? 'Go to tab': 'Go to agent';@overridediff --git a/desktop/lib/terminal/search_output_preview.dart b/desktop/lib/terminal/search_output_preview.dartdeleted file mode 100644index 31b85f026..000000000--- a/desktop/lib/terminal/search_output_preview.dart+++ /dev/null@@ -1,82 +0,0 @@-import 'dart:math' as math;--import 'package:xterm/xterm.dart';--/// A small, inert excerpt of output the app already holds. Reading a preview-/// never changes the terminal, its viewport, selection, input or connection.-class SearchOutputPreview {- const SearchOutputPreview(this.text);-- // Covers the maximum 120-row viewport plus a small amount of scrollback,- // including a short prompt near the top of an otherwise empty tall pane.- static const scannedLines = 160;- static const shownColumns = 192;- static const shownCharacters = 720;- final String text;- static final _controls = RegExp(r'[\x00-\x1f\x7f-\x9f]');- static final _rules = RegExp(r'[-─━═_╌┄]{4,}');- static final _frame = RegExp(r'^[│┃┆╎┊┇]+\s*|\s*[│┃┆╎┊┇]+$');- static final _prompt = RegExp(r'^[>›❯_$▌█\s]+$');- static final _blockStart = RegExp(r'^(?:[>›❯•●◦]|[-*]\s|\d+\.\s)');- static final _recap = RegExp(r'^(?:[—–-]\s*)?Conversation recap$');- static final _worked = RegExp(r'^[—–-]\s*Worked for \d');- static final _inputHint = RegExp(r'^Ask (Codex|Claude) to ');- static final _indented = RegExp(r'^\s');-- static SearchOutputPreview capture(Terminal? terminal) {- if (terminal == null) return const SearchOutputPreview('');- final lines = terminal.buffer.lines;- final logical = <String>[];- final start = math.max(0, lines.length - scannedLines);- for (var row = start; row < lines.length; row++) {- // getText works in terminal cells, so a wide Unicode character is not- // split as it could be by slicing an arbitrary UTF-16 string.- final text = lines[row]- .getText(0, shownColumns)- .replaceAll(_controls, '')- .trimRight();- if (lines[row].isWrapped && logical.isNotEmpty) {- logical[logical.length - 1] += text;- } else {- logical.add(text);- }- }- final blocks = <String>[];- var paragraph = '';- void finish() {- if (paragraph.isNotEmpty) blocks.add(paragraph);- paragraph = '';- }-- for (final line in logical) {- final text = line.replaceAll(_rules, '').trim().replaceAll(_frame, '');- if (text.isEmpty ||- _prompt.hasMatch(text) ||- _recap.hasMatch(text) ||- _worked.hasMatch(text) ||- _inputHint.hasMatch(text)) {- finish();- continue;- }- if (_blockStart.hasMatch(text) || !_indented.hasMatch(line)) {- finish();- }- paragraph = paragraph.isEmpty ? text : '$paragraph $text';- }- finish();- // Show complete recent paragraphs, not the bottom of a wrapped terminal- // viewport. This is a reading excerpt, never a second terminal renderer.- final recentBlocks = blocks.skip(math.max(0, blocks.length - 3)).toList();- while (recentBlocks.length > 1 &&- recentBlocks.join('\n\n').runes.length > shownCharacters) {- recentBlocks.removeAt(0);- }- final recent = recentBlocks.join('\n\n');- final characters = recent.runes.toList();- return SearchOutputPreview(- characters.length <= shownCharacters- ? recent- : '${String.fromCharCodes(characters.take(shownCharacters)).trimRight()}…',- );- }-}diff --git a/desktop/lib/widgets/machine_rail.dart b/desktop/lib/widgets/machine_rail.dartindex 5599fad51..43c3e2019 100644--- a/desktop/lib/widgets/machine_rail.dart+++ b/desktop/lib/widgets/machine_rail.dart@@ -398,7 +398,7 @@ class _CaptionActions extends StatelessWidget {AppIconButton(icon: LucideIcons.plus300,size: 16,- tooltip: 'New agent here…',+ tooltip: 'Create Agent here…',onPressed: onNewAgent,),],@@ -408,7 +408,7 @@ class _CaptionActions extends StatelessWidget {class _MachineNode extends StatefulWidget {/// Whether the guide line arrives from a row above. False on the first- /// machine, where a line dangling up towards the New agent button would point+ /// machine, where a line dangling up towards the Create Agent button would point/// at nothing.final bool isFirst;@@ -748,7 +748,7 @@ class _MachineNodeState extends State<_MachineNode> {),),// Both of this machine's actions, on this machine's own- // row. The `+` is what the rail's big New agent button+ // row. The `+` is what the rail's big Create Agent button// used to be: that button had to guess which machine you// meant, and this one cannot be wrong about it._CaptionActions(@@ -1679,7 +1679,7 @@ class _AgentLoadError extends StatelessWidget {}}-/// "New agent…", drawn as the row it would create.+/// "Create Agent…", drawn as the row it would create.////// The rail is a LIST, and every framed control put in it has read as a foreign object — there is/// nothing else in this column with a border or a fill of its own. So this is not a button placed in a@@ -1720,7 +1720,7 @@ class _NewAgentRow extends StatelessWidget {// one. A different indent here would bend the trunk at the last branch.padding: const EdgeInsets.only(left: 28),child: SidebarItem(- label: 'New agent…',+ label: 'Create Agent…',// Dimmed rather than a colour of its own: this row is a placeholder until it is reached for, and// the hover state SidebarItem already owns is what says it is live.dimmed: true,diff --git a/desktop/lib/widgets/new_agent_dialog.dart b/desktop/lib/widgets/new_agent_dialog.dartindex dca82a741..38797aafa 100644--- a/desktop/lib/widgets/new_agent_dialog.dart+++ b/desktop/lib/widgets/new_agent_dialog.dart@@ -33,7 +33,7 @@ const Map<String, String> kEngineBypassPermissionFlag = {enum NewAgentDialogResult { created, findExisting }-/// Opens the New agent dialog for [machineId].+/// Opens the Create Agent dialog for [machineId].////// [source] names the door it was opened by — `machine_row`, `rail_empty`,/// `pane_empty` or `shortcut` — and is required rather than defaulted, so a@@ -320,7 +320,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {_codexProfilesBusy;/// [Machine.displayName], not `name` — the latter is nullable and a machine- /// that never got one would title the dialog "New agent on null".+ /// that never got one would title the dialog "Create Agent on null".String get _machineName =>widget.notifier.stateOf(_machineId)?.machine.displayName ??'this machine';@@ -484,9 +484,9 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {return AlertDialog(title: Text(switch (widget.split?.axis) {- PaneResizeAxis.x => 'New agent to the right',- PaneResizeAxis.y => 'New agent below',- null => 'New agent',+ PaneResizeAxis.x => 'Create Agent to the right',+ PaneResizeAxis.y => 'Create Agent below',+ null => 'Create Agent',}),titleTextStyle: Theme.of(context).textTheme.titleMedium,content: SizedBox(@@ -556,6 +556,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {label: const Text('Find existing agent…'),),FilledButton(+ key: const ValueKey('create-agent-submit'),focusNode: _actionFocus,onPressed: canCreate ? _submit : null,style: FilledButton.styleFrom(@@ -587,7 +588,7 @@ class _NewAgentDialogState extends State<_NewAgentDialog> {_confirmationPending? 'Check status': _machineIsThisComputer- ? 'Create agent'+ ? 'Create Agent': 'Create on $_machineName',),),diff --git a/desktop/lib/widgets/pane_grid.dart b/desktop/lib/widgets/pane_grid.dartindex 89b5cd3f2..175de7e28 100644--- a/desktop/lib/widgets/pane_grid.dart+++ b/desktop/lib/widgets/pane_grid.dart@@ -1890,7 +1890,7 @@ class _EmptyGrid extends StatelessWidget {FilledButton.icon(key: const ValueKey('empty-grid-new-agent'),icon: const Icon(Icons.add, size: 16),- label: const Text('New agent'),+ label: const Text('Create Agent'),onPressed: () => showNewAgentDialog(context,notifier,diff --git a/desktop/lib/widgets/swarm_attention.dart b/desktop/lib/widgets/swarm_attention.dartindex 729c7aa27..7b5895265 100644--- a/desktop/lib/widgets/swarm_attention.dart+++ b/desktop/lib/widgets/swarm_attention.dart@@ -1,3 +1,5 @@+import 'swarm_search_field.dart';+import 'package:flutter/material.dart';import '../shared/widgets/app_dialog.dart';@@ -5,7 +7,6 @@ import '../state/app_state.dart';import '../state/swarm_attention.dart';import '../state/swarm_navigation.dart';import 'engine_identity.dart';-import 'swarm_welcome.dart';Future<SwarmAttentionEntry?> showSwarmAttention(BuildContext context,diff --git a/desktop/lib/widgets/swarm_dialogs.dart b/desktop/lib/widgets/swarm_dialogs.dartindex e5d3d0e8c..4c39c46ee 100644--- a/desktop/lib/widgets/swarm_dialogs.dart+++ b/desktop/lib/widgets/swarm_dialogs.dart@@ -30,7 +30,7 @@ class _RenameSwarmDialogState extends State<_RenameSwarmDialog> {late final _text = TextEditingController(text: widget.name,)..selection = TextSelection(baseOffset: 0, extentOffset: widget.name.length);- final _focus = FocusNode(debugLabel: 'Rename swarm name');+ final _focus = FocusNode(debugLabel: 'Rename tab name');@overridevoid initState() {@@ -51,7 +51,7 @@ class _RenameSwarmDialogState extends State<_RenameSwarmDialog> {@overrideWidget build(BuildContext context) => AlertDialog(- title: const Text('Rename swarm'),+ title: const Text('Rename tab'),content: SizedBox(width: 360,child: TextField(diff --git a/desktop/lib/widgets/swarm_inline_search.dart b/desktop/lib/widgets/swarm_inline_search.dartindex 96b5ec609..a481e1d50 100644--- a/desktop/lib/widgets/swarm_inline_search.dart+++ b/desktop/lib/widgets/swarm_inline_search.dart@@ -12,7 +12,7 @@ import '../state/swarm_search.dart';import 'swarm_switcher.dart';import 'swarm_search_input.dart';-/// New swarm owns its input and caret, sharing the same Add agent results and+/// New Agent owns its input and caret, sharing the same Add agent results and/// actions as the floating button and splits.class SwarmInlineSearch extends StatefulWidget {const SwarmInlineSearch({@@ -40,7 +40,7 @@ class SwarmInlineSearch extends StatefulWidget {class _SwarmInlineSearchState extends State<SwarmInlineSearch> {final _text = TextEditingController();- final _focus = FocusNode(debugLabel: 'New swarm search');+ final _focus = FocusNode(debugLabel: 'New Agent search');final _overlay = OverlayPortalController();final _tapGroup = Object();final _catalog = SwarmSearchCatalog();@@ -54,7 +54,7 @@ class _SwarmInlineSearchState extends State<SwarmInlineSearch> {}void _focusChanged() {- // New swarm gives the field its caret immediately, but the welcome+ // New Agent gives the field its caret immediately, but the welcome// choices stay visible until a click, edit or result-navigation key.if (!_focus.hasFocus) _close();}diff --git a/desktop/lib/widgets/swarm_navigator.dart b/desktop/lib/widgets/swarm_navigator.dartdeleted file mode 100644index 3531a0f0c..000000000--- a/desktop/lib/widgets/swarm_navigator.dart+++ /dev/null@@ -1,310 +0,0 @@-import 'package:flutter/material.dart';--import '../shared/theme/app_theme.dart' as grid;-import '../state/swarm_navigation.dart';-import '../state/swarm_search.dart';-import 'engine_identity.dart';-import 'search_result_text.dart';-import 'swarm_icon.dart';-import 'swarm_switcher.dart';--/// A directory of existing places. Unlike Add agent, navigation has no output-/// preview or creation form: each group names the exact destination swarm.-class SwarmNavigator extends StatefulWidget {- const SwarmNavigator({- super.key,- required this.search,- required this.editing,- required this.focusNode,- required this.onChoose,- required this.onClose,- required this.onAdd,- required this.onNewAgent,- });-- final SwarmSearchController search;- final TextEditingController editing;- final FocusNode focusNode;- final ValueChanged<SwarmSearchSelection> onChoose;- final VoidCallback onClose, onAdd, onNewAgent;-- @override- State<SwarmNavigator> createState() => _SwarmNavigatorState();-}--class _SwarmNavigatorState extends State<SwarmNavigator> {- final _scroll = ScrollController();- final _offsets = <double>[];- double _rowHeight = 60;- bool _scheduled = false;- SwarmSearchController get search => widget.search;-- @override- void initState() {- super.initState();- search.addListener(_changed);- }-- void _changed() {- setState(() {});- _measure();- _reveal();- if (_scheduled) return;- _scheduled = true;- WidgetsBinding.instance.addPostFrameCallback((_) {- _scheduled = false;- if (mounted) _reveal();- });- }-- void _measure() {- _offsets.clear();- var offset = 8.0;- for (var i = 0; i < search.rows.length; i++) {- _offsets.add(offset);- offset += _rowHeight;- }- _offsets.add(offset);- }-- void _reveal() {- if (!_scroll.hasClients ||- search.rows.isEmpty ||- _offsets.length <= search.cursor + 1) {- return;- }- final top = _offsets[search.cursor];- final bottom = _offsets[search.cursor + 1];- final position = _scroll.position;- final next = top < position.pixels- ? top- : bottom > position.pixels + position.viewportDimension- ? bottom - position.viewportDimension- : position.pixels;- final target = next.clamp(0.0, position.maxScrollExtent);- if (position.pixels != target) _scroll.jumpTo(target);- }-- void _choose(SwarmDestination row) {- final selection = search.submit(row);- if (selection != null) widget.onChoose(selection);- }-- @override- void dispose() {- search.removeListener(_changed);- _scroll.dispose();- super.dispose();- }-- @override- Widget build(BuildContext context) {- final scale = MediaQuery.textScalerOf(context);- _rowHeight = 28 + scale.scale(14) + scale.scale(12);- _measure();- final terms = swarmQueryTerms(search.query);- return Column(- key: const ValueKey('swarm-navigator'),- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(24, 18, 12, 8),- child: Row(- children: [- Icon(- search.isCommandMode ? Icons.terminal : Icons.explore_outlined,- color: grid.AppPalette.swarmAccent,- size: 21,- ),- const SizedBox(width: 10),- Text(- search.isCommandMode ? 'Commands' : 'Navigate',- style: const TextStyle(- fontSize: 16,- fontWeight: FontWeight.w600,- color: Colors.white,- ),- ),- const Spacer(),- TextButton(- onPressed: widget.onClose,- style: TextButton.styleFrom(foregroundColor: Colors.white60),- child: const Text('esc', style: TextStyle(fontSize: 11)),- ),- ],- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(20, 0, 20, 16),- child: SwarmSearchKeys(- search: search,- editing: widget.editing,- onChoose: widget.onChoose,- onClose: widget.onClose,- onNewAgent: widget.onNewAgent,- child: TextField(- key: const ValueKey('swarm-search-input'),- controller: widget.editing,- focusNode: widget.focusNode,- autofocus: true,- onChanged: search.setQuery,- style: const TextStyle(fontSize: 16, color: Colors.white),- cursorColor: grid.AppPalette.swarmAccent,- decoration: InputDecoration(- hintText: search.hint,- hintStyle: const TextStyle(color: Colors.white54, fontSize: 16),- prefixIcon: const Icon(- Icons.search,- size: 19,- color: Colors.white54,- ),- filled: true,- fillColor: Colors.black.withValues(alpha: .15),- contentPadding: const EdgeInsets.symmetric(- horizontal: 14,- vertical: 14,- ),- enabledBorder: OutlineInputBorder(- borderRadius: BorderRadius.circular(8),- borderSide: const BorderSide(color: Colors.white12),- ),- focusedBorder: OutlineInputBorder(- borderRadius: BorderRadius.circular(8),- borderSide: BorderSide(- color: grid.AppPalette.swarmAccent.withValues(alpha: .6),- ),- ),- ),- ),- ),- ),- const Divider(height: 1, color: Colors.white12),- Expanded(- child: search.isCommandMode- ? SwarmSearchResults(- search: search,- onChoose: widget.onChoose,- onRefocus: widget.focusNode.requestFocus,- )- : search.rows.isEmpty- ? const Center(- child: Padding(- padding: EdgeInsets.all(24),- child: Text(- 'No matching open agents or swarms.\nAdd an agent to bring more work into this swarm.',- textAlign: TextAlign.center,- style: TextStyle(- color: Colors.white60,- fontSize: 14,- height: 1.6,- ),- ),- ),- )- : ListView.builder(- key: const ValueKey('swarm-navigation-locations'),- controller: _scroll,- padding: const EdgeInsets.fromLTRB(12, 8, 12, 8),- itemCount: search.rows.length,- itemExtent: _rowHeight,- itemBuilder: (context, i) {- final row = search.rows[i];- final matches = searchResultMatches(row, terms);- return SizedBox(- height: _rowHeight,- child: ListTile(- key: ValueKey(row.id),- contentPadding: EdgeInsets.only(- left: row.agentId == null ? 14 : 42,- right: 14,- ),- minTileHeight: _rowHeight,- selected: search.cursor == i,- selectedColor: Colors.white,- selectedTileColor: grid.AppPalette.swarmAccent- .withValues(alpha: .12),- hoverColor: Colors.transparent,- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(8),- ),- leading: row.agentId == null- ? const SwarmIcon(size: 21, color: Colors.white60)- : EngineMark(engine: row.engine, size: 22),- title: SearchResultText(- row.title,- matches: matches.where((m) => m.title),- style: TextStyle(- fontSize: 14,- fontWeight: row.agentId == null- ? FontWeight.w600- : FontWeight.w400,- color: Colors.white,- ),- ),- subtitle: SearchResultText(- row.detail,- matches: matches.where((m) => !m.title),- style: const TextStyle(- fontSize: 12,- color: Colors.white54,- ),- ),- trailing: row.agentId == null && row.current- ? const Text(- 'Current swarm',- style: TextStyle(- fontSize: 10,- color: Colors.white54,- ),- )- : row.current- ? const Icon(- Icons.check,- size: 16,- color: Colors.white38,- )- : search.cursor == i- ? const Icon(- Icons.keyboard_return,- size: 17,- color: Colors.white60,- )- : null,- onTap: () => _choose(row),- ),- );- },- ),- ),- if (!search.isCommandMode) ...[- const Divider(height: 1, color: Colors.white12),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),- child: Row(- children: [- TextButton(- onPressed: widget.onAdd,- key: const ValueKey('navigation-add-agent'),- style: TextButton.styleFrom(foregroundColor: Colors.white70),- child: const Text(- 'Add an agent…',- style: TextStyle(fontSize: 12),- ),- ),- const Spacer(),- TextButton(- onPressed: search.selected == null- ? null- : () => _choose(search.selected!),- style: TextButton.styleFrom(foregroundColor: Colors.white),- child: const SwarmSearchActionLabel('Go to'),- ),- const SizedBox(width: 8),- ],- ),- ),- ],- ],- );- }-}diff --git a/desktop/lib/widgets/swarm_project_agents.dart b/desktop/lib/widgets/swarm_project_agents.dartindex eb3b41adc..d7cc52e44 100644--- a/desktop/lib/widgets/swarm_project_agents.dart+++ b/desktop/lib/widgets/swarm_project_agents.dart@@ -1,9 +1,10 @@+import 'swarm_search_field.dart';+import 'package:flutter/material.dart';import '../shared/widgets/app_dialog.dart';import '../state/app_state.dart';import '../state/swarm_catalog.dart';-import 'swarm_welcome.dart';Future<SavedSwarmProject?> showSwarmProjectAgents(BuildContext context,diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dartnew file mode 100644index 000000000..d2543a6f2--- /dev/null+++ b/desktop/lib/widgets/swarm_search_field.dart@@ -0,0 +1,108 @@+import 'package:flutter/material.dart';+import 'package:flutter/services.dart';++class SwarmSearchField extends StatefulWidget {+ const SwarmSearchField({+ super.key,+ required this.onChanged,+ this.onSubmitted,+ this.onMove,+ this.autofocus = false,+ this.hintText = 'Find an agent…',+ this.controller,+ this.focusNode,+ });+ final ValueChanged<String> onChanged;+ final VoidCallback? onSubmitted;+ final ValueChanged<int>? onMove;+ final bool autofocus;+ final String hintText;+ final TextEditingController? controller;+ final FocusNode? focusNode;+ @override+ State<SwarmSearchField> createState() => _SwarmSearchFieldState();+}++class _SwarmSearchFieldState extends State<SwarmSearchField> {+ FocusNode? _ownedFocus;+ FocusNode get _focus =>+ widget.focusNode ?? (_ownedFocus ??= FocusNode(debugLabel: 'Find agent'));++ @override+ void initState() {+ super.initState();+ if (widget.autofocus) {+ WidgetsBinding.instance.addPostFrameCallback((_) {+ // The dialog veil also requests fallback focus in this frame. The+ // search field must win so the first keystroke starts searching.+ if (mounted && ModalRoute.of(context)?.isCurrent != false) {+ _focus.requestFocus();+ }+ });+ }+ }++ @override+ void dispose() {+ _ownedFocus?.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final onMove = widget.onMove;+ final onSubmitted = widget.onSubmitted;+ return CallbackShortcuts(+ bindings: {+ if (onSubmitted != null) ...{+ const SingleActivator(+ LogicalKeyboardKey.enter,+ includeRepeats: false,+ ): onSubmitted,+ const SingleActivator(+ LogicalKeyboardKey.numpadEnter,+ includeRepeats: false,+ ): onSubmitted,+ },+ if (onMove != null) ...{+ const SingleActivator(LogicalKeyboardKey.arrowDown): () => onMove(1),+ const SingleActivator(LogicalKeyboardKey.arrowUp): () => onMove(-1),+ const SingleActivator(LogicalKeyboardKey.keyN, control: true): () =>+ onMove(1),+ const SingleActivator(LogicalKeyboardKey.keyP, control: true): () =>+ onMove(-1),+ const SingleActivator(LogicalKeyboardKey.keyJ, control: true): () =>+ onMove(1),+ const SingleActivator(LogicalKeyboardKey.keyK, control: true): () =>+ onMove(-1),+ },+ },+ child: TextField(+ controller: widget.controller,+ focusNode: _focus,+ autofocus: widget.autofocus,+ onChanged: widget.onChanged,+ onSubmitted: (_) => onSubmitted?.call(),+ style: const TextStyle(fontSize: 13),+ decoration: InputDecoration(+ hintText: widget.hintText,+ prefixIcon: const Icon(Icons.search, size: 18),+ filled: true,+ fillColor: const Color(0xa6111521),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 14,+ vertical: 14,+ ),+ border: OutlineInputBorder(+ borderRadius: BorderRadius.circular(8),+ borderSide: const BorderSide(color: Colors.white24),+ ),+ enabledBorder: OutlineInputBorder(+ borderRadius: BorderRadius.circular(8),+ borderSide: const BorderSide(color: Colors.white24),+ ),+ ),+ ),+ );+ }+}diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dartindex 7e3fe35dd..fa6ad9bc2 100644--- a/desktop/lib/widgets/swarm_search_input.dart+++ b/desktop/lib/widgets/swarm_search_input.dart@@ -5,7 +5,7 @@ import '../state/swarm_search.dart';import '../state/swarm_navigation.dart';import 'swarm_switcher.dart';-/// The same editable input in the centered picker and the New swarm page.+/// The same editable input in the centered picker and the New Agent page./// Flutter owns both the caret and result navigation; native chrome only opens it.class SwarmSearchInput extends StatelessWidget {const SwarmSearchInput({@@ -69,7 +69,7 @@ class SwarmSearchInput extends StatelessWidget {cursorColor: grid.AppPalette.swarmAccent,textAlignVertical: TextAlignVertical.center,decoration: InputDecoration(- hintText: search?.hint ?? 'Search agents to add…',+ hintText: search?.hint ?? 'Find an existing agent…',hintStyle: const TextStyle(fontSize: 16, color: Colors.white60),prefixIcon: const Icon(Icons.search, size: 20, color: Colors.white60),prefixIconConstraints: const BoxConstraints(@@ -126,7 +126,7 @@ class SwarmSearchInput extends StatelessWidget {),icon: const Icon(Icons.add, size: 20),label: const Text(- 'New agent',+ 'Create Agent',style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),),),diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dartindex 6b764d8d4..d62e04691 100644--- a/desktop/lib/widgets/swarm_switcher.dart+++ b/desktop/lib/widgets/swarm_switcher.dart@@ -1,3 +1,5 @@+import 'swarm_search_field.dart';+import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -12,7 +14,6 @@ import '../state/swarm_navigation.dart';import '../state/swarm_search.dart';import 'engine_identity.dart';import 'swarm_icon.dart';-import 'swarm_welcome.dart';Future<SwarmSearchSelection?> showSwarmHistory(BuildContext context,@@ -350,236 +351,198 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {_rowHeight = swarmSearchRowHeight(scale, commands: search.isCommandMode);final selected = search.selected;final terms = swarmQueryTerms(- search.isCommandMode- ? search.query.trimLeft().substring(1)- : search.query,+ search.isCommandMode ? search.commandQuery : search.query,);return LayoutBuilder(builder: (context, constraints) {- final horizontal = constraints.maxWidth >= 600 * scale.scale(14) / 14;- final showPreview =- search.previewVisible || (search.adding && !search.isCommandMode);return Semantics(container: true,label: 'Search results',child: Column(children: [Expanded(- child: Flex(- direction: horizontal ? Axis.horizontal : Axis.vertical,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Expanded(- flex: 6,- child: search.rows.isEmpty- ? Center(- child: Text(- search.isCommandMode- ? 'No matching commands'- : search.adding && search.query.isEmpty- ? 'Choose New agent to start fresh.'- : search.adding- ? 'No matching agents'- : 'No matching results',- style: const TextStyle(- fontSize: 14,- color: Colors.white60,- ),- ),- )- : ListView.builder(- key: const ValueKey('swarm-search-result-list'),- padding: const EdgeInsets.all(8),- controller: _scroll,- itemCount: search.rows.length,- itemExtent: _rowHeight,- itemBuilder: (context, index) {- final row = search.rows[index];- final highlighted = index == search.cursor;- final canSubmit = search.canSubmit(row);- final multiSelect = search.multiSelect;- final checked =- multiSelect && search.isChecked(row);- final canToggle =- multiSelect && search.canToggle(row);- final alreadyHere = search.alreadyHere(row);- final presentation = (- row,- search.query,- highlighted,- canSubmit,- multiSelect,- checked,- canToggle,- alreadyHere,- highlighted- ? (- search.canAccept,- search.actionLabel(row),- )- : null,- _rowHeight,- scale.scale(11),- grid.AppTheme.palette.value,- );- final previous = _rowWidgets.remove(row.id);- if (previous?.presentation == presentation) {- _rowWidgets[row.id] = previous!;- return previous.child;- }- final matches = searchResultMatches(row, terms);- final tile = ListTile(- key: ValueKey(row.id),- minTileHeight: _rowHeight,- enabled: canSubmit,- selected: highlighted,- selectedColor: Colors.white,- hoverColor: Colors.transparent,- selectedTileColor: Colors.white.withValues(- alpha: .075,- ),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(6),- ),- contentPadding: const EdgeInsets.symmetric(- horizontal: 12,- ),- leading: Row(- mainAxisSize: MainAxisSize.min,- children: [- if (multiSelect) ...[- SizedBox(- width: 28,- child: Tooltip(- message: checked- ? 'Deselect ${row.title}'- : 'Select ${row.title}',- child: Checkbox(- key: ValueKey('select:${row.id}'),- value: checked,- onChanged: canToggle- ? (_) {- search.toggle(row);- widget.onRefocus();- }- : null,- activeColor:- grid.AppPalette.swarmAccent,- checkColor:- grid.AppPalette.swarmField,- ),- ),- ),- const SizedBox(width: 10),- ],- row.isCommand- ? const Icon(- Icons.keyboard_command_key,- size: 20,- color: Colors.white60,- )- : row.agentId != null- ? EngineMark(- engine: row.engine,- size: 22,- enabled: canSubmit,- )- : const SwarmIcon(- size: 22,- color: Colors.white60,- ),- ],+ child: search.rows.isEmpty+ ? Center(+ child: Text(+ search.isCommandMode+ ? 'No matching commands'+ : search.adding && search.query.isEmpty+ ? 'Choose Create Agent to start fresh.'+ : search.adding+ ? 'No matching agents'+ : 'No matching results',+ style: const TextStyle(+ fontSize: 14,+ color: Colors.white60,+ ),+ ),+ )+ : ListView.builder(+ key: const ValueKey('swarm-search-result-list'),+ padding: const EdgeInsets.all(8),+ controller: _scroll,+ itemCount: search.rows.length,+ itemExtent: _rowHeight,+ itemBuilder: (context, index) {+ final row = search.rows[index];+ final highlighted = index == search.cursor;+ final canSubmit = search.canSubmit(row);+ final multiSelect = search.multiSelect;+ final checked = multiSelect && search.isChecked(row);+ final canToggle =+ multiSelect && search.canToggle(row);+ final alreadyHere = search.alreadyHere(row);+ final presentation = (+ row,+ search.query,+ highlighted,+ canSubmit,+ multiSelect,+ checked,+ canToggle,+ alreadyHere,+ highlighted+ ? (search.canAccept, search.actionLabel(row))+ : null,+ _rowHeight,+ scale.scale(11),+ grid.AppTheme.palette.value,+ );+ final previous = _rowWidgets.remove(row.id);+ if (previous?.presentation == presentation) {+ _rowWidgets[row.id] = previous!;+ return previous.child;+ }+ final matches = searchResultMatches(row, terms);+ final tile = ListTile(+ key: ValueKey(row.id),+ minTileHeight: _rowHeight,+ enabled: canSubmit,+ selected: highlighted,+ selectedColor: Colors.white,+ hoverColor: Colors.transparent,+ selectedTileColor: Colors.white.withValues(+ alpha: .075,+ ),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(6),+ ),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 12,+ ),+ leading: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ if (multiSelect) ...[+ SizedBox(+ width: 28,+ child: Tooltip(+ message: checked+ ? 'Deselect ${row.title}'+ : 'Select ${row.title}',+ child: Checkbox(+ key: ValueKey('select:${row.id}'),+ value: checked,+ onChanged: canToggle+ ? (_) {+ search.toggle(row);+ widget.onRefocus();+ }+ : null,+ activeColor:+ grid.AppPalette.swarmAccent,+ checkColor: grid.AppPalette.swarmField,+ ),+ ),),- title: SearchResultText(- row.title,+ const SizedBox(width: 10),+ ],+ row.isCommand+ ? const Icon(+ Icons.keyboard_command_key,+ size: 20,+ color: Colors.white60,+ )+ : row.agentId != null+ ? EngineMark(+ engine: row.engine,+ size: 22,+ enabled: canSubmit,+ )+ : const SwarmIcon(+ size: 22,+ color: Colors.white60,+ ),+ ],+ ),+ title: SearchResultText(+ row.title,+ matches: matches.where((match) => match.title),+ style: const TextStyle(fontSize: 14),+ ),+ subtitle: row.isCommand+ ? null+ : SearchResultText(+ row.detail,matches: matches.where(- (match) => match.title,+ (match) => !match.title,+ ),+ style: const TextStyle(+ fontSize: 12,+ color: Colors.white60,),- style: const TextStyle(fontSize: 14),),- subtitle: row.isCommand- ? null- : SearchResultText(- row.detail,- matches: matches.where(- (match) => !match.title,- ),- style: const TextStyle(- fontSize: 12,- color: Colors.white60,- ),- ),- trailing: alreadyHere- ? const Text(- 'In this swarm',- style: TextStyle(- fontSize: 11,- color: Colors.white38,- ),- )- : search.adding && highlighted- ? ConstrainedBox(- constraints: BoxConstraints(- maxWidth:- 170 * scale.scale(11) / 11,- ),- child: TextButton(- key: const ValueKey(- 'swarm-row-action',- ),- onPressed: search.canAccept- ? _submit- : null,- style: TextButton.styleFrom(- foregroundColor: Colors.white,- ),- child: SwarmSearchActionLabel(- search.actionLabel(row),- ),- ),- )- : row.shortcut == null- ? null- : Text(- row.shortcut!,- style: const TextStyle(- fontSize: 12,- color: Colors.white60,- ),- ),- onTap: canSubmit- ? () => search.hasSelection- ? search.toggle(row)- : _submit(row)- : null,- );- _rowWidgets[row.id] = (- presentation: presentation,- child: tile,- );- if (_rowWidgets.length > 48) {- _rowWidgets.remove(_rowWidgets.keys.first);- }- return tile;- },- ),- ),- if (showPreview) ...[- if (horizontal)- const VerticalDivider(width: 1, color: Colors.white12)- else- const Divider(height: 1, color: Colors.white12),- Expanded(- flex: 4,- child: _OutputPreview(- row: selected,- text: search.preview?.text ?? '',- members: search.previewMembers,- ),+ trailing: alreadyHere+ ? const Text(+ 'In this tab',+ style: TextStyle(+ fontSize: 11,+ color: Colors.white38,+ ),+ )+ : search.adding && highlighted+ ? ConstrainedBox(+ constraints: BoxConstraints(+ maxWidth: 170 * scale.scale(11) / 11,+ ),+ child: TextButton(+ key: const ValueKey('swarm-row-action'),+ onPressed: search.canAccept+ ? _submit+ : null,+ style: TextButton.styleFrom(+ foregroundColor: Colors.white,+ ),+ child: SwarmSearchActionLabel(+ search.actionLabel(row),+ ),+ ),+ )+ : row.shortcut == null+ ? null+ : Text(+ row.shortcut!,+ style: const TextStyle(+ fontSize: 12,+ color: Colors.white60,+ ),+ ),+ onTap: canSubmit+ ? () => search.hasSelection+ ? search.toggle(row)+ : _submit(row)+ : null,+ );+ _rowWidgets[row.id] = (+ presentation: presentation,+ child: tile,+ );+ if (_rowWidgets.length > 48) {+ _rowWidgets.remove(_rowWidgets.keys.first);+ }+ return tile;+ },),- ],- ],- ),),if (search.hasSelection) ...[const Divider(height: 1, color: Colors.white12),@@ -670,8 +633,8 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {: selected!.isGroup &&selected.members.length >AppNotifier.maxPanes- ? 'A swarm supports up to ${AppNotifier.maxPanes} agents'- : 'No room to open this ${selected.isSwarm || selected.isGroup ? 'swarm' : 'agent'}',+ ? 'A tab supports up to ${AppNotifier.maxPanes} agents'+ : 'No room to open this ${selected.isSwarm || selected.isGroup ? 'group' : 'agent'}',maxLines: 1,overflow: TextOverflow.ellipsis,style: const TextStyle(@@ -691,7 +654,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {foregroundColor: Colors.white70,),child: const SwarmSearchActionLabel(- 'Add to this swarm',+ 'Add to this tab',command: 'picker.add_here',),),@@ -771,154 +734,3 @@ class SwarmSearchActionLabel extends StatelessWidget {);}}--class _OutputPreview extends StatelessWidget {- const _OutputPreview({- required this.row,- required this.text,- required this.members,- });- final SwarmDestination? row;- final String text;- final List<SwarmDestination> members;-- @override- Widget build(BuildContext context) {- final row = this.row;- if (row == null) {- return const Center(- key: ValueKey('swarm-search-preview'),- child: Padding(- padding: EdgeInsets.all(24),- child: Text(- 'Choose an agent to preview its work.',- textAlign: TextAlign.center,- style: TextStyle(color: Colors.white38, fontSize: 13, height: 1.5),- ),- ),- );- }- return Container(- key: const ValueKey('swarm-search-preview'),- color: Colors.black.withValues(alpha: .10),- child: SingleChildScrollView(- primary: false,- padding: const EdgeInsets.all(24),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- if (row.agentId == null)- const SwarmIcon(size: 24, color: Colors.white70)- else- EngineMark(engine: row.engine, size: 24),- const SizedBox(width: 12),- Expanded(- child: Text(- row.title,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: const TextStyle(- fontSize: 16,- height: 1.35,- fontWeight: FontWeight.w600,- color: Colors.white,- ),- ),- ),- ],- ),- const SizedBox(height: 12),- Text(- row.detail,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: const TextStyle(- fontSize: 12,- height: 1.5,- color: Colors.white54,- ),- ),- const SizedBox(height: 24),- Text(- row.agentId != null- ? 'Recent output'- : row.isProject- ? 'Agents in this project'- : row.isMachine- ? 'Agents on this machine'- : 'Agents in this swarm',- style: const TextStyle(- fontSize: 11,- fontWeight: FontWeight.w500,- color: Colors.white54,- ),- ),- const SizedBox(height: 10),- if (row.agentId != null)- Container(- width: double.infinity,- padding: const EdgeInsets.all(16),- decoration: BoxDecoration(- color: Colors.white.withValues(alpha: .035),- borderRadius: BorderRadius.circular(8),- border: Border.all(- color: Colors.white.withValues(alpha: .06),- ),- ),- child: Text(- text.isEmpty ? 'No recent output yet.' : text,- maxLines: 12,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontFamily: grid.AppFont.sans,- fontFamilyFallback: grid.AppFont.sansFallback,- fontSize: 13,- height: 1.6,- color: text.isEmpty- ? Colors.white54- : Colors.white.withValues(alpha: .82),- ),- ),- )- else if (members.isEmpty)- const Text(- 'No agents yet.',- style: TextStyle(fontSize: 13, color: Colors.white54),- )- else ...[- for (final member in members.take(5))- Padding(- padding: const EdgeInsets.symmetric(vertical: 8),- child: Row(- children: [- EngineMark(engine: member.engine, size: 18),- const SizedBox(width: 10),- Expanded(- child: Text(- member.title,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(- fontSize: 13,- color: Colors.white70,- ),- ),- ),- ],- ),- ),- if (members.length > 5)- Text(- '+ ${members.length - 5} more',- style: const TextStyle(fontSize: 12, color: Colors.white54),- ),- ],- ],- ),- ),- );- }-}diff --git a/desktop/lib/widgets/swarm_welcome.dart b/desktop/lib/widgets/swarm_welcome.dartindex 7f3877e3f..25a9491d1 100644--- a/desktop/lib/widgets/swarm_welcome.dart+++ b/desktop/lib/widgets/swarm_welcome.dart@@ -1,47 +1,29 @@import 'package:flutter/material.dart';-import 'package:flutter/services.dart';import '../shared/theme/app_theme.dart' as grid;-import '../shared/widgets/skeleton.dart';import '../state/app_state.dart';import '../state/swarm_catalog.dart';-import 'engine_identity.dart';-import 'swarm_icon.dart';-import 'welcome_workspace_preview.dart';class SwarmWelcome extends StatefulWidget {const SwarmWelcome({super.key,required this.notifier,- required this.projects,required this.onNewAgent,required this.searchField,- required this.onAddProject,required this.onLinkMachine,- required this.onMachine,- required this.onProject,this.onChooseFirstFolder,- this.onCloneRepository,- this.onAgent,- this.onProjectAgents,});final AppNotifier notifier;- final List<SavedSwarmProject> projects;- final VoidCallback onNewAgent, onAddProject, onLinkMachine;- final VoidCallback? onChooseFirstFolder, onCloneRepository;+ final VoidCallback onNewAgent, onLinkMachine;+ final VoidCallback? onChooseFirstFolder;final Widget searchField;- final ValueChanged<MachineState> onMachine;- final ValueChanged<SwarmProjectGroup> onProject;- final ValueChanged<SwarmAgentRef>? onAgent;- final ValueChanged<SwarmProjectGroup>? onProjectAgents;@overrideState<SwarmWelcome> createState() => _SwarmWelcomeState();}-/// Every empty swarm uses this start surface. Available work, not whether the-/// user has visited another tab, determines the useful next action.+/// First launch and every empty tab offer the same two entry points.class _SwarmWelcomeState extends State<SwarmWelcome> {bool _reconnecting = false;@@ -58,36 +40,12 @@ class _SwarmWelcomeState extends State<SwarmWelcome> {@overrideWidget build(BuildContext context) {grid.AppTheme.watch(context);- final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;final app = widget.notifier;- final groups = swarmProjects(app, widget.projects);bool ready(MachineState machine) =>!machine.needsLink && machine.nodeOnline != false;- final retained = {- for (final pane in app.allPanes)- if (pane.agentId != null) (pane.machineId, pane.agentId!),- };- final agents =- swarmAgents(app)- .where(- (entry) =>- entry.agent.terminalAvailable ||- retained.contains((entry.machineId, entry.agent.id)),- )- .toList()- ..sort((a, b) {- final available =- (ready(b.machine) ? 1 : 0) - (ready(a.machine) ? 1 : 0);- if (available != 0) return available;- if (a.machine.isLocalMachine != b.machine.isLocalMachine) {- return a.machine.isLocalMachine ? -1 : 1;- }- return a.agent.name.toLowerCase().compareTo(- b.agent.name.toLowerCase(),- );- });final existing =- (agents.isNotEmpty || retained.isNotEmpty) && widget.onAgent != null;+ app.allPanes.any((pane) => pane.agentId != null) ||+ swarmAgents(app).any((entry) => entry.agent.terminalAvailable);final local = app.machineStates.values.where((machine) => machine.isLocalMachine && ready(machine)).firstOrNull;@@ -106,571 +64,217 @@ class _SwarmWelcomeState extends State<SwarmWelcome> {app.machineStates.values.every((machine) => machine.needsLink);final chooseFolder =!existing && local != null && widget.onChooseFirstFolder != null;- final waiting = !canCreate && finding;-- final primary = KeyedSubtree(- // Discovery can finish after the first autofocus attempt. Give the- // newly enabled action its first attempt in the welcome's own scope;- // an explicit focus elsewhere in that scope still takes precedence.- key: ValueKey(waiting),- child: FilledButton.icon(- key: const ValueKey('swarm-start-primary'),- autofocus: !existing && !waiting,- onPressed: chooseFolder- ? widget.onChooseFirstFolder- : canCreate- ? widget.onNewAgent- : finding- ? null- : needsLink- ? widget.onLinkMachine- : _reconnect,- icon: Icon(- chooseFolder- ? Icons.folder_open_outlined- : canCreate- ? Icons.add- : Icons.computer_outlined,- size: 18,- ),- label: Text(- chooseFolder- ? 'Choose folder…'- : canCreate- ? 'New agent'- : finding- ? 'Finding your computers…'- : needsLink- ? 'Link a machine'- : 'Reconnect',- ),- style: FilledButton.styleFrom(- minimumSize: const Size(140, 44),- backgroundColor: grid.AppPalette.swarmAccent,- foregroundColor: grid.AppPalette.swarmTabBar,- ),- ),+ final find = _AgentEntryCard(+ key: const ValueKey('welcome-find-agent'),+ icon: Icons.search_rounded,+ title: 'Find an agent',+ description:+ 'Pick up where you left off. Search by agent, machine, or project.',+ action: widget.searchField,);-- Widget intro() => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- existing ? 'Start a swarm' : 'Start with one agent',- style: const TextStyle(- fontSize: 32,- height: 1.15,- fontWeight: FontWeight.w600,- letterSpacing: -.7,- color: Colors.white,- ),- ),- const SizedBox(height: 12),- Text(- existing ? 'Start with one agent. Add more whenever you need them.' : 'Work with Codex, Claude Code, and other agents side by side. Start in a folder you already use.',- style: const TextStyle(- fontSize: 14,- height: 1.55,- color: Colors.white70,- ),- ),- if (!existing) ...[- const SizedBox(height: 24),- Wrap(- spacing: 12,- runSpacing: 8,- crossAxisAlignment: WrapCrossAlignment.center,- children: [- primary,- if (local != null && widget.onCloneRepository != null)- TextButton(- key: const ValueKey('swarm-start-clone'),- onPressed: widget.onCloneRepository,- style: TextButton.styleFrom(foregroundColor: Colors.white70),- child: const Text('Clone repository…'),- ),- ],- ),- const SizedBox(height: 12),- Text(- canCreate- ? 'Choose a folder → Pick an agent → Give it a task'+ final create = _AgentEntryCard(+ key: const ValueKey('welcome-create-agent'),+ icon: Icons.add_rounded,+ title: 'Create a new agent',+ description:+ 'Start fresh. Choose an agent, a machine, and a working folder.',+ action: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ mainAxisSize: MainAxisSize.min,+ children: [+ FilledButton.icon(+ key: const ValueKey('swarm-start-primary'),+ onPressed: chooseFolder+ ? widget.onChooseFirstFolder+ : canCreate+ ? widget.onNewAgent: finding- ? 'Looking for your computers and existing agents…'+ ? null: needsLink- ? 'Connect a computer to start or bring in existing work.'- : 'Your computers are offline. Reconnect to load your agents.',- style: const TextStyle(- fontSize: 12,- height: 1.5,- color: Colors.white60,+ ? widget.onLinkMachine+ : _reconnect,+ icon: Icon(+ canCreate ? Icons.add : Icons.computer_outlined,+ size: 20,+ ),+ label: Text(+ canCreate+ ? 'Create Agent'+ : finding+ ? 'Finding your computers…'+ : needsLink+ ? 'Link a machine'+ : 'Reconnect',+ ),+ style: FilledButton.styleFrom(+ minimumSize: const Size(0, 58),+ padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18),+ backgroundColor: grid.AppPalette.swarmAccent,+ foregroundColor: grid.AppPalette.swarmTabBar,+ textStyle: TextStyle(+ fontFamily: grid.AppFont.sans,+ fontFamilyFallback: grid.AppFont.sansFallback,+ fontSize: 16,+ fontWeight: FontWeight.w600,+ ),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(12),+ ),),),+ if (!canCreate && !finding) ...[+ const SizedBox(height: 12),+ Text(+ needsLink+ ? 'Connect a computer to create your first agent.'+ : 'Your computers are offline. Reconnect to create an agent.',+ style: const TextStyle(+ fontSize: 12,+ height: 1.5,+ color: Colors.white60,+ ),+ ),+ ],],- ],- );-- const example = Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- 'Work side by side · Example',- style: TextStyle(- fontSize: 12,- fontWeight: FontWeight.w600,- color: Colors.white70,- ),- ),- SizedBox(height: 10),- WelcomeWorkspacePreview(),- SizedBox(height: 10),- Text(- 'A swarm is a tab of agents. Use + to add another when you’re ready.',- style: TextStyle(fontSize: 12, height: 1.5, color: Colors.white60),- ),- ],+ ),);return FocusScope(- // A tab can become empty while a dialog is open. Its new autofocus- // controls must not take keyboard input from that dialog.+ // An empty tab must not take keyboard input from an open dialog.canRequestFocus: ModalRoute.isCurrentOf(context) != false,child: LayoutBuilder(- builder: (context, constraints) => SingleChildScrollView(- child: ConstrainedBox(- constraints: BoxConstraints(minHeight: constraints.maxHeight),- child: Center(- child: Container(- constraints: const BoxConstraints(maxWidth: 1040),- padding: EdgeInsets.fromLTRB(- constraints.maxWidth < 700 ? 24 : 48,- 36,- constraints.maxWidth < 700 ? 24 : 48,- 70,+ builder: (context, constraints) {+ final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;+ final padding = constraints.maxWidth < 600 ? 24.0 : 48.0;+ return SingleChildScrollView(+ key: const ValueKey('swarm-welcome-scroll'),+ child: ConstrainedBox(+ constraints: BoxConstraints(minHeight: constraints.maxHeight),+ child: Padding(+ padding: EdgeInsets.symmetric(+ horizontal: padding,+ vertical: 48,),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- if (existing) ...[- intro(),- const SizedBox(height: 24),- LayoutBuilder(- builder: (context, size) =>- size.maxWidth < 620 * textScale- ? Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- widget.searchField,- const SizedBox(height: 12),- primary,- ],- )- : Row(- children: [- Expanded(child: widget.searchField),- const SizedBox(width: 12),- primary,- ],- ),- ),- const SizedBox(height: 18),- if (agents.isNotEmpty)- _Surface(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const Padding(- padding: EdgeInsets.fromLTRB(12, 8, 12, 4),- child: Text(- 'Add your first agent',- style: TextStyle(- fontSize: 13,- fontWeight: FontWeight.w600,- ),- ),- ),- for (final entry in agents.take(3))- ListTile(- key: ValueKey(- 'welcome-agent:${entry.machineId}:${entry.agent.id}',- ),- leading: EngineMark(- engine: entry.agent.engine,- size: 22,- ),- title: Text(- entry.agent.name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(fontSize: 14),- ),- subtitle: Text(- [- entry.machine.machine.displayName,- entry.project?.name,- if (!ready(entry.machine))- entry.machine.needsLink- ? 'Link required'- : 'Offline',- ].whereType<String>().join(' · '),- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(- fontSize: 12,- color: Colors.white60,- ),- ),- trailing: const Icon(- Icons.add,- size: 17,- color: Colors.white60,- ),- onTap: () => widget.onAgent!(entry),- ),- ],+ child: Align(+ alignment: Alignment.topCenter,+ child: ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 1040),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const Text(+ 'New Agent',+ key: ValueKey('welcome-title'),+ style: TextStyle(+ fontSize: 32,+ height: 1.2,+ fontWeight: FontWeight.w600,+ color: Colors.white,),),- ] else- LayoutBuilder(- builder: (context, size) =>- size.maxWidth >= 720 * textScale- ? Row(- children: [- Expanded(flex: 6, child: intro()),- const SizedBox(width: 40),- const Expanded(flex: 5, child: example),- ],- )- : Column(- crossAxisAlignment: CrossAxisAlignment.start,+ const SizedBox(height: 12),+ const Text(+ 'Resume existing work or start something new.',+ style: TextStyle(+ fontSize: 15,+ height: 1.5,+ color: Colors.white70,+ ),+ ),+ const SizedBox(height: 32),+ LayoutBuilder(+ builder: (context, size) {+ if (size.maxWidth < 840 * textScale) {+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,children: [- intro(),- const SizedBox(height: 24),- example,+ find,+ const SizedBox(height: 20),+ create,],- ),- ),- const SizedBox(height: 24),- const Padding(- padding: EdgeInsets.only(bottom: 12),- child: Text(- 'Or start with a machine or project',- style: TextStyle(fontSize: 13, color: Colors.white70),- ),+ );+ }+ return Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Expanded(child: find),+ const SizedBox(width: 24),+ Expanded(child: create),+ ],+ );+ },+ ),+ ],),- _catalog(app, groups),- ],+ ),),),),- ),- ),+ );+ },),);}-- Widget _project(SwarmProjectGroup group) => _StarterRow(- name: group.name,- count: group.agents.length,- onTap: () => widget.onProject(group),- onManage: widget.onProjectAgents == null- ? null- : () => widget.onProjectAgents!(group),- );-- Widget _catalog(AppNotifier app, List<SwarmProjectGroup> groups) => _Surface(- child: LayoutBuilder(- builder: (context, size) {- final machines = _section(- 'Machines',- 'Link machine',- widget.onLinkMachine,- [- if (app.machinesLoading && app.machineStates.isEmpty)- const SkeletonList(rows: 3),- for (final machine in app.machineStates.values)- _StarterRow(- name: machine.machine.displayName,- note: machine.needsLink- ? 'Link required'- : machine.nodeOnline == false- ? 'Offline'- : machine.isLocalMachine- ? 'This computer'- : null,- count: machine.agents.length,- onTap: () => widget.onMachine(machine),- ),- if (!app.machinesLoading && app.machineStates.isEmpty)- const Padding(- padding: EdgeInsets.all(12),- child: Text(- 'Link a computer to find its agents.',- style: TextStyle(fontSize: 12, color: Colors.white60),- ),- ),- ],- );- final projects = _section(- 'Projects',- 'Add project',- widget.onAddProject,- [- for (final group in groups) _project(group),- if (groups.isEmpty)- const Padding(- padding: EdgeInsets.all(12),- child: Text(- 'Save a working folder for quick access.',- style: TextStyle(fontSize: 12, color: Colors.white60),- ),- ),- ],- );- final textScale = MediaQuery.textScalerOf(context).scale(14) / 14;- return size.maxWidth < 570 * textScale- ? Column(children: [machines, const SizedBox(height: 24), projects])- : Row(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Expanded(child: machines),- const SizedBox(width: 28),- Expanded(child: projects),- ],- );- },- ),- );-- Widget _section(- String title,- String action,- VoidCallback onAction,- List<Widget> children,- ) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.symmetric(horizontal: 12),- child: Row(- children: [- Expanded(- child: Text(- title,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(- fontSize: 13,- fontWeight: FontWeight.w600,- ),- ),- ),- TextButton(- onPressed: onAction,- style: TextButton.styleFrom(foregroundColor: Colors.white70),- child: Text(action, style: const TextStyle(fontSize: 12)),- ),- ],- ),- ),- ...children,- ],- );}-class SwarmSearchField extends StatefulWidget {- const SwarmSearchField({+class _AgentEntryCard extends StatelessWidget {+ const _AgentEntryCard({super.key,- required this.onChanged,- this.onSubmitted,- this.onMove,- this.autofocus = false,- this.hintText = 'Find an agent…',- this.controller,- this.focusNode,+ required this.icon,+ required this.title,+ required this.description,+ required this.action,});- final ValueChanged<String> onChanged;- final VoidCallback? onSubmitted;- final ValueChanged<int>? onMove;- final bool autofocus;- final String hintText;- final TextEditingController? controller;- final FocusNode? focusNode;- @override- State<SwarmSearchField> createState() => _SwarmSearchFieldState();-}--class _SwarmSearchFieldState extends State<SwarmSearchField> {- FocusNode? _ownedFocus;- FocusNode get _focus =>- widget.focusNode ?? (_ownedFocus ??= FocusNode(debugLabel: 'Find agent'));-- @override- void initState() {- super.initState();- if (widget.autofocus) {- WidgetsBinding.instance.addPostFrameCallback((_) {- // The dialog veil also requests fallback focus in this frame. The- // search field must win so the first keystroke starts searching.- if (mounted && ModalRoute.of(context)?.isCurrent != false) {- _focus.requestFocus();- }- });- }- }- @override- void dispose() {- _ownedFocus?.dispose();- super.dispose();- }+ final IconData icon;+ final String title, description;+ final Widget action;@override- Widget build(BuildContext context) {- final onMove = widget.onMove;- final onSubmitted = widget.onSubmitted;- return CallbackShortcuts(- bindings: {- if (onSubmitted != null) ...{- const SingleActivator(- LogicalKeyboardKey.enter,- includeRepeats: false,- ): onSubmitted,- const SingleActivator(- LogicalKeyboardKey.numpadEnter,- includeRepeats: false,- ): onSubmitted,- },- if (onMove != null) ...{- const SingleActivator(LogicalKeyboardKey.arrowDown): () => onMove(1),- const SingleActivator(LogicalKeyboardKey.arrowUp): () => onMove(-1),- const SingleActivator(LogicalKeyboardKey.keyN, control: true): () =>- onMove(1),- const SingleActivator(LogicalKeyboardKey.keyP, control: true): () =>- onMove(-1),- const SingleActivator(LogicalKeyboardKey.keyJ, control: true): () =>- onMove(1),- const SingleActivator(LogicalKeyboardKey.keyK, control: true): () =>- onMove(-1),- },- },- child: TextField(- controller: widget.controller,- focusNode: _focus,- autofocus: widget.autofocus,- onChanged: widget.onChanged,- onSubmitted: (_) => onSubmitted?.call(),- style: const TextStyle(fontSize: 13),- decoration: InputDecoration(- hintText: widget.hintText,- prefixIcon: const Icon(Icons.search, size: 18),- filled: true,- fillColor: const Color(0xa6111521),- contentPadding: const EdgeInsets.symmetric(- horizontal: 14,- vertical: 14,- ),- border: OutlineInputBorder(- borderRadius: BorderRadius.circular(8),- borderSide: const BorderSide(color: Colors.white24),+ Widget build(BuildContext context) => Container(+ constraints: const BoxConstraints(minHeight: 320),+ padding: const EdgeInsets.all(28),+ decoration: BoxDecoration(+ color: grid.AppPalette.swarmSearchSurface.withValues(alpha: .94),+ borderRadius: BorderRadius.circular(24),+ border: Border.all(color: Colors.white.withValues(alpha: .16)),+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Container(+ width: 44,+ height: 44,+ decoration: BoxDecoration(+ color: grid.AppPalette.swarmAccent.withValues(alpha: .12),+ borderRadius: BorderRadius.circular(12),),- enabledBorder: OutlineInputBorder(- borderRadius: BorderRadius.circular(8),- borderSide: const BorderSide(color: Colors.white24),+ child: Icon(icon, size: 26, color: grid.AppPalette.swarmAccent),+ ),+ const SizedBox(height: 24),+ Text(+ title,+ style: const TextStyle(+ fontSize: 23,+ height: 1.2,+ fontWeight: FontWeight.w600,+ color: Colors.white,),),- ),- );- }-}--class _StarterRow extends StatelessWidget {- const _StarterRow({- required this.name,- required this.count,- required this.onTap,- this.note,- this.onManage,- });- final String name;- final int count;- final VoidCallback onTap;- final String? note;- final VoidCallback? onManage;- @override- Widget build(BuildContext context) => Tooltip(- message: name,- child: InkWell(- onTap: onTap,- borderRadius: BorderRadius.circular(7),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 14),- child: Row(- children: [- const SwarmIcon(size: 19, color: Colors.white60),- const SizedBox(width: 11),- Expanded(- child: Text(- name,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: const TextStyle(fontSize: 12),- ),- ),- if (note != null) ...[- const SizedBox(width: 6),- Text(- note!,- style: const TextStyle(fontSize: 10, color: Colors.white54),- ),- ],- const SizedBox(width: 12),- Text(- '$count',- style: const TextStyle(fontSize: 11, color: Colors.white54),- ),- const SizedBox(width: 8),- if (onManage == null)- const Icon(Icons.chevron_right, size: 14, color: Colors.white54)- else- PopupMenuButton<String>(- tooltip: 'Project options for $name',- padding: EdgeInsets.zero,- constraints: const BoxConstraints(minWidth: 180),- icon: const Icon(- Icons.more_horiz,- size: 16,- color: Colors.white54,- ),- style: IconButton.styleFrom(- minimumSize: const Size(24, 24),- maximumSize: const Size(24, 24),- padding: EdgeInsets.zero,- ),- itemBuilder: (_) => const [- PopupMenuItem(value: 'agents', child: Text('Choose agents…')),- ],- onSelected: (_) => onManage!(),- ),- ],+ const SizedBox(height: 12),+ Text(+ description,+ style: const TextStyle(+ fontSize: 14,+ height: 1.6,+ color: Colors.white70,+ ),),- ),- ),- );-}--class _Surface extends StatelessWidget {- const _Surface({required this.child});- final Widget child;- @override- Widget build(BuildContext context) => Container(- padding: const EdgeInsets.all(8),- decoration: BoxDecoration(- color: grid.AppPalette.swarmSearchSurface.withValues(alpha: .94),- borderRadius: BorderRadius.circular(12),- border: Border.all(color: Colors.white12),+ const SizedBox(height: 28),+ action,+ ],),- child: Material(type: MaterialType.transparency, child: child),);}diff --git a/desktop/lib/widgets/welcome_workspace_preview.dart b/desktop/lib/widgets/welcome_workspace_preview.dartindex 6d960c023..a34b2d7a7 100644--- a/desktop/lib/widgets/welcome_workspace_preview.dart+++ b/desktop/lib/widgets/welcome_workspace_preview.dart@@ -14,7 +14,7 @@ class WelcomeWorkspacePreview extends StatelessWidget {final palette = grid.AppTheme.palette.value;return Semantics(image: true,- label: 'Example swarm: Claude Code and Codex working side by side.',+ label: 'Example agent group: Claude Code and Codex working side by side.',child: ExcludeSemantics(child: Container(decoration: BoxDecoration(diff --git a/desktop/macos/Runner/SwarmTitlebar.swift b/desktop/macos/Runner/SwarmTitlebar.swiftindex fe07e46a4..e46a26b46 100644--- a/desktop/macos/Runner/SwarmTitlebar.swift+++ b/desktop/macos/Runner/SwarmTitlebar.swift@@ -92,7 +92,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {}private func sendTabAction(_ method: String, arguments: Any?) {- guard ["select", "close", "new", "rename", "jump", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane"].contains(method) else {+ guard ["select", "close", "new", "rename", "commands", "notifications", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane"].contains(method) else {channel.invokeMethod(method, arguments: arguments)return}@@ -110,8 +110,8 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {private func setKeymap(_ map: HarnessNativeKeymap) {keymap = map- let hint = map.hint(for: "navigation.quick_open", context: "workspace")- strip.searchButton.toolTip = hint.map { "Navigate (\($0))" } ?? "Navigate"+ let hint = map.hint(for: "swarm.new", context: "workspace")+ strip.newButton.toolTip = hint.map { "New Agent (\($0))" } ?? "New Agent"if let main = NSApp.mainMenu, let window {let menu = main as? HarnessKeymapMenu ?? HarnessKeymapMenu.replacing(main)if NSApp.mainMenu !== menu { NSApp.mainMenu = menu }@@ -196,17 +196,10 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {main.insertItem(item, at: index)}if let file = main.item(withTitle: "File") { main.removeItem(file) }- let swarm = NSMenu(title: "Swarm")- add(swarm, "New Swarm", "t", "new")- add(swarm, "Rename Swarm…", "r", "renameActive", [.command, .shift])- add(swarm, "Close Swarm", "w", "closeActive")- swarm.addItem(.separator())- add(swarm, "Link Machine…", "", "linkMachine")- add(swarm, "Add Project…", "", "addProject")- install(swarm, at: 1)let agent = NSMenu(title: "Agent")+ add(agent, "New Agent", "t", "new")add(agent, "Add Agent…", "n", "addAgent")- add(agent, "New Agent…", "n", "newAgent", [.command, .shift])+ add(agent, "Create Agent…", "n", "newAgent", [.command, .shift])agent.addItem(.separator())add(agent, "Split Right…", "", "splitRight")add(agent, "Split Down…", "", "splitDown")@@ -214,16 +207,20 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {add(agent, "Zoom Agent", "", "zoomPane")add(agent, "Pin or Unpin Agent", "", "pinPane")agent.addItem(.separator())- add(agent, "Remove Agent from Swarm", "w", "closePane", [.command, .shift])- install(agent, at: 2)+ add(agent, "Rename Tab…", "r", "renameActive", [.command, .shift])+ add(agent, "Close Agent Pane", "w", "closePane", [.command, .shift])+ add(agent, "Close Tab", "w", "closeActive")+ agent.addItem(.separator())+ add(agent, "Link Machine…", "", "linkMachine")+ add(agent, "Add Project…", "", "addProject")+ install(agent, at: 1)rebuildHistoryMenu()- install(historyMenu, at: 3)+ install(historyMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)// Native menu hints mirror Flutter; the shared picker owns all editing.if let edit = main.item(withTitle: "Edit")?.submenu {edit.addItem(.separator())- add(edit, "Navigate to Agent or Swarm…", "p", "jump")add(edit, "Search Commands…", "p", "commands", [.command, .shift])}if let view = main.item(withTitle: "View")?.submenu {@@ -233,7 +230,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {modelsMenu.autoenablesItems = falsemodelsMenu.delegate = selfrebuildModelsMenu()- install(modelsMenu, at: 3)+ install(modelsMenu, at: main.items.firstIndex(where: { $0.title == "Window" }) ?? main.numberOfItems)installTerminalFindMenu(main)}@@ -350,7 +347,7 @@ final class SwarmTitlebar: NSObject, NSMenuItemValidation, NSMenuDelegate {historyMenu.addItem(item)}if entries.isEmpty {- let item = NSMenuItem(title: closed ? "No Recently Closed Agents or Swarms" : "No Recent Visits", action: nil, keyEquivalent: "")+ let item = NSMenuItem(title: closed ? "No Recently Closed Agents or Tabs" : "No Recent Visits", action: nil, keyEquivalent: "")item.isEnabled = falsehistoryMenu.addItem(item)}@@ -658,10 +655,10 @@ private final class SwarmTabStrip: NSView {var emit: ((String, Any?) -> Void)?private let scroll = NSScrollView()private let document = NSView()- private let newButton = NSButton()- fileprivate let searchButton = NSButton()+ fileprivate let newButton = NSButton()fileprivate let notificationButton = SwarmNotificationButton()private var tabs: [SwarmTabButton] = []+ private let icons = SwarmHistoryIcons()private var activeId = ""private var revealActiveAfterLayout = falseprivate var tabOrderChanged = false@@ -690,12 +687,10 @@ private final class SwarmTabStrip: NSView {button.setAccessibilityLabel(label)addSubview(button)}- button(newButton, "plus", "New swarm (⌘T)", #selector(newSwarm))+ button(newButton, "plus", "New Agent (⌘T)", #selector(newSwarm))+ newButton.setAccessibilityLabel("New Agent")newButton.isEnabled = false- button(searchButton, "safari", "Navigate (⌘P)", #selector(openSearch))- searchButton.setAccessibilityLabel("Navigate")button(notificationButton, "bell", "Notifications", #selector(openNotifications))- searchButton.isEnabled = falsenotificationButton.isEnabled = falseregisterForDraggedTypes([swarmPasteboardType])}@@ -705,7 +700,6 @@ private final class SwarmTabStrip: NSView {let nextPalette = SwarmNativePalette(values)guard nextPalette != palette else { return }palette = nextPalette- searchButton.contentTintColor = palette.accentnotificationButton.contentTintColor = palette.accentnewButton.contentTintColor = palette.accentfor tab in tabs { tab.palette = palette }@@ -729,7 +723,13 @@ private final class SwarmTabStrip: NSView {guard let id = row["id"] as? String else { return nil }let tab = previous[id] ?? SwarmTabButton(id: id)tab.palette = palette- tab.name = row["name"] as? String ?? "New swarm"+ tab.name = row["name"] as? String ?? "New Agent"+ let count = row["agentCount"] as? Int ?? 0+ tab.icon = count == 1+ ? icons.image(engine: row["engine"] as? String, asset: row["iconAsset"] as? String)+ : count > 1+ ? SwarmIdentity.menuIcon+ : NSImage(systemSymbolName: "plus.square", accessibilityDescription: "New Agent")tab.selected = id == activeIdtab.actionsEnabled = actionsEnabledtab.attention = (row["attention"] as? Int ?? 0) > 0@@ -747,7 +747,6 @@ private final class SwarmTabStrip: NSView {// Moving frames alone leaves AppKit's child traversal in insertion order.document.setAccessibilityChildren(tabs)newButton.isEnabled = actionsEnabled && tabs.count < 24- searchButton.isEnabled = actionsEnablednotificationButton.isEnabled = actionsEnabledlet attention = state["attention"] as? Int ?? 0notificationButton.hasAttention = attention > 0@@ -774,7 +773,7 @@ private final class SwarmTabStrip: NSView {let activeWasVisible = active.map { scroll.documentVisibleRect.intersects($0.frame) } ?? falselet previousScrollSize = scroll.frame.sizelet previousDocumentSize = document.frame.size- let available = max(132, bounds.width - 124)+ let available = max(132, bounds.width - 84)let width = min(220, max(132, available / CGFloat(max(1, tabs.count))))let occupied = min(available, CGFloat(tabs.count) * width)scroll.frame = NSRect(x: 0, y: 0, width: occupied, height: bounds.height)@@ -785,7 +784,6 @@ private final class SwarmTabStrip: NSView {}let buttonY = (bounds.height - 28) / 2newButton.frame = NSRect(x: occupied + 4, y: buttonY, width: 28, height: 28)- searchButton.frame = NSRect(x: bounds.width - 80, y: buttonY, width: 28, height: 28)notificationButton.frame = NSRect(x: bounds.width - 40, y: buttonY, width: 28, height: 28)let geometryChanged = scroll.frame.size != previousScrollSize || document.frame.size != previousDocumentSizeif let active, revealActiveAfterLayout || (activeWasVisible && (geometryChanged || tabOrderChanged)) {@@ -822,9 +820,6 @@ private final class SwarmTabStrip: NSView {@objc private func newSwarm() {if actionsEnabled && newButton.isEnabled { emit?("new", nil) }}- @objc private func openSearch() {- if actionsEnabled { emit?("jump", nil) }- }@objc private func openNotifications() {if actionsEnabled { emit?("notifications", nil) }}@@ -854,7 +849,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatididSet { if palette != oldValue { needsDisplay = true } }}let swarmId: String- var name = "New swarm" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }+ var name = "New Agent" { didSet { if name != oldValue { invalidateLabel(); updateAccessibility() } } }var selected = false { didSet { if selected != oldValue { invalidateLabel(); updateAccessibility() } } }var attention = false { didSet { if attention != oldValue { needsDisplay = true; updateAccessibility() } } }var showsDivider = false { didSet { if showsDivider != oldValue { needsDisplay = true } } }@@ -864,6 +859,11 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidativar isHovered: Bool { hovered && actionsEnabled }private let closeButton = SwarmTabActionButton()private let selectButton = SwarmSelectButton()+ private let iconView = NSImageView()+ var icon: NSImage? {+ get { iconView.image }+ set { iconView.image = newValue }+ }private var cachedLabel: NSAttributedString?var actionsEnabled = true {didSet {@@ -882,6 +882,10 @@ 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 = ""@@ -889,16 +893,16 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatiselectButton.target = selfselectButton.action = #selector(selectSwarm)addSubview(selectButton)- closeButton.image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "Close swarm")+ closeButton.image = NSImage(systemSymbolName: "xmark", accessibilityDescription: "Close tab")closeButton.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 10, weight: .semibold)closeButton.contentTintColor = NSColor(white: 0.78, alpha: 1)closeButton.isBordered = falsecloseButton.target = selfcloseButton.action = #selector(closeSwarm)- closeButton.toolTip = "Close swarm"+ closeButton.toolTip = "Close tab"addSubview(closeButton)let menu = NSMenu()- for (title, action) in [("Rename Swarm…", #selector(renameSwarm)), ("Close Swarm", #selector(closeSwarm))] {+ for (title, action) in [("Rename Tab…", #selector(renameSwarm)), ("Close Tab", #selector(closeSwarm))] {let item = NSMenuItem(title: title, action: action, keyEquivalent: "")item.target = selfmenu.addItem(item)@@ -909,6 +913,7 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidatirequired init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }override func layout() {super.layout()+ iconView.frame = NSRect(x: 22, y: contentCenterY - 8, width: 16, height: 16)selectButton.frame = NSRect(x: 0, y: 0, width: max(0, bounds.width - 36), height: bounds.height)closeButton.frame = NSRect(x: bounds.width - 36, y: contentCenterY - 12, width: 24, height: 24)}@@ -969,8 +974,8 @@ private final class SwarmTabButton: NSView, NSDraggingSource, NSMenuItemValidati}let label = self.labellet labelHeight = label.size().height- label.draw(in: NSRect(x: 22, y: contentCenterY - labelHeight / 2,- width: bounds.width - 64, height: labelHeight))+ label.draw(in: NSRect(x: 46, y: contentCenterY - labelHeight / 2,+ width: bounds.width - 88, height: labelHeight))if attention {NSColor.systemOrange.setFill()NSBezierPath(ovalIn: NSRect(x: 13, y: contentCenterY - 2, width: 4, height: 4)).fill()diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dartindex a9d73a192..9baab6fed 100644--- a/desktop/test/agent_creation_recovery_test.dart+++ b/desktop/test/agent_creation_recovery_test.dart@@ -88,7 +88,7 @@ Future<void> _timeOut(void main() {for (final entry in ['Add', 'Split right', 'Split down']) {- testWidgets('cancel New agent returns to the same $entry search', (+ testWidgets('cancel Create Agent returns to the same $entry search', (tester,) async {final connection = _Connection();@@ -103,7 +103,7 @@ void main() {if (entry == 'Add') {await chord(tester, LogicalKeyboardKey.keyN);} else {- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(field, '> $entry');await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -171,7 +171,7 @@ void main() {await mount(tester, app);final field = find.byKey(const ValueKey('swarm-search-input'));if (change == 'changed split') {- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(field, '> split right');await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -229,7 +229,7 @@ void main() {await tester.pumpAndSettle();await tester.tap(find.byKey(const Key('new-agent-folder')));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();final create = connection.calls.single;if (outcome == 'created') {@@ -290,7 +290,7 @@ void main() {? find.byKey(const ValueKey('swarm-welcome-search-input')): search;if (splitting) {- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(search, '> split right');await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -309,7 +309,7 @@ void main() {await tester.tap(find.byKey(const Key('new-agent-folder')));await tester.pumpAndSettle();expect(find.text('Find existing agent…'), findsNothing);- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();expect(find.text('Find existing agent…'), findsNothing);connection.calls.last.reply.completeError(@@ -345,7 +345,7 @@ void main() {expect(search, findsNothing);expect(find.textContaining(- change == 'closed' ? 'swarm was closed' : 'split changed',+ change == 'closed' ? 'tab was closed' : 'split changed',),findsOneWidget,);@@ -585,7 +585,7 @@ void main() {app.stateOf('m')!.agents.any((agent) => agent.id == 'created'),isTrue,);- expect(app.lastError, contains('Find it with Add agent'));+ expect(app.lastError, contains('Find it with New Agent'));});testWidgets(@@ -617,14 +617,14 @@ void main() {);await tester.tap(find.text('open'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();connection.calls.last.reply.completeError(const WsRequestTimeout('agent_create'),);await tester.pumpAndSettle();expect(find.text('/work'), findsOneWidget);- expect(find.widgetWithText(FilledButton, 'Create agent'), findsNothing);+ expect(find.widgetWithText(FilledButton, 'Create Agent'), findsNothing);final action = tester.widget<FilledButton>(find.widgetWithText(FilledButton, 'Check status'),);diff --git a/desktop/test/benchmarks/startup_benchmark.dart b/desktop/test/benchmarks/startup_benchmark.dartindex cbcb72d79..32c76fc5a 100644--- a/desktop/test/benchmarks/startup_benchmark.dart+++ b/desktop/test/benchmarks/startup_benchmark.dart@@ -52,7 +52,7 @@ void main() {final keymapFile = File('${directory.path}/config/keybindings.jsonc');await keymapFile.parent.create();await keymapFile.writeAsString(- '{"bindings":[{"keys":"cmd+g","command":"navigation.quick_open"}]}',+ '{"bindings":[{"keys":"cmd+g","command":"swarm.new"}]}',);for (final withKeymap in [false, true]) {@@ -93,7 +93,7 @@ void main() {expect(stats.summary.agentsSpawned, 12);if (withKeymap) {expect(keymap.error, isNull);- expect(keymap.bindings('navigation.quick_open').length, 2);+ expect(keymap.bindings('swarm.new').length, 2);}} finally {keymap.dispose();diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dartindex 9655825fc..0bcbc8801 100644--- a/desktop/test/boot_flow_widget_test.dart+++ b/desktop/test/boot_flow_widget_test.dart@@ -829,9 +829,10 @@ void main() {),);await tester.pumpAndSettle();- expect(find.text('Start with one agent'), findsOneWidget);- expect(find.text('New agent'), findsNothing);- expect(find.text('Add project'), findsOneWidget);+ expect(find.text('New Agent'), findsWidgets);+ expect(find.text('Create Agent'), findsNothing);+ expect(find.text('Add project'), findsNothing);+ await tester.ensureVisible(find.text('Link a machine'));await tester.tap(find.text('Link a machine'));await tester.pumpAndSettle();expect(find.text('harness login\nharness start'), findsOneWidget);@@ -1080,6 +1081,14 @@ void main() {await tester.pump();expect(find.text('Link this machine'), findsNothing);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ '> link machine',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();await tester.ensureVisible(find.text('link-mac'));await tester.tap(find.text('link-mac'));// Same popup-transition reasoning as above.@@ -1158,6 +1167,14 @@ void main() {await tester.pump();expect(find.text('Link this machine'), findsNothing);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ '> link machine',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();await tester.ensureVisible(find.text('link-mac'));await tester.tap(find.text('link-mac'));await tester.pumpAndSettle();diff --git a/desktop/test/dial_desk_test.dart b/desktop/test/dial_desk_test.dartindex 26e7b569b..8c6ee4160 100644--- a/desktop/test/dial_desk_test.dart+++ b/desktop/test/dial_desk_test.dart@@ -141,7 +141,7 @@ void main() {await app.openAgentFromDial('m1', 'a${AppNotifier.maxPanes}');expect(app.panes, before);expect(app.focusedPaneId, focus);- expect(app.lastError, contains('Open another swarm'));+ expect(app.lastError, contains('Open another tab'));app.dispose();},);diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dartindex 1db255c9f..dda23245e 100644--- a/desktop/test/first_workspace_test.dart+++ b/desktop/test/first_workspace_test.dart@@ -14,7 +14,6 @@ import 'package:harness/state/pane_arrangement.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/terminal/terminal_session.dart';-import 'package:harness/widgets/clone_repository_dialog.dart';import 'package:xterm/xterm.dart';import 'swarm_screen_test.dart' show mount, terminal;@@ -105,38 +104,38 @@ class _FolderPicker extends FileSelectorPlatform {}void main() {- testWidgets('a saved empty project stays visible and starts in its folder', (- tester,- ) async {- final app = _FirstUseApp();- final projects = SwarmProjectStore();- await projects.add(- const SavedSwarmProject(- machineId: 'm',- path: '/work/saved-project',- name: 'Saved project',- ),- );- await mount(tester, app, projects: projects);- expect(find.text('Machines'), findsOneWidget);- expect(find.text('Saved project'), findsOneWidget);- await tester.tap(find.text('Saved project'));- await tester.pump();- expect(find.byType(AlertDialog), findsOneWidget);- expect(find.text('/work/saved-project'), findsOneWidget);- expect(app.launches, isEmpty);- await tester.tap(find.text('Cancel'));- await tester.pump();- app.newSwarm();- await tester.pump();- expect(find.text('Saved project'), findsOneWidget);- expect(find.text('Machines'), findsOneWidget);- await tester.pumpWidget(const SizedBox());- projects.dispose();- app.dispose();- });+ testWidgets(+ 'welcome presents two actions without machine and project directories',+ (tester) async {+ final app = _FirstUseApp();+ final projects = SwarmProjectStore();+ await projects.add(+ const SavedSwarmProject(+ machineId: 'm',+ path: '/work/saved-project',+ name: 'Saved project',+ ),+ );+ await mount(tester, app, projects: projects);+ expect(find.text('Find an agent'), findsOneWidget);+ expect(find.text('Create a new agent'), findsOneWidget);+ expect(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ findsOneWidget,+ );+ expect(find.byKey(const ValueKey('swarm-start-primary')), findsOneWidget);+ expect(find.text('Machines'), findsNothing);+ expect(find.text('Projects'), findsNothing);+ expect(find.text('Saved project'), findsNothing);+ expect(find.byKey(const ValueKey('swarm-start-clone')), findsNothing);+ expect(app.launches, isEmpty);+ await tester.pumpWidget(const SizedBox());+ projects.dispose();+ app.dispose();+ },+ );- testWidgets('first discovery enables the folder action for Enter', (+ testWidgets('first discovery enables the new-agent action beside search', (tester,) async {final app = _FirstUseApp();@@ -155,8 +154,8 @@ void main() {app.machinesLoading = false;app.dismissError();await tester.pump();- expect(find.text('Choose folder…'), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ expect(find.text('Create Agent'), findsOneWidget);+ await tester.tap(find.byKey(const ValueKey('swarm-start-primary')));await tester.pump();expect(picker.opened, 1);expect(find.byType(AlertDialog), findsOneWidget);@@ -175,7 +174,7 @@ void main() {final original = app.activeSwarm;await mount(tester, app);expect(find.text('Reconnect'), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.tap(find.text('Reconnect'));await tester.pump();expect(find.text('Finding your computers…'), findsOneWidget);await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -190,15 +189,13 @@ void main() {app.dispose();});- testWidgets('discovery preserves an explicit focus on project setup', (- tester,- ) async {+ testWidgets('discovery preserves the focused agent search', (tester) async {final app = _FirstUseApp();final local = app.machineStates.remove('m')!;app.machinesLoading = true;await mount(tester, app);- final browsing = find.text('Add project');- final focus = Focus.of(tester.element(browsing));+ final browsing = find.byKey(const ValueKey('swarm-welcome-search-input'));+ final focus = tester.widget<TextField>(browsing).focusNode!;focus.requestFocus();await tester.pump();expect(focus.hasPrimaryFocus, isTrue);@@ -207,7 +204,7 @@ void main() {app.dismissError();await tester.pump();expect(focus.hasPrimaryFocus, isTrue);- expect(find.text('Machines'), findsOneWidget);+ expect(find.text('Machines'), findsNothing);expect(find.byType(AlertDialog), findsNothing);expect(app.launches, isEmpty);await tester.pumpWidget(const SizedBox());@@ -231,8 +228,8 @@ void main() {FileSelectorPlatform.instance = picker;addTearDown(() => FileSelectorPlatform.instance = oldPicker);await mount(tester, app);- expect(find.text('Choose folder…'), findsOneWidget);- expect(find.text('Machines'), findsOneWidget);+ expect(find.text('Create Agent'), findsOneWidget);+ expect(find.text('Machines'), findsNothing);await tester.tap(find.byKey(const ValueKey('swarm-start-primary')));await tester.pump();expect(picker.opened, 1);@@ -263,28 +260,6 @@ void main() {},);- testWidgets(- 'the start page opens cloning separately and cancellation starts no agent',- (tester) async {- final app = _FirstUseApp();- await mount(tester, app);- final original = app.activeSwarm;- await tester.tap(find.byKey(const ValueKey('swarm-start-clone')));- await tester.pump();- expect(find.byType(CloneRepositoryDialog), findsOneWidget);- expect(find.text('Create agent'), findsNothing);- await tester.tap(find.text('Cancel'));- await tester.pump();- expect(find.byType(CloneRepositoryDialog), findsNothing);- expect(app.activeSwarm, same(original));- expect(app.panes, isEmpty);- expect(app.launches, isEmpty);- expect(app.probes, 1);- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );-testWidgets('pending creation stays visible and an error preserves choices for retry',(tester) async {@@ -300,7 +275,7 @@ void main() {await tester.pump();await tester.tap(find.text('Browse…'));await tester.pump();- await tester.tap(find.text('Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();await tester.sendKeyEvent(LogicalKeyboardKey.escape);await tester.pump();@@ -338,7 +313,7 @@ void main() {findsNothing,);app.creation = null;- await tester.tap(find.text('Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();expect(find.byType(AlertDialog), findsNothing);expect(find.byType(TerminalView), findsOneWidget);@@ -409,7 +384,7 @@ void main() {await tester.pump();await opening;} else {- final search = find.byKey(const ValueKey('swarm-search-button'));+ final search = find.byKey(const ValueKey('swarm-new-agent-button'));final add = find.byKey(const ValueKey('swarm-add-agent-button'));final bell = find.byKey(const ValueKey('swarm-notifications-button'));expect(@@ -453,7 +428,15 @@ void main() {expect(app.input, isEmpty);await tester.tap(find.text('Cancel'));await tester.pump();+ await tester.pump();expect(find.byType(AlertDialog), findsNothing);+ if (!native) {+ final search = find.byKey(const ValueKey('swarm-search-input'));+ expect(search, findsOneWidget);+ expect(tester.widget<TextField>(search).focusNode!.hasFocus, isTrue);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pump();+ }expect(tester.widget<TerminalView>(find.byType(TerminalView))@@ -556,7 +539,14 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.tab);await tester.pump();expect(- Focus.of(tester.element(find.text('Create agent'))).hasPrimaryFocus,+ Focus.of(+ tester.element(+ find.descendant(+ of: find.byKey(const ValueKey('create-agent-submit')),+ matching: find.text('Create Agent'),+ ),+ ),+ ).hasPrimaryFocus,isTrue,);expect(app.launches, isEmpty);@@ -589,19 +579,24 @@ void main() {addTearDown(() => FileSelectorPlatform.instance = oldPicker);await mount(tester, app);- expect(find.text('Start with one agent'), findsOneWidget);- expect(find.text('Machines'), findsOneWidget);- expect(find.text('Projects'), findsOneWidget);+ expect(find.text('New Agent'), findsWidgets);+ expect(find.text('Machines'), findsNothing);+ expect(find.text('Projects'), findsNothing);expect(app.launches, isEmpty);expect(find.byKey(const ValueKey('swarm-welcome-search-input')),- findsNothing,+ findsOneWidget,);expect(- Focus.of(tester.element(find.text('Choose folder…'))).hasPrimaryFocus,+ tester+ .widget<TextField>(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ )+ .focusNode!+ .hasFocus,isTrue,);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.tap(find.byKey(const ValueKey('swarm-start-primary')));await tester.pump();final engine = tester.widget<AppSelectField<String>>(find.byKey(const Key('new-agent-engine-field')),@@ -616,7 +611,7 @@ void main() {expect(app.probes, 1);expect(find.text('/work/my-project'), findsOneWidget);expect(app.launches, isEmpty);- await tester.tap(find.text('Create agent'));+ await tester.tap(find.byKey(const ValueKey('create-agent-submit')));await tester.pump();expect(app.launches, [@@ -649,19 +644,29 @@ void main() {];await mount(tester, app);expect(app.panes, isEmpty);- expect(find.text('Add your first agent'), findsOneWidget);+ expect(find.text('Find an agent'), findsOneWidget);expect(find.text('Go to an agent'), findsNothing);- await tester.tap(find.byKey(const ValueKey('welcome-agent:m:existing')));+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ 'My ongoing work',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();expect(app.panes.single.agentId, 'existing');final source = app.activeSwarm;final pane = app.panes.single;app.newSwarm();await tester.pump();- expect(find.text('Add your first agent'), findsOneWidget);- expect(find.text('New agent'), findsOneWidget);+ expect(find.text('Find an agent'), findsOneWidget);+ expect(find.text('Create Agent'), findsOneWidget);expect(find.text('Go to an agent'), findsNothing);- await tester.tap(find.byKey(const ValueKey('welcome-agent:m:existing')));+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ 'My ongoing work',+ );+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();expect(app.panes.single, same(pane));expect(source.panes.single, same(pane));@@ -670,7 +675,7 @@ void main() {app.newSwarm();await tester.pump();expect(app.closedHistory, isNotEmpty);- expect(find.text('Add your first agent'), findsOneWidget);+ expect(find.text('Find an agent'), findsOneWidget);expect(app.launches, isEmpty);expect(find.text('Go to an agent'), findsNothing);expect(tester.takeException(), isNull);@@ -688,9 +693,9 @@ void main() {addTearDown(() => FileSelectorPlatform.instance = oldPicker);await mount(tester, app);- await tester.tap(find.text('Choose folder…'));+ await tester.tap(find.text('Create Agent'));await tester.pump();- await tester.tap(find.text('Choose folder…'));+ await tester.tap(find.text('Create Agent'));await tester.pump();expect(picker.opened, 1);expect(app.probes, 1);@@ -741,7 +746,7 @@ void main() {FileSelectorPlatform.instance = picker;addTearDown(() => FileSelectorPlatform.instance = oldPicker);await mount(tester, app);- await tester.tap(find.text('Choose folder…'));+ await tester.tap(find.text('Create Agent'));await tester.pump();switch (change) {case 'swarm':diff --git a/desktop/test/keymap_host_test.dart b/desktop/test/keymap_host_test.dartindex 01d12a934..23b66570c 100644--- a/desktop/test/keymap_host_test.dart+++ b/desktop/test/keymap_host_test.dart@@ -89,7 +89,7 @@ void main() {expect(command('cmd+alt+left'), isNull);expect(command('cmd+shift+enter'), isNull);expect(command('ctrl+n', KeymapContext.picker), 'picker.next');- expect(command('cmd+p', KeymapContext.picker), 'navigation.quick_open');+ expect(command('cmd+t', KeymapContext.picker), 'swarm.new');expect(command('cmd+['), 'navigation.back');});@@ -144,7 +144,7 @@ void main() {child: KeymapHost(keymap: map,enabled: () => true,- actions: {'navigation.quick_open': () => searches++},+ actions: {'swarm.new': () => searches++},child: KeymapRegion(contextKind: KeymapContext.terminal,child: Focus(@@ -165,7 +165,7 @@ void main() {),);await tester.pump();- await key(tester, LogicalKeyboardKey.keyP, cmd: true);+ await key(tester, LogicalKeyboardKey.keyT, cmd: true);expect(searches, 1);expect(delivered, isEmpty);await key(tester, LogicalKeyboardKey.keyB, ctrl: true);@@ -173,13 +173,13 @@ void main() {await key(tester, LogicalKeyboardKey.tab, ctrl: true);expect(delivered, ['ctrl+b', 'alt+c']);map.apply(- '{"bindings":[{"keys":"cmd+p","command":null},{"keys":"ctrl+o","command":"navigation.quick_open","when":"terminal"}]}',+ '{"bindings":[{"keys":"cmd+t","command":null},{"keys":"ctrl+o","command":"swarm.new","when":"terminal"}]}',);await tester.pump();- await key(tester, LogicalKeyboardKey.keyP, cmd: true);+ await key(tester, LogicalKeyboardKey.keyT, cmd: true);await key(tester, LogicalKeyboardKey.keyO, ctrl: true);expect(searches, 2);- expect(delivered.last, 'cmd+p');+ expect(delivered.last, 'cmd+t');await tester.pumpWidget(const SizedBox());focus.dispose();map.dispose();diff --git a/desktop/test/keymap_native_test.dart b/desktop/test/keymap_native_test.dartindex 2f1743e53..f02dddca5 100644--- a/desktop/test/keymap_native_test.dart+++ b/desktop/test/keymap_native_test.dart@@ -16,8 +16,8 @@ void main() {addTearDown(keymap.dispose);final defaults = nativeKeymapSnapshot(keymap);keymap.apply('''{"bindings":[- {"keys":"cmd+p","command":null},- {"keys":"cmd+o","command":"navigation.quick_open"},+ {"keys":"cmd+t","command":null},+ {"keys":"cmd+o","command":"swarm.new"},{"keys":"cmd+k","command":null},{"keys":"cmd+k cmd+n","command":"swarm.new"},{"keys":"cmd+h","command":null,"when":"terminal"},@@ -46,7 +46,7 @@ void main() {);}expect(- rows.any((row) => (row['keys'] as List).join(' ') == 'cmd+p'),+ rows.any((row) => (row['keys'] as List).join(' ') == 'cmd+t'),isFalse,);}diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dartindex f6569ed26..970a56fad 100644--- a/desktop/test/keymap_runtime_test.dart+++ b/desktop/test/keymap_runtime_test.dart@@ -13,7 +13,6 @@ import 'package:harness/state/app_state.dart';import 'package:harness/state/swarm_catalog.dart';import 'package:harness/terminal/terminal_binary.dart';import 'package:harness/widgets/swarm_switcher.dart';-import 'package:harness/widgets/swarm_navigator.dart';import 'package:xterm/xterm.dart';import 'keymap_host_test.dart' show MemoryKeymap, key;@@ -119,7 +118,7 @@ void main() {for (final inline in [false, true]) {testWidgets(- 'configured picker actions and hints stay in ${inline ? 'New swarm' : 'titlebar'} search',+ 'configured picker actions and hints stay in ${inline ? 'New Agent' : 'titlebar'} search',(tester) async {final map = MemoryKeymap()..apply('''{"bindings":[@@ -132,7 +131,6 @@ void main() {app.machineStates['m']!.nodeOnline = true;final frames = <TerminalBinaryFrame>[];final pane = app.adoptSessionForTest(terminal('a0', frames));- final original = app.activeSwarmId;app.newSwarm();final addingTo = app.activeSwarmId;await mount(tester, app, map);@@ -144,7 +142,7 @@ void main() {if (inline) {await tester.tap(input);} else {- await key(tester, LogicalKeyboardKey.keyP, cmd: true);+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);}await tester.enterText(input, 'Agent');await tester.pump();@@ -152,7 +150,9 @@ void main() {? tester.widget<SwarmSearchResults>(find.byType(SwarmSearchResults)).search- : tester.widget<SwarmNavigator>(find.byType(SwarmNavigator)).search;+ : tester+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))+ .search;final initial = search.cursor;await key(tester, LogicalKeyboardKey.arrowDown);expect(search.cursor, initial);@@ -160,19 +160,22 @@ void main() {expect(search.cursor, (initial - 1) % search.rows.length);await tester.enterText(input, 'Agent 0');await tester.pump();- expect(search.previewVisible, inline);+ expect(+ find.byKey(const ValueKey('swarm-search-preview')),+ findsNothing,+ );expect(find.byKey(const ValueKey('swarm-search-preview-toggle')),findsNothing,);await key(tester, LogicalKeyboardKey.enter);expect(- find.byType(inline ? SwarmSearchResults : SwarmNavigator),+ find.byType(inline ? SwarmSearchResults : SwarmSearchResults),findsOneWidget,);expect(frames, isEmpty);await key(tester, LogicalKeyboardKey.enter, alt: true);- expect(app.activeSwarmId, inline ? addingTo : original);+ expect(app.activeSwarmId, addingTo);expect(app.focusedPane, same(pane));expect(find.byType(SwarmSearchResults), findsNothing);await key(tester, LogicalKeyboardKey.arrowLeft);@@ -185,7 +188,7 @@ void main() {}testWidgets(- 'closed New swarm search honors remapped opening keys and command mode',+ 'closed New tab search honors remapped opening keys and command mode',(tester) async {final map = MemoryKeymap()..apply('''{"bindings":[@@ -255,12 +258,10 @@ void main() {final map = MemoryKeymap();final app = createApp();await mount(tester, app, map, native: true);- await native(tester, 'keymapCommand', {- 'command': 'navigation.quick_open',- });+ await native(tester, 'keymapCommand', {'command': 'swarm.new'});await tester.pump();calls.clear();- final field = find.byKey(const ValueKey('swarm-search-input'));+ var field = find.byKey(const ValueKey('swarm-welcome-search-input'));for (final query in ['w', 'wo', 'wor', 'work', 'work 木']) {await tester.enterText(field, query);app.renameSwarm(app.activeSwarmId, 'Background $query');@@ -291,6 +292,7 @@ void main() {await tester.pump();calls.clear();await native(tester, 'keymapCommand', {'command': 'navigation.commands'});+ field = find.byKey(const ValueKey('swarm-search-input'));await tester.pump();expect(calls@@ -380,34 +382,32 @@ void main() {await mount(tester, app, map, native: true);expect(calls.where((c) => c.method == 'keymapState'), hasLength(1));map.apply(- '{"bindings":[{"keys":"cmd+p","command":null},{"keys":"cmd+o","command":"navigation.quick_open"}]}',+ '{"bindings":[{"keys":"cmd+t","command":null},{"keys":"cmd+o","command":"swarm.new"}]}',);await tester.pump();final snapshot =calls.lastWhere((c) => c.method == 'keymapState').arguments as Map;final picker = (snapshot['contexts'] as Map)['picker'] as List;expect(- picker.any((row) => (row['keys'] as List).contains('cmd+p')),+ picker.any((row) => (row['keys'] as List).contains('cmd+t')),isFalse,);expect(picker.any((row) =>- row['command'] == 'navigation.quick_open' &&+ row['command'] == 'swarm.new' &&(row['keys'] as List).contains('cmd+o'),),isTrue,);- await native(tester, 'keymapCommand', {- 'command': 'navigation.quick_open',- });+ await native(tester, 'keymapCommand', {'command': 'swarm.new'});await tester.pump();await tester.enterText(- find.byKey(const ValueKey('swarm-search-input')),+ find.byKey(const ValueKey('swarm-welcome-search-input')),'Agent 0',);await tester.pump();- expect(find.byType(SwarmNavigator), findsOneWidget);+ expect(find.byType(SwarmSearchResults), findsOneWidget);await native(tester, 'keymapCommand', {'command': 'picker.accept'});await tester.pump();expect(find.byType(SwarmSearchResults), findsNothing);@@ -438,11 +438,11 @@ void main() {);var rows = effectiveShortcutRows(helpContext, KeymapContext.workspace);final searchLabel = rows- .firstWhere((row) => row.chords.any((keys) => keys.join() == '⌘P'))+ .firstWhere((row) => row.chords.any((keys) => keys.join() == '⌘T')).label;map.apply('''{"bindings":[- {"keys":"cmd+p","command":null},- {"keys":"cmd+o","command":"navigation.quick_open"},+ {"keys":"cmd+t","command":null},+ {"keys":"cmd+o","command":"swarm.new"},{"keys":"cmd+s","command":null,"when":"terminal"}]}''');await tester.pump();@@ -451,7 +451,7 @@ void main() {['⌘', 'O'],]);expect(- rows.any((r) => r.chords.any((keys) => keys.join() == '⌘P')),+ rows.any((r) => r.chords.any((keys) => keys.join() == '⌘T')),isFalse,);final terminalRows = effectiveShortcutRows(diff --git a/desktop/test/keymap_store_test.dart b/desktop/test/keymap_store_test.dartindex e74809cf0..f5cc07105 100644--- a/desktop/test/keymap_store_test.dart+++ b/desktop/test/keymap_store_test.dart@@ -8,23 +8,20 @@ import 'package:harness/shortcuts/keymap_store.dart';String config(String command) => jsonEncode({'bindings': [- {'keys': 'cmd+p', 'command': command},+ {'keys': 'cmd+t', 'command': command},],});KeymapStore storeFor(File file, {bool watch = false}) => KeymapStore(file: file,watchFiles: watch,defaults: [- KeyBinding(- keys: [KeyStroke.parse('cmd+p')],- command: 'navigation.quick_open',- ),+ KeyBinding(keys: [KeyStroke.parse('cmd+t')], command: 'swarm.new'),],- commands: {'navigation.quick_open', 'pane.focus_left'},+ commands: {'swarm.new', 'pane.focus_left'},);String? selected(KeymapStore store) => store.current.match(KeymapContext.terminal,- [KeyStroke.parse('cmd+p')],+ [KeyStroke.parse('cmd+t')],).command;Future<void> eventually(bool Function() condition) async {@@ -61,7 +58,7 @@ void main() {final store = storeFor(file);addTearDown(store.dispose);await store.start();- expect(selected(store), 'navigation.quick_open');+ expect(selected(store), 'swarm.new');expect(store.error, isNull);expect(await file.parent.exists(), false);expect(store.revision, 0);@@ -94,7 +91,7 @@ void main() {expect(changes, 3); // New map, diagnostic, diagnostic cleared.await file.delete();await store.reload();- expect(selected(store), 'navigation.quick_open');+ expect(selected(store), 'swarm.new');},);@@ -157,9 +154,9 @@ void main() {await file.writeAsString(config('pane.focus_left'));await eventually(() => selected(store) == 'pane.focus_left');final replacement = File('${file.path}.save');- await replacement.writeAsString(config('navigation.quick_open'));+ await replacement.writeAsString(config('swarm.new'));await replacement.rename(file.path);- await eventually(() => selected(store) == 'navigation.quick_open');+ await eventually(() => selected(store) == 'swarm.new');expect(store.error, isNull);},);@@ -171,7 +168,7 @@ void main() {final second = File('${directory.path}/repo2/keys.jsonc');await first.parent.create();await second.parent.create();- await first.writeAsString(config('navigation.quick_open'));+ await first.writeAsString(config('swarm.new'));await second.writeAsString(config('pane.focus_left'));final link = Link('${directory.path}/app/keybindings.jsonc');await Directory('${directory.path}/app').create();@@ -182,9 +179,9 @@ void main() {await link.update(second.path);await eventually(() => selected(store) == 'pane.focus_left');final replacement = File('${second.path}.save');- await replacement.writeAsString(config('navigation.quick_open'));+ await replacement.writeAsString(config('swarm.new'));await replacement.rename(second.path);- await eventually(() => selected(store) == 'navigation.quick_open');+ await eventually(() => selected(store) == 'swarm.new');},skip: Platform.isWindows? 'Creating Windows symlinks requires host permission'diff --git a/desktop/test/keymap_test.dart b/desktop/test/keymap_test.dartindex b3df22ee0..13c1199a1 100644--- a/desktop/test/keymap_test.dart+++ b/desktop/test/keymap_test.dart@@ -1,7 +1,7 @@import 'package:flutter_test/flutter_test.dart';import 'package:harness/shortcuts/keymap.dart';-const commands = {'navigation.quick_open', 'pane.focus_left', 'picker.next'};+const commands = {'swarm.new', 'pane.focus_left', 'picker.next'};KeyBinding bind(String keys,String? command, [@@ -18,9 +18,10 @@ KeymapMatch match(]) => map.match(context, keys.split(' ').map(KeyStroke.parse));void main() {- test('a retired preview binding does not break other custom shortcuts', () {+ test('retired Navigate and preview bindings preserve other shortcuts', () {final config = KeymapConfig.parse('''{"bindings":[{"keys":"cmd+i","command":"picker.preview","when":"picker"},+ {"keys":"cmd+o","command":"navigation.quick_open"},{"keys":"cmd+ctrl+h","command":"pane.focus_left"}]}''', commands: commands);expect(config.bindings.single.command, 'pane.focus_left');@@ -49,7 +50,7 @@ void main() {test('string escapes and comment-like strings retain their exact value', () {const command = 'url://a"/*b*/';final config = KeymapConfig.parse(- r'{"bindings":[{"keys":"cmd+p","command":"url://a\"/*b*/"}]}',+ r'{"bindings":[{"keys":"cmd+t","command":"url://a\"/*b*/"}]}',commands: {command},);expect(config.bindings.single.command, command);@@ -59,14 +60,14 @@ void main() {for (final source in ['{"version":2}','{"binding":[]}',- '{"bindings":[{"keys":"cmd+p","command":"unknown"}]}',- '{"bindings":[{"keys":"cmd+p"}]}',- '{"bindings":[{"keys":"cmd+p","command":null,"when":"typo"}]}',- '{"bindings":[{"keys":"cmd+cmd+p","command":null}]}',+ '{"bindings":[{"keys":"cmd+t","command":"unknown"}]}',+ '{"bindings":[{"keys":"cmd+t"}]}',+ '{"bindings":[{"keys":"cmd+t","command":null,"when":"typo"}]}',+ '{"bindings":[{"keys":"cmd+cmd+t","command":null}]}','{"bindings":[{"keys":"cmd","command":null}]}','{"bindings":[{"keys":"made-up","command":null}]}','{"bindings":[{"keys":"a b c d e","command":null}]}',- '{"bindings":[{"keys":"cmd+p","command":null},{"keys":"super+p","command":null}]}',+ '{"bindings":[{"keys":"cmd+t","command":null},{"keys":"super+t","command":null}]}','{"bindings":[,]}','{,}','/* unfinished',@@ -91,46 +92,40 @@ void main() {test('terminal overrides do not change workspace or modal picker keys', () {final map = ResolvedKeymap([- bind('cmd+p', 'navigation.quick_open'),+ bind('cmd+t', 'swarm.new'),bind('ctrl+n', 'picker.next', KeymapContext.picker),- ], KeymapConfig([bind('cmd+p', null, KeymapContext.terminal)]));- expect(match(map, 'cmd+p').matched, false);- expect(- match(map, 'cmd+p', KeymapContext.workspace).command,- 'navigation.quick_open',- );- expect(- match(map, 'cmd+p', KeymapContext.picker).command,- 'navigation.quick_open',- );+ ], KeymapConfig([bind('cmd+t', null, KeymapContext.terminal)]));+ expect(match(map, 'cmd+t').matched, false);+ expect(match(map, 'cmd+t', KeymapContext.workspace).command, 'swarm.new');+ expect(match(map, 'cmd+t', KeymapContext.picker).command, 'swarm.new');expect(match(map, 'ctrl+n', KeymapContext.picker).command, 'picker.next');expect(match(map, 'ctrl+n', KeymapContext.terminal).matched, false);});test('explicit workspace overrides also replace terminal defaults', () {final map = ResolvedKeymap([- bind('cmd+p', 'navigation.quick_open'),- bind('cmd+p', 'pane.focus_left', KeymapContext.terminal),- ], KeymapConfig([bind('cmd+p', null)]));- expect(match(map, 'cmd+p').matched, false);+ bind('cmd+t', 'swarm.new'),+ bind('cmd+t', 'pane.focus_left', KeymapContext.terminal),+ ], KeymapConfig([bind('cmd+t', null)]));+ expect(match(map, 'cmd+t').matched, false);});test('sequences need explicit removal of an ambiguous shorter binding', () {- final defaults = [bind('cmd+p', 'navigation.quick_open')];- final sequence = bind('cmd+p h', 'pane.focus_left');+ final defaults = [bind('cmd+t', 'swarm.new')];+ final sequence = bind('cmd+t h', 'pane.focus_left');expect(() => ResolvedKeymap(defaults, KeymapConfig([sequence])),throwsFormatException,);final map = ResolvedKeymap(defaults,- KeymapConfig([bind('cmd+p', null), sequence]),+ KeymapConfig([bind('cmd+t', null), sequence]),);- expect(match(map, 'cmd+p').prefix, true);- expect(match(map, 'cmd+p').command, null);- expect(match(map, 'cmd+p h').command, 'pane.focus_left');- expect(match(map, 'cmd+p l').matched, false);- expect(match(map, 'cmd+p h j').matched, false);+ expect(match(map, 'cmd+t').prefix, true);+ expect(match(map, 'cmd+t').command, null);+ expect(match(map, 'cmd+t h').command, 'pane.focus_left');+ expect(match(map, 'cmd+t l').matched, false);+ expect(match(map, 'cmd+t h j').matched, false);});test(@@ -138,15 +133,15 @@ void main() {() {expect(() => ResolvedKeymap([- bind('cmd+p h', 'pane.focus_left'),- bind('cmd+p', 'navigation.quick_open'),+ bind('cmd+t h', 'pane.focus_left'),+ bind('cmd+t', 'swarm.new'),], const KeymapConfig.empty()),throwsFormatException,);expect(() => ResolvedKeymap([- bind('cmd+p h', 'pane.focus_left', KeymapContext.terminal),- ], KeymapConfig([bind('cmd+p', 'navigation.quick_open')])),+ bind('cmd+t h', 'pane.focus_left', KeymapContext.terminal),+ ], KeymapConfig([bind('cmd+t', 'swarm.new')])),throwsFormatException,);},@@ -154,11 +149,11 @@ void main() {test('unbinding a prefix releases its entire inherited sequence tree', () {final map = ResolvedKeymap([- bind('cmd+p h', 'pane.focus_left'),- bind('cmd+p p', 'navigation.quick_open'),- ], KeymapConfig([bind('cmd+p', null)]));- expect(match(map, 'cmd+p').matched, false);- expect(match(map, 'cmd+p h').matched, false);+ bind('cmd+t h', 'pane.focus_left'),+ bind('cmd+t p', 'swarm.new'),+ ], KeymapConfig([bind('cmd+t', null)]));+ expect(match(map, 'cmd+t').matched, false);+ expect(match(map, 'cmd+t h').matched, false);});test(@@ -173,7 +168,7 @@ void main() {);expect(() => KeymapConfig.parse(- '{"bindings":[{"keys":"cmd+p","command":null,"scope":"terminal"}]}',+ '{"bindings":[{"keys":"cmd+t","command":null,"scope":"terminal"}]}',commands: commands,),throwsFormatException,diff --git a/desktop/test/machine_tree_widget_test.dart b/desktop/test/machine_tree_widget_test.dartindex c7f8176e9..eee682d68 100644--- a/desktop/test/machine_tree_widget_test.dart+++ b/desktop/test/machine_tree_widget_test.dart@@ -174,11 +174,11 @@ void main() {);await tester.pump();- expect(find.text('New agent…'), findsOneWidget);+ expect(find.text('Create Agent…'), findsOneWidget);expect(find.text('no running agents'), findsNothing);// The old button read "New agent" flat, and it is the ellipsis that promises a dialog rather than an// agent appearing on the spot.- expect(find.text('New agent'), findsNothing);+ expect(find.text('Create Agent'), findsNothing);});testWidgets('a machine that HAS agents is offered the same row, last', (@@ -198,9 +198,9 @@ void main() {await tester.pump();expect(find.text('backend-api'), findsOneWidget);- expect(find.text('New agent…'), findsOneWidget);+ expect(find.text('Create Agent…'), findsOneWidget);// …and LAST, because a row that would create the next agent has to stand where the next agent would.- final rowY = tester.getTopLeft(find.text('New agent…')).dy;+ final rowY = tester.getTopLeft(find.text('Create Agent…')).dy;for (final name in ['backend-api', 'future-worker', 'herdr-session']) {expect(tester.getTopLeft(find.text(name)).dy,diff --git a/desktop/test/new_agent_codex_profile_test.dart b/desktop/test/new_agent_codex_profile_test.dartindex 7bb7982c9..853314475 100644--- a/desktop/test/new_agent_codex_profile_test.dart+++ b/desktop/test/new_agent_codex_profile_test.dart@@ -197,7 +197,7 @@ void main() {expect(find.text('Link a profile folder…'), findsOneWidget);await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], isNull);});@@ -218,7 +218,7 @@ void main() {expect(find.text('Link a profile folder…'), findsOneWidget);await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], '/custom/work-login');expect(tester.takeException(), isNull);@@ -291,7 +291,7 @@ void main() {await open(tester, notifier: notifier);await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- final createButton = find.widgetWithText(FilledButton, 'Create agent');+ final createButton = find.widgetWithText(FilledButton, 'Create Agent');expect(tester.widget<FilledButton>(createButton).onPressed, isNull);expect(notifier.calls, isEmpty);notifier.pending!.complete();@@ -323,7 +323,7 @@ void main() {expectProfile(tester, 'codex1');await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], '/accounts/codex1');});@@ -347,7 +347,7 @@ void main() {expectProfile(tester, 'Default profile');await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], isNull);});@@ -360,7 +360,7 @@ void main() {expectProfile(tester, 'codex2');await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls, [{'engine': 'codex', 'codexHome': '/accounts/codex2', 'folder': '/work'},@@ -435,7 +435,7 @@ void main() {);await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], isNull);expect(notifier.calls.single['engine'], 'claude');@@ -455,7 +455,7 @@ void main() {);await tester.tap(find.text('Browse…'));await tester.pumpAndSettle();- await tester.tap(find.widgetWithText(FilledButton, 'Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pumpAndSettle();expect(notifier.calls.single['codexHome'], isNull);},diff --git a/desktop/test/new_agent_engine_check_test.dart b/desktop/test/new_agent_engine_check_test.dartindex 36ff760f9..bef6fbf51 100644--- a/desktop/test/new_agent_engine_check_test.dart+++ b/desktop/test/new_agent_engine_check_test.dart@@ -184,7 +184,7 @@ void main() {findsOneWidget,);expect(app.launches, isEmpty);- await tester.tap(find.text('Create agent'));+ await tester.tap(find.widgetWithText(FilledButton, 'Create Agent'));await tester.pump();expect(app.launches.single, {'machine': 'machine-1',diff --git a/desktop/test/rail_agents_first_test.dart b/desktop/test/rail_agents_first_test.dartindex 0a3f4af4e..53371e62c 100644--- a/desktop/test/rail_agents_first_test.dart+++ b/desktop/test/rail_agents_first_test.dart@@ -107,7 +107,7 @@ void main() {// by accident. Measured on the clip box, not on a button — each button// keeps its own 24px inside it either way.final menu = find.byTooltip('Machine options');- final plus = find.byTooltip('New agent here…');+ final plus = find.byTooltip('Create Agent here…');expect(menu, findsOneWidget);expect(plus, findsOneWidget);Size actionsBox() => tester.getSize(diff --git a/desktop/test/search_workspace_test.dart b/desktop/test/search_workspace_test.dartindex 1fc80612f..f1729b23e 100644--- a/desktop/test/search_workspace_test.dart+++ b/desktop/test/search_workspace_test.dart@@ -3,8 +3,7 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/terminal/terminal_binary.dart';-import 'package:harness/widgets/swarm_icon.dart';-import 'package:harness/widgets/swarm_navigator.dart';+import 'package:harness/widgets/swarm_switcher.dart';import 'keymap_host_test.dart' show MemoryKeymap, key;import 'keymap_runtime_test.dart' show mount;@@ -14,17 +13,18 @@ import 'swarm_state_test.dart' show createApp;void main() {for (final native in [false, true]) {testWidgets(- 'shared ${native ? 'native-button' : 'Flutter-button'} picker owns arrows, select-all, delete and command mode',+ 'command and Add pickers own editing without previews (native=$native)',(tester) async {debugDefaultTargetPlatformOverride = TargetPlatform.macOS;addTearDown(() => debugDefaultTargetPlatformOverride = null);+ const channel = MethodChannel('harness/swarm_tabs');tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(- const MethodChannel('harness/swarm_tabs'),+ channel,(_) async => null,);addTearDown(() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(- const MethodChannel('harness/swarm_tabs'),+ channel,null,),);@@ -32,19 +32,14 @@ void main() {final app = createApp();app.machineStates['m']!.nodeOnline = true;final input = <TerminalBinaryFrame>[];- final session = terminal('a0', input)- ..terminal.write('Reviewing the implementation\r\nAll checks passed');- app.adoptSessionForTest(session);+ app.adoptSessionForTest(+ terminal('a0', input)..terminal.write('Private terminal output'),+ );await mount(tester, app, map, native: native);final field = find.byKey(const ValueKey('swarm-search-input'));- expect(field, findsNothing);- await key(tester, LogicalKeyboardKey.keyP, cmd: true);- await tester.pump();- expect(field, findsOneWidget);- expect(find.byType(SwarmNavigator), findsOneWidget);+ await key(tester, LogicalKeyboardKey.keyP, cmd: true, shift: true);final controller = tester.widget<TextField>(field).controller!;final focus = tester.widget<TextField>(field).focusNode!;- expect(focus.hasFocus, isTrue);final selected = find.byWidgetPredicate((w) => w is ListTile && w.selected,);@@ -53,52 +48,37 @@ void main() {expect(tester.widget<ListTile>(selected).key, isNot(first));await key(tester, LogicalKeyboardKey.arrowUp);expect(tester.widget<ListTile>(selected).key, first);- await tester.enterText(field, 'Agent 0');- await tester.pump();- expect(- find.byKey(const ValueKey('swarm-navigation-locations')),- findsOneWidget,- );- expect(- find.byKey(const ValueKey('swarm-search-preview')),- findsNothing,- );+ await tester.enterText(field, 'new');await key(tester, LogicalKeyboardKey.keyA, cmd: true);- expect(controller.selection.textInside(controller.text), 'Agent 0');+ expect(controller.selection.textInside(controller.text), 'new');await key(tester, LogicalKeyboardKey.backspace);expect(controller.text, isEmpty);- await tester.enterText(field, 'Agent 1');- await key(tester, LogicalKeyboardKey.keyP, cmd: true);- expect(controller.selection.textInside(controller.text), 'Agent 1');- await key(tester, LogicalKeyboardKey.keyP, cmd: true, shift: true);- expect(controller.text, '> ');- expect(find.text('Search commands…'), findsOneWidget);expect(- find.byKey(const ValueKey('swarm-search-preview')),- findsNothing,+ tester+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))+ .search+ .rows+ .every((row) => row.isCommand),+ isTrue,);- expect(app.activeSwarm.pinnedSlots, isEmpty);- await key(tester, LogicalKeyboardKey.keyA, cmd: true);- await key(tester, LogicalKeyboardKey.backspace);- expect(controller.text, isEmpty);- expect(find.byType(SwarmIcon), findsWidgets);expect(focus.hasFocus, isTrue);- expect(input, isEmpty);await key(tester, LogicalKeyboardKey.escape);expect(field, findsNothing);- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));- await tester.pump();+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);await tester.enterText(field, 'Agent 0');await tester.pump();+ expect(+ find.byKey(const ValueKey('swarm-search-preview')),+ findsNothing,+ );+ expect(find.textContaining('Private terminal output'), findsNothing);final results = tester.getRect(find.byKey(const ValueKey('swarm-search-result-list')),);- final preview = tester.getRect(- find.byKey(const ValueKey('swarm-search-preview')),+ final picker = tester.getRect(+ find.byKey(const ValueKey('swarm-search-results')),);- expect(preview.left, greaterThanOrEqualTo(results.right));- expect(preview.top, results.top);- expect(find.textContaining('All checks passed'), findsOneWidget);+ expect(results.width, closeTo(picker.width, 2));expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);expect(input, isEmpty);await key(tester, LogicalKeyboardKey.escape);diff --git a/desktop/test/shortcuts_deck_test.dart b/desktop/test/shortcuts_deck_test.dartindex 29808ea1e..cc156c74c 100644--- a/desktop/test/shortcuts_deck_test.dart+++ b/desktop/test/shortcuts_deck_test.dart@@ -50,7 +50,7 @@ void main() {await pumpDeck(tester, 900);- final navigate = tester.getTopLeft(find.text('NAVIGATE'));+ final navigate = tester.getTopLeft(find.text('WORKSPACE'));final panes = tester.getTopLeft(find.text('PANES'));expect(panes.dx, greaterThan(navigate.dx), reason: 'a second lane');expect(panes.dy, navigate.dy, reason: 'and level with the first');@@ -65,7 +65,7 @@ void main() {await pumpDeck(tester, 320);- final navigate = tester.getTopLeft(find.text('NAVIGATE'));+ final navigate = tester.getTopLeft(find.text('WORKSPACE'));final panes = tester.getTopLeft(find.text('PANES'));expect(panes.dx, navigate.dx);expect(panes.dy, greaterThan(navigate.dy));diff --git a/desktop/test/shortcuts_test.dart b/desktop/test/shortcuts_test.dartindex 6bcd962e8..f9dd9d66f 100644--- a/desktop/test/shortcuts_test.dart+++ b/desktop/test/shortcuts_test.dart@@ -291,8 +291,11 @@ void main() {test('the terminal verbs tmux trained people on are all here', () {expect(chordsFor(ShortcutAction.zoomPane), contains('⌘⏎'));expect(chordsFor(ShortcutAction.lastPane), contains('⌘;'));- expect(chordsFor(ShortcutAction.switchAgent), contains('⌘P'));- expect(chordsFor(ShortcutAction.switchAgent), isNot(contains('⇧⌘F')));+ expect(chordsFor(ShortcutAction.newSwarm), ['⌘T']);+ expect(+ appShortcuts().where((s) => describeShortcut(s.activator) == '⌘P'),+ isEmpty,+ );expect(chordsFor(ShortcutAction.addAgent), ['⌘N']);expect(chordsFor(ShortcutAction.newAgent), ['⇧⌘N']);expect(chordsFor(ShortcutAction.showAttention), ['⇧⌘I']);@@ -329,7 +332,7 @@ void main() {['⌘', '→'],]);- final next = rows.firstWhere((row) => row.label == 'Next swarm');+ final next = rows.firstWhere((row) => row.label == 'Next tab');expect(next.chords, [['⇧', '⌘', ']'],['⌃', '⇥'],diff --git a/desktop/test/swarm_add_agent_test.dart b/desktop/test/swarm_add_agent_test.dartindex 485253199..5bd56dff6 100644--- a/desktop/test/swarm_add_agent_test.dart+++ b/desktop/test/swarm_add_agent_test.dart@@ -47,7 +47,7 @@ void main() {'Agent 0',);await tester.pump();- expect(find.text('Add to this swarm'), findsNWidgets(2));+ expect(find.text('Add to this tab'), findsNWidgets(2));expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);expect(find.text('Go to agent'), findsNothing);expect(find.byType(AlertDialog), findsNothing);@@ -82,7 +82,7 @@ void main() {await tester.pump();final neighborRect = tester.getRect(find.byKey(neighbor.cellKey));final expected = app.preparePaneSplit(axis)!;- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);final inputField = find.byKey(const ValueKey('swarm-search-input'));await tester.enterText(inputField,diff --git a/desktop/test/swarm_attention_picker_test.dart b/desktop/test/swarm_attention_picker_test.dartindex 52209b340..f7b71c26d 100644--- a/desktop/test/swarm_attention_picker_test.dart+++ b/desktop/test/swarm_attention_picker_test.dart@@ -115,13 +115,7 @@ void main() {await tester.pump(const Duration(milliseconds: 10));expect(firstInput.single.bytes, [27, 91, 68]);expect(secondInput, isEmpty);- await chord(tester, LogicalKeyboardKey.keyP);- expect(- find.descendant(of: selectedRow, matching: find.text('Agent 1')),- findsOneWidget,- );- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();+ await chord(tester, LogicalKeyboardKey.bracketLeft);expect(app.activeSwarmId, second.id);expect(app.focusedPaneId, secondPane.id);await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);diff --git a/desktop/test/swarm_commands_test.dart b/desktop/test/swarm_commands_test.dartindex 05c5f7d65..bec9a2a6d 100644--- a/desktop/test/swarm_commands_test.dart+++ b/desktop/test/swarm_commands_test.dart@@ -18,7 +18,7 @@ void main() {addTearDown(app.dispose);final command = SwarmDestination(id: 'command:swarm.new',- title: 'New swarm',+ title: 'New Agent',detail: 'Navigate',swarmId: null,current: false,@@ -32,7 +32,7 @@ void main() {commands: () => available ? [command] : [],);addTearDown(search.dispose);- search.setQuery('New swarm');+ search.setQuery('New Agent');expect(search.rows.any((row) => row.isCommand), isFalse);search.setQuery('> new');expect(search.selected, same(command));@@ -68,13 +68,13 @@ void main() {final pane = app.adoptSessionForTest(terminal('a0', frames));final original = app.activeSwarm;await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);final input = find.byKey(const ValueKey('swarm-search-input'));await tester.enterText(input, '> pin');await tester.pump();expect(find.text('⌘⇧P'), findsNothing);expect(find.text('⇧⌘P'), findsNothing);- expect(find.text('Add to this swarm'), findsNothing);+ expect(find.text('Add to this tab'), findsNothing);expect(find.byKey(const ValueKey('command:pane.pin')), findsOneWidget);expect(app.isPanePinned(pane), isFalse);await tester.sendKeyEvent(LogicalKeyboardKey.enter);@@ -106,7 +106,7 @@ void main() {);testWidgets(- 'New swarm commands stay inline and hand focus to the chosen dialog',+ 'New tab commands stay inline and hand focus to the chosen dialog',(tester) async {final app = createApp();await mount(tester, app);diff --git a/desktop/test/swarm_history_test.dart b/desktop/test/swarm_history_test.dartindex 80f8924b3..d3ca3dac4 100644--- a/desktop/test/swarm_history_test.dart+++ b/desktop/test/swarm_history_test.dart@@ -356,32 +356,8 @@ void main() {await tester.pump();await settings;- // Native navigation opens the centered editor and exact locations.- final jumping = native('jump');- await tester.pump();- expect(- find.byKey(const ValueKey('swarm-search-results')),- findsOneWidget,- );- final field = find.byKey(const ValueKey('swarm-search-input'));- expect(field, findsOneWidget);- await tester.enterText(field, 'Agent 1');- await tester.pump();- expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);- expect(fieldUpdates, isEmpty, reason: 'Queries stay in Flutter');- final picker = tester.getRect(- find.byKey(const ValueKey('swarm-search-results')),- );- expect(picker.width, greaterThan(600));- expect(- picker.center.dx,- tester.view.physicalSize.width / tester.view.devicePixelRatio / 2,- );- expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);- expect(otherInput, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await native('historyDestination', {'id': agentDestinationId('m', 'a1')});await tester.pump();- await jumping;expect(app.focusedPaneId, second.id);await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);await tester.pump(const Duration(milliseconds: 10));diff --git a/desktop/test/swarm_inline_search_test.dart b/desktop/test/swarm_inline_search_test.dartindex 45d87a320..c0bb13391 100644--- a/desktop/test/swarm_inline_search_test.dart+++ b/desktop/test/swarm_inline_search_test.dart@@ -17,7 +17,7 @@ final _results = find.byKey(const ValueKey('swarm-welcome-search-results'));void main() {for (final native in [false, true]) {testWidgets(- 'New swarm arrives ready to type without opening results (native=$native)',+ 'New tab arrives ready to type without opening results (native=$native)',(tester) async {const channel = MethodChannel('harness/swarm_tabs');final messages = <MethodCall>[];@@ -142,7 +142,7 @@ void main() {}testWidgets(- 'New swarm keeps editing and results at the field that was clicked',+ 'New tab keeps editing and results at the field that was clicked',(tester) async {final app = createApp();await mount(tester, app);@@ -168,15 +168,12 @@ void main() {await tester.tap(_input);await tester.pump();expect(_results, findsOneWidget);- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.pump();- expect(_results, findsNothing);- expect(- find.byKey(const ValueKey('swarm-search-results')),- findsOneWidget,- );- expect(tester.widget<TextField>(top).focusNode!.hasFocus, isTrue);- expect(tester.widget<TextField>(top).controller!.text, isEmpty);+ expect(_results, findsOneWidget);+ expect(top, findsNothing);+ expect(tester.widget<TextField>(_input).focusNode!.hasFocus, isTrue);+ expect(tester.widget<TextField>(_input).controller!.text, '> ');await tester.pumpWidget(const SizedBox());app.dispose();},diff --git a/desktop/test/swarm_interactions_test.dart b/desktop/test/swarm_interactions_test.dartindex 675222700..edeec5234 100644--- a/desktop/test/swarm_interactions_test.dart+++ b/desktop/test/swarm_interactions_test.dart@@ -242,7 +242,7 @@ void main() {expect(input.single.streamId, 'stream-a1');expect(String.fromCharCodes(input.single.bytes), 'x');await activate('rename', {'id': second});- expect(find.text('Rename swarm'), findsOneWidget);+ expect(find.text('Rename tab'), findsOneWidget);final name = tester.widget<TextField>(find.byType(TextField));expect(name.focusNode!.hasPrimaryFocus, isTrue);tester.testTextInput.enterText('Keyboard work');@@ -262,7 +262,7 @@ void main() {expect(app.swarms, hasLength(1));expect(app.panes, isEmpty);expect(app.activeSwarmId, isNot(anyOf(first, second)));- expect(find.text('Start a swarm'), findsOneWidget);+ expect(find.text('New Agent'), findsOneWidget);await activate('new');expect(app.swarms, hasLength(2));expect(input, hasLength(2));diff --git a/desktop/test/swarm_multi_add_test.dart b/desktop/test/swarm_multi_add_test.dartindex 42675474b..167beee81 100644--- a/desktop/test/swarm_multi_add_test.dart+++ b/desktop/test/swarm_multi_add_test.dart@@ -225,7 +225,7 @@ void main() {app.newSwarm();final target = app.activeSwarm;await mount(tester, app);- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));+ await chord(tester, LogicalKeyboardKey.keyN);await tester.pump();final field = find.byKey(const ValueKey('swarm-search-input'));await tester.enterText(field, 'Agent 0');@@ -264,7 +264,7 @@ void main() {await tester.pump();await tester.enterText(field, 'no results here');await tester.pump();- expect(find.text('Add 2 agents'), findsOneWidget);+ expect(find.text('Open 2 agents'), findsOneWidget);await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();expect(target.panes, [second, first]);diff --git a/desktop/test/swarm_navigator_test.dart b/desktop/test/swarm_navigator_test.dartindex 8b747641e..d5d96b8b6 100644--- a/desktop/test/swarm_navigator_test.dart+++ b/desktop/test/swarm_navigator_test.dart@@ -1,63 +1,12 @@-import 'package:flutter/material.dart';-import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/state/swarm_navigation.dart';import 'package:harness/state/swarm_search.dart';-import 'package:harness/terminal/terminal_binary.dart';-import 'package:harness/widgets/swarm_navigator.dart';-import 'package:harness/widgets/swarm_switcher.dart';-import 'swarm_interactions_test.dart' show chord;-import 'swarm_screen_test.dart' show mount, terminal;+import 'swarm_screen_test.dart' show terminal;import 'swarm_state_test.dart' show createApp;void main() {- testWidgets('swarm parents appear once above their indented agents', (- tester,- ) async {- final app = createApp();- final pane = app.adoptSessionForTest(terminal('a0', []));- final populated = app.activeSwarm;- app.renameSwarm(populated.id, 'Release');- app.newSwarm(name: 'Empty');- final empty = app.activeSwarm;- await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);- final navigator = find.byType(SwarmNavigator);- final parent = find.byKey(ValueKey(swarmDestinationId(populated.id)));- final child = find.byKey(ValueKey(agentLocationId(populated.id, pane.id)));- final emptyParent = find.byKey(ValueKey(swarmDestinationId(empty.id)));- expect(- find.descendant(of: navigator, matching: find.text('Release')),- findsOneWidget,- );- expect(- find.descendant(of: navigator, matching: find.text('Empty')),- findsOneWidget,- );- expect(- tester.getRect(parent).bottom,- lessThanOrEqualTo(tester.getRect(child).top),- );- final parentPadding =- tester.widget<ListTile>(parent).contentPadding! as EdgeInsets;- final childPadding =- tester.widget<ListTile>(child).contentPadding! as EdgeInsets;- expect(childPadding.left, greaterThan(parentPadding.left));- await tester.tap(parent);- await tester.pump();- expect(app.activeSwarm, same(populated));- await chord(tester, LogicalKeyboardKey.keyP);- await tester.tap(emptyParent);- await tester.pump();- expect(app.activeSwarm, same(empty));- expect(app.panes, isEmpty);- expect(tester.takeException(), isNull);- await tester.pumpWidget(const SizedBox());- app.dispose();- });-test('each membership is an exact destination, never an implicit add or fallback', () async {final app = createApp();addTearDown(app.dispose);@@ -80,7 +29,6 @@ void main() {});expect(search.rows.map((r) => r.id).toSet(), hasLength(6));expect(search.selected?.agentId, 'a0');- expect(search.previewVisible, isFalse);final exact = search.rows.singleWhere((r) => r.swarmId == second.id && r.agentId != null,);@@ -181,115 +129,4 @@ void main() {expect(app.focusedPane, same(pane));},);-- testWidgets(- 'navigation offers three locations and sends the next key only to the chosen agent',- (tester) async {- final app = createApp();- final input = <TerminalBinaryFrame>[];- final pane = app.adoptSessionForTest(terminal('a0', input));- final first = app.activeSwarm;- app.renameSwarm(first.id, 'Release');- app.newSwarm(name: 'Review');- final second = app.activeSwarm;- await app.addAgentToSwarm('m', 'a0');- app.newSwarm(name: 'Research');- final third = app.activeSwarm;- await app.addAgentToSwarm('m', 'a0');- app.machineStates['m']!.nodeOnline = true;- await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);- final field = find.byKey(const ValueKey('swarm-search-input'));- await tester.enterText(field, 'Agent 0');- await tester.pump();- expect(find.byType(SwarmNavigator), findsOneWidget);- expect(find.byType(SwarmSearchResults), findsNothing);- expect(- find.descendant(- of: find.byType(SwarmNavigator),- matching: find.text('Release'),- ),- findsOneWidget,- );- expect(- find.descendant(- of: find.byType(SwarmNavigator),- matching: find.text('Review'),- ),- findsOneWidget,- );- expect(- find.descendant(- of: find.byType(SwarmNavigator),- matching: find.text('Research'),- ),- findsOneWidget,- );- final pickerRect = tester.getRect(- find.byKey(const ValueKey('swarm-search-results')),- );- await tester.tap(- find.byKey(ValueKey(agentLocationId(second.id, pane.id))),- );- await tester.pump();- expect(app.activeSwarm, same(second));- expect(input, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump(const Duration(milliseconds: 10));- expect(input.single.bytes, [27, 91, 68]);- expect(first.panes, [pane]);- expect(third.panes, [pane]);- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));- await tester.pump();- expect(find.byType(SwarmNavigator), findsNothing);- expect(find.byType(SwarmSearchResults), findsOneWidget);- expect(- tester- .getRect(find.byKey(const ValueKey('swarm-search-results')))- .width,- greaterThan(pickerRect.width),- );- expect(find.text('New agent'), findsOneWidget);- await tester.enterText(field, 'Agent 0');- await tester.pump();- expect(find.text('In this swarm'), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(second.panes, [pane]);- expect(find.byType(SwarmSearchResults), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump();- expect(tester.takeException(), isNull);- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );-- testWidgets(- 'an unmatched navigation query can enter Add without losing the query or changing membership',- (tester) async {- final app = createApp();- final pane = app.adoptSessionForTest(terminal('a0', []));- await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);- final input = find.byKey(const ValueKey('swarm-search-input'));- await tester.enterText(input, 'Agent 69');- await tester.pump();- expect(find.textContaining('No matching open agents'), findsOneWidget);- await tester.tap(find.byKey(const ValueKey('navigation-add-agent')));- await tester.pump();- expect(tester.widget<TextField>(input).controller!.text, 'Agent 69');- expect(tester.widget<TextField>(input).focusNode!.hasFocus, isTrue);- expect(app.panes, [pane]);- expect(find.text('New agent'), findsOneWidget);- expect(- find.byKey(const ValueKey('swarm-search-preview')),- findsOneWidget,- );- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump();- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );}diff --git a/desktop/test/swarm_project_members_test.dart b/desktop/test/swarm_project_members_test.dartindex af797941d..fa98ef799 100644--- a/desktop/test/swarm_project_members_test.dart+++ b/desktop/test/swarm_project_members_test.dart@@ -1,4 +1,5 @@import 'package:flutter/material.dart';+import 'package:harness/widgets/swarm_project_agents.dart';import 'package:flutter_test/flutter_test.dart';import 'package:harness/core/models.dart';import 'package:harness/screens/swarm_screen.dart';@@ -60,9 +61,11 @@ void main() {),);await tester.pump();- await tester.tap(find.byTooltip('Project options for Workshop'));- await tester.pumpAndSettle();- await tester.tap(find.text('Choose agents…'));+ final editing = showSwarmProjectAgents(+ tester.element(find.byType(SwarmScreen)),+ app,+ swarmProjects(app, projects.projects).single,+ );await tester.pumpAndSettle();await tester.enterText(find.byWidgetPredicate(@@ -76,6 +79,9 @@ void main() {await tester.tap(find.widgetWithText(CheckboxListTile, 'Chess Set'));await tester.tap(find.text('Save'));await tester.pumpAndSettle();+ final saved = await editing;+ expect(saved, isNotNull);+ await projects.add(saved!);final restored = SwarmProjectStore(storage: memory);await restored.load();final group = swarmProjects(app, restored.projects).single;@@ -86,7 +92,12 @@ void main() {reason:'Editing project membership does not attach or take over terminals',);- await tester.tap(find.text('Workshop'));+ await tester.enterText(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ 'Workshop',+ );+ await tester.pump();+ await tester.tap(find.widgetWithText(ListTile, 'Workshop'));await tester.pump(const Duration(milliseconds: 100));expect(app.panes.map((p) => (p.machineId, p.agentId)), [('m', 'a0'),diff --git a/desktop/test/swarm_reopen_test.dart b/desktop/test/swarm_reopen_test.dartindex 2705248d1..c8bee28e1 100644--- a/desktop/test/swarm_reopen_test.dart+++ b/desktop/test/swarm_reopen_test.dart@@ -175,7 +175,7 @@ void main() {expect(app.swarms, hasLength(AppNotifier.maxSwarms));await app.closeSwarm(app.activeSwarmId);app.reopenClosedSwarm();- expect(app.activeSwarm.name, 'New swarm');+ expect(app.activeSwarm.name, 'New Agent');// Free slots directly without adding newer close records to this check.app.swarms.removeRange(1, app.swarms.length);app.selectSwarm(app.swarms.single.id);diff --git a/desktop/test/swarm_resize_test.dart b/desktop/test/swarm_resize_test.dartindex 74cd574ea..20312f572 100644--- a/desktop/test/swarm_resize_test.dart+++ b/desktop/test/swarm_resize_test.dart@@ -120,7 +120,7 @@ void main() {app.adoptSessionForTest(terminal('a1', frames));await mountWide(tester, app);final before = tester.getSize(find.byKey(left.cellKey)).width;- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(find.byKey(const ValueKey('swarm-search-input')),'> resize panes',diff --git a/desktop/test/swarm_screen_test.dart b/desktop/test/swarm_screen_test.dartindex e0eb1be22..5a9143f92 100644--- a/desktop/test/swarm_screen_test.dart+++ b/desktop/test/swarm_screen_test.dart@@ -58,6 +58,68 @@ TerminalSession terminal(String id, List<TerminalBinaryFrame> input) =>..streamId = 'stream-$id';void main() {+ for (final native in [false, true]) {+ testWidgets('tab identity follows its agent count (native=$native)', (+ tester,+ ) async {+ const channel = MethodChannel('harness/swarm_tabs');+ final updates = <Map>[];+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(channel, (+ call,+ ) async {+ if (call.method == 'update') updates.add(call.arguments as Map);+ return true;+ });+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ final app = createApp();+ final tab = app.activeSwarm;+ await mount(tester, app, nativeTabs: native);+ expect(tab.name, 'New Agent');+ expect(find.text('New Agent'), findsWidgets);++ await app.addAgentToSwarm('m', 'a0');+ await tester.pump();+ if (native) {+ final row = (updates.last['tabs'] as List).single as Map;+ expect(row['agentCount'], 1);+ expect(row['engine'], 'codex');+ expect(row['iconAsset'], 'assets/engine-icons/codex.png');+ } else {+ expect(find.byKey(ValueKey('tab-engine:${tab.id}')), findsOneWidget);+ }++ await app.addAgentToSwarm('m', 'a1');+ await tester.pump();+ if (native) {+ final row = (updates.last['tabs'] as List).single as Map;+ expect(row['agentCount'], 2);+ expect(row['engine'], isNull);+ } else {+ expect(find.byKey(ValueKey('tab-group:${tab.id}')), findsOneWidget);+ }++ await app.closePane(app.panes.last.id);+ await tester.pump();+ if (native) {+ expect(+ ((updates.last['tabs'] as List).single as Map)['engine'],+ 'codex',+ );+ } else {+ expect(find.byKey(ValueKey('tab-engine:${tab.id}')), findsOneWidget);+ expect(find.byKey(ValueKey('tab-group:${tab.id}')), findsNothing);+ }+ expect(app.activeSwarm, same(tab));+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+ }+testWidgets('an older daemon working folder is searchable and seeds its real agents',(tester) async {@@ -73,7 +135,7 @@ void main() {},);await mount(tester, app);- expect(find.text('Existing project'), findsOneWidget);+ expect(find.text('Existing project'), findsNothing);await tester.tap(find.byKey(const ValueKey('swarm-welcome-search-input')),);@@ -92,9 +154,7 @@ void main() {findsOneWidget,);expect(find.byKey(ValueKey(agentDestinationId('m', 'a2'))), findsNothing);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump();- await tester.tap(find.text('Existing project'));+ await tester.tap(find.widgetWithText(ListTile, 'Existing project'));await tester.pump(const Duration(milliseconds: 100));expect(app.activeSwarm.name, 'Existing project');expect(app.panes.map((p) => p.agentId), ['a0', 'a1']);@@ -108,9 +168,9 @@ void main() {(tester) async {final app = createApp();await mount(tester, app);- expect(find.text('Start a swarm'), findsOneWidget);+ expect(find.text('New Agent'), findsWidgets);expect(find.text('Models'), findsNothing);- expect(find.text('Machines'), findsOneWidget);+ expect(find.text('Machines'), findsNothing);await tester.tap(find.byKey(const ValueKey('swarm-welcome-search-input')),);@@ -125,10 +185,11 @@ void main() {await tester.pump();await app.addAgentToSwarm('m', 'a2');app.toggleZoomPane();- await tester.pump();+ // The Add button appears when the first agent replaces the welcome page.+ await tester.pump(const Duration(milliseconds: 200));final zoom = app.zoomedPaneId;final before = tester.getSize(find.byType(PaneGrid));- await tester.tap(find.byKey(const ValueKey('swarm-search-button')));+ await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));await tester.pump(const Duration(milliseconds: 300));expect(find.byKey(const ValueKey('swarm-search-results')),diff --git a/desktop/test/swarm_search_preview_test.dart b/desktop/test/swarm_search_preview_test.dartindex d072798f5..c3b5fb85b 100644--- a/desktop/test/swarm_search_preview_test.dart+++ b/desktop/test/swarm_search_preview_test.dart@@ -1,158 +1,58 @@import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';-import 'package:harness/state/swarm_search.dart';-import 'package:harness/terminal/search_output_preview.dart';-import 'package:harness/terminal/terminal_binary.dart';-import 'package:xterm/xterm.dart';+import 'package:harness/widgets/swarm_switcher.dart';import 'swarm_interactions_test.dart' show chord;import 'swarm_screen_test.dart' show mount, terminal;import 'swarm_state_test.dart' show createApp;void main() {- test('preview joins wrapped prose and omits terminal decorations', () {- final terminal = Terminal()..resize(42, 18);- terminal.write(- '> Simplify setup\r\n\r\n'- ' Keep the working folder and agent choice when creation fails.\r\n'- ' The retry can then start from the same place.\r\n\r\n'- '— Worked for 2m 05s ─────────────────────\r\n'- '— Conversation recap ───────────────────\r\n'- ' Setup now preserves your choices.\r\n'- '> ',- );- final before = terminal.buffer.getText();- expect(- SearchOutputPreview.capture(terminal).text,- '> Simplify setup\n\n'- 'Keep the working folder and agent choice when creation fails. '- 'The retry can then start from the same place.\n\n'- 'Setup now preserves your choices.',- );- expect(terminal.buffer.getText(), before);- });-- test(- 'preview bounds scrollback, rows and columns without altering Unicode',- () {- final terminal = Terminal(maxLines: 10000)..resize(300, 120);- terminal.write('A short prompt in a tall pane');- expect(- SearchOutputPreview.capture(terminal).text,- 'A short prompt in a tall pane',- );- terminal.write('\r\n');- for (var i = 0; i < 500; i++) {- terminal.write('Old line $i\r\n');- }- terminal.write('${'木' * 150}\r\nRecent result 😀\r\n> ');- final before = terminal.buffer.getText();- final position = (terminal.buffer.cursorX, terminal.buffer.cursorY);- final snapshot = SearchOutputPreview.capture(terminal).text;- expect(snapshot.split('\n\n').length, lessThanOrEqualTo(3));- expect(- snapshot.runes.length,- lessThanOrEqualTo(SearchOutputPreview.shownCharacters + 1),- );- expect(snapshot, contains('木' * 96));- expect(snapshot, isNot(contains('木' * 97)));- expect(snapshot, contains('Recent result 😀'));- expect(snapshot, isNot(contains('Old line 0\n')));- expect(snapshot, isNot(contains('\uFFFD')));- expect(terminal.buffer.getText(), before);- expect((terminal.buffer.cursorX, terminal.buffer.cursorY), position);- terminal.write('\r\n' * (SearchOutputPreview.scannedLines + 1));- expect(SearchOutputPreview.capture(terminal).text, isEmpty);- expect(SearchOutputPreview.capture(null).text, isEmpty);- },- );-- test('preview is always on and cached until selection changes', () {- final app = createApp();- addTearDown(app.dispose);- final output = terminal('a0', []);- output.terminal.write('Original context');- final pane = app.adoptSessionForTest(output);- final search = SwarmSearchController(app, []);- addTearDown(search.dispose);- search.setQuery('Agent 0');- expect(search.previewVisible, isTrue);- final first = search.preview;- expect(first!.text, contains('Original context'));- output.terminal.write('\r\nNew output');- for (final query in ['Agent', 'Agent 0', 'Test host Agent 0']) {- search.setQuery(query);- expect(search.preview, same(first));- }- search.setQuery('Agent 1');- search.setQuery('Agent 0');- expect(search.preview!.text, contains('New output'));- expect(pane.session, same(output));- search.setQuery('Agent 1');- expect(search.preview!.text, isEmpty);- expect(app.allPanes, [pane]);- search.setQuery('>');- expect(search.previewVisible, isFalse);- expect(search.preview, isNull);- });-for (final inline in [false, true]) {testWidgets(- 'always-on preview keeps ${inline ? 'New swarm' : 'floating Add'} input and add action',+ 'agent and group results use a single list without previews (inline=$inline)',(tester) async {final app = createApp();- app.machineStates['m']!.nodeOnline = true;- final frames = <TerminalBinaryFrame>[];- final output = terminal('a0', frames);- output.terminal.write('Checking the build\r\nOne useful clue\r\n');- final original = app.adoptSessionForTest(output);+ app.adoptSessionForTest(+ terminal('a0', [])..terminal.write('Output belongs in the terminal'),+ );app.newSwarm();- final target = app.activeSwarm;await mount(tester, app);- final input = find.byKey(+ final field = find.byKey(ValueKey(inline ? 'swarm-welcome-search-input' : 'swarm-search-input',),);- if (!inline) {- await tester.tap(- find.byKey(const ValueKey('swarm-add-agent-button')),- );+ if (!inline) await chord(tester, LogicalKeyboardKey.keyN);+ for (final query in ['Agent 0', 'Test host']) {+ await tester.enterText(field, query);await tester.pump();+ final search = tester+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))+ .search;+ expect(search.rows, isNotEmpty);+ expect(+ find.byKey(const ValueKey('swarm-search-preview')),+ findsNothing,+ );+ expect(+ find.textContaining('Output belongs in the terminal'),+ findsNothing,+ );+ final list = tester.getRect(+ find.byKey(const ValueKey('swarm-search-result-list')),+ );+ final surface = tester.getRect(+ find.byKey(+ ValueKey(+ inline+ ? 'swarm-welcome-search-results'+ : 'swarm-search-results',+ ),+ ),+ );+ expect(list.width, closeTo(surface.width, 2));}- await tester.tap(input);- await tester.enterText(input, 'Agent 0');- await tester.pump();- expect(- find.byKey(const ValueKey('swarm-search-preview')),- findsOneWidget,- );- expect(- find.byKey(const ValueKey('swarm-search-preview-toggle')),- findsNothing,- );- final field = tester.widget<TextField>(input);- await chord(tester, LogicalKeyboardKey.keyI);- await tester.pump();- expect(- find.byKey(const ValueKey('swarm-search-preview')),- findsOneWidget,- );- expect(find.textContaining('One useful clue'), findsOneWidget);- expect(field.controller!.text, 'Agent 0');- expect(field.focusNode!.hasFocus, isTrue);- expect(app.activeSwarm, same(target));- expect(frames, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(app.focusedPaneId, original.id);- expect(app.panes.single.session, same(output));- expect(frames, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump(const Duration(milliseconds: 10));- expect(frames.single.bytes, [27, 91, 68]);- expect(tester.takeException(), isNull);await tester.pumpWidget(const SizedBox());app.dispose();},diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dartindex e9bf6e44e..416897bbb 100644--- a/desktop/test/swarm_search_render_test.dart+++ b/desktop/test/swarm_search_render_test.dart@@ -28,7 +28,7 @@ class _CatalogMachine extends MachineState {}void main() {- for (final add in [false, true]) {+ for (final add in [true]) {testWidgets('reopened ${add ? 'Add' : 'Navigate'} sees changed metadata and membership',(tester) async {@@ -126,7 +126,7 @@ void main() {}testWidgets(- 'reopening Add reuses catalog work but refreshes output and choices',+ 'reopening Add reuses catalog work and resets choices without showing output',(tester) async {final app = createApp();final machine = _CatalogMachine(app.machineStates['m']!.machine)@@ -150,7 +150,7 @@ void main() {final first = inputWidget().search!;final oldRow = first.selected!;expect(oldRow.agentId, 'a0');- expect(first.preview!.text, contains('Earlier useful output.'));+ expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);first.toggle();await tester.pump();expect(first.checkedCount, 1);@@ -164,7 +164,7 @@ void main() {await tester.pump();final next = inputWidget().search!;expect(next.checkedCount, 0);- expect(next.preview!.text, contains('Newest useful output.'));+ expect(find.textContaining('Newest useful output.'), findsNothing);expect(next.selected, same(oldRow));expect(machine.projectReads, 0, reason: 'Agent metadata did not change');expect(input, isEmpty);@@ -176,7 +176,7 @@ void main() {for (final native in [false, true]) {for (final add in [false, true]) {testWidgets(- '${add ? 'Add' : 'Navigate'} opening and cancel keep the canvas built (native $native)',+ '${add ? 'Add' : 'Commands'} opening and cancel keep the canvas built (native $native)',(tester) async {const channel = MethodChannel('harness/swarm_tabs');final messenger = tester.binding.defaultBinaryMessenger;@@ -197,6 +197,7 @@ void main() {await chord(tester,add ? LogicalKeyboardKey.keyN : LogicalKeyboardKey.keyP,+ shift: !add,);expect(tester@@ -351,7 +352,7 @@ void main() {final row = find.byKey(ValueKey(agentDestinationId('m', 'a0')));expect(tester.widget<ListTile>(row).enabled, isFalse);expect(- find.descendant(of: row, matching: find.text('In this swarm')),+ find.descendant(of: row, matching: find.text('In this tab')),findsOneWidget,);await app.closePane(app.panes.last.id);diff --git a/desktop/test/swarm_search_test.dart b/desktop/test/swarm_search_test.dartindex a2f80becd..cb5da9f3b 100644--- a/desktop/test/swarm_search_test.dart+++ b/desktop/test/swarm_search_test.dart@@ -27,7 +27,7 @@ void main() {await mount(tester, app);final input = find.byKey(const ValueKey('swarm-search-input'));expect(input, findsNothing);- await tester.tap(find.byKey(const ValueKey('swarm-search-button')));+ await chord(tester, LogicalKeyboardKey.keyN);await tester.pump();final originalController = tester.widget<TextField>(input).controller;await tester.enterText(input, 'a query only');@@ -174,7 +174,7 @@ void main() {search.setQuery('Test host');final choice = search.submit();expect(choice?.destination.isMachine, isTrue);- expect(SwarmSearchController.action(choice!.destination), 'Go to swarm');+ expect(SwarmSearchController.action(choice!.destination), 'Go to tab');expect(await activateSwarmSearchSelection(app,@@ -275,7 +275,7 @@ void main() {.take(3).toList();await mount(tester, app);- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));+ await chord(tester, LogicalKeyboardKey.keyN);await tester.pump();await tester.enterText(jumpField, 'Test host');await tester.pump();@@ -304,12 +304,12 @@ void main() {app.adoptSessionForTest(terminal('a1', secondInputs));final target = app.activeSwarm;await mount(tester, app);- await tester.tap(find.byKey(const ValueKey('swarm-add-agent-button')));+ await chord(tester, LogicalKeyboardKey.keyN);await tester.pump();await tester.enterText(jumpField, 'Agent 0');await tester.pump();expect(find.byKey(const ValueKey('swarm-row-action')), findsOneWidget);- expect(find.text('Add to this swarm'), findsNWidgets(2));+ expect(find.text('Add to this tab'), findsNWidgets(2));await chord(tester, LogicalKeyboardKey.enter);expect(find.byType(Dialog), findsNothing);expect(app.activeSwarm, same(target));@@ -332,7 +332,7 @@ void main() {for (final adding in [false, true]) {testWidgets(- 'Return waits for composing text in ${adding ? 'Add' : 'Navigate'}',+ 'Return waits for composing text in ${adding ? 'Add' : 'New Agent'}',(tester) async {final app = createApp();app.adoptSessionForTest(terminal('a0', []));@@ -340,24 +340,32 @@ void main() {app.newSwarm();final target = app.activeSwarm;await mount(tester, app);+ final field = find.byKey(+ ValueKey(+ adding ? 'swarm-search-input' : 'swarm-welcome-search-input',+ ),+ );if (adding) {- await tester.tap(- find.byKey(const ValueKey('swarm-add-agent-button')),- );+ await chord(tester, LogicalKeyboardKey.keyN);await tester.pump();} else {- await chord(tester, LogicalKeyboardKey.keyP);+ await tester.tap(field);+ await tester.pump();}- await tester.enterText(jumpField, 'Agent 0');+ await tester.enterText(field, 'Agent 0');await tester.pump();- final controller = tester.widget<TextField>(jumpField).controller!;+ final controller = tester.widget<TextField>(field).controller!;controller.value = controller.value.copyWith(composing: const TextRange(start: 0, end: 7),);await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();expect(- find.byKey(const ValueKey('swarm-search-results')),+ find.byKey(+ ValueKey(+ adding ? 'swarm-search-results' : 'swarm-welcome-search-results',+ ),+ ),findsOneWidget,);expect(find.byType(Dialog), findsNothing);@@ -366,7 +374,7 @@ void main() {await tester.sendKeyEvent(LogicalKeyboardKey.enter);await tester.pump();expect(app.panes.single.agentId, 'a0');- expect(app.activeSwarm, same(adding ? target : original));+ expect(app.activeSwarm, same(target));expect(original.panes, hasLength(1));await tester.pumpWidget(const SizedBox());app.dispose();diff --git a/desktop/test/swarm_split_test.dart b/desktop/test/swarm_split_test.dartindex af34026aa..0f6132900 100644--- a/desktop/test/swarm_split_test.dart+++ b/desktop/test/swarm_split_test.dart@@ -217,7 +217,7 @@ void main() {await mountWide(tester, app);tester.view.physicalSize = const Size(3000, 1800);await tester.pump();- await chord(tester, LogicalKeyboardKey.keyP);+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);await tester.enterText(find.byKey(const ValueKey('swarm-search-input')),'> split right',@@ -230,7 +230,7 @@ void main() {expect(find.byType(AlertDialog), findsNothing);await tester.tap(find.byKey(const ValueKey('swarm-search-new-agent')));await tester.pump();- expect(find.text('New agent to the right'), findsOneWidget);+ expect(find.text('Create Agent to the right'), findsOneWidget);expect(find.text('/work/checkout'), findsOneWidget);expect(app.panes, [pane]);await tester.sendKeyEvent(LogicalKeyboardKey.escape);diff --git a/desktop/test/swarm_state_test.dart b/desktop/test/swarm_state_test.dartindex f662d2215..905b7a1e9 100644--- a/desktop/test/swarm_state_test.dart+++ b/desktop/test/swarm_state_test.dart@@ -58,6 +58,28 @@ AppNotifier createApp({}void main() {+ test(+ 'old empty swarm names restore as tabs and still name the first agent',+ () async {+ final store = MemoryStore();+ final original = createApp(store: store);+ original.renameSwarm(original.activeSwarmId, 'New swarm');+ await original.flushPaneLayout();+ // Retain the old payload exactly as previous versions wrote it.+ expect(+ store.values.values.any((value) => value.contains('New swarm')),+ isTrue,+ );+ original.dispose();+ final restored = createApp(store: store);+ addTearDown(restored.dispose);+ await restored.restorePaneLayoutForTest();+ expect(restored.activeSwarm.name, 'New Agent');+ await restored.addAgentToSwarm('m', 'a0');+ expect(restored.activeSwarm.name, 'Agent 0');+ },+ );+test('first agent names a swarm and survives closing and reopening',() async {@@ -175,7 +197,7 @@ void main() {for (var i = 0; i < 70; i++) (machineId: 'm', agentId: 'a$i'),]);expect(app.panes.length, AppNotifier.maxPanes);- expect(app.lastError, contains('Open another swarm'));+ expect(app.lastError, contains('Open another tab'));expect(app.panes.first.agentId, 'a0');app.dispose();},diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dartindex 6daa3f100..23a137df4 100644--- a/desktop/test/swarm_switcher_test.dart+++ b/desktop/test/swarm_switcher_test.dart@@ -1,292 +1,122 @@import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_test/flutter_test.dart';-import 'package:harness/core/models.dart';-import 'package:harness/state/swarm_navigation.dart';+import 'package:harness/shortcuts/keymap_commands.dart';import 'package:harness/terminal/terminal_binary.dart';-import 'package:harness/state/pane_preset.dart';-import 'package:harness/widgets/terminal_panel.dart';-import 'package:xterm/xterm.dart';+import 'package:harness/widgets/swarm_switcher.dart';+import 'keymap_runtime_test.dart' show native;import 'swarm_interactions_test.dart' show chord;import 'swarm_screen_test.dart' show mount, terminal;import 'swarm_state_test.dart' show createApp;-Finder get jumpField => find.byWidgetPredicate(- (w) =>- w is TextField &&- w.key == const ValueKey('swarm-search-input') &&- w.decoration?.hintText == 'Find an agent or swarm…',-);+Finder get jumpField => find.byKey(const ValueKey('swarm-search-input'));Finder get selectedRow =>find.byWidgetPredicate((w) => w is ListTile && w.selected);void main() {- testWidgets('jump reveals an offscreen pane and delivers the first key there', (- tester,- ) async {- final app = createApp();- app.machineStates['m']!.nodeOnline = true;- final inputs = List.generate(12, (_) => <TerminalBinaryFrame>[]);- final sessions = List.generate(12, (i) => terminal('a$i', inputs[i]));- for (final session in sessions) {- app.adoptSessionForTest(session);- }- app.setPreset(12, PanePreset.cols2);- app.focusPane(app.panes.first.id);- await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);- await tester.enterText(jumpField, 'Agent 11');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- final pane = find.byWidgetPredicate(- (w) => w is TerminalPanel && identical(w.session, sessions.last),- );- final rect = tester.getRect(pane);- expect(rect.top, greaterThanOrEqualTo(40));- expect(rect.bottom, lessThanOrEqualTo(800));- final view = tester.widget<TerminalView>(- find.descendant(of: pane, matching: find.byType(TerminalView)),- );- expect(- view.focusNode!.hasFocus,- isTrue,- reason:- 'model ${app.focusedPaneId} / primary ${FocusManager.instance.primaryFocus}',+ for (final nativeTabs in [false, true]) {+ testWidgets(+ 'New Agent opens existing work in a new view and preserves its runtime (native=$nativeTabs)',+ (tester) async {+ const channel = MethodChannel('harness/swarm_tabs');+ tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ (_) async => null,+ );+ addTearDown(+ () => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(+ channel,+ null,+ ),+ );+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final frames = <TerminalBinaryFrame>[];+ final pane = app.adoptSessionForTest(terminal('a0', frames));+ final original = app.activeSwarm;+ await mount(tester, app, nativeTabs: nativeTabs);+ expect(find.byKey(const ValueKey('swarm-search-button')), findsNothing);+ expect(+ harnessCommandById.containsKey('navigation.quick_open'),+ isFalse,+ );+ await chord(tester, LogicalKeyboardKey.keyP);+ expect(jumpField, findsNothing);+ expect(app.swarms, [original]);+ if (nativeTabs) {+ await native(tester, 'jump');+ expect(jumpField, findsNothing);+ final opening = native(tester, 'new');+ await tester.pump();+ await opening;+ } else {+ await tester.tap(+ find.byKey(const ValueKey('swarm-new-agent-button')),+ );+ await tester.pump();+ }+ final opened = app.activeSwarm;+ expect(opened, isNot(same(original)));+ expect(opened.name, 'New Agent');+ expect(opened.panes, isEmpty);+ expect(find.byType(AlertDialog), findsNothing);+ final field = find.byKey(const ValueKey('swarm-welcome-search-input'));+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);+ await tester.enterText(field, 'Agent 0');+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(app.activeSwarm, same(opened));+ expect(opened.panes, [pane]);+ expect(original.panes, [pane]);+ expect(app.focusedPane, same(pane));+ expect(frames, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);+ await tester.pump(const Duration(milliseconds: 10));+ expect(frames.single.bytes, [27, 91, 68]);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump(const Duration(milliseconds: 10));- expect(inputs.last.single.bytes, [27, 91, 68]);- expect(inputs.take(11).every((input) => input.isEmpty), isTrue);- final gridScroll = tester- .widget<SingleChildScrollView>(find.byType(SingleChildScrollView).first)- .controller!;- for (final crossSwarm in [false, true]) {- if (crossSwarm) {- app.newSwarm();- } else {- gridScroll.jumpTo(0);- }- await tester.pump();- await chord(tester, LogicalKeyboardKey.keyP);- await tester.enterText(jumpField, 'Agent 11');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(tester.getRect(pane).bottom, lessThanOrEqualTo(800));- expect(tester.getRect(pane).top, greaterThanOrEqualTo(40));- expect(- tester- .widget<TerminalView>(- find.descendant(of: pane, matching: find.byType(TerminalView)),- )- .focusNode!- .hasFocus,- isTrue,- );- }- await tester.pumpWidget(const SizedBox());- app.dispose();- });+ }- testWidgets('jump focuses a same-Swarm pane, repeats focus and follows zoom', (+ testWidgets('command search stays commands-only and can open New Agent', (tester,) async {final app = createApp();- app.machineStates['m']!.nodeOnline = true;- final inputs = List.generate(3, (_) => <TerminalBinaryFrame>[]);- final sessions = List.generate(3, (i) => terminal('a$i', inputs[i]));- for (final session in sessions) {- app.adoptSessionForTest(session);- }+ final frames = <TerminalBinaryFrame>[];+ final pane = app.adoptSessionForTest(terminal('a0', frames));await mount(tester, app);- for (final i in [0, 0, 1]) {- if (i == 1) app.toggleZoomPane();- await chord(tester, LogicalKeyboardKey.keyP);- await tester.enterText(jumpField, 'Agent $i');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- final view = tester.widget<TerminalView>(- find.byWidgetPredicate(- (w) =>- w is TerminalView && identical(w.terminal, sessions[i].terminal),- ),- );+ await chord(tester, LogicalKeyboardKey.keyP, shift: true);+ final field = find.byKey(const ValueKey('swarm-search-input'));+ for (final query in ['', 'Agent 0', '> ', 'new']) {+ await tester.enterText(field, query);+ await tester.pump();+ final search = tester+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))+ .search;+ expect(search.isCommandMode, isTrue);+ expect(search.rows.every((row) => row.isCommand), isTrue);+ expect(find.text('Navigate'), findsNothing);expect(- view.focusNode!.hasFocus,- isTrue,- reason:- 'model ${app.focusedPaneId} / primary ${FocusManager.instance.primaryFocus}',+ find.byKey(const ValueKey('swarm-navigation-locations')),+ findsNothing,);- if (i == 1) expect(app.zoomedPaneId, app.panes[i].id);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump(const Duration(milliseconds: 10));+ expect(find.byKey(const ValueKey('swarm-search-preview')), findsNothing);}- expect(inputs[0], hasLength(2));- expect(inputs[1].single.bytes, [27, 91, 68]);- expect(inputs[2], isEmpty);+ expect(harnessCommandById['agent.new']!.label, 'Create Agent');+ await tester.tap(find.byKey(const ValueKey('command:swarm.new')));+ await tester.pump();+ expect(app.activeSwarm.name, 'New Agent');+ expect(app.panes, isEmpty);+ expect(app.allPanes, contains(pane));+ expect(+ find.byKey(const ValueKey('swarm-welcome-search-input')),+ findsOneWidget,+ );+ expect(frames, isEmpty);await tester.pumpWidget(const SizedBox());app.dispose();});-- testWidgets(- 'navigation opens in one frame, owns typing, cancels, and stays distinct from Add',- (tester) async {- final app = createApp();- app.adoptSessionForTest(terminal('a0', []));- await mount(tester, app);- final membership = [...app.panes];- final input = find.byKey(const ValueKey('swarm-search-input'));- expect(input, findsNothing);- await tester.sendKeyDownEvent(LogicalKeyboardKey.meta);- await tester.sendKeyEvent(LogicalKeyboardKey.keyP);- await tester.sendKeyUpEvent(LogicalKeyboardKey.meta);- await tester.pump();- expect(jumpField, findsOneWidget);- final field = tester.widget<TextField>(jumpField);- expect(field.focusNode!.hasFocus, isTrue);- final controller = field.controller;- final results = tester.getRect(- find.byKey(const ValueKey('swarm-navigation-locations')),- );- final bar = tester.getRect(input);- expect(results.top, inInclusiveRange(bar.bottom, bar.bottom + 30));- final picker = tester.getRect(- find.byKey(const ValueKey('swarm-search-results')),- );- expect(picker.center.dx, closeTo(1280 / 2, 0.1));- expect(find.byType(TextField), findsOneWidget);- expect(find.byType(BackdropFilter), findsNothing);- await chord(tester, LogicalKeyboardKey.keyP);- expect(tester.widget<TextField>(input).controller, same(controller));- expect(- find.byKey(const ValueKey('swarm-search-results')),- findsOneWidget,- );- expect(find.byType(Dialog), findsNothing);- await tester.enterText(jumpField, 'missing');- await tester.pump();- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(jumpField, findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump();- expect(jumpField, findsNothing);- expect(app.panes, membership);- await chord(tester, LogicalKeyboardKey.keyF, shift: true);- expect(find.byType(Dialog), findsNothing);- await tester.tap(find.byKey(const ValueKey('swarm-search-button')));- await tester.pump();- expect(jumpField, findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.escape);- await tester.pump(const Duration(milliseconds: 200));- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );-- testWidgets(- 'Return jumps across swarms and a second jump returns to prior focus',- (tester) async {- final app = createApp();- app.machineStates['m']!.nodeOnline = true;- final firstInput = <TerminalBinaryFrame>[];- final secondInput = <TerminalBinaryFrame>[];- final firstPane = app.adoptSessionForTest(terminal('a0', firstInput));- final first = app.activeSwarm;- await mount(tester, app);- app.newSwarm();- final secondPane = app.adoptSessionForTest(terminal('a1', secondInput));- app.dismissError();- await tester.pump();- final second = app.activeSwarm;- await chord(tester, LogicalKeyboardKey.keyP);- expect(- find.descendant(of: selectedRow, matching: find.text('Agent 0')),- findsOneWidget,- );- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(app.activeSwarmId, first.id);- expect(app.focusedPaneId, firstPane.id);- expect(first.panes, [firstPane]);- expect(second.panes, [secondPane]);- expect(firstInput, isEmpty);- expect(secondInput, isEmpty);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);- await tester.pump(const Duration(milliseconds: 10));- expect(firstInput.single.bytes, [27, 91, 68]);- expect(secondInput, isEmpty);- await chord(tester, LogicalKeyboardKey.keyP);- expect(- find.descendant(of: selectedRow, matching: find.text('Agent 1')),- findsOneWidget,- );- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(app.activeSwarmId, second.id);- expect(app.focusedPaneId, secondPane.id);- await tester.sendKeyEvent(LogicalKeyboardKey.arrowRight);- await tester.pump(const Duration(milliseconds: 10));- expect(firstInput, hasLength(1));- expect(secondInput.single.bytes, [27, 91, 67]);- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );-- testWidgets(- 'keyboard selection scrolls, survives discovery, and explicitly opens a view',- (tester) async {- final app = createApp();- for (var i = 0; i < 18; i++) {- app.adoptSessionForTest(terminal('a$i', []));- }- await mount(tester, app);- await chord(tester, LogicalKeyboardKey.keyP);- await tester.enterText(jumpField, 'Agent');- await tester.pump();- for (var i = 0; i < 12; i++) {- await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);- await tester.pump();- expect(selectedRow, findsOneWidget);- final row = tester.getRect(selectedRow);- final list = tester.getRect(find.byType(ListView));- expect(row.top, greaterThanOrEqualTo(list.top));- expect(row.bottom, lessThanOrEqualTo(list.bottom));- }- await tester.pump();- final selectedId =- (tester.widget<ListTile>(selectedRow).key! as ValueKey<String>).value;- final rowRect = tester.getRect(selectedRow);- final listRect = tester.getRect(find.byType(ListView));- expect(rowRect.top, greaterThanOrEqualTo(listRect.top));- expect(rowRect.bottom, lessThanOrEqualTo(listRect.bottom));- final machine = app.machineStates['m']!;- machine.agents = [- const Agent(- id: 'new',- name: 'A newly discovered agent',- terminalAvailable: true,- ),- ...machine.agents,- ];- app.dismissError();- await tester.pump();- await tester.pump();- expect(tester.widget<ListTile>(selectedRow).key, ValueKey(selectedId));- expect(find.text('Go to'), findsOneWidget);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(app.panes, hasLength(18));- expect(- agentLocationId(app.activeSwarmId, app.focusedPane!.id),- selectedId,- );- await tester.pumpWidget(const SizedBox());- app.dispose();- },- );}diff --git a/desktop/test/welcome_entry_layout_test.dart b/desktop/test/welcome_entry_layout_test.dartnew file mode 100644index 000000000..b9c34a192--- /dev/null+++ b/desktop/test/welcome_entry_layout_test.dart@@ -0,0 +1,108 @@+import 'dart:io';+import 'dart:ui' as ui;++import 'package:flutter/material.dart';+import 'package:flutter/rendering.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/screens/swarm_screen.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;++import 'support/real_fonts.dart';+import 'swarm_state_test.dart' show createApp;++void main() {+ setUpAll(() async {+ await loadRealFonts();+ await (FontLoader(+ 'MaterialIcons',+ )..addFont(rootBundle.load('fonts/MaterialIcons-Regular.otf'))).load();+ });+ for (final (width, height, scale) in [+ (1280.0, 800.0, 1.0),+ (760.0, 900.0, 1.0),+ (600.0, 900.0, 1.7),+ ]) {+ testWidgets(+ 'two welcome actions remain usable at $width with text scale $scale',+ (tester) async {+ tester.view.devicePixelRatio = 1;+ tester.view.physicalSize = Size(width, height);+ addTearDown(tester.view.reset);+ final app = createApp();+ app.machineStates['m']!.nodeOnline = true;+ final boundaryKey = GlobalKey();+ await tester.pumpWidget(+ RepaintBoundary(+ key: boundaryKey,+ child: MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ builder: (context, child) => MediaQuery(+ data: MediaQuery.of(context)+ .copyWith(textScaler: TextScaler.linear(scale)),+ child: child!,+ ),+ home: SwarmScreen(notifier: app, nativeTabs: false),+ ),+ ),+ );+ await tester.pumpAndSettle();+ final findCard = find.byKey(const ValueKey('welcome-find-agent'));+ final createCard = find.byKey(const ValueKey('welcome-create-agent'));+ final field = find.byKey(const ValueKey('swarm-welcome-search-input'));+ expect(find.text('Find an agent'), findsOneWidget);+ expect(find.text('Create a new agent'), findsOneWidget);+ expect(find.text('Machines'), findsNothing);+ expect(find.text('Projects'), findsNothing);+ expect(+ find.byKey(const ValueKey('swarm-add-agent-button')),+ findsNothing,+ );+ final findRect = tester.getRect(findCard);+ final createRect = tester.getRect(createCard);+ if (width == 1280) {+ expect(createRect.left, greaterThan(findRect.right));+ expect(createRect.top, findRect.top);+ expect(createRect.height, closeTo(findRect.height, 1));+ } else {+ expect(createRect.top, greaterThan(findRect.bottom));+ }+ expect(tester.takeException(), isNull);+ final output = Platform.environment['HARNESS_WELCOME_CAPTURE_DIR'];+ if (output != null) {+ final boundary =+ boundaryKey.currentContext!.findRenderObject()!+ as RenderRepaintBoundary;+ await tester.runAsync(() async {+ final image = await boundary.toImage(pixelRatio: 1);+ final bytes = await image.toByteData(+ format: ui.ImageByteFormat.png,+ );+ await Directory(output).create(recursive: true);+ await File(+ '$output/welcome-${width.toInt()}-${scale.toStringAsFixed(1)}.png',+ ).writeAsBytes(bytes!.buffer.asUint8List());+ image.dispose();+ });+ }+ await tester.enterText(field, 'Test host');+ await tester.pump();+ final results = find.byKey(+ const ValueKey('swarm-welcome-search-results'),+ );+ expect(results, findsOneWidget);+ expect(tester.getRect(results).width, tester.getRect(field).width);+ expect(+ find.byKey(const ValueKey('swarm-search-preview')),+ findsNothing,+ );+ await tester.ensureVisible(+ find.byKey(const ValueKey('swarm-start-primary')),+ );+ expect(tester.takeException(), isNull);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );+ }+}diff --git a/desktop/tool/keymap_native_checks.swift b/desktop/tool/keymap_native_checks.swiftindex d00434ebc..746de2f56 100644--- a/desktop/tool/keymap_native_checks.swift+++ b/desktop/tool/keymap_native_checks.swift@@ -15,16 +15,16 @@ for (key, command) in [("cmd+h", "pane.focus_left"), ("cmd+j", "pane.focus_below"),("cmd+k", "pane.focus_above"), ("cmd+l", "pane.focus_right"),("cmd+s", "pane.layout"), ("cmd+r", "machines.refresh"),- ("cmd+b", "task.route"), ("cmd+p", "navigation.quick_open"),+ ("cmd+b", "task.route"), ("cmd+t", "swarm.new"),] {try checkKeymap(defaults.match([stroke(key)], context: "workspace").binding?.command == command,"Preserve the current default for \(key)")}for context in ["workspace", "terminal", "picker"] {- try checkKeymap(changed.match([stroke("cmd+p")], context: context).binding == nil,+ try checkKeymap(changed.match([stroke("cmd+t")], context: context).binding == nil,"Native context honors inherited unbinding")let search = changed.match([stroke("cmd+o")], context: context).binding- try checkKeymap(search?.command == "navigation.quick_open" && search?.hint == "⌘O" && search?.menuAction == "jump",+ try checkKeymap(search?.command == "swarm.new" && search?.hint == "⌘O" && search?.menuAction == "new","The new key, menu owner and displayed hint agree")try checkKeymap(changed.match([stroke("cmd+k")], context: context).prefix,"User sequence prefix replaces the shorter command")@@ -76,9 +76,9 @@ _ = send("cmd+k")dispatcher.suspend()try checkKeymap(dispatcher.pending.isEmpty && !dispatcher.release(1), "Window blur clears pending and held keys")dispatcher.update(defaults)-try checkKeymap(send("cmd+p").command == "navigation.quick_open", "Reload installs the new resolved map")+try checkKeymap(send("cmd+t").command == "swarm.new", "Reload installs the new resolved map")-try checkKeymap(HarnessKeyStroke.fromCharacters("P", modifiers: [.command, .capsLock]) == stroke("cmd+p"),+try checkKeymap(HarnessKeyStroke.fromCharacters("T", modifiers: [.command, .capsLock]) == stroke("cmd+t"),"Caps Lock does not change a Command binding")try checkKeymap(HarnessKeyStroke.fromCharacters("1", modifiers: [.command, .shift]) == stroke("cmd+shift+1"),"Shift stays in modifiers after layout translation")@@ -98,7 +98,7 @@ try checkKeymap(HarnessNativeKeymap(payload([prefix, sequence])) == nil, "Rejecttry checkKeymap(HarnessNativeKeymap(payload([prefix, prefix])) == nil, "Reject duplicate strokes atomically")try checkKeymap(HarnessNativeKeymap(payload(Array(repeating: prefix, count: 641))) == nil, "Bound incoming binding counts")try checkKeymap(HarnessNativeKeymap(["version": 2, "contexts": [:]]) == nil, "Reject unsupported snapshots")-for value in ["cmd+cmd+p", "cmd+", "cmd+not-a-key", "ctrl+alt+shift+cmd+fn+p", "f01"] {+for value in ["cmd+cmd+t", "cmd+", "cmd+not-a-key", "ctrl+alt+shift+cmd+fn+p", "f01"] {try checkKeymap(HarnessKeyStroke(value) == nil, "Reject malformed native stroke \(value)")}print("Native keyboard bridge: \(keymapChecks) checks passed against Dart's exported bindings; no windows or agents opened.")diff --git a/desktop/tool/swarm_titlebar_checks.swift b/desktop/tool/swarm_titlebar_checks.swiftindex 40d57c008..65be0d4af 100644--- a/desktop/tool/swarm_titlebar_checks.swift+++ b/desktop/tool/swarm_titlebar_checks.swift@@ -36,11 +36,27 @@ private extension SwarmTabButton {}private extension SwarmTabStrip {+ func checkAgentIdentity() throws {+ func show(_ count: Int, engine: String? = nil) {+ var row: [String: Any] = ["id": "agent-tab", "name": "Login flow", "agentCount": count]+ if let engine { row["engine"] = engine }+ update(["tabs": [row], "activeId": "agent-tab", "enabled": true])+ }+ 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")+ 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")+ }+func checkStartupPalette(_ expected: SwarmNativePalette) throws {- try checkTitlebar(palette == expected && searchButton.contentTintColor == expected.accent && notificationButton.contentTintColor == expected.accent &&+ try checkTitlebar(palette == expected && newButton.contentTintColor == expected.accent && notificationButton.contentTintColor == expected.accent &&newButton.contentTintColor == expected.accent,"Initial search and new-swarm colors use the saved palette")- try checkTitlebar(tabs.isEmpty && !actionsEnabled && !newButton.isEnabled && !searchButton.isEnabled && !notificationButton.isEnabled,+ try checkTitlebar(tabs.isEmpty && !actionsEnabled && !newButton.isEnabled && !notificationButton.isEnabled,"Initial palette setup does not create or enable workspace controls")}@@ -95,7 +111,7 @@ private extension SwarmTabStrip {try checkTitlebar(tabs[0].showsDivider && tabs[1].showsDivider, "Separators return when the pointer leaves")try checkTitlebar(!tabs[10].showsDivider && !tabs[11].showsDivider, "Selected tab remains joined without neighboring separators")try checkTitlebar(tabs.count == 24, "All overflow tabs exist")- try checkTitlebar(!newButton.isEnabled, "New tab is disabled at capacity")+ try checkTitlebar(!newButton.isEnabled, "New Agent is disabled at capacity")for (index, tab) in tabs.enumerated() {try tab.checkAccessibility(expectedName: "Swarm \(index)", active: index == 11)}@@ -133,23 +149,22 @@ private extension SwarmTabStrip {update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0"))try checkTitlebar(tabs.count == 1 && tabs[0] === original, "Closing tabs retains the surviving control")try original.checkAccessibility(expectedName: "Renamed tab", active: true)- try checkTitlebar(newButton.isEnabled, "New tab returns below capacity")- try checkTitlebar(searchButton.toolTip?.contains("⌘P") == true, "Search advertises its keyboard shortcut")- try checkTitlebar(newButton.frame.maxX + 12 <= searchButton.frame.minX, "New swarm leaves space before the search icon")- try checkTitlebar(searchButton.frame.maxX < notificationButton.frame.minX, "Search and bell have separate targets in order")+ try checkTitlebar(newButton.isEnabled, "New Agent returns below capacity")+ try checkTitlebar(newButton.toolTip?.contains("⌘T") == true, "New Agent advertises its keyboard shortcut")+ try checkTitlebar(newButton.frame.maxX < notificationButton.frame.minX, "New Agent and the bell have separate targets")try checkTitlebar(!subviews.contains(where: { $0 is NSTextField }), "The titlebar has no competing text editor")events.removeAll()- searchButton.performClick(nil)+ newButton.performClick(nil)notificationButton.performClick(nil)- try checkTitlebar(events == ["jump", "notifications"], "Each toolbar icon opens its shared Flutter surface once")+ try checkTitlebar(events == ["new", "notifications"], "Each toolbar icon opens its shared Flutter surface once")try checkTitlebar(notificationButton.hasAttention, "The bell represents pending agent attention")- let oldButton = searchButton+ let oldButton = newButtonvar themedState = state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0")themedState["palette"] = ["workspace": Int64(0xff252d43), "search": Int64(0xff262f46)]update(themedState)- try checkTitlebar(searchButton === oldButton && tabs[0] === original,+ try checkTitlebar(newButton === oldButton && tabs[0] === original,"Palette changes retain native control identity")- try checkTitlebar(searchButton.contentTintColor == palette.accent && notificationButton.contentTintColor == palette.accent,+ try checkTitlebar(newButton.contentTintColor == palette.accent && notificationButton.contentTintColor == palette.accent,"Both toolbar icons receive the coordinated palette")events.removeAll()try original.checkEnabled(true)@@ -159,10 +174,9 @@ private extension SwarmTabStrip {events.removeAll()update(state([["id": "swarm-0", "name": "Renamed tab"]], active: "swarm-0", enabled: false))try original.checkEnabled(false)- try checkTitlebar(!newButton.isEnabled && !searchButton.isEnabled && !notificationButton.isEnabled, "Titlebar actions disable with a modal")+ try checkTitlebar(!newButton.isEnabled && !notificationButton.isEnabled, "Titlebar actions disable with a modal")original.clickBothActions()newButton.performClick(nil)- searchButton.performClick(nil)notificationButton.performClick(nil)try checkTitlebar(events.isEmpty, "Disabled controls emit no actions")try checkDragOperations()@@ -214,10 +228,10 @@ private extension SwarmTabStrip {let current = tabs[0].accessibilityChildren()!.first as! NSButtonwindow.makeFirstResponder(current)current.performClick(nil)- window.makeFirstResponder(searchButton)- searchButton.performClick(nil)+ window.makeFirstResponder(newButton)+ newButton.performClick(nil)messenger.finishNextReply()- try checkTitlebar(window.firstResponder === searchButton,+ try checkTitlebar(window.firstResponder === newButton,"A delayed tab reply cannot steal focus from a newer search action")messenger.finishNextReply()try checkTitlebar(window.firstResponder === window.contentViewController,@@ -294,7 +308,7 @@ private extension SwarmTabStrip {try checkTitlebar(draggingEntered(info).isEmpty && draggingUpdated(info).isEmpty && !performDragOperation(info), reason)try checkTitlebar(moves.isEmpty, "Rejected drag emits no reorder")}- info.draggingLocation = convert(NSPoint(x: searchButton.frame.midX, y: 20), to: nil)+ info.draggingLocation = convert(NSPoint(x: newButton.frame.midX, y: 20), to: nil)try rejected("Search is not a tab drop target")info.draggingLocation = document.convert(NSPoint(x: tabs[0].frame.midX, y: 20), to: nil)info.draggingSource = SwarmTabButton(id: "drag-3")@@ -357,19 +371,18 @@ private extension SwarmTitlebar {}let original = NSApp.mainMenu!let edit = original.item(withTitle: "Edit")!.submenu!- let jump = edit.items.first(where: { $0.representedObject as? String == "jump" })!- let swarm = original.item(withTitle: "Swarm")!.submenu!- let newSwarm = swarm.items.first(where: { $0.representedObject as? String == "new" })!+ let agent = original.item(withTitle: "Agent")!.submenu!+ let newSwarm = agent.items.first(where: { $0.representedObject as? String == "new" })!let nativeCopy = NSMenuItem(title: "Copy", action: #selector(NSText.copy(_:)), keyEquivalent: "c")edit.addItem(nativeCopy)setKeymap(defaults)let main = NSApp.mainMenu as! HarnessKeymapMenutry checkTitlebar(main !== original && main.item(withTitle: "Edit")?.submenu === edit,"The main-menu dispatcher retains the actual Edit submenu and its targets")- try checkTitlebar(jump.keyEquivalent == "p" && jump.toolTip?.contains("⌘P") == true,+ try checkTitlebar(newSwarm.keyEquivalent == "t" && newSwarm.toolTip?.contains("⌘T") == true,"Native shortcut display comes from the effective Dart binding")setKeymap(changed)- try checkTitlebar(NSApp.mainMenu === main && jump.keyEquivalent == "o",+ try checkTitlebar(NSApp.mainMenu === main && newSwarm.keyEquivalent == "o","Hot reload updates the existing menu to the remapped key")try checkTitlebar(nativeCopy.keyEquivalent == "c" && nativeCopy.action == #selector(NSText.copy(_:)),"Standard native editing remains intact")@@ -381,7 +394,8 @@ private extension SwarmTitlebar {setKeymap(onlySequence)try checkTitlebar(newSwarm.keyEquivalent.isEmpty && newSwarm.toolTip?.contains("⌘K N") == true,"A sequence has a complete tooltip without a misleading first-key menu shortcut")- try checkTitlebar(jump.keyEquivalent.isEmpty && jump.toolTip == nil,+ setKeymap(HarnessNativeKeymap(["version": 1, "contexts": ["workspace": [], "terminal": [], "picker": []]])!)+ try checkTitlebar(newSwarm.keyEquivalent.isEmpty && newSwarm.toolTip == nil,"Unbinding clears the old native shortcut and hint")rebuildHistoryMenu()try checkTitlebar(historyMenu.items.allSatisfy { $0.keyEquivalent.isEmpty },@@ -394,14 +408,14 @@ private extension SwarmTitlebar {charactersIgnoringModifiers: text, isARepeat: false, keyCode: code)!}let open = event("o", 31, .command)- let oldOpen = event("p", 35, .command)+ let oldOpen = event("t", 17, .command)try checkTitlebar(main.defersToInput(open) && !main.defersToInput(oldOpen),"The menu yields the remapped search shortcut to Flutter")try checkTitlebar(!main.performKeyEquivalent(with: open), "Menu equivalents defer before input dispatch")setKeymap(defaults)- try checkTitlebar(strip.searchButton.toolTip == "Navigate (⌘P)", "Reload refreshes the navigation button hint")- try checkTitlebar(strip.searchButton.accessibilityLabel() == "Navigate", "The compass announces global navigation")- try checkTitlebar(main.defersToInput(event("p", 35, .command)), "Command-P reaches the shared Flutter picker")+ try checkTitlebar(strip.newButton.toolTip == "New Agent (⌘T)", "Reload refreshes the New Agent button hint")+ try checkTitlebar(strip.newButton.accessibilityLabel() == "New Agent", "The plus announces New Agent")+ try checkTitlebar(!main.defersToInput(event("p", 35, .command)), "Command-P no longer opens Navigate")try checkTitlebar(main.defersToInput(event("p", 35, [.command, .shift])), "Command-Shift-P reaches command search")flutterKeyContext = "picker"syncMenuKeys()@@ -454,20 +468,20 @@ private extension SwarmTitlebar {try strip.checkStartupPalette(startupPalette)try checkTitlebar(window.firstResponder === window.contentViewController,"Adding toolbar buttons does not take initial keyboard focus from the workspace")- try checkTitlebar(main.items.map(\.title) == ["Harness", "Swarm", "Agent", "Models", "History", "Edit", "View", "Window", "Help"], "Swarm and Agent replace File without duplicate menus")+ try checkTitlebar(main.items.map(\.title) == ["Harness", "Agent", "Edit", "View", "History", "Models", "Window", "Help"], "Agent leads the standard macOS menus without a separate Swarm menu")let settings = appItem.submenu!.items[0]try checkTitlebar(settings.title == "Settings…" && settings.representedObject as? String == "settings", "Settings stays in the application menu")- let swarm = main.item(withTitle: "Swarm")!.submenu!let agent = main.item(withTitle: "Agent")!.submenu!let historyMenu = main.item(withTitle: "History")!.submenu!- try checkTitlebar(swarm.items.compactMap { $0.representedObject as? String } == ["new", "renameActive", "closeActive", "linkMachine", "addProject"], "Swarm groups workspace actions")- try checkTitlebar(agent.items.compactMap { $0.representedObject as? String } == ["addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "closePane"], "Agent groups creation and pane actions")+ try checkTitlebar(agent.items.compactMap { $0.representedObject as? String } == ["new", "addAgent", "newAgent", "splitRight", "splitDown", "zoomPane", "pinPane", "renameActive", "closePane", "closeActive", "linkMachine", "addProject"], "Agent groups tab, creation and pane actions without changing their command identities")let addAgent = agent.items.first(where: { $0.representedObject as? String == "addAgent" })!let newAgent = agent.items.first(where: { $0.representedObject as? String == "newAgent" })!try checkTitlebar(addAgent.keyEquivalent == "n" && addAgent.keyEquivalentModifierMask == [.command], "Command-N opens the shared Add agent picker")try checkTitlebar(newAgent.keyEquivalent == "n" && newAgent.keyEquivalentModifierMask == [.command, .shift], "Shift-Command-N creates a fresh agent")- let jump = edit.submenu!.items.first(where: { $0.representedObject as? String == "jump" })!- try checkTitlebar(jump.keyEquivalent == "p" && jump.keyEquivalentModifierMask == [.command], "Command-P has a native menu owner while a terminal has focus")+ let commands = edit.submenu!.items.first(where: { $0.representedObject as? String == "commands" })!+ try checkTitlebar(commands.keyEquivalent == "p" && commands.keyEquivalentModifierMask == [.command, .shift], "Command search keeps its native menu owner")+ try checkTitlebar(edit.submenu!.items.allSatisfy { $0.representedObject as? String != "jump" }, "Edit has no Navigate action")+ try checkTitlebar(agent.items.first?.title == "New Agent" && newAgent.title == "Create Agent…", "New Agent opens the chooser while Create Agent opens the creation form")let reopen = historyMenu.items.first(where: { $0.representedObject as? String == "reopen" })!actionsEnabled = truecanReopen = false@@ -479,7 +493,7 @@ private extension SwarmTitlebar {try checkTitlebar(!validateMenuItem(closePane), "Remove Agent is disabled in New swarm")canClosePane = truetry checkTitlebar(validateMenuItem(closePane), "Remove Agent is enabled for a focused pane")- let create = swarm.items.first(where: { $0.representedObject as? String == "new" })!+ let create = agent.items.first(where: { $0.representedObject as? String == "new" })!canCreateSwarm = falsetry checkTitlebar(!validateMenuItem(create), "Native New Swarm respects the tab capacity")canCreateSwarm = true@@ -522,8 +536,8 @@ private extension SwarmTitlebar {try checkTitlebar(!validateMenuItem(back) && validateMenuItem(forward), "Back and Forward have independent navigation availability")try checkTitlebar(validateMenuItem(recent), "Recent navigation is available in the shell")actionsEnabled = false- try checkTitlebar(!validateMenuItem(recent) && !validateMenuItem(jump) && !validateMenuItem(settings), "History, jump and Settings cannot act behind a modal")- for item in swarm.items + agent.items where !item.isSeparatorItem {+ try checkTitlebar(!validateMenuItem(recent) && !validateMenuItem(commands) && !validateMenuItem(settings), "History, commands and Settings cannot act behind a modal")+ for item in agent.items where !item.isSeparatorItem {try checkTitlebar(!validateMenuItem(item), "Workspace commands cannot act behind a modal")}actionsEnabled = true@@ -672,6 +686,7 @@ do {try checkTitlebar(unknown.isTemplate && unknown.size == NSSize(width: 16, height: 16), "Unknown engines have a native-size adaptive initial")let strip = SwarmTabStrip(frame: NSRect(x: 0, y: 0, width: 900, height: 40))try strip.runChecks()+ try strip.checkAgentIdentity()try checkTitlebar(titlebarCheckApp.windows.isEmpty, "Checks never open an application window")if CommandLine.arguments.contains("--window-layout") {let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1280, height: 700),diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.mdnew file mode 100644index 000000000..f528b716a--- /dev/null+++ b/docs/harness-agent-first-tabs.md@@ -0,0 +1,42 @@+# Agent-first entry++Users start with an agent and group agents when useful. A tab holds one or+several agents without a separate swarm creation flow.++## New Agent++The plus button and Cmd-T open **New Agent**, a new tab that lets the user+choose existing work or create a fresh agent. First launch uses this same page.++The welcome page has exactly two sections:++- **Find an agent**: a focused search field for agents, machines, and projects.+- **Create a new agent**: a **Create Agent** button opening the existing local-first+ machine, engine, and working-folder flow.++Machine and project directories and recent-agent lists are removed from the+welcome page. Machines and projects remain grouped search results. Search shows+one full-width result list, without terminal output or group previews.++There is no Navigate action, compass button, or Cmd-P directory. Command search+remains on Shift-Cmd-P and stays in command mode when its query is cleared.+Typing `>` in the agent search also finds commands.++Selecting an existing agent opens it in the new tab and reuses its runtime.+**Add Agent** and split right/down choose or create agents within the current tab.+Actions that directly start a fresh agent are labeled **Create Agent**.++## Tabs and menus++One agent shows its engine mark; multiple agents use the group mark. Returning+to one restores the engine mark. Tab names remain editable. Former default names+`New swarm` and `New tab` restore as `New Agent`.++The macOS menus are **Harness, Agent, Edit, View, History, Models, Window, Help**.+Agent contains New Agent, Add Agent, Create Agent, split and pane controls,+Rename Tab, Close Agent Pane, Close Tab, Link Machine, and Add Project.++Cmd-T opens New Agent, Cmd-N opens Add Agent, Shift-Cmd-N opens Create Agent,+Cmd-W closes the tab, and Shift-Cmd-W closes the focused pane. Closing views+keeps agent runtimes alive. The stored layout format and internal command IDs+remain compatible; product language uses agents, tabs, and groups.diff --git a/docs/harness-v2-handoff.md b/docs/harness-v2-handoff.mdindex f44f52780..572dc4e67 100644--- a/docs/harness-v2-handoff.md+++ b/docs/harness-v2-handoff.md@@ -1,5 +1,11 @@# Harness v2: goal, plan, and continuation handoff+**Latest UI direction:** [Agent-first tabs](harness-agent-first-tabs.md) supersedes+the swarm terminology in the historical notes below. First launch and New Tab+offer existing-agent search alongside New agent. Single-agent tabs show engine+icons; groups show the group icon. The macOS Agent menu now includes tab actions,+with no separate Swarm menu. Existing creation, split and session behavior remains.+Updated September 14, 2026. **Read this first when resuming on another computer.**This is the current product contract and next-work order. It supersedes conflictinghistorical checkpoints in [the progress log](harness-v2-progress.md). The user