Skip to content

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

Simplify Cmd-P with single-line results and fzf navigation (#328)

Dee3db602df0a81
diff --git a/desktop/design/images/terminal-open-harness-preview.png b/desktop/design/images/terminal-open-harness-preview.png
new file mode 100644
index 000000000..351d4e44c
Binary files /dev/null and b/desktop/design/images/terminal-open-harness-preview.png differ
diff --git a/desktop/design/images/terminal-open-harness.png b/desktop/design/images/terminal-open-harness.png
index bccda3535..94a42657e 100644
Binary files a/desktop/design/images/terminal-open-harness.png and b/desktop/design/images/terminal-open-harness.png differ
diff --git a/desktop/design/new-harness-entry-rules.md b/desktop/design/new-harness-entry-rules.md
index 20328809f..374ff19a7 100644
--- a/desktop/design/new-harness-entry-rules.md
+++ b/desktop/design/new-harness-entry-rules.md
@@ -36,7 +36,7 @@ Narrow windows show the active list full-width with a back action.
| Entry | Initial values | Destination after a successful start |
| --- | --- | --- |
| Cmd-T, then Cmd-N | Previous pane's agent, machine, and project | The blank tab opened by Cmd-T |
-| Cmd-P or Cmd-Shift-P → New Harness | Focused pane's agent, machine, and project | Current tab |
+| Cmd-Shift-P → New Harness | Focused pane's agent, machine, and project | Current tab |
| Cmd-N or the New Harness command | Focused pane's defaults; retain a task and destination already chosen in search | Current tab unless its source requests a new tab |
| Explicit pane split | Focused pane's defaults | Requested split in that tab |
| Store New Harness, or a product's Open action in the pane or native Models menu | Explicit product and machine; suggested project named for that product | New tab |
@@ -50,7 +50,9 @@ apply any agent or machine explicitly named by the request.
The unified picker has search and results on the left, with a read-only preview
on the right. It has no action strip or keyboard footer. Enter opens a result;
-machines and projects drill into their session lists. Cmd-Shift-P searches named
+machines and projects drill into their session lists. Cmd-P never offers New
+Harness, including when no sessions match or a scoped list is empty. Cmd-N opens
+creation explicitly. Cmd-Shift-P searches named
commands for the selected resource and returns to the same search after an action
or cancellation. Each item action names its target, which is revalidated before
execution. Filters and sorting are explicit commands, with no More menu.
@@ -192,7 +194,7 @@ worktree: the retry selects that worktree's branch with Worktree off.
- Workspace drafts belong to their original machine, focused source harness,
and project context. A different focused harness does not inherit their edits.
-- Cmd-P and Cmd-Shift-P can resume the same workspace draft. The current tab controls
+- Cmd-N and Cmd-Shift-P can resume the same workspace draft. The current tab controls
placement; a saved draft cannot redirect it to an old destination.
- Store drafts belong to the explicitly requested product and machine. Opening
Blender cannot restore Workshop's agent, task, or generated project name.
@@ -231,7 +233,7 @@ never silently renamed, and existing files are never overwritten.
- `test/new_harness_entry_rules_test.dart`: product changes with an open or
dismissed dock, Open/Try, edited names, machine changes, explicit agent
precedence, search isolation, exact launch payloads, pending receipts, source
- pane changes, and Cmd-P/Cmd-Shift-P draft recovery and placement. Repeated/switched
+ pane changes, and Cmd-N/Cmd-Shift-P draft recovery and placement. Repeated/switched
shortcuts retain typed tasks, text selection, existing results, and project
scope; starting then uses the displayed destination.
- `test/harness_placement_test.dart`, `test/box_flows_test.dart`,
diff --git a/desktop/design/terminal-dialogs.md b/desktop/design/terminal-dialogs.md
index e3128a568..b6f692f1e 100644
--- a/desktop/design/terminal-dialogs.md
+++ b/desktop/design/terminal-dialogs.md
@@ -14,8 +14,8 @@ viewers keep their own component systems.
![Cmd-P rendered with fixture data](images/terminal-open-harness.png)
-The fixture above shows the terminal grid, plain-text rows, and one-line
-selection. Live surfaces use the user's selected terminal font and palette.
+The fixture above shows the terminal grid, plain-text rows, and unselected
+opening state. Live surfaces use the user's selected terminal font and palette.
## Lay out a character grid
@@ -58,9 +58,11 @@ when using custom row widgets.
- No provider logos, avatars, decorative emoji, image assets, or icon-font
glyphs in dialog chrome. Write `Codex`, `Claude`, or the harness name.
-- Use `>` for the search prompt. Harness result subtitles use the compact
- Standard status format: `machine:project (branch)`. Omit missing fields and
- redundant provider/engine labels; preserve important state such as Offline.
+- Use `>` for the search prompt. Cmd-P session results occupy one row: title
+ on the left and activity age on the right. The preview puts the compact
+ Standard context `machine:project (branch)` directly below the session title,
+ followed by status and harness type. Omit missing fields and preserve
+ important state such as Offline.
- Boolean controls use `[x]` and `[ ]`; Enter and Space toggle them.
- Actions use concise text, such as `[ New Harness ]`. Shortcut hints are text
beside the action, resolved from the live keymap.
@@ -69,19 +71,20 @@ when using custom row widgets.
- Preserve user content, including Unicode. The restriction on decorative
graphics applies to our controls, not to the text someone supplied.
-For example, a result is two text lines followed by one blank row:
+For example, Cmd-P session results are consecutive single lines:
```text
-> Find a harness...
+> Search harnesses
Checkout retries 5m
- M2:storefront (fix/retry)
-
Search experience 1h
- M2:storefront (main)
```
-The highlight covers only the selected title line.
+The highlight covers the selected row. Machine, project, and branch metadata
+remain searchable and available to screen readers. Resource choices with
+descriptions keep two text lines followed by one blank row.
+
+![A selected session with its context in the preview](images/terminal-open-harness-preview.png)
## Inherit the real terminal's appearance
@@ -106,10 +109,18 @@ Search is one unfilled, borderless text line with a block caret one measured
cell wide. Its prompt occupies the shared gutter. Previews use the same text
metrics and blank-row spacing; warnings are readable text in semantic colors.
-An empty Cmd-P search uses the blank row below its input for a muted type hint:
-`> harnesses @ machines # projects : models * store`. Hide it while a
-query or type filter is active, keeping that row's height so results never jump.
-In narrow layouts, show only the symbols and retain the full accessible label.
+Cmd-P opens with no selected row. The preview area shows the type hints as plain,
+muted text: `> harnesses`, `@ machines`, `# projects`, `: models`, and `* store`.
+Typing selects the first match and replaces the hints with its preview. Arrows,
+Tab, and pointer movement can also select a row. Clearing the root search returns
+to the hints; live inventory updates must not choose a row for the user. Enter
+does nothing until a row is selected. Keep the input and list in place throughout.
+Cmd-P has no New Harness row, including in machine and project session lists.
+Cmd-N opens creation. Resource setup rows use general guidance rather than
+presumed defaults.
+Page Up/Down pages the result list; Shift-Up/Down scrolls the preview by one
+measured terminal row. These keys preserve the input's focus and query. Preview
+scrolling keeps the selected result and result-list scroll position unchanged.
Open dialogs must follow live terminal font and theme changes while preserving
the input controller, query, selection, focus, and scroll state. Wire the font,
diff --git a/desktop/integration_test/native_workspace_e2e_test.dart b/desktop/integration_test/native_workspace_e2e_test.dart
index 9feb2b791..0400747a2 100644
--- a/desktop/integration_test/native_workspace_e2e_test.dart
+++ b/desktop/integration_test/native_workspace_e2e_test.dart
@@ -1472,6 +1472,8 @@ void main() {
expect(find.text('Check retargeted keyboard input'), findsWidgets);
expect(find.text('New Pane'), findsNothing);
await key(tester, LogicalKeyboardKey.enter);
+ expect(find.byType(NewHarnessForm), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
expect(find.byType(NewHarnessForm), findsOneWidget);
expect(
tester
@@ -1680,6 +1682,8 @@ void main() {
task,
);
await key(tester, LogicalKeyboardKey.enter);
+ expect(find.byType(NewHarnessForm), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
await tester.pump(const Duration(milliseconds: 80));
expect(prompt().engine, 'codex');
expect(prompt().machineId, 'm');
@@ -1750,8 +1754,7 @@ void main() {
// Reopen from the same source. Escape kept the task and edited defaults
// without creating a temporary tab.
- await key(tester, LogicalKeyboardKey.keyP, cmd: true);
- await key(tester, LogicalKeyboardKey.enter);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
await tester.pump(const Duration(milliseconds: 80));
expect(prompt().engine, 'claude');
expect(prompt().mode, 'plan');
diff --git a/desktop/lib/models/models_panel.dart b/desktop/lib/models/models_panel.dart
index 7e70c3f7a..13c634a21 100644
--- a/desktop/lib/models/models_panel.dart
+++ b/desktop/lib/models/models_panel.dart
@@ -179,10 +179,10 @@ class _ModelsPanelState extends State<ModelsPanel> {
style: AppType.monoLabel(),
decoration: InputDecoration(
hintText: _selectedTab == ModelsTab.subscriptions
- ? 'Search subscriptions…'
+ ? 'Search subscriptions'
: _selectedTab == ModelsTab.apis
- ? 'Search APIs…'
- : 'Search models…',
+ ? 'Search APIs'
+ : 'Search models',
hintStyle: AppType.monoLabel(
color: AppPalette.textFaint,
),
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 5286a4a2e..6813995b4 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -204,7 +204,7 @@ class _SwarmScreenState extends State<SwarmScreen>
);
final _searchCatalog = SwarmSearchCatalog();
final _searchText = TextEditingController();
- final _searchFocus = FocusNode(debugLabel: 'Find a harness');
+ final _searchFocus = FocusNode(debugLabel: 'Search harnesses');
final _tabScroll = ScrollController();
({String activeId, List<String> order, double viewport, List<double> widths})?
_tabGeometry;
@@ -503,9 +503,11 @@ class _SwarmScreenState extends State<SwarmScreen>
final split = _search!.split;
final placement = _search!.placement;
final task = _search!.createTask;
+ final machineId = _search!.scopedMachineId;
_closeSearch(restoreFocus: false);
unawaited(
_newAgent(
+ machineId: machineId,
swarmId: target,
split: split,
placement: placement,
@@ -2770,10 +2772,10 @@ class _SwarmScreenState extends State<SwarmScreen>
),
adding: adding,
offersCreate: adding,
- activityFirst: split == null && !query.startsWith('>'),
- // The input leads now, so the results read downward from it. Left
- // bottom-up, the list reversed itself and New Harness — first in the
- // rows — landed visually last.
+ offersHarnessCreate: split != null,
+ activityFirst: split == null,
+ selectOnEmptyQuery: split != null,
+ // Results read downward from the input.
resultsFromBottom: false,
split: split,
placement:
@@ -3089,7 +3091,6 @@ class _SwarmScreenState extends State<SwarmScreen>
if (app.modelManager.error == null) _closeSearch(restoreFocus: false);
},
);
- final cell = terminalCellSizeOf(context);
final terminalTheme = terminalThemeFor(
grid.AppTheme.palette.value,
terminalThemeStore.value,
@@ -3121,53 +3122,28 @@ class _SwarmScreenState extends State<SwarmScreen>
terminal: true,
bios: true,
previewBuilder: preview,
- header: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- if (search.canGoBack)
- Padding(
- padding: EdgeInsets.fromLTRB(
- cell.width * 4,
- cell.height,
- cell.width * 2,
- 0,
- ),
- child: Text(
- search.title,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: terminalContentStyle(
- color: terminalTheme.foreground.withValues(
- alpha: .54,
- ),
- ),
- ),
- ),
- Semantics(
- label: search.hint,
- child: ReadlineKeys(
- controller: _searchText,
- onChanged: search.editQuery,
- child: SwarmSearchInput(
- inputKey: const ValueKey('swarm-search-input'),
- controller: _searchText,
- focusNode: _searchFocus,
- search: search,
- onClose: _dismissSearch,
- onChanged: search.editQuery,
- onOpen: _focusSearch,
- terminal: true,
- bios: true,
- showResourceHints: search.allowsCommands,
- prompt: search.prompt,
- onEmptyBackspace: search.scopePrefix.isEmpty
- ? null
- : () => search.setQuery(''),
- hintText: search.hint,
- ),
- ),
+ header: Semantics(
+ label: search.hint,
+ child: ReadlineKeys(
+ controller: _searchText,
+ onChanged: search.editQuery,
+ child: SwarmSearchInput(
+ inputKey: const ValueKey('swarm-search-input'),
+ controller: _searchText,
+ focusNode: _searchFocus,
+ search: search,
+ onClose: _dismissSearch,
+ onChanged: search.editQuery,
+ onOpen: _focusSearch,
+ terminal: true,
+ bios: true,
+ prompt: search.prompt,
+ onEmptyBackspace: search.scopePrefix.isEmpty
+ ? null
+ : () => search.setQuery(''),
+ hintText: search.hint,
),
- ],
+ ),
),
)
: Column(
diff --git a/desktop/lib/shortcuts/keyboard_practice.dart b/desktop/lib/shortcuts/keyboard_practice.dart
index bf9d7c022..9609ed689 100644
--- a/desktop/lib/shortcuts/keyboard_practice.dart
+++ b/desktop/lib/shortcuts/keyboard_practice.dart
@@ -379,22 +379,34 @@ class _KeyboardPracticeState extends State<KeyboardPractice> {
}
}
- void _read(int direction) {
+ void _read(int direction, {bool byLine = false}) {
if (!_detailScroll.hasClients) return;
final position = _detailScroll.position;
_detailScroll.jumpTo(
- (position.pixels + direction * position.viewportDimension * .8).clamp(
- 0.0,
- position.maxScrollExtent,
- ),
+ (position.pixels +
+ direction *
+ (byLine
+ ? terminalCellSizeOf(context).height
+ : position.viewportDimension * .8))
+ .clamp(0.0, position.maxScrollExtent),
);
}
void _record(String id) {
if (_lesson == null) return;
if ((_matched || id != _lesson!.command) &&
- (id == 'picker.preview_page_down' || id == 'picker.preview_page_up')) {
- _read(id == 'picker.preview_page_down' ? 1 : -1);
+ {
+ 'picker.page_down',
+ 'picker.page_up',
+ 'picker.preview_down',
+ 'picker.preview_up',
+ 'picker.preview_page_down',
+ 'picker.preview_page_up',
+ }.contains(id)) {
+ _read(
+ id.endsWith('_down') ? 1 : -1,
+ byLine: id == 'picker.preview_down' || id == 'picker.preview_up',
+ );
return;
}
if (id == 'picker.accept' &&
diff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dart
index 1f738b324..84000bf3f 100644
--- a/desktop/lib/shortcuts/keymap_commands.dart
+++ b/desktop/lib/shortcuts/keymap_commands.dart
@@ -509,11 +509,42 @@ final harnessCommands = <HarnessCommand>[
context: KeymapContext.picker,
repeatable: true,
),
+ const HarnessCommand(
+ 'picker.page_up',
+ 'Page up in the results',
+ ShortcutGroup.navigate,
+ extraKeys: ['pageup'],
+ context: KeymapContext.picker,
+ repeatable: true,
+ ),
+ const HarnessCommand(
+ 'picker.page_down',
+ 'Page down in the results',
+ ShortcutGroup.navigate,
+ extraKeys: ['pagedown'],
+ context: KeymapContext.picker,
+ repeatable: true,
+ ),
+ const HarnessCommand(
+ 'picker.preview_up',
+ 'Scroll the preview up one line',
+ ShortcutGroup.navigate,
+ extraKeys: ['shift+up'],
+ context: KeymapContext.picker,
+ repeatable: true,
+ ),
+ const HarnessCommand(
+ 'picker.preview_down',
+ 'Scroll the preview down one line',
+ ShortcutGroup.navigate,
+ extraKeys: ['shift+down'],
+ context: KeymapContext.picker,
+ repeatable: true,
+ ),
const HarnessCommand(
'picker.preview_page_up',
'Page up in the preview or results',
ShortcutGroup.navigate,
- extraKeys: ['pageup'],
context: KeymapContext.picker,
repeatable: true,
),
@@ -521,7 +552,6 @@ final harnessCommands = <HarnessCommand>[
'picker.preview_page_down',
'Page down in the preview or results',
ShortcutGroup.navigate,
- extraKeys: ['pagedown'],
context: KeymapContext.picker,
repeatable: true,
),
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index da316e080..19bedc0e2 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -567,7 +567,7 @@ class SwarmSearchCatalog {
id: 'project:${group.id}',
projectId: group.id,
title: group.name,
- detail: 'Project · ${_countLabel(members.length, 'harness')}',
+ detail: _countLabel(members.length, 'harness'),
swarmId: null,
current: false,
members: Set.unmodifiable(members),
diff --git a/desktop/lib/state/swarm_search.dart b/desktop/lib/state/swarm_search.dart
index 0ea16679e..d93fa0a66 100644
--- a/desktop/lib/state/swarm_search.dart
+++ b/desktop/lib/state/swarm_search.dart
@@ -11,10 +11,8 @@ import 'swarm_catalog.dart';
import 'swarm_navigation.dart';
import 'harness_sessions.dart';
-/// A compact hint for the shared search field outside the terminal picker.
-const kSwarmSearchHint =
- 'Search harnesses @ machines # projects : models * store';
-const kHarnessPickerHint = 'Find a harness…';
+const kSwarmSearchHint = 'Search harnesses';
+const kHarnessPickerHint = kSwarmSearchHint;
const kSwarmCreateRowId = 'create:harness';
@@ -47,8 +45,10 @@ class SwarmSearchController extends ChangeNotifier {
this.adding = false,
this.navigating = false,
this.activityFirst = false,
+ this.selectOnEmptyQuery = true,
this.commandsOnly = false,
this.offersCreate = false,
+ this.offersHarnessCreate = true,
this.resultsFromBottom = false,
this._placement,
this._split,
@@ -88,6 +88,9 @@ class SwarmSearchController extends ChangeNotifier {
/// Open Harness filters by latest activity; commands and splits keep relevance order.
final bool activityFirst;
+
+ /// Cmd-P starts without a choice; typing or navigating activates a result.
+ final bool selectOnEmptyQuery;
bool get setupLayout => activityFirst && !isCommandMode && !isHelpMode;
final bool commandsOnly;
SessionFilter sessionFilter = SessionFilter.all;
@@ -149,10 +152,13 @@ class SwarmSearchController extends ChangeNotifier {
notifyListeners();
}
- /// Whether the list ends in a row that makes a harness instead of finding
- /// one. What was typed becomes the new harness's first task.
+ /// Whether the list offers a creation row for its current resource type.
final bool offersCreate;
+ /// Cmd-P finds existing harnesses; splits can also offer a new harness.
+ /// Machine, project, and model setup remain available in their own scopes.
+ final bool offersHarnessCreate;
+
/// Docked pickers keep their best match next to the input at the bottom.
/// Catalog ranking stays unchanged; rendering and spatial movement invert.
final bool resultsFromBottom;
@@ -222,6 +228,13 @@ class SwarmSearchController extends ChangeNotifier {
: isModelMode
? 'New Model'
: 'New Harness';
+ String get createDescription => isMachineMode
+ ? 'Set up or link another computer.'
+ : isProjectMode
+ ? 'Choose a working folder for a project.'
+ : isModelMode
+ ? 'Add a local model or connect an API.'
+ : 'Choose a harness, machine, and project.';
({String id, String name, String query})? _groupScope;
bool get canGoBack => _groupScope != null;
String? get scopedMachineId => _groupScope == null
@@ -301,6 +314,8 @@ class SwarmSearchController extends ChangeNotifier {
// Paging the preview must not rebuild the result list or its text editor.
final _previewPage = ValueNotifier<int>(0);
ValueListenable<int> get previewPage => _previewPage;
+ final _previewLine = ValueNotifier<int>(0);
+ ValueListenable<int> get previewLine => _previewLine;
final _resultPage = ValueNotifier<int>(0);
ValueListenable<int> get resultPage => _resultPage;
void page(int pages) {
@@ -311,6 +326,12 @@ class SwarmSearchController extends ChangeNotifier {
}
}
+ void pageResults(int pages) => _resultPage.value += pages;
+
+ void scrollPreview(int lines) {
+ if (hasPreview) _previewLine.value += lines;
+ }
+
String targetId, targetName;
// The workspace can retain normalized metadata across picker openings. Each
// read still validates its snapshot; query, selection and output stay local.
@@ -366,23 +387,31 @@ class SwarmSearchController extends ChangeNotifier {
bool get canAccept => canSubmit(selected);
- SwarmDestination? get selected => rows.isEmpty ? null : rows[cursor];
+ SwarmDestination? get selected =>
+ cursor < 0 || cursor >= rows.length ? null : rows[cursor];
+ bool get _emptyFinder =>
+ !selectOnEmptyQuery &&
+ setupLayout &&
+ !canGoBack &&
+ sessionFilter == SessionFilter.all &&
+ query.trim().isEmpty;
+ bool get showsTypeHints => _emptyFinder && selected == null;
String get hint => isCommandMode
- ? 'Search commands…'
+ ? 'Search commands'
: isHelpMode
- ? 'Choose a mode or search help…'
+ ? 'Search help'
: _groupScope != null
- ? 'Search agents in ${_groupScope!.name}…'
+ ? 'Search harnesses in ${_groupScope!.name}'
: isProjectMode
- ? 'Search projects…'
+ ? 'Search projects'
: isMachineMode
- ? 'Search machines…'
+ ? 'Search machines'
: isModelMode
- ? 'Search models…'
+ ? 'Search models'
: isStoreMode
- ? 'Search store…'
+ ? 'Search store'
: history != null
- ? 'Search history…'
+ ? 'Search history'
: placement != null
? kHarnessPickerHint
: kSwarmSearchHint;
@@ -413,6 +442,7 @@ class SwarmSearchController extends ChangeNotifier {
!navigating &&
!isCommandMode &&
!isHelpMode &&
+ (offersHarnessCreate || isGroupMode || isModelMode) &&
(_groupScope == null || scopedMachineId != null) &&
(isGroupMode ||
isModelMode ||
@@ -433,7 +463,8 @@ class SwarmSearchController extends ChangeNotifier {
? 'create:$scopePrefix'
: kSwarmCreateRowId,
title: title,
- detail: name ?? 'use current defaults',
+ detail: name ?? createDescription,
+ terminalDetail: createDescription,
swarmId: null,
current: false,
isCreate: true,
@@ -817,9 +848,7 @@ class SwarmSearchController extends ChangeNotifier {
for (final row in rows)
if (!row.isCreate) row,
];
- // Navigating (⌘P) always leads with New Harness: the list below it is
- // ordered by latest activity, so the one thing that is never a
- // result needs a fixed home rather than a place in that order.
+ // When creation is available, keep its row outside the result order.
rows =
resultsFromBottom ||
navigating ||
@@ -841,7 +870,10 @@ class SwarmSearchController extends ChangeNotifier {
).firstOrNull?.id
: null);
final index = rows.indexWhere((row) => row.id == preferred);
- cursor = rows.isEmpty
+ final waitingForSelection = _emptyFinder && _selectedId == null;
+ cursor = waitingForSelection
+ ? -1
+ : rows.isEmpty
? 0
: index >= 0
? index
@@ -851,13 +883,17 @@ class SwarmSearchController extends ChangeNotifier {
rows.length > 1 &&
rows.first.isCreate &&
((placement == null && split == null) ||
+ !selectOnEmptyQuery ||
matchQuery.trim().isNotEmpty)
? 1
: cursor.clamp(0, rows.length - 1);
// Nor on a row Return cannot take: "Already added", dimmed, with its
// reason stranded at the bottom. Only when the position is ours to pick —
// a row somebody arrowed to stays theirs.
- if (preferred == null && rows.isNotEmpty && !canSubmit(rows[cursor])) {
+ if (preferred == null &&
+ cursor >= 0 &&
+ rows.isNotEmpty &&
+ !canSubmit(rows[cursor])) {
final first = rows.indexWhere(canSubmit);
if (first >= 0) cursor = first;
}
@@ -903,7 +939,7 @@ class SwarmSearchController extends ChangeNotifier {
void move(int delta) {
if (rows.isEmpty) return;
- cursor = (cursor + delta) % rows.length;
+ cursor = ((cursor < 0 && delta < 0 ? 0 : cursor) + delta) % rows.length;
_selectedId = selected!.id;
notifyListeners();
}
@@ -1041,6 +1077,7 @@ class SwarmSearchController extends ChangeNotifier {
models?.removeListener(_modelsChanged);
app.sessionPreviews.removeListener(_previewChanged);
_previewPage.dispose();
+ _previewLine.dispose();
_resultPage.dispose();
super.dispose();
}
diff --git a/desktop/lib/widgets/agent_picker.dart b/desktop/lib/widgets/agent_picker.dart
index fc6d7df0c..998fd6fe0 100644
--- a/desktop/lib/widgets/agent_picker.dart
+++ b/desktop/lib/widgets/agent_picker.dart
@@ -472,6 +472,8 @@ class _AgentPickerState extends State<AgentPicker> {
'picker.cancel': () => run(_close),
if (widget.terminalStyle)
'picker.toggle_preview': () => run(_togglePreview),
+ 'picker.page_down': () => run(() => _page(1)),
+ 'picker.page_up': () => run(() => _page(-1)),
'picker.preview_page_down': () => run(() => _page(1)),
'picker.preview_page_up': () => run(() => _page(-1)),
// Tab is a picker command now (the box completes paths with it); a
diff --git a/desktop/lib/widgets/harness_session_manager.dart b/desktop/lib/widgets/harness_session_manager.dart
index 058c8450a..e2ed06399 100644
--- a/desktop/lib/widgets/harness_session_manager.dart
+++ b/desktop/lib/widgets/harness_session_manager.dart
@@ -305,7 +305,7 @@ class _HarnessSessionManagerState extends State<HarnessSessionManager> {
},
decoration: InputDecoration(
hintText:
- 'Search harnesses, machines, projects, branches…',
+ 'Search harnesses, machines, projects, branches',
hintStyle: AppType.monoLabel(color: AppPalette.textFaint),
prefixIcon: Icon(
LucideIcons.search,
diff --git a/desktop/lib/widgets/swarm_command_picker.dart b/desktop/lib/widgets/swarm_command_picker.dart
index 43044c4c5..3c1822bd0 100644
--- a/desktop/lib/widgets/swarm_command_picker.dart
+++ b/desktop/lib/widgets/swarm_command_picker.dart
@@ -95,7 +95,7 @@ class _SwarmCommandPickerState extends State<SwarmCommandPicker> {
search: widget.search,
onClose: _close,
onChanged: widget.search.setQuery,
- hintText: 'Find an action…',
+ hintText: 'Search actions',
prompt: '>',
terminal: true,
bios: true,
diff --git a/desktop/lib/widgets/swarm_preview_scroll.dart b/desktop/lib/widgets/swarm_preview_scroll.dart
new file mode 100644
index 000000000..5132067da
--- /dev/null
+++ b/desktop/lib/widgets/swarm_preview_scroll.dart
@@ -0,0 +1,106 @@
+import 'package:flutter/widgets.dart';
+
+import '../state/swarm_search.dart';
+
+/// Shared keyboard scrolling for session, model, store, and help previews.
+/// Scroll requests do not rebuild the search field or result rows.
+class SwarmPreviewScrollController extends ScrollController {
+ SwarmPreviewScrollController({
+ required this.search,
+ required this.lineHeight,
+ }) {
+ _selectedId = search.selected?.id;
+ _lastPage = search.previewPage.value;
+ _lastLine = search.previewLine.value;
+ search.addListener(_selectionChanged);
+ search.previewPage.addListener(_scrollChanged);
+ search.previewLine.addListener(_scrollChanged);
+ }
+
+ final SwarmSearchController search;
+ final double Function() lineHeight;
+ String? _selectedId;
+ int _lastPage = 0, _lastLine = 0;
+ int _pendingPages = 0, _pendingLines = 0;
+ bool _waitingForLayout = false, _scheduled = false, _disposed = false;
+ bool _resetScroll = true;
+
+ @override
+ void attach(ScrollPosition position) {
+ super.attach(position);
+ _waitingForLayout = true;
+ _schedule();
+ }
+
+ void _selectionChanged() {
+ final id = search.selected?.id;
+ if (id == _selectedId) return;
+ _selectedId = id;
+ _pendingPages = _pendingLines = 0;
+ _resetScroll = true;
+ if (positions.length == 1) jumpTo(0);
+ // A selection and a scroll key may arrive before the new preview is laid
+ // out. Apply pending movement against the new result's own dimensions.
+ _waitingForLayout = true;
+ _schedule();
+ }
+
+ void _scrollChanged() {
+ final page = search.previewPage.value;
+ final line = search.previewLine.value;
+ _pendingPages += page - _lastPage;
+ _pendingLines += line - _lastLine;
+ _lastPage = page;
+ _lastLine = line;
+ if (!_waitingForLayout &&
+ positions.length == 1 &&
+ position.hasContentDimensions) {
+ _apply();
+ } else {
+ _schedule();
+ }
+ }
+
+ void _schedule() {
+ if (_scheduled) return;
+ _scheduled = true;
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (_disposed) return;
+ _scheduled = false;
+ _waitingForLayout = false;
+ _apply();
+ });
+ }
+
+ void _apply() {
+ if (positions.length != 1 || !position.hasContentDimensions) {
+ return;
+ }
+ // Flutter can hand a replacement controller the previous scroll position.
+ // A new search or selection must begin at the new preview's first line.
+ if (_resetScroll) {
+ _resetScroll = false;
+ jumpTo(0);
+ }
+ if (_pendingPages == 0 && _pendingLines == 0) return;
+ final distance =
+ _pendingLines * lineHeight() +
+ _pendingPages * position.viewportDimension * .8;
+ _pendingPages = _pendingLines = 0;
+ jumpTo(
+ (position.pixels + distance).clamp(
+ position.minScrollExtent,
+ position.maxScrollExtent,
+ ),
+ );
+ }
+
+ @override
+ void dispose() {
+ _disposed = true;
+ search.removeListener(_selectionChanged);
+ search.previewPage.removeListener(_scrollChanged);
+ search.previewLine.removeListener(_scrollChanged);
+ super.dispose();
+ }
+}
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index a4f01a659..f80a1a7d5 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -20,6 +20,7 @@ import 'machine_actions.dart';
import 'machines_manager.dart' show showMachineRenameDialog;
import 'link_another_machine_dialog.dart';
import 'swarm_search_preview.dart';
+import 'swarm_preview_scroll.dart';
const resourcePickerCommands = {
'picker.resource_toggle',
@@ -89,18 +90,36 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
ModelSearchEntry? get model => widget.search.models?.entries[row?.modelId];
final _pending = <String>{};
final _errors = <String, String>{};
+ late SwarmPreviewScrollController _scroll;
@override
void initState() {
super.initState();
+ _scroll = _scrollController();
widget.controls.dispatch = _dispatch;
widget.controls.commands = _commands;
}
+ SwarmPreviewScrollController _scrollController() =>
+ SwarmPreviewScrollController(
+ search: widget.search,
+ lineHeight: () => terminalCellSizeOf(context).height,
+ );
+
+ @override
+ void didUpdateWidget(SwarmResourcePreview oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.search != widget.search) {
+ _scroll.dispose();
+ _scroll = _scrollController();
+ }
+ }
+
@override
void dispose() {
widget.controls.dispatch = null;
widget.controls.commands = null;
+ _scroll.dispose();
super.dispose();
}
@@ -689,6 +708,7 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
terminalThemeStore.value,
);
return ListView(
+ controller: _scroll,
padding: EdgeInsets.symmetric(
horizontal: cell.width * 2,
vertical: cell.height,
@@ -710,6 +730,30 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
);
}
+ Widget _typeHints() {
+ final cell = terminalCellSizeOf(context);
+ final theme = terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ );
+ return ListView(
+ controller: _scroll,
+ padding: EdgeInsets.symmetric(
+ horizontal: cell.width * 2,
+ vertical: cell.height,
+ ),
+ children: [
+ Text(
+ '> harnesses\n@ machines\n# projects\n: models\n* store',
+ key: const ValueKey('swarm-search-type-hints'),
+ style: terminalContentStyle(
+ color: theme.foreground.withValues(alpha: .54),
+ ),
+ ),
+ ],
+ );
+ }
+
@override
Widget build(BuildContext context) {
TerminalFontScope.watch(context);
@@ -759,14 +803,11 @@ class _SwarmResourcePreviewState extends State<SwarmResourcePreview> {
),
if (row?.isMachine == true) _machineDetails(),
Expanded(
- child: row?.isCreate == true
+ child: widget.search.showsTypeHints
+ ? _typeHints()
+ : row?.isCreate == true
? _details([
- switch (widget.search.scopePrefix) {
- '@' => 'Set up or link another computer.',
- '#' => 'Choose a working folder for a project.',
- ':' => 'Add a local model or connect an API.',
- _ => 'Start a new harness.',
- },
+ widget.search.createDescription,
if (widget.search.isModelMode)
?widget.search.models?.manager.error,
])
diff --git a/desktop/lib/widgets/swarm_search_field.dart b/desktop/lib/widgets/swarm_search_field.dart
index 37bb3e511..ec1cd9afc 100644
--- a/desktop/lib/widgets/swarm_search_field.dart
+++ b/desktop/lib/widgets/swarm_search_field.dart
@@ -11,7 +11,7 @@ class SwarmSearchField extends StatefulWidget {
this.onSubmitted,
this.onMove,
this.autofocus = false,
- this.hintText = 'Find a harness',
+ this.hintText = 'Search harnesses',
this.controller,
this.focusNode,
});
diff --git a/desktop/lib/widgets/swarm_search_input.dart b/desktop/lib/widgets/swarm_search_input.dart
index 5299c6cb1..3558f31e1 100644
--- a/desktop/lib/widgets/swarm_search_input.dart
+++ b/desktop/lib/widgets/swarm_search_input.dart
@@ -7,9 +7,6 @@ import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
import 'box_chrome.dart';
-const _resourceTypeHints =
- '> harnesses @ machines # projects : models * store';
-
/// The shared input for the start page, Open Agent and split searches.
/// Flutter owns the caret and result navigation; native chrome only opens it.
class SwarmSearchInput extends StatelessWidget {
@@ -36,7 +33,6 @@ class SwarmSearchInput extends StatelessWidget {
this.prompt,
this.terminal = false,
this.bios = false,
- this.showResourceHints = false,
this.onEmptyBackspace,
});
@@ -69,7 +65,6 @@ class SwarmSearchInput extends StatelessWidget {
/// The active resource prefix can be rendered separately as [prompt].
final bool terminal;
final bool bios;
- final bool showResourceHints;
final VoidCallback? onEmptyBackspace;
@override
@@ -244,61 +239,28 @@ class SwarmSearchInput extends StatelessWidget {
);
if (!bios) return field;
return Padding(
- padding: EdgeInsets.fromLTRB(
- cell.width * 2,
- cell.height,
- cell.width * 2,
- showResourceHints ? 0 : cell.height,
+ padding: EdgeInsets.symmetric(
+ horizontal: cell.width * 2,
+ vertical: cell.height,
),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- SizedBox(
- height: cell.height,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.baseline,
- textBaseline: TextBaseline.alphabetic,
- children: [
- SizedBox(
- width: cell.width * 2,
- child: Text(
- prompt ?? '>',
- key: const ValueKey('swarm-search-prompt'),
- textAlign: TextAlign.center,
- style: style,
- ),
- ),
- Expanded(child: field),
- ],
- ),
- ),
- // Use the existing blank row so typing never moves the results.
- if (showResourceHints)
+ child: SizedBox(
+ height: cell.height,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.baseline,
+ textBaseline: TextBaseline.alphabetic,
+ children: [
SizedBox(
- height: cell.height,
- child: controller.text.isEmpty && search?.query.isEmpty == true
- ? Padding(
- padding: EdgeInsets.only(left: cell.width * 2),
- child: LayoutBuilder(
- builder: (context, constraints) => Text(
- constraints.maxWidth >=
- cell.width * _resourceTypeHints.length
- ? _resourceTypeHints
- : '> @ # : *',
- key: const ValueKey('swarm-search-type-hints'),
- semanticsLabel: _resourceTypeHints,
- maxLines: 1,
- overflow: TextOverflow.clip,
- style: style.copyWith(
- color: theme.foreground.withValues(alpha: .54),
- ),
- ),
- ),
- )
- : null,
+ width: cell.width * 2,
+ child: Text(
+ prompt ?? '>',
+ key: const ValueKey('swarm-search-prompt'),
+ textAlign: TextAlign.center,
+ style: style,
+ ),
),
- ],
+ Expanded(child: field),
+ ],
+ ),
),
);
}
diff --git a/desktop/lib/widgets/swarm_search_preview.dart b/desktop/lib/widgets/swarm_search_preview.dart
index 6aec9a60c..3ee6d79df 100644
--- a/desktop/lib/widgets/swarm_search_preview.dart
+++ b/desktop/lib/widgets/swarm_search_preview.dart
@@ -8,6 +8,7 @@ import 'package:harness/terminal/terminal_text.dart';
import '../core/models.dart';
import '../shared/theme/app_theme.dart' as grid;
import '../shared/theme/app_type.dart';
+import '../shared/theme/status_line_style.dart';
import '../state/app_state.dart';
import '../state/swarm_navigation.dart';
import '../state/swarm_search.dart';
@@ -15,6 +16,7 @@ import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
import 'box_chrome.dart';
import 'engine_identity.dart';
+import 'swarm_preview_scroll.dart';
typedef _PreviewAgent = ({MachineState machine, Agent agent});
@@ -65,31 +67,31 @@ class SwarmSearchPreview extends StatefulWidget {
class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
Timer? _warm;
String? _selectedId;
- final _scroll = ScrollController();
- int _lastPage = 0;
- int _pendingPages = 0;
- String? _renderedId;
- bool _pageScheduled = false;
+ late SwarmPreviewScrollController _scroll;
AppNotifier get app => widget.search.app;
@override
void initState() {
super.initState();
+ _scroll = _scrollController();
widget.search.addListener(_changed);
- _lastPage = widget.search.previewPage.value;
- widget.search.previewPage.addListener(_pageChanged);
_changed();
}
+ SwarmPreviewScrollController _scrollController() =>
+ SwarmPreviewScrollController(
+ search: widget.search,
+ lineHeight: () => terminalCellSizeOf(context).height,
+ );
+
@override
void didUpdateWidget(SwarmSearchPreview oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.search != widget.search) {
oldWidget.search.removeListener(_changed);
- oldWidget.search.previewPage.removeListener(_pageChanged);
+ _scroll.dispose();
+ _scroll = _scrollController();
widget.search.addListener(_changed);
- _lastPage = widget.search.previewPage.value;
- widget.search.previewPage.addListener(_pageChanged);
_selectedId = null;
_changed();
}
@@ -99,8 +101,6 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
final row = widget.search.selected;
if (_selectedId == row?.id) return;
_selectedId = row?.id;
- _pendingPages = 0;
- if (_scroll.hasClients) _scroll.jumpTo(0);
setState(() {});
_warm?.cancel();
_warm = Timer(const Duration(milliseconds: 140), () {
@@ -119,46 +119,10 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
});
}
- void _pageChanged() {
- final page = widget.search.previewPage.value;
- _pendingPages += page - _lastPage;
- _lastPage = page;
- if (_renderedId == _selectedId &&
- _scroll.hasClients &&
- _scroll.position.hasContentDimensions) {
- _applyPage();
- } else if (!_pageScheduled) {
- // A new result can be selected and paged before its first layout. Apply
- // against its own dimensions; a later selection clears the pending move.
- _pageScheduled = true;
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (!mounted) return;
- _pageScheduled = false;
- _applyPage();
- });
- }
- }
-
- void _applyPage() {
- if (_pendingPages == 0 || !_scroll.hasClients) return;
- final position = _scroll.position;
- if (!position.hasContentDimensions) return;
- final pages = _pendingPages;
- _pendingPages = 0;
- // Keep a little overlap for reading, and respond directly to held keys.
- _scroll.jumpTo(
- (position.pixels + pages * position.viewportDimension * .8).clamp(
- position.minScrollExtent,
- position.maxScrollExtent,
- ),
- );
- }
-
@override
void dispose() {
_warm?.cancel();
widget.search.removeListener(_changed);
- widget.search.previewPage.removeListener(_pageChanged);
_scroll.dispose();
super.dispose();
}
@@ -182,7 +146,6 @@ class _SwarmSearchPreviewState extends State<SwarmSearchPreview> {
builder: (context, _) {
final row = widget.search.selected;
if (row == null) return const SizedBox.shrink();
- _renderedId = row.id;
final agents = _agents(app, row);
return Semantics(
container: true,
@@ -378,6 +341,15 @@ class _AgentPreview extends StatelessWidget {
children: [
if (terminal) ...[
Text(agent.displayName, style: body),
+ Text(
+ statusLineParts(
+ provider: '',
+ machine: machine.machine.displayName,
+ project: project?.label ?? '',
+ branch: project?.shownBranch,
+ ).text,
+ style: muted,
+ ),
Text.rich(
TextSpan(
children: [
@@ -385,10 +357,7 @@ class _AgentPreview extends StatelessWidget {
text: '$state ',
style: TextStyle(color: color),
),
- TextSpan(
- text:
- '${agentIdentity(agent).label} @ ${machine.machine.name}',
- ),
+ TextSpan(text: agentIdentity(agent).label),
],
),
style: muted,
@@ -470,7 +439,7 @@ class _AgentPreview extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: excerpt == null ? muted : body,
),
- if (project != null)
+ if (project != null && !terminal)
Padding(
padding: EdgeInsets.only(top: terminal ? cell.height : 8),
child: Text(
@@ -577,10 +546,8 @@ class _AgentPreview extends StatelessWidget {
),
if (!terminal) const SizedBox(height: 8),
if (project?.cwd case final cwd?) Text(cwd, style: muted),
- if (project?.branch case final branch?)
- if (terminal)
- Text('git: $branch', style: muted)
- else
+ if (!terminal)
+ if (project?.branch case final branch?)
Padding(
padding: const EdgeInsets.only(top: 4),
child: Row(
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 9d4230ed4..9720c64ec 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -101,7 +101,7 @@ class _SwarmHistoryState extends State<_SwarmHistory> {
controller: _query,
focusNode: _focus,
autofocus: true,
- hintText: 'Search history…',
+ hintText: 'Search history',
onChanged: widget.search.setQuery,
),
const SizedBox(height: 8),
@@ -210,6 +210,10 @@ class SwarmSearchKeys extends StatelessWidget {
'picker.previous': () => move(-1),
if (search != null) ...{
'picker.toggle_preview': () => run(search.togglePreview),
+ 'picker.page_up': () => run(() => search.pageResults(-1)),
+ 'picker.page_down': () => run(() => search.pageResults(1)),
+ 'picker.preview_up': () => run(() => search.scrollPreview(-1)),
+ 'picker.preview_down': () => run(() => search.scrollPreview(1)),
'picker.preview_page_up': () => run(() => search.page(-1)),
'picker.preview_page_down': () => run(() => search.page(1)),
},
@@ -335,9 +339,19 @@ class SwarmSearchKeys extends StatelessWidget {
): () =>
run(search.togglePreview),
const SingleActivator(LogicalKeyboardKey.pageUp): () =>
- run(() => search.page(-1)),
+ run(() => search.pageResults(-1)),
const SingleActivator(LogicalKeyboardKey.pageDown): () =>
- run(() => search.page(1)),
+ run(() => search.pageResults(1)),
+ const SingleActivator(
+ LogicalKeyboardKey.arrowUp,
+ shift: true,
+ ): () =>
+ run(() => search.scrollPreview(-1)),
+ const SingleActivator(
+ LogicalKeyboardKey.arrowDown,
+ shift: true,
+ ): () =>
+ run(() => search.scrollPreview(1)),
},
const SingleActivator(
LogicalKeyboardKey.keyN,
@@ -651,6 +665,9 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
700 *
scale.scale(grid.AppType.monoSize) /
grid.AppType.monoSize;
+ final singleLine =
+ search.isCommandMode ||
+ (search.setupLayout && search.scopePrefix.isEmpty);
_rowHeight = swarmSearchRowHeight(
scale,
commands: search.isCommandMode,
@@ -658,9 +675,9 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
stacked: stacked,
);
if (widget.bios) {
- // A name, its context, then one blank terminal row. Only the name
- // receives the selection bar, exactly as in New Harness.
- _rowHeight = cell.height * (search.isCommandMode ? 1 : 3);
+ // Session context lives in the preview. Resource choices retain
+ // their description and one blank terminal row.
+ _rowHeight = cell.height * (singleLine ? 1 : 3);
}
final height = widget.fitRows
? _fittedHeight(
@@ -735,6 +752,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
terminal: true,
stacked: true,
bios: true,
+ singleLine: singleLine,
highlighted: highlighted,
enabled: canSubmit,
cellSize: cell,
@@ -1136,6 +1154,7 @@ class _SearchRowContent extends StatefulWidget {
required this.terminal,
required this.stacked,
this.bios = false,
+ this.singleLine = false,
this.highlighted = false,
this.enabled = true,
this.cellSize,
@@ -1147,6 +1166,7 @@ class _SearchRowContent extends StatefulWidget {
final bool terminal;
final bool stacked;
final bool bios;
+ final bool singleLine;
final bool highlighted;
final bool enabled;
final Size? cellSize;
@@ -1223,7 +1243,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
].where((part) => part.isNotEmpty).join(' ');
return Semantics(
label: row.isCreate
- ? row.title
+ ? '${row.title}\n$detail'
: '${row.title}\n${row.terminalDetail ?? row.detail}'
'${widget.activityAge == null ? '' : ', Last active ${widget.activityAge} ago'}',
excludeSemantics: true,
@@ -1237,8 +1257,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
padding: EdgeInsets.symmetric(horizontal: cell.width),
child: Row(
children: [
- // Match Cmd-N's empty two-cell gutter. Agent identities are
- // text in the context line, never logos or icon-font glyphs.
+ // Match Cmd-N's empty two-cell gutter.
SizedBox(width: cell.width * 2),
Expanded(
child: row.isCreate
@@ -1265,7 +1284,7 @@ class _SearchRowContentState extends State<_SearchRowContent> {
],
),
),
- if (!row.isCreate && !row.isCommand && detail.isNotEmpty)
+ if (!widget.singleLine && !row.isCommand && detail.isNotEmpty)
Padding(
padding: EdgeInsets.only(
left: cell.width * 3,
diff --git a/desktop/lib/widgets/terminal_prompt.dart b/desktop/lib/widgets/terminal_prompt.dart
index 81413f659..5e4f80f26 100644
--- a/desktop/lib/widgets/terminal_prompt.dart
+++ b/desktop/lib/widgets/terminal_prompt.dart
@@ -199,6 +199,8 @@ class TerminalPromptKeys extends StatelessWidget {
FocusManager.instance.primaryFocus?.nextFocus(),
'picker.complete_back': () =>
FocusManager.instance.primaryFocus?.previousFocus(),
+ 'picker.page_down': ?pageDown,
+ 'picker.page_up': ?pageUp,
'picker.preview_page_down': ?pageDown,
'picker.preview_page_up': ?pageUp,
'picker.refresh': ?refresh,
diff --git a/desktop/test/advanced_agent_keyboard_test.dart b/desktop/test/advanced_agent_keyboard_test.dart
index 1323ae96d..9b7b5e42a 100644
--- a/desktop/test/advanced_agent_keyboard_test.dart
+++ b/desktop/test/advanced_agent_keyboard_test.dart
@@ -97,6 +97,31 @@ Future<_Connection> _open(WidgetTester tester, {MemoryKeymap? keymap}) async {
}
void main() {
+ testWidgets('configured page keys still scroll the agent preview', (
+ tester,
+ ) async {
+ final map = MemoryKeymap();
+ addTearDown(map.dispose);
+ final connection = await _open(tester, keymap: map);
+ final input = tester.widget<TextField>(agentSearch);
+ final editing = input.controller!.value;
+ await key(tester, LogicalKeyboardKey.slash, ctrl: true);
+ final preview = find.byKey(const ValueKey('new-agent-agent-preview'));
+ final scroll = tester
+ .state<ScrollableState>(
+ find.descendant(of: preview, matching: find.byType(Scrollable)).first,
+ )
+ .position;
+ await key(tester, LogicalKeyboardKey.pageDown);
+ expect(scroll.pixels, greaterThan(0));
+ await key(tester, LogicalKeyboardKey.pageUp);
+ expect(scroll.pixels, 0);
+ expect(input.controller!.value, editing);
+ expect(input.focusNode!.hasFocus, isTrue);
+ expect(connection.launches, isEmpty);
+ await tester.pumpWidget(const SizedBox());
+ });
+
for (final mapped in [false, true]) {
testWidgets(
'modified Enter chooses the visible agent without launching the form (keymap: $mapped)',
@@ -231,8 +256,7 @@ void main() {
app.adoptSessionForTest(terminal('a0', []));
await mount(tester, app);
await key(tester, LogicalKeyboardKey.keyT, cmd: true);
- await key(tester, LogicalKeyboardKey.keyP, cmd: true);
- await key(tester, LogicalKeyboardKey.enter);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
await key(tester, LogicalKeyboardKey.period, cmd: true);
await tester.pumpAndSettle();
await openLaunchRow(tester, 'agent');
diff --git a/desktop/test/agent_creation_recovery_test.dart b/desktop/test/agent_creation_recovery_test.dart
index 4caa58f65..8d0ef7225 100644
--- a/desktop/test/agent_creation_recovery_test.dart
+++ b/desktop/test/agent_creation_recovery_test.dart
@@ -108,10 +108,11 @@ void main() {
await chord(tester, LogicalKeyboardKey.keyP);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ expect(find.byType(AlertDialog), findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyN);
case 'new tab':
await chord(tester, LogicalKeyboardKey.keyT);
- await chord(tester, LogicalKeyboardKey.keyP);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
case 'search shortcut':
await chord(tester, LogicalKeyboardKey.keyP);
await tester.enterText(
diff --git a/desktop/test/api_connections_test.dart b/desktop/test/api_connections_test.dart
index f8a14a35d..cf7282af3 100644
--- a/desktop/test/api_connections_test.dart
+++ b/desktop/test/api_connections_test.dart
@@ -541,7 +541,7 @@ void main() {
(tester) async {
final (app, controller) = await mount(tester);
expect(find.text('APIs 0'), findsOneWidget);
- expect(find.text('Search APIs…'), findsOneWidget);
+ expect(find.text('Search APIs'), findsOneWidget);
await tester.tap(find.byTooltip('Add OpenRouter'));
await tester.pumpAndSettle();
expect(find.byKey(const ValueKey('models-search')), findsNothing);
@@ -657,7 +657,7 @@ void main() {
await tester.enterText(field('API key'), 'not-saved');
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
- expect(find.text('Search APIs…'), findsOneWidget);
+ expect(find.text('Search APIs'), findsOneWidget);
expect(
app.requests.where((request) => request['action'] == 'save'),
isEmpty,
@@ -706,7 +706,7 @@ void main() {
await tester.tap(find.text('Explore local models'));
await tester.pumpAndSettle();
expect(find.text('Explore local models'), findsNothing);
- expect(find.text('Search models…'), findsOneWidget);
+ expect(find.text('Search models'), findsOneWidget);
expect(field('API key'), findsNothing);
expect(find.byTooltip('Add OpenRouter'), findsNothing);
expect(tester.takeException(), isNull);
diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dart
index aefb36978..5d4a94abf 100644
--- a/desktop/test/boot_flow_widget_test.dart
+++ b/desktop/test/boot_flow_widget_test.dart
@@ -908,6 +908,7 @@ void main() {
await tester.tap(find.byKey(const ValueKey('harness-start-new-pane')));
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
// With no machine to open an agent on, the start page's New goes to
// the Machines panel, with desktop and server instructions one click away.
diff --git a/desktop/test/command_dock_interaction_test.dart b/desktop/test/command_dock_interaction_test.dart
index 8fe1a1464..de9d802bb 100644
--- a/desktop/test/command_dock_interaction_test.dart
+++ b/desktop/test/command_dock_interaction_test.dart
@@ -53,7 +53,7 @@ void main() {
});
testWidgets(
- 'session context and activity are visible beside a distinct create action',
+ 'session rows show activity and searchable context lives in the preview',
(tester) async {
final app = createApp();
final map = MemoryKeymap();
@@ -83,32 +83,29 @@ void main() {
find.descendant(of: row, matching: find.text('33m')),
findsOneWidget,
);
- final detail = tester.widget<SearchResultText>(
+ expect(
+ find.descendant(of: row, matching: find.byType(SearchResultText)),
+ findsOneWidget,
+ );
+ await tester.enterText(
+ find.byKey(const ValueKey('swarm-search-input')),
+ 'feature/login-redirect',
+ );
+ await tester.pumpAndSettle();
+ final detail = tester.widget<Text>(
find.descendant(
- of: row,
- matching: find.byWidgetPredicate(
- (widget) =>
- widget is SearchResultText &&
- widget.text.contains('(feature/login-redirect)'),
- ),
+ of: find.byKey(const ValueKey('swarm-search-preview')),
+ matching: find.text('M2:openharness (feature/login-redirect)'),
),
);
- expect(detail.text, 'M2:openharness (feature/login-redirect)');
for (final label in ['M2', 'openharness', 'feature/login-redirect']) {
- expect(detail.text, contains(label));
+ expect(detail.data, contains(label));
}
- expect(detail.style.fontFamily, terminalFontStore.value.fontFamily);
- expect(detail.style.fontSize, terminalFontStore.size);
- expect(detail.style.height, terminalFontStore.value.height);
+ expect(detail.style!.fontFamily, terminalFontStore.value.fontFamily);
+ expect(detail.style!.fontSize, terminalFontStore.size);
+ expect(detail.style!.height, terminalFontStore.value.height);
final create = find.byKey(const ValueKey(kSwarmCreateRowId));
- expect(
- find.descendant(of: create, matching: find.text('New Harness')),
- findsOneWidget,
- );
- expect(
- find.descendant(of: create, matching: find.byType(Icon)),
- findsNothing,
- );
+ expect(create, findsNothing);
expect(find.text('Harness:'), findsNothing);
expect(find.byKey(const ValueKey('swarm-search-hints')), findsNothing);
expect(tester.takeException(), isNull);
@@ -152,16 +149,20 @@ void main() {
final search = tester
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
.search;
- expect(search.rows.first.isCreate, isTrue);
+ expect(search.selected, isNull);
+ expect(search.rows.any((row) => row.isCreate), isFalse);
await key(tester, LogicalKeyboardKey.tab);
+ expect(search.selected, search.rows.first);
expect(tester.widget<TextField>(input).focusNode!.hasFocus, isTrue);
await tester.enterText(input, 'nothing-like-this');
await tester.pump();
- expect(search.rows.single.isCreate, isTrue);
+ expect(search.rows, isEmpty);
expect(tester.getRect(panel), bounds);
expect(count, findsNothing);
expect(tester.getRect(find.byKey(pane.cellKey)), paneBounds);
- expect(find.text('New Harness'), findsOneWidget);
+ expect(find.text('New Harness'), findsNothing);
+ await key(tester, LogicalKeyboardKey.enter);
+ expect(tester.getRect(panel), bounds);
await key(tester, LogicalKeyboardKey.escape);
expect(panel, findsNothing);
expect(tester.takeException(), isNull);
diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dart
index 759dc20ee..7c4d2ff08 100644
--- a/desktop/test/first_workspace_test.dart
+++ b/desktop/test/first_workspace_test.dart
@@ -307,7 +307,7 @@ void main() {
await tester.pump();
await tester.tap(_newHarness);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
expect(picker.opened, 0);
expect(find.byType(AlertDialog), findsOneWidget);
@@ -366,7 +366,7 @@ void main() {
expect(find.text('Machines'), findsNothing);
await tester.tap(_newHarness);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
expect(picker.opened, 0);
await _browseLocal(tester);
@@ -724,7 +724,7 @@ void main() {
expect(tester.widget<TextField>(_startInput).focusNode!.hasFocus, isTrue);
await tester.tap(_newHarness);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
final engine = tester.widget<AgentPicker>(
find.byKey(const Key('new-agent-agent-picker')),
@@ -827,7 +827,7 @@ void main() {
await tester.tap(_newHarness);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
expect(find.byType(AlertDialog), findsOneWidget);
await _browseLocal(tester);
@@ -876,7 +876,7 @@ void main() {
await mount(tester, app);
await tester.tap(_newHarness);
await tester.pump();
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await _browseLocal(tester);
await tester.pump();
diff --git a/desktop/test/harness_placement_test.dart b/desktop/test/harness_placement_test.dart
index de6b2cf70..20861dcbf 100644
--- a/desktop/test/harness_placement_test.dart
+++ b/desktop/test/harness_placement_test.dart
@@ -366,8 +366,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
- await chord(tester, LogicalKeyboardKey.keyP);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
final input = find.byKey(const ValueKey('new-harness-query'));
tester
@@ -722,6 +721,9 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
+ expect(find.byType(NewHarnessForm), findsNothing);
+ expect(connection.requests, isEmpty);
+ await chord(tester, LogicalKeyboardKey.keyN);
final box = tester
.widget<NewHarnessForm>(find.byType(NewHarnessForm))
.controller;
@@ -813,8 +815,7 @@ void main() {
final original = app.activeSwarm;
await mount(tester, app);
await chord(tester, LogicalKeyboardKey.keyT);
- await chord(tester, LogicalKeyboardKey.keyP);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
tester
.widget<NewHarnessForm>(find.byType(NewHarnessForm))
@@ -833,8 +834,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(find.byType(NewHarnessForm), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyP);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
final box = tester
.widget<NewHarnessForm>(find.byType(NewHarnessForm))
@@ -851,8 +851,7 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(find.byType(NewHarnessForm), findsNothing);
- await chord(tester, LogicalKeyboardKey.keyP);
- await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
@@ -934,6 +933,8 @@ void main() {
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
+ expect(find.byType(NewHarnessForm), findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyN);
final box = tester
.widget<NewHarnessForm>(find.byType(NewHarnessForm))
.controller;
diff --git a/desktop/test/harness_session_manager_test.dart b/desktop/test/harness_session_manager_test.dart
index 9577b546f..80c97c1b8 100644
--- a/desktop/test/harness_session_manager_test.dart
+++ b/desktop/test/harness_session_manager_test.dart
@@ -377,7 +377,7 @@ void main() {
.widget<TextField>(find.byKey(const ValueKey('session-search')))
.decoration
?.hintText,
- 'Search harnesses, machines, projects, branches…',
+ 'Search harnesses, machines, projects, branches',
);
await tester.enterText(
find.byKey(const ValueKey('session-search')),
diff --git a/desktop/test/harness_session_picker_test.dart b/desktop/test/harness_session_picker_test.dart
index d90835109..1cf49ec93 100644
--- a/desktop/test/harness_session_picker_test.dart
+++ b/desktop/test/harness_session_picker_test.dart
@@ -261,7 +261,8 @@ void main() {
await key(tester, LogicalKeyboardKey.keyS, ctrl: true);
expect(connection.stops, isEmpty);
await key(tester, LogicalKeyboardKey.keyP, ctrl: true);
- expect(resourceSearch(tester).selected!.isCreate, isTrue);
+ expect(resourceSearch(tester).selected!.agentId, 'a0');
+ expect(resourceSearch(tester).rows.single.isCreate, isFalse);
await key(tester, LogicalKeyboardKey.keyN, ctrl: true);
expect(resourceSearch(tester).selected!.agentId, 'a0');
final editing = tester.widget<TextField>(resourceField).controller!;
diff --git a/desktop/test/keyboard_practice_test.dart b/desktop/test/keyboard_practice_test.dart
index 0a163b725..ce11b03c1 100644
--- a/desktop/test/keyboard_practice_test.dart
+++ b/desktop/test/keyboard_practice_test.dart
@@ -15,6 +15,7 @@ import 'package:harness/shortcuts/keymap.dart';
import 'package:harness/shortcuts/keymap_commands.dart';
import 'package:harness/state/workspace_learning.dart';
import 'package:harness/terminal/terminal_binary.dart';
+import 'package:harness/terminal/terminal_text.dart';
import 'package:harness/widgets/workspace_quick_start.dart';
import 'keymap_host_test.dart' show MemoryKeymap, key;
@@ -322,6 +323,12 @@ void main() {
addTearDown(tester.view.reset);
final boundary = GlobalKey();
final storage = LearningMemoryStore();
+ final map = MemoryKeymap();
+ addTearDown(map.dispose);
+ map.apply('''{"version":1,"bindings":[
+ {"keys":"alt+j","command":"picker.page_down","when":"picker"},
+ {"keys":"alt+k","command":"picker.page_up","when":"picker"}
+ ]}''');
await tester.pumpWidget(
MaterialApp(
theme: ThemeData.dark(),
@@ -332,7 +339,7 @@ void main() {
),
home: RepaintBoundary(
key: boundary,
- child: KeyboardPractice(storage: storage),
+ child: KeyboardPractice(storage: storage, keymap: map),
),
),
);
@@ -363,6 +370,21 @@ void main() {
await key(tester, LogicalKeyboardKey.escape);
await openLesson(tester, 'New Pane');
expect(scrolling.offset, 0);
+ await key(tester, LogicalKeyboardKey.escape);
+ await openLesson(tester, 'Next result');
+ await key(tester, LogicalKeyboardKey.arrowDown);
+ await tester.pumpAndSettle();
+ final cell = terminalCellSizeOf(
+ tester.element(find.byType(KeyboardPractice)),
+ );
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(scrolling.offset, closeTo(cell.height, .01));
+ await key(tester, LogicalKeyboardKey.arrowUp, shift: true);
+ expect(scrolling.offset, 0);
+ await key(tester, LogicalKeyboardKey.keyJ, alt: true);
+ expect(scrolling.offset, greaterThan(cell.height));
+ await key(tester, LogicalKeyboardKey.keyK, alt: true);
+ expect(scrolling.offset, 0);
}
expect(storage.values.values.any((v) => v.contains('swarm.new')), isTrue);
await tester.pumpWidget(const SizedBox());
diff --git a/desktop/test/keymap_runtime_test.dart b/desktop/test/keymap_runtime_test.dart
index 37329209e..d5574fbdd 100644
--- a/desktop/test/keymap_runtime_test.dart
+++ b/desktop/test/keymap_runtime_test.dart
@@ -728,7 +728,7 @@ void main() {
);
expect(
tester.widget<TextField>(commandField).decoration!.hintText,
- 'Search commands…',
+ 'Search commands',
);
await key(tester, LogicalKeyboardKey.escape);
await tester.pump();
diff --git a/desktop/test/machines_manager_test.dart b/desktop/test/machines_manager_test.dart
index 8837c93a6..4330d5b1c 100644
--- a/desktop/test/machines_manager_test.dart
+++ b/desktop/test/machines_manager_test.dart
@@ -363,7 +363,7 @@ void main() {
find.byKey(const ValueKey('swarm-search-input')),
);
expect(search.controller!.text, isEmpty);
- expect(find.text('Harnesses · Test host'), findsOneWidget);
+ expect(search.decoration!.hintText, 'Search harnesses in Test host');
expect(find.text('Task from another Test host'), findsNothing);
await tester.enterText(
find.byKey(const ValueKey('swarm-search-input')),
@@ -413,7 +413,7 @@ void main() {
);
}
- testWidgets('a fresh machine opens creation with that machine selected', (
+ testWidgets('an empty machine session list waits for Cmd-N to create there', (
tester,
) async {
final previous = newHarnessOpensInBox;
@@ -437,6 +437,10 @@ void main() {
await tester.pumpAndSettle();
await key(tester, LogicalKeyboardKey.enter);
await tester.pumpAndSettle();
+ expect(find.byType(NewHarnessForm), findsNothing);
+ expect(find.text('New Harness'), findsNothing);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
+ await tester.pumpAndSettle();
final box = tester.widget<NewHarnessForm>(find.byType(NewHarnessForm));
expect(box.controller.machineId, 'fresh');
expect(box.controller.placement, HarnessPlacement.currentTab);
diff --git a/desktop/test/models_menu_test.dart b/desktop/test/models_menu_test.dart
index 96c076018..80098faf5 100644
--- a/desktop/test/models_menu_test.dart
+++ b/desktop/test/models_menu_test.dart
@@ -386,8 +386,8 @@ void main() {
expect(source.calls, 1);
expect(app.activeSwarmId, original);
expect(resourceScope(':'), findsOneWidget);
- expect(find.text('OpenAI'), findsOneWidget);
- expect(find.textContaining('Not signed in'), findsOneWidget);
+ expect(find.text('OpenAI'), findsWidgets);
+ expect(find.textContaining('Not signed in'), findsWidgets);
expect(messages.where((c) => c.method == 'modelsState'), isEmpty);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
@@ -517,7 +517,7 @@ void main() {
expect(resourceScope(':'), findsOneWidget);
expect(
tester.widget<TextField>(resourceField).decoration!.hintText,
- 'Search models…',
+ 'Search models',
);
expect(app.sent, isEmpty);
await tester.pumpWidget(const SizedBox());
@@ -535,7 +535,7 @@ void main() {
expect(resourceScope(':'), findsOneWidget);
expect(
tester.widget<TextField>(resourceField).decoration!.hintText,
- 'Search models…',
+ 'Search models',
);
expect(resourceField, findsOneWidget);
expect(connection.creations, isEmpty);
diff --git a/desktop/test/models_panel_test.dart b/desktop/test/models_panel_test.dart
index 6d959e6e1..f41648dab 100644
--- a/desktop/test/models_panel_test.dart
+++ b/desktop/test/models_panel_test.dart
@@ -696,7 +696,7 @@ void main() {
await selectResource(tester, 'model:local:qwen');
await tester.pump();
expect(find.text('Qwen3.8-27B'), findsWidgets);
- expect(find.text('Search models…'), findsOneWidget);
+ expect(find.text('Search models'), findsOneWidget);
expect(tester.getSize(resourceScope(':')).height, greaterThan(620));
expect(tester.getRect(resourceScope(':')).bottom, lessThan(760));
tester.view.physicalSize = const Size(1200, 480);
@@ -732,7 +732,7 @@ void main() {
expect(panel.top, greaterThan(0));
expect(panel.width, greaterThan(1000));
expect(find.byType(Dialog), findsNothing);
- expect(find.text('Search models…'), findsOneWidget);
+ expect(find.text('Search models'), findsOneWidget);
expect(
resourceSearch(tester).rows
.any((row) => row.modelId == 'model:local:qwen'),
diff --git a/desktop/test/new_harness_entry_rules_test.dart b/desktop/test/new_harness_entry_rules_test.dart
index c7f25be3f..fab383785 100644
--- a/desktop/test/new_harness_entry_rules_test.dart
+++ b/desktop/test/new_harness_entry_rules_test.dart
@@ -171,12 +171,21 @@ void main() {
for (final shortcut in [LogicalKeyboardKey.keyN, LogicalKeyboardKey.keyP]) {
testWidgets(
- '${shortcut.keyLabel} starts a pane with no extra launch controls',
+ '${shortcut.keyLabel == 'N' ? 'Cmd-N' : 'command palette'} starts a pane with no extra launch controls',
(tester) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
- await key(tester, shortcut, cmd: true);
+ await key(
+ tester,
+ shortcut,
+ cmd: true,
+ shift: shortcut == LogicalKeyboardKey.keyP,
+ );
if (shortcut != LogicalKeyboardKey.keyN) {
+ await tester.enterText(
+ find.byKey(const ValueKey('swarm-search-input')),
+ '> New Harness',
+ );
await acceptSetupOrSearch(tester);
}
final controller = box(tester);
@@ -446,7 +455,9 @@ void main() {
await tester.pumpWidget(const SizedBox());
});
- testWidgets('Cmd-P repeats without losing the search task', (tester) async {
+ testWidgets('an unmatched Cmd-P query waits for explicit Cmd-N creation', (
+ tester,
+ ) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
final shortcut = LogicalKeyboardKey.keyP;
@@ -475,6 +486,10 @@ void main() {
expect(app.swarms.first, same(origin));
expect(app.swarms.length, 1);
await acceptSetupOrSearch(tester);
+ expect(find.byType(NewHarnessForm), findsNothing);
+ expect(updated.search!.rows, isEmpty);
+ expect(connections.values.expand((c) => c.starts), isEmpty);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
expect(box(tester).task, 'Check the keyboard workflow');
expect(box(tester).placement, HarnessPlacement.currentTab);
await acceptSetupOrSearch(tester);
@@ -491,23 +506,21 @@ void main() {
});
testWidgets(
- 'Cmd-P keeps drafts separate when the focused source pane changes',
+ 'Cmd-N keeps drafts separate when the focused source pane changes',
(tester) async {
await mount(tester, store: false);
final first = app.focusedPane!;
final other = app.adoptSessionForTest(terminal('a2', []));
app.focusPane(first.id);
await tester.pump();
- final shortcut = LogicalKeyboardKey.keyP;
+ final shortcut = LogicalKeyboardKey.keyN;
await key(tester, shortcut, cmd: true);
- await acceptSetupOrSearch(tester);
await nameProject(tester, 'keyboard-review');
box(tester).task = 'Review this project';
await dismiss(tester);
app.focusPane(other.id);
await tester.pump();
await key(tester, shortcut, cmd: true);
- await acceptSetupOrSearch(tester);
expect(box(tester).harnessId, 'autonomous/typst');
expect(box(tester).project.folder, '/work/release-notes');
expect(box(tester).task, isEmpty);
@@ -515,7 +528,6 @@ void main() {
app.focusPane(first.id);
await tester.pump();
await key(tester, shortcut, cmd: true);
- await acceptSetupOrSearch(tester);
expect(box(tester).engine, 'codex');
expect(box(tester).project.name, 'keyboard-review');
expect(box(tester).task, 'Review this project');
@@ -526,14 +538,13 @@ void main() {
},
);
- testWidgets('Cmd-P inherits its source and resumes edits via Open Harness', (
+ testWidgets('Cmd-N inherits its source and resumes edits after finding', (
tester,
) async {
await mount(tester, store: false);
final origin = app.activeSwarm;
- final shortcut = LogicalKeyboardKey.keyP;
+ final shortcut = LogicalKeyboardKey.keyN;
await key(tester, shortcut, cmd: true);
- await acceptSetupOrSearch(tester);
var draft = box(tester);
expect(draft.engine, 'codex');
expect(draft.machineId, 'm');
@@ -547,6 +558,9 @@ void main() {
expect(app.activeSwarm, same(origin));
await key(tester, LogicalKeyboardKey.keyP, cmd: true);
await acceptSetupOrSearch(tester);
+ expect(find.byType(NewHarnessForm), findsNothing);
+ expect(connections.values.expand((c) => c.starts), isEmpty);
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
draft = box(tester);
expect(draft.task, 'Check keyboard focus');
expect(draft.project.name, 'keyboard-review');
@@ -592,7 +606,11 @@ void main() {
expect(picker.rows.any((row) => row.isCreate), isFalse);
expect(picker.selected?.id, selected);
expect(picker.rows.map((row) => row.id), results);
- expect(find.text('Harnesses · openharness'), findsOneWidget);
+ expect(find.text('Harnesses · openharness'), findsNothing);
+ expect(
+ tester.widget<TextField>(search).decoration!.hintText,
+ 'Search harnesses in openharness',
+ );
await key(tester, LogicalKeyboardKey.escape);
expect(picker.query, '# openharness');
expect(picker.canGoBack, isFalse);
diff --git a/desktop/test/open_picker_rendering_test.dart b/desktop/test/open_picker_rendering_test.dart
index f15a0a115..8c61849b6 100644
--- a/desktop/test/open_picker_rendering_test.dart
+++ b/desktop/test/open_picker_rendering_test.dart
@@ -96,6 +96,10 @@ void main() {
expect(tester.widget<Container>(row).color, pane.theme.selection);
final cell = terminalCellSizeOf(tester.element(input));
expect(tester.getSize(row).height, closeTo(cell.height, .01));
+ expect(
+ tester.getSize(find.byKey(ValueKey(search.selected!.id))).height,
+ closeTo(cell.height, .01),
+ );
expect(field.cursorWidth, closeTo(cell.width, .01));
final rowTitles = tester.widgetList<SearchResultText>(
find.byWidgetPredicate(
@@ -152,6 +156,34 @@ void main() {
);
await tester.pumpAndSettle();
checkAppearance();
+ await tester.enterText(input, 'safe-retries');
+ await tester.pumpAndSettle();
+ expect(search.selected!.agentId, 'a0');
+ final preview = find.byKey(const ValueKey('swarm-search-preview'));
+ final title = find.descendant(
+ of: preview,
+ matching: find.text('Checkout retries'),
+ );
+ final context = find.text('Test host:storefront (feat/safe-retries)');
+ expect(context, findsOneWidget);
+ expect(find.descendant(of: preview, matching: context), findsOneWidget);
+ final cell = terminalCellSizeOf(tester.element(input));
+ expect(
+ tester.getTopLeft(context).dy - tester.getTopLeft(title).dy,
+ closeTo(cell.height, .01),
+ );
+ expect(
+ tester
+ .widgetList<SearchResultText>(
+ find.descendant(
+ of: find.byKey(ValueKey(search.selected!.id)),
+ matching: find.byType(SearchResultText),
+ ),
+ )
+ .map((text) => text.text),
+ ['Checkout retries'],
+ );
+ expect(find.text('git: feat/safe-retries'), findsNothing);
await tester.enterText(input, 'Workspace sync');
await tester.pumpAndSettle();
final waiting = tester.widget<Text>(find.text('Needs your input'));
@@ -283,6 +315,11 @@ void main() {
closeTo(cell.height, .01),
reason: 'Selection occupies exactly one terminal line.',
);
+ expect(
+ tester.getSize(find.byKey(ValueKey(id))).height,
+ closeTo(cell.height, .01),
+ reason: 'The entire result occupies one line, with no spacer row.',
+ );
final title = find
.descendant(of: line, matching: find.byType(Text))
.first;
@@ -291,6 +328,12 @@ void main() {
closeTo(tester.getTopLeft(input).dx, .01),
);
}
+ final first = find.byKey(ValueKey(search.rows[0].id));
+ final second = find.byKey(ValueKey(search.rows[1].id));
+ expect(
+ tester.getTopLeft(second).dy - tester.getTopLeft(first).dy,
+ closeTo(cell.height, .01),
+ );
for (final type in [ListTile, Icon, Image, EngineMark, PromptContextView]) {
expect(
find.descendant(of: results, matching: find.byType(type)),
@@ -298,7 +341,10 @@ void main() {
);
}
expect(search.rows.length, greaterThan(50));
- expect(rows.evaluate().length, lessThan(35));
+ final list = find.byKey(const ValueKey('swarm-search-result-list'));
+ final capacity = (tester.getSize(list).height / cell.height).ceil();
+ expect(rows.evaluate().length, lessThanOrEqualTo(capacity + 2));
+ expect(rows.evaluate().length, lessThan(search.rows.length));
final visited = <String>{};
for (var step = 0; step < 35; step++) {
await key(tester, LogicalKeyboardKey.tab);
diff --git a/desktop/test/quick_access_test.dart b/desktop/test/quick_access_test.dart
index 4c76d9a25..4052387e5 100644
--- a/desktop/test/quick_access_test.dart
+++ b/desktop/test/quick_access_test.dart
@@ -14,6 +14,55 @@ import 'swarm_screen_test.dart' show terminal;
import 'swarm_state_test.dart' show createApp;
void main() {
+ test('Cmd-P never creates harnesses in root or scoped session lists', () {
+ final app = createApp();
+ seedMixedAgents(app);
+ addTearDown(app.dispose);
+ final search = SwarmSearchController(
+ app,
+ const [],
+ adding: true,
+ activityFirst: true,
+ offersCreate: true,
+ offersHarnessCreate: false,
+ selectOnEmptyQuery: false,
+ placement: HarnessPlacement.currentTab,
+ );
+ addTearDown(search.dispose);
+ expect(search.rows, isNotEmpty);
+ expect(search.rows.any((row) => row.isCreate), isFalse);
+ expect(search.selected, isNull);
+ expect(search.submit(), isNull);
+ for (final query in ['@ Office', '# openharness']) {
+ search.setQuery(query);
+ expect(search.rows.first.isCreate, isTrue);
+ expect(search.selected!.isCreate, isFalse);
+ expect(search.submit(), isNull);
+ expect(search.canGoBack, isTrue);
+ expect(search.rows, isNotEmpty);
+ expect(search.rows.any((row) => row.isCreate), isFalse);
+ search.setQuery('a harness that does not exist');
+ expect(search.rows, isEmpty);
+ expect(search.selected, isNull);
+ expect(search.submit(), isNull);
+ expect(search.back(), isTrue);
+ }
+ search.setQuery('a harness that does not exist');
+ expect(search.rows, isEmpty);
+ expect(search.submit(), isNull);
+ search.setQuery('');
+ for (final machine in app.machineStates.values) {
+ machine.agents = [];
+ }
+ app.notifyListeners();
+ expect(search.rows, isEmpty);
+ expect(search.showsTypeHints, isTrue);
+ search.move(1);
+ search.move(-1);
+ expect(search.selected, isNull);
+ expect(search.submit(), isNull);
+ });
+
for (final placement in HarnessPlacement.values) {
test('prefixes switch lists and retain $placement', () {
final app = createApp();
diff --git a/desktop/test/resource_picker_test.dart b/desktop/test/resource_picker_test.dart
index 046ce05cf..cc851218e 100644
--- a/desktop/test/resource_picker_test.dart
+++ b/desktop/test/resource_picker_test.dart
@@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/dsh_catalog.dart';
+import 'package:harness/core/models.dart';
import 'package:harness/models/api_connections_controller.dart';
import 'package:harness/models/api_connections_panel.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
@@ -112,6 +113,10 @@ void main() {
expect(field, findsOneWidget);
final hints = find.byKey(const ValueKey('swarm-search-type-hints'));
expect(hints, findsOneWidget);
+ expect(search(tester).selected, isNull);
+ await key(tester, LogicalKeyboardKey.enter);
+ expect(field, findsOneWidget);
+ expect(search(tester).selected, isNull);
expect(search(tester).isCommandMode, isFalse);
await tester.enterText(field, ':qwen');
await tester.pump();
@@ -143,74 +148,126 @@ void main() {
}),
);
- testWidgets('type hints keep the input and results fixed while typing', (
- tester,
- ) async {
- final app = await fixture();
- final originalFont = terminalFontStore.value;
- final originalPalette = grid.AppTheme.palette.value;
- final originalTheme = terminalThemeStore.value;
- addTearDown(() {
- terminalFontStore.value = originalFont;
- grid.AppTheme.palette.value = originalPalette;
- terminalThemeStore.value = originalTheme;
- });
- await mount(tester, app);
- await chord(tester, LogicalKeyboardKey.keyP);
- final hints = find.byKey(const ValueKey('swarm-search-type-hints'));
- final input = tester.widget<TextField>(field);
- final inputPosition = tester.getTopLeft(field);
- final createPosition = tester.getTopLeft(find.text('New Harness'));
- const fullHint =
- '> harnesses @ machines # projects : models * store';
- expect(tester.widget<Text>(hints).data, fullHint);
- expect(tester.getTopLeft(hints).dx, closeTo(inputPosition.dx, .01));
- expect(
- tester.getTopLeft(hints).dy - inputPosition.dy,
- closeTo(terminalCellSizeOf(tester.element(field)).height, 1),
- reason: 'The hint sits one terminal row below the input.',
- );
- await capture(tester, 'empty-type-hints');
+ testWidgets(
+ 'empty search shows hints in the preview until a result is selected',
+ (tester) async {
+ final app = await fixture();
+ final originalFont = terminalFontStore.value;
+ final originalPalette = grid.AppTheme.palette.value;
+ final originalTheme = terminalThemeStore.value;
+ addTearDown(() {
+ terminalFontStore.value = originalFont;
+ grid.AppTheme.palette.value = originalPalette;
+ terminalThemeStore.value = originalTheme;
+ });
+ await mount(tester, app);
+ await chord(tester, LogicalKeyboardKey.keyP);
+ final hints = find.byKey(const ValueKey('swarm-search-type-hints'));
+ final input = tester.widget<TextField>(field);
+ final inputPosition = tester.getTopLeft(field);
+ final listPosition = tester.getTopLeft(
+ find.byKey(const ValueKey('swarm-search-result-list')),
+ );
+ const fullHint =
+ '> harnesses\n@ machines\n# projects\n: models\n* store';
+ expect(tester.widget<Text>(hints).data, fullHint);
+ final controller = search(tester);
+ expect(controller.selected, isNull);
+ expect(controller.rows.any((row) => row.isCreate), isFalse);
+ expect(find.text('New Harness'), findsNothing);
+ expect(
+ tester.getRect(hints).left,
+ greaterThanOrEqualTo(
+ tester
+ .getRect(find.byKey(const ValueKey('swarm-search-result-list')))
+ .right,
+ ),
+ );
+ for (final row in controller.rows) {
+ final line = find.byKey(ValueKey('swarm-search-line:${row.id}'));
+ if (line.evaluate().isNotEmpty) {
+ expect(tester.widget<Container>(line).color, Colors.transparent);
+ }
+ }
+ app.machineStates['m']!.agents.add(
+ const Agent(
+ id: 'late-result',
+ name: 'Discovered session',
+ terminalAvailable: true,
+ ),
+ );
+ app.notifyListeners();
+ await tester.pump();
+ expect(controller.selected, isNull);
+ await capture(tester, 'empty-type-hints');
- await tester.enterText(field, 'search');
- await tester.pump();
- expect(hints, findsNothing);
- expect(tester.getTopLeft(field), inputPosition);
- expect(tester.getTopLeft(find.text('New Harness')), createPosition);
- expect(tester.widget<TextField>(field).controller, same(input.controller));
- expect(input.focusNode!.hasFocus, isTrue);
- for (final prefix in ['@', '#', ':', '*']) {
- await tester.enterText(field, prefix);
+ await key(tester, LogicalKeyboardKey.arrowDown);
+ expect(controller.selected, controller.rows.first);
+ expect(hints, findsNothing);
+ await key(tester, LogicalKeyboardKey.tab);
+ expect(controller.selected, controller.rows[1]);
+
+ await tester.enterText(field, 'search');
await tester.pump();
expect(hints, findsNothing);
- await key(tester, LogicalKeyboardKey.backspace);
+ expect(controller.selected!.isCreate, isFalse);
+ expect(
+ controller.selected,
+ controller.rows.firstWhere((row) => !row.isCreate),
+ );
+ expect(tester.getTopLeft(field), inputPosition);
+ expect(
+ tester.getTopLeft(
+ find.byKey(const ValueKey('swarm-search-result-list')),
+ ),
+ listPosition,
+ );
+ expect(
+ tester.widget<TextField>(field).controller,
+ same(input.controller),
+ );
+ expect(input.focusNode!.hasFocus, isTrue);
+ await capture(tester, 'selected-search');
+ await tester.enterText(field, '');
+ await tester.pump();
+ expect(controller.selected, isNull);
expect(hints, findsOneWidget);
- }
+ await key(tester, LogicalKeyboardKey.arrowUp);
+ expect(controller.selected, controller.rows.last);
+ for (final prefix in ['@', '#', ':', '*']) {
+ await tester.enterText(field, prefix);
+ await tester.pump();
+ expect(hints, findsNothing);
+ expect(controller.selected!.isCreate, isFalse);
+ await key(tester, LogicalKeyboardKey.backspace);
+ expect(hints, findsOneWidget);
+ expect(controller.selected, isNull);
+ }
- grid.AppTheme.palette.value = HarnessPalette.slate;
- terminalThemeStore.value = TerminalThemeChoice.tango;
- terminalFontStore.value = const TerminalStyle(
- fontSize: 18,
- fontFamily: 'Menlo',
- );
- tester.view.physicalSize = const Size(480, 600);
- await tester.pumpAndSettle();
- final compact = tester.widget<Text>(hints);
- expect(compact.data, '> @ # : *');
- expect(compact.semanticsLabel, fullHint);
- expect(compact.style!.fontSize, 18);
- expect(
- compact.style!.color,
- terminalThemeFor(
- grid.AppTheme.palette.value,
- terminalThemeStore.value,
- ).foreground.withValues(alpha: .54),
- );
- expect(tester.takeException(), isNull);
- await capture(tester, 'narrow-type-hints');
- await tester.pumpWidget(const SizedBox());
- app.dispose();
- });
+ grid.AppTheme.palette.value = HarnessPalette.slate;
+ terminalThemeStore.value = TerminalThemeChoice.tango;
+ terminalFontStore.value = const TerminalStyle(
+ fontSize: 18,
+ fontFamily: 'Menlo',
+ );
+ tester.view.physicalSize = const Size(480, 600);
+ await tester.pumpAndSettle();
+ final compact = tester.widget<Text>(hints);
+ expect(compact.data, fullHint);
+ expect(compact.style!.fontSize, 18);
+ expect(
+ compact.style!.color,
+ terminalThemeFor(
+ grid.AppTheme.palette.value,
+ terminalThemeStore.value,
+ ).foreground.withValues(alpha: .54),
+ );
+ expect(tester.takeException(), isNull);
+ await capture(tester, 'narrow-type-hints');
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ },
+ );
for (final withKeymap in [false, true]) {
testWidgets(
@@ -231,7 +288,8 @@ void main() {
]) {
await tester.enterText(field, prefix);
await tester.pump();
- expect(search(tester).selected!.title, label);
+ expect(search(tester).rows.first.title, label);
+ expect(search(tester).selected!.isCreate, isFalse);
expect(
tester
.widget<SwarmSearchInput>(find.byType(SwarmSearchInput))
@@ -304,6 +362,115 @@ void main() {
});
}
+ testWidgets(
+ 'resource previews scroll by line and empty searches stay inert',
+ (tester) async {
+ final app = await fixture();
+ app.machineStates['m']!.dsh.replace([
+ DshEntry(
+ id: 'blender',
+ name: 'Blender',
+ engine: 'codex',
+ description: List.generate(
+ 90,
+ (i) => 'Product description line $i.',
+ ).join('\n'),
+ ),
+ ]);
+ app.modelManager.apis.connections = [
+ ApiConnection({
+ 'id': 'deepseek-api',
+ 'provider': 'custom',
+ 'name': 'DeepSeek API',
+ 'baseUrl':
+ 'https://example.test/${List.filled(500, 'endpoint/').join()}',
+ 'keyEnv': 'TEST_API_KEY',
+ }),
+ ];
+ final originalFont = terminalFontStore.value;
+ addTearDown(() => terminalFontStore.value = originalFont);
+ await configured.mount(tester, app, MemoryKeymap());
+ await chord(tester, LogicalKeyboardKey.keyP);
+ final controller = search(tester);
+ ScrollPosition position() => tester
+ .widget<ListView>(
+ find.descendant(
+ of: find.byType(SwarmResourcePreview),
+ matching: find.byType(ListView),
+ ),
+ )
+ .controller!
+ .position;
+ for (final query in ['*blender', ':deepseek']) {
+ await tester.enterText(field, query);
+ await tester.pumpAndSettle();
+ final selected = controller.selected!.id;
+ expect(position().pixels, 0);
+ expect(position().maxScrollExtent, greaterThan(0));
+ final editing = tester.widget<TextField>(field).controller!.value;
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(
+ position().pixels,
+ closeTo(terminalCellSizeOf(tester.element(field)).height, .01),
+ );
+ await key(tester, LogicalKeyboardKey.arrowUp, shift: true);
+ await key(tester, LogicalKeyboardKey.arrowUp, shift: true);
+ expect(position().pixels, 0);
+ terminalFontStore.value = const TerminalStyle(
+ fontSize: 20,
+ fontFamily: 'Menlo',
+ height: 1.5,
+ );
+ await tester.pumpAndSettle();
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(
+ position().pixels,
+ closeTo(terminalCellSizeOf(tester.element(field)).height, .01),
+ );
+ controller.scrollPreview(10000);
+ await tester.pumpAndSettle();
+ expect(position().pixels, position().maxScrollExtent);
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(position().pixels, position().maxScrollExtent);
+ expect(controller.selected!.id, selected);
+ expect(tester.widget<TextField>(field).controller!.value, editing);
+ expect(tester.widget<TextField>(field).focusNode!.hasFocus, isTrue);
+ }
+ await tester.enterText(field, '*no-such-product');
+ await tester.pumpAndSettle();
+ expect(controller.rows, isEmpty);
+ expect(controller.selected, isNull);
+ for (final button in [
+ LogicalKeyboardKey.arrowUp,
+ LogicalKeyboardKey.arrowDown,
+ LogicalKeyboardKey.pageUp,
+ LogicalKeyboardKey.pageDown,
+ LogicalKeyboardKey.enter,
+ ]) {
+ await key(tester, button);
+ }
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(controller.selected, isNull);
+ expect(field, findsOneWidget);
+ expect(app.actions, isEmpty);
+ // A pending scroll cannot act on a later selection or a disposed view.
+ controller.setQuery('*blender');
+ controller.scrollPreview(1);
+ controller.setQuery('');
+ await tester.pump();
+ expect(controller.selected, isNull);
+ expect(
+ find.byKey(const ValueKey('swarm-search-type-hints')),
+ findsOneWidget,
+ );
+ controller.setQuery('*blender');
+ controller.scrollPreview(1);
+ await tester.pumpWidget(const SizedBox());
+ expect(tester.takeException(), isNull);
+ app.dispose();
+ },
+ );
+
testWidgets(
'machine Enter always opens its sessions, even before connection',
(tester) async {
@@ -323,12 +490,16 @@ void main() {
origin.cursor,
);
await tester.pump();
+ final inputPosition = tester.getTopLeft(field);
await key(tester, LogicalKeyboardKey.enter);
expect(search(tester), same(origin));
expect(origin.canGoBack, isTrue);
expect(origin.scopedMachineId, 'm');
+ expect(tester.getTopLeft(field), inputPosition);
+ expect(find.text(origin.title), findsNothing);
expect(find.byType(TextField), findsOneWidget);
expect(app.actions, isEmpty);
+ await capture(tester, 'machine-sessions');
await key(tester, LogicalKeyboardKey.escape);
expect(origin.isMachineMode, isTrue);
}
@@ -406,6 +577,7 @@ void main() {
await chord(tester, LogicalKeyboardKey.keyP);
await tester.enterText(field, '@');
await tester.pump();
+ await key(tester, LogicalKeyboardKey.arrowUp);
await key(tester, LogicalKeyboardKey.enter);
expect(find.text('Link another machine'), findsWidgets);
await key(tester, LogicalKeyboardKey.escape);
diff --git a/desktop/test/search_workspace_test.dart b/desktop/test/search_workspace_test.dart
index 2e3e4738f..20c81dfd9 100644
--- a/desktop/test/search_workspace_test.dart
+++ b/desktop/test/search_workspace_test.dart
@@ -66,6 +66,10 @@ void main() {
find.byKey(const ValueKey('swarm-search-preview')),
findsNothing,
);
+ expect(
+ find.byKey(const ValueKey('swarm-search-type-hints')),
+ findsOneWidget,
+ );
await key(tester, LogicalKeyboardKey.escape);
expect(field, findsNothing);
await key(tester, LogicalKeyboardKey.keyP, cmd: true);
diff --git a/desktop/test/swarm_attention_picker_test.dart b/desktop/test/swarm_attention_picker_test.dart
index da75b0eaf..749560589 100644
--- a/desktop/test/swarm_attention_picker_test.dart
+++ b/desktop/test/swarm_attention_picker_test.dart
@@ -142,7 +142,7 @@ void main() {
final zoom = app.zoomedPaneId;
final panes = [...app.panes];
final machine = app.machineStates['m']!;
- for (var i = 0; i < 25; i++) {
+ for (var i = 0; i < 60; i++) {
app.rememberOpenedHarness('m', 'a$i');
machine.blockedAgents['a$i'] = waitingQuestion(
'a$i',
@@ -158,9 +158,9 @@ void main() {
.evaluate()
.where((e) => (e.widget.key?.toString() ?? '').contains('agent:'))
.length,
- lessThan(25),
+ lessThan(60),
);
- for (var i = 0; i < 13; i++) {
+ for (var i = 0; i < 45; i++) {
await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
expect(selectedHarness, findsOneWidget);
@@ -173,14 +173,14 @@ void main() {
}
await tester.pump();
final selection = resourceSearch(tester).selected!.id;
- expect(selection, agentDestinationId('m', 'a13'));
+ expect(selection, agentDestinationId('m', 'a45'));
final list = tester.getRect(
find.byKey(const ValueKey('swarm-search-result-list')),
);
final row = tester.getRect(selectedHarness);
expect(row.top, greaterThanOrEqualTo(list.top));
expect(row.bottom, lessThanOrEqualTo(list.bottom));
- machine.blockedAgents['a30'] = waitingQuestion('a30', ageOrder: -1);
+ machine.blockedAgents['a65'] = waitingQuestion('a65', ageOrder: -1);
app.dismissError();
await tester.pump();
await tester.pump();
@@ -189,15 +189,15 @@ void main() {
await tester.pump();
expect(
resourceSearch(tester).selected!.id,
- agentDestinationId('m', 'a14'),
+ agentDestinationId('m', 'a46'),
);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
await tester.pump();
expect(resourceSearch(tester).selected!.id, selection);
- machine.blockedAgents.remove('a13');
+ machine.blockedAgents.remove('a45');
app.dismissError();
await tester.pump();
- expect(find.text('Question 13?'), findsNothing);
+ expect(find.text('Question 45?'), findsNothing);
expect(selectedHarness, findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
diff --git a/desktop/test/swarm_entry_picker_test.dart b/desktop/test/swarm_entry_picker_test.dart
index 2c8ee2c47..885c4fd2f 100644
--- a/desktop/test/swarm_entry_picker_test.dart
+++ b/desktop/test/swarm_entry_picker_test.dart
@@ -36,7 +36,7 @@ void main() {
expect(find.widgetWithText(ListTile, 'Agent 0'), findsNothing);
expect(
tester.widget<TextField>(_input).decoration!.hintText,
- 'Search commands…',
+ 'Search commands',
);
expect(_results, findsOneWidget);
await tester.enterText(_input, '> rename');
@@ -158,6 +158,8 @@ void main() {
await tester.tap(find.byKey(const ValueKey('harness-start-new-pane')));
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ expect(find.byType(AlertDialog), findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pump(const Duration(milliseconds: 200));
expect(find.byType(AlertDialog), findsOneWidget);
expect(
@@ -251,7 +253,7 @@ void main() {
expect(tester.widget<TextField>(_input).controller!.text, '>');
expect(
tester.widget<TextField>(_input).decoration!.hintText,
- 'Search commands…',
+ 'Search commands',
);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/swarm_history_test.dart b/desktop/test/swarm_history_test.dart
index 87d134e30..a4bd0b342 100644
--- a/desktop/test/swarm_history_test.dart
+++ b/desktop/test/swarm_history_test.dart
@@ -55,34 +55,31 @@ void main() {
);
for (final count in [1, 2]) {
- test(
- 'History keeps the engine identity of $count-agent agents',
- () async {
- final app = createApp();
- addTearDown(app.dispose);
- app.machineStates['m']!.agents[0] = const Agent(
- id: 'a0',
- name: 'Architecture',
- engine: 'claude',
- terminalAvailable: true,
- );
- for (var i = 0; i < count; i++) {
- app.adoptSessionForTest(terminal('a$i', []));
- }
- final history = SwarmNavigationHistory()..record(app);
- final open = history
- .menuDestinations(app)
- .singleWhere((row) => row.isSwarm);
- expect(open.members, hasLength(count));
- expect(open.engine, count == 1 ? 'claude' : isNull);
- await app.closeSwarm(app.activeSwarmId);
- app.machineStates['m']!.agents = [];
- final closed = closedWorkDestinations(app).single;
- expect(closed.isSwarm, isTrue);
- expect(closed.members, hasLength(count));
- expect(closed.engine, count == 1 ? 'claude' : isNull);
- },
- );
+ test('History keeps the engine identity of $count-agent agents', () async {
+ final app = createApp();
+ addTearDown(app.dispose);
+ app.machineStates['m']!.agents[0] = const Agent(
+ id: 'a0',
+ name: 'Architecture',
+ engine: 'claude',
+ terminalAvailable: true,
+ );
+ for (var i = 0; i < count; i++) {
+ app.adoptSessionForTest(terminal('a$i', []));
+ }
+ final history = SwarmNavigationHistory()..record(app);
+ final open = history
+ .menuDestinations(app)
+ .singleWhere((row) => row.isSwarm);
+ expect(open.members, hasLength(count));
+ expect(open.engine, count == 1 ? 'claude' : isNull);
+ await app.closeSwarm(app.activeSwarmId);
+ app.machineStates['m']!.agents = [];
+ final closed = closedWorkDestinations(app).single;
+ expect(closed.isSwarm, isTrue);
+ expect(closed.members, hasLength(count));
+ expect(closed.engine, count == 1 ? 'claude' : isNull);
+ });
}
test('History does not format unopened agents during focus changes', () {
@@ -509,7 +506,7 @@ void main() {
final historyView = native('showHistory');
await tester.pump();
final historyField = find.byWidgetPredicate(
- (w) => w is TextField && w.decoration?.hintText == 'Search history…',
+ (w) => w is TextField && w.decoration?.hintText == 'Search history',
);
expect(historyField, findsOneWidget);
await tester.enterText(historyField, 'Agent 0');
diff --git a/desktop/test/swarm_search_identity_test.dart b/desktop/test/swarm_search_identity_test.dart
index a1f3ac15d..100b74b57 100644
--- a/desktop/test/swarm_search_identity_test.dart
+++ b/desktop/test/swarm_search_identity_test.dart
@@ -394,15 +394,15 @@ void main() {
);
await tester.enterText(input, 'extensibility');
await tester.pump();
- // One harness, then the row that makes what was typed instead.
+ // Only the matching harness; creation belongs to Cmd-N.
expect(
tester
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
.search
.rows,
- hasLength(2),
+ hasLength(1),
);
- expect(find.byKey(const ValueKey(kSwarmCreateRowId)), findsOneWidget);
+ expect(find.byKey(const ValueKey(kSwarmCreateRowId)), findsNothing);
// Minimal rows keep the full metadata accessible and searchable.
for (final value in [
'Claude',
@@ -427,7 +427,7 @@ void main() {
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
.search
.rows,
- hasLength(2),
+ hasLength(1),
);
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
await tester.pump();
diff --git a/desktop/test/swarm_search_preview_test.dart b/desktop/test/swarm_search_preview_test.dart
index f0b39758d..74c59b158 100644
--- a/desktop/test/swarm_search_preview_test.dart
+++ b/desktop/test/swarm_search_preview_test.dart
@@ -7,6 +7,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
import 'package:harness/state/app_state.dart';
+import 'package:harness/state/swarm_search.dart';
+import 'package:harness/terminal/terminal_text.dart';
import 'package:harness/terminal/terminal_binary.dart';
import 'package:harness/widgets/swarm_switcher.dart';
@@ -93,6 +95,107 @@ void main() {
.load();
});
+ testWidgets(
+ 'standalone keys and replacement searches own their preview scroll',
+ (tester) async {
+ final app = createApp();
+ await seedPreviews(app);
+ await app.handleEventForTest('m', {
+ 'type': 'turn_started',
+ 'payload': {'agentId': 'a0', 'sessionId': 'session-a0'},
+ });
+ await app.handleEventForTest('m', {
+ 'type': 'text_delta',
+ 'payload': {
+ 'agentId': 'a0',
+ 'sessionId': 'session-a0',
+ 'content': List.generate(80, (i) => 'Preview line $i').join('\n'),
+ },
+ });
+ await app.handleEventForTest('m', {
+ 'type': 'turn_ended',
+ 'payload': {'agentId': 'a0', 'sessionId': 'session-a0'},
+ });
+ final first = SwarmSearchController(app, const [], adding: true)
+ ..setQuery('Checkout retries');
+ final second = SwarmSearchController(app, const [], adding: true)
+ ..setQuery('Checkout retries');
+ final editor = TextEditingController(text: first.query);
+ final focus = FocusNode();
+ addTearDown(() {
+ focus.dispose();
+ editor.dispose();
+ });
+ Future<void> show(SwarmSearchController search) => tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SwarmSearchKeys(
+ search: search,
+ editing: editor,
+ onChoose: (_) {},
+ onClose: () {},
+ child: Column(
+ children: [
+ TextField(
+ controller: editor,
+ focusNode: focus,
+ autofocus: true,
+ ),
+ Expanded(
+ child: SwarmSearchResults(
+ search: search,
+ terminal: true,
+ bios: true,
+ onChoose: (_) {},
+ onRefocus: focus.requestFocus,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ ScrollPosition preview() => tester
+ .state<ScrollableState>(
+ find
+ .descendant(
+ of: find.byKey(const ValueKey('swarm-search-preview')),
+ matching: find.byType(Scrollable),
+ )
+ .first,
+ )
+ .position;
+ await show(first);
+ await tester.pumpAndSettle();
+ final cell = terminalCellSizeOf(tester.element(find.byType(TextField)));
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(preview().pixels, closeTo(cell.height, .01));
+ await key(tester, LogicalKeyboardKey.arrowUp, shift: true);
+ expect(preview().pixels, 0);
+ await key(tester, LogicalKeyboardKey.pageDown);
+ expect(first.resultPage.value, 1);
+ expect(preview().pixels, 0);
+ await key(tester, LogicalKeyboardKey.pageUp);
+ expect(first.resultPage.value, 0);
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(preview().pixels, greaterThan(0));
+ await show(second);
+ await tester.pumpAndSettle();
+ expect(preview().pixels, 0);
+ first.scrollPreview(1);
+ expect(preview().pixels, 0);
+ second.scrollPreview(1);
+ expect(preview().pixels, closeTo(cell.height, .01));
+ expect(editor.text, 'Checkout retries');
+ expect(focus.hasFocus, isTrue);
+ await tester.pumpWidget(const SizedBox());
+ first.dispose();
+ second.dispose();
+ app.dispose();
+ },
+ );
+
testWidgets('offline previews retain text without claiming to work or wait', (
tester,
) async {
@@ -118,10 +221,125 @@ void main() {
await tester.pumpWidget(const SizedBox());
app.dispose();
});
+ for (final mapping in ['fallback', 'default', 'remapped']) {
+ testWidgets('fzf paging moves the result list ($mapping)', (tester) async {
+ final app = createApp();
+ await seedPreviews(app);
+ app.machineStates['m']!.agents.addAll([
+ for (var i = 0; i < 60; i++)
+ Agent(
+ id: 'test-$i',
+ name: 'Checkout test $i',
+ terminalAvailable: true,
+ ),
+ ]);
+ await app.handleEventForTest('m', {
+ 'type': 'text_delta',
+ 'payload': {
+ 'agentId': 'a0',
+ 'sessionId': 'session-a0',
+ 'content': List.generate(
+ 80,
+ (i) => 'Saved checkout response line $i.',
+ ).join('\n'),
+ },
+ });
+ await app.handleEventForTest('m', {
+ 'type': 'turn_ended',
+ 'payload': {'agentId': 'a0', 'sessionId': 'session-a0'},
+ });
+ app.adoptSessionForTest(terminal('a69', []));
+ final map = MemoryKeymap();
+ final remapped = mapping == 'remapped';
+ if (remapped) {
+ map.apply('''{"bindings":[
+ {"keys":"pagedown","command":null,"when":"picker"},
+ {"keys":"pageup","command":null,"when":"picker"},
+ {"keys":"alt+j","command":"picker.page_down","when":"picker"},
+ {"keys":"alt+k","command":"picker.page_up","when":"picker"}
+ ]}''');
+ }
+ if (mapping == 'fallback') {
+ await mount(tester, app);
+ } else {
+ await configured.mount(tester, app, map);
+ }
+ await chord(tester, LogicalKeyboardKey.keyP);
+ final field = find.byKey(const ValueKey('swarm-search-input'));
+ await tester.enterText(field, 'Checkout');
+ await tester.pump();
+ final search = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search;
+ final editor = tester.widget<TextField>(field);
+ final editing = editor.controller!.value;
+ final first = search.cursor;
+ ScrollPosition preview() => tester
+ .widget<Scrollbar>(
+ find.descendant(
+ of: find.byKey(const ValueKey('swarm-search-preview')),
+ matching: find.byType(Scrollbar),
+ ),
+ )
+ .controller!
+ .position;
+ expect(preview().maxScrollExtent, greaterThan(0));
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(preview().pixels, greaterThan(0));
+ expect(search.cursor, first);
+ if (remapped) {
+ await key(tester, LogicalKeyboardKey.pageDown);
+ expect(search.cursor, first);
+ }
+ Future<void> page({bool up = false}) => key(
+ tester,
+ remapped
+ ? (up ? LogicalKeyboardKey.keyK : LogicalKeyboardKey.keyJ)
+ : (up ? LogicalKeyboardKey.pageUp : LogicalKeyboardKey.pageDown),
+ alt: remapped,
+ );
+ await page();
+ expect(search.cursor, greaterThan(first + 1));
+ expect(preview().pixels, 0);
+ expect(editor.controller!.value, editing);
+ expect(editor.focusNode!.hasFocus, isTrue);
+ await page(up: true);
+ expect(search.cursor, first);
+ expect(preview().pixels, 0);
+ // Existing custom preview-page commands still page their own pane.
+ search.page(1);
+ expect(
+ preview().pixels,
+ greaterThan(terminalCellSizeOf(tester.element(field)).height),
+ );
+ search.page(-1);
+ expect(preview().pixels, 0);
+ final selected = search.selected!.id;
+ await key(tester, LogicalKeyboardKey.slash, ctrl: true);
+ expect(search.hasPreview, isFalse);
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
+ expect(search.selected!.id, selected);
+ await page();
+ expect(search.cursor, greaterThan(first + 1));
+ for (var i = 0; i < 20; i++) {
+ await page();
+ }
+ expect(search.cursor, search.rows.length - 1);
+ for (var i = 0; i < 20; i++) {
+ await page(up: true);
+ }
+ expect(search.cursor, 0);
+ expect(editor.controller!.value, editing);
+ expect(tester.takeException(), isNull);
+ await tester.pumpWidget(const SizedBox());
+ app.dispose();
+ map.dispose();
+ });
+ }
for (final inline in [false, true]) {
for (final mapping in ['fallback', 'default', 'remapped']) {
testWidgets(
- 'preview paging retains search input and selection (inline=$inline, $mapping)',
+ 'preview line scrolling retains search input and selection (inline=$inline, $mapping)',
(tester) async {
final app = createApp();
await seedPreviews(app);
@@ -157,10 +375,10 @@ void main() {
final remapped = mapping == 'remapped';
if (remapped) {
map.apply('''{"bindings":[
- {"keys":"pageup","command":null,"when":"picker"},
- {"keys":"pagedown","command":null,"when":"picker"},
- {"keys":"alt+j","command":"picker.preview_page_down","when":"picker"},
- {"keys":"alt+k","command":"picker.preview_page_up","when":"picker"}
+ {"keys":"shift+up","command":null,"when":"picker"},
+ {"keys":"shift+down","command":null,"when":"picker"},
+ {"keys":"alt+j","command":"picker.preview_down","when":"picker"},
+ {"keys":"alt+k","command":"picker.preview_up","when":"picker"}
]}''');
}
if (mapping == 'fallback') {
@@ -206,7 +424,7 @@ void main() {
search.addListener(() => notifications++);
expect(previewPosition().maxScrollExtent, greaterThan(0));
if (remapped) {
- await key(tester, LogicalKeyboardKey.pageDown);
+ await key(tester, LogicalKeyboardKey.arrowDown, shift: true);
expect(previewPosition().pixels, 0);
}
Future<void> page({bool up = false, bool pump = true}) async {
@@ -215,20 +433,22 @@ void main() {
? LogicalKeyboardKey.keyK
: LogicalKeyboardKey.keyJ
: up
- ? LogicalKeyboardKey.pageUp
- : LogicalKeyboardKey.pageDown;
- if (remapped) {
- await tester.sendKeyDownEvent(LogicalKeyboardKey.altLeft);
- }
+ ? LogicalKeyboardKey.arrowUp
+ : LogicalKeyboardKey.arrowDown;
+ final modifier = remapped
+ ? LogicalKeyboardKey.altLeft
+ : LogicalKeyboardKey.shiftLeft;
+ await tester.sendKeyDownEvent(modifier);
await tester.sendKeyEvent(trigger);
- if (remapped) {
- await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
- }
+ await tester.sendKeyUpEvent(modifier);
if (pump) await tester.pump();
}
await page(pump: false);
- expect(previewPosition().pixels, greaterThan(0));
+ expect(
+ previewPosition().pixels,
+ closeTo(terminalCellSizeOf(tester.element(field)).height, .01),
+ );
expect(search.selected!.id, selected);
expect(editor.controller.value, value);
expect(editor.focusNode.hasPrimaryFocus, isTrue);
diff --git a/desktop/test/swarm_search_render_test.dart b/desktop/test/swarm_search_render_test.dart
index cea0a46f1..67337c556 100644
--- a/desktop/test/swarm_search_render_test.dart
+++ b/desktop/test/swarm_search_render_test.dart
@@ -255,7 +255,7 @@ void main() {
if (element.widget is InkWell && visibleRows.contains(element)) rows++;
};
try {
- await tester.sendKeyEvent(LogicalKeyboardKey.arrowUp);
+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);
await tester.pump();
} finally {
debugOnRebuildDirtyWidget = null;
diff --git a/desktop/test/swarm_switcher_test.dart b/desktop/test/swarm_switcher_test.dart
index 523e26f0d..46366cd2a 100644
--- a/desktop/test/swarm_switcher_test.dart
+++ b/desktop/test/swarm_switcher_test.dart
@@ -139,7 +139,8 @@ void main() {
.widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
.search;
expect(search.isCommandMode, isFalse);
- expect(search.selected!.isCreate, isTrue);
+ expect(search.selected, isNull);
+ expect(search.rows.any((row) => row.isCreate), isFalse);
expect(frames, isEmpty);
await tester.pumpWidget(const SizedBox());
app.dispose();
diff --git a/desktop/test/toolbar_onboarding_test.dart b/desktop/test/toolbar_onboarding_test.dart
index ad5a1157e..2a9e90262 100644
--- a/desktop/test/toolbar_onboarding_test.dart
+++ b/desktop/test/toolbar_onboarding_test.dart
@@ -368,7 +368,7 @@ void main() {
findsNothing,
);
await openWorkspaceTool(tester, 'harnesses');
- expect(find.text('New Harness'), findsOneWidget);
+ expect(find.text('New Harness'), findsNothing);
expect(journey.completed(OnboardingStep.harnesses), isFalse);
expect(
find.byKey(const ValueKey('onboarding-harnesses-dot')),
@@ -377,7 +377,7 @@ void main() {
await key(tester, LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
await openWorkspaceTool(tester, 'harnesses');
- await tap(tester, find.text('New Harness'));
+ await key(tester, LogicalKeyboardKey.keyN, cmd: true);
expect(resourceScope(''), findsNothing);
expect(find.byType(NewHarnessForm), findsOneWidget);
expect(tester.takeException(), isNull);
@@ -458,7 +458,7 @@ void main() {
expect(app.connections, ['source']);
await key(tester, LogicalKeyboardKey.enter);
expect(resourceScope('@'), findsNothing);
- expect(find.text('Harnesses · M2'), findsOneWidget);
+ expect(find.text('Search harnesses in M2'), findsOneWidget);
expect(find.text('Existing work'), findsWidgets);
expect(find.text('Work on this computer'), findsNothing);
expect(journey.completed(OnboardingStep.machines), isFalse);
diff --git a/desktop/test/welcome_entry_layout_test.dart b/desktop/test/welcome_entry_layout_test.dart
index c5560f062..76de2fcc3 100644
--- a/desktop/test/welcome_entry_layout_test.dart
+++ b/desktop/test/welcome_entry_layout_test.dart
@@ -12,6 +12,7 @@ import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'support/real_fonts.dart';
import 'swarm_state_test.dart' show createApp;
import 'swarm_screen_test.dart' show terminal;
+import 'swarm_interactions_test.dart' show chord;
import 'package:harness/core/models.dart';
@@ -172,6 +173,8 @@ void main() {
await tester.tap(create);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ expect(find.byType(AlertDialog), findsNothing);
+ await chord(tester, LogicalKeyboardKey.keyN);
await tester.pumpAndSettle();
expect(find.byType(AlertDialog), findsOneWidget);
expect(results, findsNothing);
diff --git a/docs/keyboard.md b/docs/keyboard.md
index ef9d6df3b..3cbbb1c16 100644
--- a/docs/keyboard.md
+++ b/docs/keyboard.md
@@ -35,13 +35,15 @@ New Tab starts with three clickable shortcuts: ⌘N to start your first harness,
Checkmarks record actual use and persist per account on this device. After all
three are complete, the next New Tab shows the everyday ⌘N, ⌘P, and ⌘S shortcuts.
-In the harness picker, New agent is selected when the query is empty. Typing selects the best matching existing harness; the creation row stays pinned above it and carries the query into the first task. Projects and machines filter individual harnesses rather than opening whole groups. The destination is shown in the picker and carried into creation. A harness can have views in several tabs, with one view per tab; closing a pane only removes that view.
+A harness can have views in several tabs, with one view per tab; closing a pane only removes that view.
Hover near a pane’s right or bottom edge to reveal its **+** button, or use **File → Split Right… / Split Down…**. The picker shows **New Pane to the Right** or **New Pane Below**. The split is applied after choosing or creating a harness; Escape leaves the layout unchanged.
When a split needs more room, the workspace expands and scrolls to keep both panes readable. Keyboard focus brings the selected pane into view. Splitting remains available up to the tab’s 64-pane limit.
-In a picker: ↓ ⌃N ⌃J and ↑ ⌃P ⌃K move, and ⏎ opens. In the unified picker, Return opens the highlighted harness; a paused harness resumes and opens. Machines and projects open their session lists inside the picker. Model management opens the existing Model Manager terminal; API connections open the existing edit dialog. Cmd-Shift-P (Ctrl-Shift-P on Linux) searches named actions for the selected item. Commands name their target, and cancelling or completing an action returns to the same search. Filters and sorting are explicit commands. The preview has no action strip or keyboard footer. Existing remappable Ctrl-S lifecycle shortcuts remain available. Escape returns from a scoped list or closes the picker. ⌘⏎ accepts into the same requested destination. ⌃/ toggles the preview and Page Up/Down scroll it without leaving the search input.
+In a picker: ↓ ⌃N ⌃J and ↑ ⌃P ⌃K move, and ⏎ opens. In the unified picker, Return opens the highlighted harness; a paused harness resumes and opens. Machines and projects open their session lists inside the picker. Model management opens the existing Model Manager terminal; API connections open the existing edit dialog. Cmd-Shift-P (Ctrl-Shift-P on Linux) searches named actions for the selected item. Commands name their target, and cancelling or completing an action returns to the same search. Filters and sorting are explicit commands. The preview has no action strip or keyboard footer. Existing remappable Ctrl-S lifecycle shortcuts remain available. Escape returns from a scoped list or closes the picker. ⌘⏎ accepts into the same requested destination. ⌃/ toggles the preview. Page Up/Down pages the result list; Shift-↑/↓ scrolls the preview by one line without leaving the search input. Cmd-P starts without a selected row and shows the resource type hints in the preview area. Typing selects the first match; arrows or Tab can select a row without typing. Enter does nothing until a row is selected.
+Cmd-P has no New Harness row; use Cmd-N to create a harness, including when no sessions match.
+Session results use one line each, with the name and activity age. The preview shows the machine, project, and branch directly beneath the session name; these fields remain searchable.
The terminal keeps ⌘C, ⌘V, ⌘A, Esc, ⌥⏎ and ⌃C for itself. `pane.pin`, `pane.focus_1…9`,
`pane.resize`, `pane.reset_sizes`, `machine.link` and a few others ship unbound and are in the palette.