The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Select machine and agent choices by typing their names
deed4697ad49a45
diff --git a/desktop/lib/shared/widgets/app_select_field.dart b/desktop/lib/shared/widgets/app_select_field.dartindex 99bfe8905..8a51d216d 100644--- a/desktop/lib/shared/widgets/app_select_field.dart+++ b/desktop/lib/shared/widgets/app_select_field.dart@@ -96,25 +96,170 @@ class AppSelectField<T> extends StatefulWidget {class _AppSelectFieldState<T> extends State<AppSelectField<T>> {final _controller = MenuController();final _fieldFocus = FocusNode(debugLabel: 'Select field');- final _selectedFocus = FocusNode(debugLabel: 'Selected option');+ final _optionFocus = <T, FocusNode>{};+ ({T value})? _pendingFocus;+ String _prefix = '';+ Duration? _lastTyped;+ bool _focusScheduled = false;bool _hovered = false;bool _focused = false;+ FocusNode _focusFor(T value) => _optionFocus.putIfAbsent(+ value,+ () => FocusNode(debugLabel: 'Select option'),+ );++ SelectOption<T>? get _currentOption =>+ widget.options+ .where((option) => option.value == widget.value)+ .firstOrNull ??+ widget.options.firstOrNull;++ @override+ void didUpdateWidget(AppSelectField<T> oldWidget) {+ super.didUpdateWidget(oldWidget);+ final values = widget.options.map((option) => option.value).toSet();+ var lostFocus = false;+ for (final value in _optionFocus.keys.toList()) {+ if (values.contains(value)) continue;+ final node = _optionFocus.remove(value)!;+ lostFocus |= node.hasFocus || _pendingFocus?.value == value;+ node.dispose();+ }+ if (!_controller.isOpen || !lostFocus) return;+ _prefix = '';+ _lastTyped = null;+ final next = _currentOption;+ if (next == null) {+ _controller.close();+ } else {+ _focusOption(next);+ }+ }+@overridevoid dispose() {_fieldFocus.dispose();- _selectedFocus.dispose();+ for (final node in _optionFocus.values) {+ node.dispose();+ }super.dispose();}void _open() {if (widget.options.isEmpty || _controller.isOpen) return;+ _prefix = '';+ _lastTyped = null;_controller.open();+ // Unopened controls need no per-option focus nodes. Mount them with the+ // menu, including any match typed before its first frame.+ setState(() {});+ _focusOption(_currentOption!, afterLayout: true);+ }++ void _focusOption(SelectOption<T> option, {bool afterLayout = false}) {+ _pendingFocus = (value: option.value);+ final node = _focusFor(option.value);+ if (!afterLayout &&+ !_focusScheduled &&+ node.parent != null &&+ node.context?.mounted == true) {+ node.requestFocus();+ Scrollable.ensureVisible(node.context!);+ return;+ }+ // Opening and typing can happen before the menu's first frame. Keep the+ // newest match, rather than restoring the old selection after it mounts.+ if (_focusScheduled) return;+ _focusScheduled = true;WidgetsBinding.instance.addPostFrameCallback((_) {- if (mounted && _controller.isOpen) _selectedFocus.requestFocus();+ _focusScheduled = false;+ if (!mounted || !_controller.isOpen) return;+ final pending = _pendingFocus;+ if (pending == null) return;+ final node = _optionFocus[pending.value];+ if (node?.context == null) return;+ node!.requestFocus();+ Scrollable.ensureVisible(node.context!);});}+ int get _highlightedIndex {+ final focused = widget.options.indexWhere(+ (option) => _optionFocus[option.value]?.hasPrimaryFocus == true,+ );+ if (focused >= 0) return focused;+ final pending = _pendingFocus;+ return pending == null+ ? -1+ : widget.options.indexWhere((option) => option.value == pending.value);+ }++ void _choose(SelectOption<T> option) {+ _controller.close();+ _fieldFocus.requestFocus();+ if (option.value != widget.value) widget.onChanged(option.value);+ }++ KeyEventResult _typeAhead(FocusNode _, KeyEvent event) {+ if (!_controller.isOpen || event is KeyUpEvent) {+ return KeyEventResult.ignored;+ }+ final keyboard = HardwareKeyboard.instance;+ if (keyboard.isMetaPressed ||+ keyboard.isControlPressed ||+ keyboard.isAltPressed) {+ return KeyEventResult.ignored;+ }+ if (!keyboard.isShiftPressed) {+ if (event.logicalKey == LogicalKeyboardKey.escape) {+ _controller.close();+ _fieldFocus.requestFocus();+ return KeyEventResult.handled;+ }+ if (event.logicalKey == LogicalKeyboardKey.enter ||+ event.logicalKey == LogicalKeyboardKey.numpadEnter) {+ final index = _highlightedIndex;+ if (index >= 0) _choose(widget.options[index]);+ return KeyEventResult.handled;+ }+ }+ final text = event.character?.toLowerCase();+ if (text == null ||+ text.isEmpty ||+ text.runes.any((r) => r < 32 || r == 127)) {+ _prefix = '';+ return KeyEventResult.ignored;+ }+ if (_lastTyped == null ||+ event.timeStamp < _lastTyped! ||+ event.timeStamp - _lastTyped! > const Duration(seconds: 1)) {+ _prefix = '';+ }+ if (text == ' ' && _prefix.isEmpty) return KeyEventResult.ignored;+ _lastTyped = event.timeStamp;+ final continuing = _prefix.isNotEmpty && _prefix != text;+ _prefix = continuing ? _prefix + text : text;+ final current = _highlightedIndex;+ final start = current < 0 ? 0 : current + (continuing ? 0 : 1);+ for (var offset = 0; offset < widget.options.length; offset++) {+ final option = widget.options[(start + offset) % widget.options.length];+ if (option.label.trimLeft().toLowerCase().startsWith(_prefix)) {+ _focusOption(option);+ break;+ }+ }+ return KeyEventResult.handled;+ }++ Widget _typingRegion(Widget child, {Key? key}) => Focus(+ key: key,+ canRequestFocus: false,+ skipTraversal: true,+ onKeyEvent: _typeAhead,+ child: child,+ );+/// How tall this panel may draw.////// ⚠️ NOT [AppControl.menuMaxHeight]. That token's 240 is for a menu that@@ -178,6 +323,11 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {return MenuAnchor(controller: _controller,childFocusNode: _fieldFocus,+ onClose: () {+ _prefix = '';+ _lastTyped = null;+ _pendingFocus = null;+ },// Below the control, by the app's one menu gap — and the panel takes its// fill, rim and radius from [AppMenu], the app's single panel recipe.alignmentOffset: const Offset(0, AppControl.menuGap),@@ -192,129 +342,124 @@ class _AppSelectFieldState<T> extends State<AppSelectField<T>> {style: AppMenu.style(maxHeight: _panelHeight),menuChildren: [for (final option in widget.options)- SizedBox(- width: math.max(panelWidth ?? 0, _minPanelWidth),- child: AppMenuItem(- // No glyph of its own: the leading slot belongs to the tick,- // and stays empty (not a blank checkbox) on rows without it.- // `selected` also carries the wash and the heavier label, so the- // choice is marked three ways rather than by a tick alone.- // A picker's list, not a context menu's: this menu IS the- // control, it is read down rather than glanced at, and it is the- // only place these choices are ever shown.- metrics: AppMenuRowMetrics.roomy,- focusNode:- option == current ||- (current == null && option == widget.options.first)- ? _selectedFocus- : null,- selected: option.value == widget.value,- label: option.label,- note: option.note,- detail: option.detail,- leading: option.leading?.call(),- trailing: option.trailing?.call(),- onPressed: () {- _controller.close();- _fieldFocus.requestFocus();- if (option.value != widget.value) {- widget.onChanged(option.value);- }- },+ _typingRegion(+ SizedBox(+ width: math.max(panelWidth ?? 0, _minPanelWidth),+ child: AppMenuItem(+ // No glyph of its own: the leading slot belongs to the tick,+ // and stays empty (not a blank checkbox) on rows without it.+ // `selected` also carries the wash and the heavier label, so the+ // choice is marked three ways rather than by a tick alone.+ // A picker's list, not a context menu's: this menu IS the+ // control, it is read down rather than glanced at, and it is the+ // only place these choices are ever shown.+ metrics: AppMenuRowMetrics.roomy,+ focusNode: _controller.isOpen ? _focusFor(option.value) : null,+ selected: option.value == widget.value,+ label: option.label,+ note: option.note,+ detail: option.detail,+ leading: option.leading?.call(),+ trailing: option.trailing?.call(),+ onPressed: () => _choose(option),+ ),),+ key: ValueKey(option.value),),],- builder: (context, controller, _) => MouseRegion(- cursor: SystemMouseCursors.click,- onEnter: (_) => setState(() => _hovered = true),- onExit: (_) => setState(() => _hovered = false),- child: CallbackShortcuts(- bindings: {- const SingleActivator(LogicalKeyboardKey.arrowDown): _open,- const SingleActivator(LogicalKeyboardKey.arrowUp): _open,- },- child: InkWell(- focusNode: _fieldFocus,- onFocusChange: (value) => setState(() => _focused = value),- onTap: () => controller.isOpen ? controller.close() : _open(),- splashFactory: NoSplash.splashFactory,- hoverColor: Colors.transparent,- focusColor: Colors.transparent,- borderRadius: BorderRadius.circular(AppControl.radius),- child: AnimatedContainer(- duration: AppMotion.hover,- curve: AppMotion.curve,- width: widget.width,- height: widget.height,- padding: const EdgeInsets.only(left: 10, right: 8),- decoration: BoxDecoration(- color: _hovered || _focused || controller.isOpen- ? AppSurface.recessHover- : AppSurface.recess,- borderRadius: BorderRadius.circular(AppControl.radius),- border: Border.all(- color: _focused- ? AppPalette.accentOnSurface- : Colors.transparent,+ builder: (context, controller, _) => _typingRegion(+ MouseRegion(+ cursor: SystemMouseCursors.click,+ onEnter: (_) => setState(() => _hovered = true),+ onExit: (_) => setState(() => _hovered = false),+ child: CallbackShortcuts(+ bindings: {+ const SingleActivator(LogicalKeyboardKey.arrowDown): _open,+ const SingleActivator(LogicalKeyboardKey.arrowUp): _open,+ },+ child: InkWell(+ focusNode: _fieldFocus,+ onFocusChange: (value) => setState(() => _focused = value),+ onTap: () => controller.isOpen ? controller.close() : _open(),+ splashFactory: NoSplash.splashFactory,+ hoverColor: Colors.transparent,+ focusColor: Colors.transparent,+ borderRadius: BorderRadius.circular(AppControl.radius),+ child: AnimatedContainer(+ duration: AppMotion.hover,+ curve: AppMotion.curve,+ width: widget.width,+ height: widget.height,+ padding: const EdgeInsets.only(left: 10, right: 8),+ decoration: BoxDecoration(+ color: _hovered || _focused || controller.isOpen+ ? AppSurface.recessHover+ : AppSurface.recess,+ borderRadius: BorderRadius.circular(AppControl.radius),+ border: Border.all(+ color: _focused+ ? AppPalette.accentOnSurface+ : Colors.transparent,+ ),),- ),- child:- widget.trigger ??- Row(- children: [- Expanded(- child: Row(- children: [- if (current?.leading != null) ...[- current!.leading!(),- const SizedBox(width: 8),- ],- Flexible(- child: Text(- current?.label ?? '—',- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: TextStyle(- fontFamily: AppFont.sans,- fontFamilyFallback: AppFont.sansFallback,- fontSize: AppControl.fontSize,- fontWeight: AppControl.fontWeight,- letterSpacing: AppFont.trackingFor(- AppControl.fontSize,- ),- color: AppPalette.textPrimary,- ),- ),- ),- if (current?.note != null) ...[- const SizedBox(width: 8),+ child:+ widget.trigger ??+ Row(+ children: [+ Expanded(+ child: Row(+ children: [+ if (current?.leading != null) ...[+ current!.leading!(),+ const SizedBox(width: 8),+ ],Flexible(child: Text(- current!.note!,+ current?.label ?? '—',maxLines: 1,overflow: TextOverflow.ellipsis,style: TextStyle(fontFamily: AppFont.sans,fontFamilyFallback: AppFont.sansFallback,- fontSize: 11.5,- color: AppPalette.textFaint,+ fontSize: AppControl.fontSize,+ fontWeight: AppControl.fontWeight,+ letterSpacing: AppFont.trackingFor(+ AppControl.fontSize,+ ),+ color: AppPalette.textPrimary,),),),+ if (current?.note != null) ...[+ const SizedBox(width: 8),+ Flexible(+ child: Text(+ current!.note!,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: TextStyle(+ fontFamily: AppFont.sans,+ fontFamilyFallback: AppFont.sansFallback,+ fontSize: 11.5,+ color: AppPalette.textFaint,+ ),+ ),+ ),+ ],],- ],+ ),),- ),- const SizedBox(width: 6),- Icon(- Icons.expand_more_rounded,- size: AppControl.iconSize,- color: _hovered || controller.isOpen- ? AppPalette.textPrimary- : AppPalette.textSecondary,- ),- ],- ),+ const SizedBox(width: 6),+ Icon(+ Icons.expand_more_rounded,+ size: AppControl.iconSize,+ color: _hovered || controller.isOpen+ ? AppPalette.textPrimary+ : AppPalette.textSecondary,+ ),+ ],+ ),+ ),),),),diff --git a/desktop/test/app_select_field_test.dart b/desktop/test/app_select_field_test.dartindex d5c02a193..10cd60d22 100644--- a/desktop/test/app_select_field_test.dart+++ b/desktop/test/app_select_field_test.dart@@ -49,6 +49,49 @@ Future<void> _open(WidgetTester tester) async {void main() {tearDown(() => grid.AppTheme.brightness.value = Brightness.light);+ testWidgets('typing a name focuses a choice without applying it', (+ tester,+ ) async {+ var picked = 'initial';+ await tester.pumpWidget(+ _host(+ AppSelectField<String>(+ value: 'local',+ options: const [+ SelectOption(value: 'local', label: 'This computer'),+ SelectOption(value: 'mac', label: 'MacBook Pro'),+ SelectOption(value: 'mini', label: 'Mac mini'),+ SelectOption(value: 'office', label: 'Office workstation'),+ SelectOption(value: 'workshop', label: 'Workshop machine'),+ ],+ onChanged: (value) => picked = value,+ width: 260,+ ),+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.pump();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ await tester.sendKeyEvent(LogicalKeyboardKey.keyW, character: 'w');+ await tester.sendKeyEvent(LogicalKeyboardKey.keyO, character: 'o');+ await tester.pump();+ final row = find.widgetWithText(AppMenuItem, 'Workshop machine');+ expect(+ Focus.of(+ tester.element(+ find.descendant(of: row, matching: find.text('Workshop machine')),+ ),+ ).hasPrimaryFocus,+ isTrue,+ );+ expect(picked, 'initial');+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(picked, 'workshop');+ expect(find.byType(AppMenuItem), findsNothing);+ });+testWidgets('Tab, Enter, arrows and Escape operate the picker',(tester) async {diff --git a/desktop/test/first_workspace_test.dart b/desktop/test/first_workspace_test.dartindex f64664b45..f3ca11a84 100644--- a/desktop/test/first_workspace_test.dart+++ b/desktop/test/first_workspace_test.dart@@ -98,7 +98,133 @@ class _FolderPicker extends FileSelectorPlatform {}}+class _KeyboardCreationApp extends _FirstUseApp {+ final folderRequests = <({String machine, String? path})>[];++ @override+ Future<Map<String, dynamic>> listRemoteFolder(+ String machineId,+ String? path,+ ) async {+ folderRequests.add((machine: machineId, path: path));+ return {'path': path ?? '/home/dev', 'entries': <Object>[]};+ }+}+void main() {+ testWidgets(+ 'machine, remote folder and agent can be chosen entirely by keyboard',+ (tester) async {+ final app = _KeyboardCreationApp();+ addTearDown(() async {+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ });+ await app.agentPreference.select('claude');+ const remote = Machine(+ machineId: 'workshop',+ name: 'Workshop machine',+ authMode: MachineAuthMode.remote,+ );+ app.machines = [...app.machines, remote];+ app.machineStates['workshop'] = MachineState(remote)+ ..nodeOnline = true+ ..agentLoadStatus = AgentLoadStatus.loaded;+ app.machineStates['workshop']!.engines.replace(const [+ EngineAvailability(engine: 'claude', installed: true),+ EngineAvailability(engine: 'hermes', installed: true),+ ]);+ await mount(tester, app);+ await chord(tester, LogicalKeyboardKey.keyN);+ await tester.pumpAndSettle();+ FocusNode fieldFocus(String key) => tester+ .widget<InkWell>(+ find+ .descendant(+ of: find.byKey(Key(key)),+ matching: find.byType(InkWell),+ )+ .first,+ )+ .focusNode!;+ Future<void> tabTo(FocusNode node, {bool back = false}) async {+ if (back) await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);+ for (var i = 0; i < 12 && !node.hasPrimaryFocus; i++) {+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.pump();+ }+ if (back) await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);+ expect(node.hasPrimaryFocus, isTrue);+ }++ await tabTo(fieldFocus('new-agent-machine-field'), back: true);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.sendKeyEvent(LogicalKeyboardKey.keyW, character: 'w');+ await tester.pumpAndSettle();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(+ tester+ .widget<AppSelectField<String>>(+ find.byKey(const Key('new-agent-machine-field')),+ )+ .value,+ 'workshop',+ );+ expect(app.launches, isEmpty);++ final folder = tester+ .widget<InkWell>(find.byKey(const Key('new-agent-folder')))+ .focusNode!;+ await tabTo(folder);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ tester.testTextInput.enterText('/work/selected-project');+ await tester.pump();+ // Return in a platform text field arrives as the input method's action.+ await tester.testTextInput.receiveAction(TextInputAction.done);+ await tester.pumpAndSettle();+ await chord(tester, LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(find.text('Choose a folder'), findsNothing);+ expect(app.folderRequests, [+ (machine: 'workshop', path: null),+ (machine: 'workshop', path: '/work/selected-project'),+ ]);++ await tabTo(fieldFocus('new-agent-engine-field'), back: true);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ for (final code in 'hermes'.codeUnits) {+ await tester.sendKeyEvent(+ LogicalKeyboardKey(code),+ character: String.fromCharCode(code),+ );+ }+ await tester.pumpAndSettle();+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(find.text('Hermes'), findsOneWidget);+ expect(app.launches, isEmpty);+ final submit = tester.widget<FilledButton>(+ find.byKey(const ValueKey('create-agent-submit')),+ );+ await tabTo(submit.focusNode!);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(app.launches, [+ (+ machine: 'workshop',+ engine: 'hermes',+ folder: '/work/selected-project',+ bypass: false,+ ),+ ]);+ expect(app.input, isEmpty);+ expect(tester.takeException(), isNull);+ },+ variant: const TargetPlatformVariant({TargetPlatform.macOS}),+ );+testWidgets('first use starts idle with separate Open and New actions', (tester,) async {diff --git a/desktop/test/select_field_typing_test.dart b/desktop/test/select_field_typing_test.dartnew file mode 100644index 000000000..9d1a7f322--- /dev/null+++ b/desktop/test/select_field_typing_test.dart@@ -0,0 +1,292 @@+// Flutter's key simulator uses these same entry points, with timestamps fixed+// at zero. The pause check supplies elapsed time through the real dispatch path.+// ignore_for_file: deprecated_member_use++import 'dart:ui' as ui;++import 'package:flutter/material.dart';+import 'package:flutter/services.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/shared/widgets/app_menu.dart';+import 'package:harness/shared/widgets/app_select_field.dart';++import 'support/real_fonts.dart';++const _machines = [+ SelectOption(value: 'local', label: 'This computer'),+ SelectOption(value: 'book', label: 'MacBook Pro'),+ SelectOption(value: 'mini', label: 'Mac mini'),+ SelectOption(value: 'office', label: 'Office workstation'),+ SelectOption(value: 'workshop', label: 'Workshop machine'),+];++Finder _row(String label) => find.widgetWithText(AppMenuItem, label);+FocusNode _focus(WidgetTester tester, String label) => Focus.of(+ tester.element(find.descendant(of: _row(label), matching: find.text(label))),+);++Future<void> _type(WidgetTester tester, String text) async {+ for (final code in text.codeUnits) {+ await tester.sendKeyEvent(+ LogicalKeyboardKey(code),+ character: String.fromCharCode(code),+ );+ }+}++Future<void> _mount(WidgetTester tester, {required Widget child}) async {+ await tester.pumpWidget(+ MaterialApp(+ theme: grid.buildAppTheme(brightness: Brightness.dark),+ home: Scaffold(+ body: Align(+ alignment: Alignment.topCenter,+ child: SizedBox(width: 280, child: child),+ ),+ ),+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.tab);+ await tester.pump();+}++void main() {+ setUpAll(loadRealFonts);++ for (final accept in [true, false]) {+ testWidgets(+ 'immediate ${accept ? 'Enter' : 'Escape'} belongs to the opening menu',+ (tester) async {+ var outerEscapes = 0;+ final picked = <String>[];+ await _mount(+ tester,+ child: CallbackShortcuts(+ bindings: {+ const SingleActivator(LogicalKeyboardKey.escape): () =>+ outerEscapes++,+ },+ child: AppSelectField<String>(+ value: 'local',+ options: _machines,+ onChanged: picked.add,+ ),+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await _type(tester, 'work');+ await tester.sendKeyEvent(+ accept ? LogicalKeyboardKey.enter : LogicalKeyboardKey.escape,+ );+ await tester.pumpAndSettle();+ expect(picked, accept ? ['workshop'] : isEmpty);+ expect(outerEscapes, 0);+ expect(find.byType(AppMenuItem), findsNothing);+ },+ );+ }++ testWidgets(+ 'typing before opening paint and after reopening keeps the match',+ (tester) async {+ final picked = <String>[];+ await _mount(+ tester,+ child: AppSelectField<String>(+ value: 'local',+ options: _machines,+ onChanged: picked.add,+ ),+ );+ for (var opening = 0; opening < 2; opening++) {+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ // No frame between opening and typing a different destination.+ await _type(tester, 'work');+ await tester.pumpAndSettle();+ expect(_focus(tester, 'Workshop machine').hasPrimaryFocus, isTrue);+ expect(picked, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);+ await tester.pumpAndSettle();+ expect(find.byType(AppMenuItem), findsNothing);+ }+ expect(tester.takeException(), isNull);+ },+ variant: const TargetPlatformVariant({+ TargetPlatform.macOS,+ TargetPlatform.linux,+ }),+ );++ testWidgets('repeated initials cycle; names with spaces do not activate', (+ tester,+ ) async {+ final picked = <String>[];+ await _mount(+ tester,+ child: AppSelectField<String>(+ value: 'local',+ options: _machines,+ onChanged: picked.add,+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ for (final label in ['MacBook Pro', 'Mac mini', 'MacBook Pro']) {+ await _type(tester, 'm');+ await tester.pump();+ expect(_focus(tester, label).hasPrimaryFocus, isTrue);+ }+ await _type(tester, 'ac mi');+ await tester.pump();+ expect(_focus(tester, 'Mac mini').hasPrimaryFocus, isTrue);+ expect(picked, isEmpty);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(picked, ['mini']);+ });++ testWidgets('typing pause and arrow navigation start a new name', (+ tester,+ ) async {+ await _mount(+ tester,+ child: AppSelectField<String>(+ value: 'local',+ options: _machines,+ onChanged: (_) {},+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ await _type(tester, 'mac');+ await tester.pump();+ const elapsed = Duration(seconds: 2);+ for (final down in [true, false]) {+ tester.binding.keyEventManager.handleKeyData(+ ui.KeyData(+ physical: PhysicalKeyboardKey.keyO.usbHidUsage,+ logical: LogicalKeyboardKey.keyO.keyId,+ type: down ? ui.KeyEventType.down : ui.KeyEventType.up,+ character: down ? 'o' : null,+ timeStamp: elapsed,+ synthesized: false,+ ),+ );+ await tester.binding.keyEventManager.handleRawKeyMessage(+ KeyEventSimulator.getKeyData(+ LogicalKeyboardKey.keyO,+ platform: 'macos',+ isDown: down,+ character: down ? 'o' : null,+ ),+ );+ }+ await tester.pump();+ expect(_focus(tester, 'Office workstation').hasPrimaryFocus, isTrue);+ await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown);+ await tester.pump();+ await _type(tester, 'm');+ await tester.pump();+ expect(_focus(tester, 'MacBook Pro').hasPrimaryFocus, isTrue);+ });++ testWidgets('modifier chords do not change the highlighted choice', (+ tester,+ ) async {+ await _mount(+ tester,+ child: AppSelectField<String>(+ value: 'local',+ options: _machines,+ onChanged: (_) {},+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ for (final modifier in [+ LogicalKeyboardKey.metaLeft,+ LogicalKeyboardKey.controlLeft,+ LogicalKeyboardKey.altLeft,+ ]) {+ await tester.sendKeyDownEvent(modifier);+ await _type(tester, 'w');+ await tester.sendKeyUpEvent(modifier);+ await tester.pump();+ expect(_focus(tester, 'This computer').hasPrimaryFocus, isTrue);+ }+ await _type(tester, 'w');+ await tester.pump();+ expect(_focus(tester, 'Workshop machine').hasPrimaryFocus, isTrue);+ });++ testWidgets('long menus reveal the named row and support nullable choices', (+ tester,+ ) async {+ final picked = <String?>[];+ await _mount(+ tester,+ child: AppSelectField<String?>(+ value: '0',+ options: [+ for (var i = 0; i < 40; i++)+ SelectOption(value: '$i', label: 'Machine $i'),+ const SelectOption(value: null, label: 'System default'),+ ],+ onChanged: picked.add,+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ await _type(tester, 'sys');+ await tester.pumpAndSettle();+ expect(_focus(tester, 'System default').hasPrimaryFocus, isTrue);+ expect(_row('System default').hitTestable(), findsOneWidget);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ expect(picked, [null]);+ });++ testWidgets(+ 'discovery preserves focused identity and recovers when it leaves',+ (tester) async {+ var options = _machines;+ late StateSetter refresh;+ await _mount(+ tester,+ child: StatefulBuilder(+ builder: (_, setState) {+ refresh = setState;+ return AppSelectField<String>(+ value: 'local',+ options: options,+ onChanged: (_) {},+ );+ },+ ),+ );+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pumpAndSettle();+ await _type(tester, 'w');+ await tester.pump();+ refresh(+ () => options = [+ const SelectOption(value: 'workshop', label: 'Workshop renamed'),+ ..._machines.take(4),+ ],+ );+ await tester.pumpAndSettle();+ expect(_focus(tester, 'Workshop renamed').hasPrimaryFocus, isTrue);+ refresh(() => options = _machines.take(4).toList());+ await tester.pumpAndSettle();+ expect(_focus(tester, 'This computer').hasPrimaryFocus, isTrue);+ await _type(tester, 'o');+ await tester.pump();+ expect(_focus(tester, 'Office workstation').hasPrimaryFocus, isTrue);+ refresh(() => options = []);+ await tester.pumpAndSettle();+ expect(find.byType(AppMenuItem), findsNothing);+ expect(tester.takeException(), isNull);+ },+ );+}diff --git a/docs/harness-agent-first-tabs.md b/docs/harness-agent-first-tabs.mdindex 6ae83a9b7..aa75701fa 100644--- a/docs/harness-agent-first-tabs.md+++ b/docs/harness-agent-first-tabs.md@@ -45,6 +45,10 @@ cancellation or failure returns focus to the folder control. If a required Codexaccount lookup is still pending, focus stays on the folder instead of a disabledsubmit action. Completing that lookup does not steal focus.+Machine and agent menus support typing a name to highlight a choice. Enter+selects it; Escape returns to the field without changing the value. These keys+also work immediately after opening the menu, before its first frame.+The Open popup keeps its full-width **Find a harness** field, single-choiceresults and 90% black backdrop. Only the highlighted row shows **Open Harness**,**Open N Harnesses**, or **Split right/down**, depending on context.