Merge commit '2e41717e83132e55d296853c0338bc2c7ed87b9d' into pipelines/run-20261111-1927-unify-chat-selectors-with-permission-men-e1a8

This commit is contained in:
2026-11-11 19:53:26 +00:00
16 changed files with 248 additions and 18 deletions
@@ -82,6 +82,7 @@ class FilesHeader extends StatelessWidget {
),
AppOverflowMenu<FilesSortKey>(
label: 'Sort',
icon: const Icon(Icons.sort),
onSelected: (_, key) =>
controller.setSort(controller.sort.reverseOr(key)),
actions: [
@@ -221,7 +221,7 @@ class ChatWindows {
if (event is KeyDownEvent) tiling.floatActive();
return KeyEventResult.handled;
}
if (event is KeyDownEvent) manager.toggleGroup(chatWindowKind);
if (event is KeyDownEvent) manager.toggleOrRaiseGroup(chatWindowKind);
return KeyEventResult.handled;
}
}
@@ -1,16 +1,13 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import '../../../ui/input/keyboard_owner.dart';
/// Whether [event] shows or hides the floating chats: Alt+Y (Option+Y),
/// Ctrl+Y, and Cmd+Y on Apple platforms, matching the terminal's Alt+T. It is
/// a global key handler like the terminal's toggle, so it works while a
/// composer or the terminal has the keyboard; a plain Y (or Shift+Y) always
/// types. Alt+Y is always the chord, as Alt+T is for the terminal. On Apple
/// platforms Ctrl+Y inside a terminal is left to the shell (yank), since Cmd+Y
/// is there; elsewhere Ctrl+Y is the chord, so it takes priority over the
/// shell's yank.
/// platforms Ctrl+Y is also the chord, so it takes priority over the shell's
/// yank.
///
/// A held chord's repeats match too (and are swallowed); only its first
/// press toggles.
@@ -31,7 +28,7 @@ bool chatFloatShortcut(
if (alt) return !control && !meta;
if (control == meta) return false;
if (!_apple(platform ?? defaultTargetPlatform)) return control;
return meta || !primaryFocusIsTypingSurface();
return control || meta;
}
bool _apple(TargetPlatform platform) =>
+21
View File
@@ -128,6 +128,27 @@ class WindowFrame extends StatelessWidget {
);
}
/// The foreground edge of a floating window. This is separate from
/// [WindowFrame] because the window body is painted by a later navigator
/// child and may otherwise cover the card's decoration.
class WindowOutline extends StatelessWidget {
const WindowOutline({super.key});
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).colorScheme;
return IgnorePointer(
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(color: colors.outlineVariant),
borderRadius: BorderRadius.circular(windowCornerRadius),
),
child: const SizedBox.expand(),
),
);
}
}
/// The lower right corner of a window: drag to resize.
class WindowResizeCorner extends StatelessWidget {
const WindowResizeCorner({
+1
View File
@@ -300,6 +300,7 @@ class _WindowLayerState extends State<WindowLayer>
onResizeEnd: _resizeEnded,
),
),
Positioned.fromRect(rect: frame, child: const WindowOutline()),
],
);
final center = widget.bounds.center(Offset.zero);
+14
View File
@@ -289,6 +289,20 @@ class WindowManager extends ChangeNotifier {
return true;
}
/// Hides the group when it is active; otherwise shows and raises its most
/// recently used window. A global shortcut should bring a group forward when
/// pressed from another window, rather than hide it behind that window.
bool toggleOrRaiseGroup(String groupId) {
final group = inGroup(groupId).toList();
if (group.isEmpty) return false;
if (group.any(isVisible) && active?.groupId == groupId) {
setGroupShown(groupId, false);
} else {
show(group.last.id);
}
return true;
}
/// Brings the next ([step] 1) or previous (-1) visible window to the top.
void cycle([int step = 1]) {
final visible = windows.where(isVisible).toList();
+6 -1
View File
@@ -33,6 +33,7 @@ class AppOverflowMenu<T> extends StatelessWidget {
this.label = 'More actions',
this.sheetTitle,
this.enabled = true,
this.icon = const Icon(Icons.more_vert),
});
final List<AppMenuAction<T>> actions;
@@ -48,6 +49,10 @@ class AppOverflowMenu<T> extends StatelessWidget {
final bool enabled;
/// The button glyph. Most callers use the default overflow icon; controls
/// whose action has a distinct meaning can provide a matching Material icon.
final Widget icon;
@override
Widget build(BuildContext context) {
if (actions.isEmpty) return const SizedBox.shrink();
@@ -57,7 +62,7 @@ class AppOverflowMenu<T> extends StatelessWidget {
child: Material(
type: MaterialType.transparency,
child: PopupMenuButton<T>(
icon: const Icon(Icons.more_vert),
icon: icon,
tooltip: label,
enabled: enabled,
onSelected: (value) => onSelected(context, value),
+23
View File
@@ -0,0 +1,23 @@
# Chat terminal shortcut focus
Implemented the macOS Ctrl+Y floating-chat handoff. A chat shortcut now hides
the chat group only when chat is already the active window; from another
window it raises the most recently used chat. The existing window-host
post-frame lifecycle then focuses that chat's composer. Ctrl+Y now joins the
existing Option+Y and Cmd+Y aliases on Apple platforms; plain Y and repeat
events remain untouched.
Evidence:
- `tool/memwatch/full.sh 'test/features/chat/windows/chat_windows_test.dart test/features/chat/workspace/chat_float_shortcut_test.dart test/features/chat/chat_floating_pane_test.dart test/shell/windows/window_manager_test.dart'`
— PASS: 33 passed, 0 failed, 0 skipped; peak 1236 MB; 14s.
- `tool/analyze.sh` — clean; exit 0.
- The floating-pane regression uses a terminal-like `TypingSurface`, presses
macOS Ctrl+Y, verifies the chat composer has primary focus, types
`from terminal` without a click, and verifies the terminal did not receive
Y. The manager regression covers visible-behind-terminal, hidden, multiple
chats, and repeated toggles.
No browser fixture was run in this implementation stage; browser terminal
fixture support and full-app rendered evidence remain for the appropriate
review stage.
+11
View File
@@ -0,0 +1,11 @@
# File explorer sort icon
- Changed `FilesHeader` to use the Material `Icons.sort` glyph for the Sort
control instead of the generic overflow glyph.
- Extended `AppOverflowMenu` with an optional icon while preserving the default
`Icons.more_vert` for existing callers.
- Added widget coverage for the recognizable sort icon and key/direction
selection behavior.
- Focused verification: `files_panel_test.dart` and `files_models_test.dart`
through `tool/memwatch/full.sh`, followed by `tool/analyze.sh` (recorded in
the stage handoff).
+11
View File
@@ -0,0 +1,11 @@
# Floating window outline
- Added a one-logical-pixel `ColorScheme.outlineVariant` outline over the full
floating window perimeter, including the body painted by its navigator.
- The outline is non-interactive and keeps the existing title drag, body input,
resize, popup layering, and window state behavior unchanged.
- Focused checks: `window_host_test.dart`, `window_layering_test.dart`, and
`window_conveniences_test.dart` — 41 passed.
- `tool/analyze.sh` — clean.
- Browser captures were not run in this implementation stage; rendered review
remains for the UI review stage.
@@ -16,7 +16,9 @@ import 'package:pipelines_app/shell/windows/window_host.dart';
import 'package:pipelines_app/shell/windows/window_kind.dart';
import 'package:pipelines_app/shell/windows/window_manager.dart';
import 'package:pipelines_app/shell/windows/window_store.dart';
import 'package:pipelines_app/shell/windows/window_entry.dart';
import 'package:pipelines_app/ui/motion/fade_through_stack.dart';
import 'package:pipelines_app/ui/input/keyboard_owner.dart';
import 'conversation/chat_thread_fixtures.dart';
@@ -46,6 +48,19 @@ class _Store implements WindowStore {
}
}
class _TerminalKind extends WindowKind {
@override
String get key => 'terminal';
@override
bool get serverScoped => false;
@override
IconData get icon => Icons.terminal;
@override
String title(BuildContext context, WindowEntry entry) => entry.contentId;
@override
Widget build(BuildContext context, WindowEntry entry) => const SizedBox();
}
Finder _thread(String id) => find.byWidgetPredicate(
(widget) => widget is ChatThreadView && widget.sessionId == id,
skipOffstage: false,
@@ -83,21 +98,21 @@ class _App {
late final ChatRuntime runtime;
late final WindowManager manager;
late final ChatWindows windows;
final terminalFocus = FocusNode(debugLabel: 'test terminal');
final terminalTyped = <LogicalKeyboardKey>[];
Future<void> start(
WidgetTester tester, {
Size size = const Size(1800, 1000),
bool terminalSurface = false,
}) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
bindServerIdentity(gateway, 'server-a');
runtime = ChatRuntime(gateway: gateway, serverKey: 'server-a');
manager = WindowManager(
kinds: WindowKinds(),
store: store,
server: 'server-a',
);
final kinds = WindowKinds()..register(_TerminalKind());
manager = WindowManager(kinds: kinds, store: store, server: 'server-a');
windows = ChatWindows(
manager: manager,
runtime: runtime,
@@ -131,6 +146,21 @@ class _App {
],
),
),
if (terminalSurface)
Positioned.fill(
child: TypingSurface(
child: Focus(
focusNode: terminalFocus,
onKeyEvent: (node, event) {
if (event is KeyDownEvent) {
terminalTyped.add(event.logicalKey);
}
return KeyEventResult.handled;
},
child: const SizedBox(),
),
),
),
Positioned.fill(child: WindowHost(manager: manager)),
],
),
@@ -147,6 +177,7 @@ class _App {
manager.dispose();
destination.dispose();
chatBuilt.dispose();
terminalFocus.dispose();
gateway.close();
}
@@ -187,6 +218,13 @@ Future<void> _chord(WidgetTester tester) async {
await tester.pumpAndSettle();
}
Future<void> _controlChord(WidgetTester tester) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyY);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
}
void main() {
testWidgets('Float and Dock move the live chat with its draft', (
tester,
@@ -391,6 +429,36 @@ void main() {
await app.stop(tester);
});
testWidgets(
'Ctrl+Y from a terminal raises chat and focuses its composer',
(tester) async {
await _saved('a', 'b');
final app = _App(_Store());
await app.start(tester, terminalSurface: true);
await _menu(tester, 'b', 'Float (Option+Y)');
app.manager.open('terminal', 'terminal');
app.terminalFocus.requestFocus();
await tester.pump();
await _controlChord(tester);
final input = _input('b');
expect(_shown('Chat b'), findsOneWidget);
expect(
tester.widget<EditableText>(input).focusNode.hasPrimaryFocus,
isTrue,
);
tester.testTextInput.enterText('from terminal');
await tester.pump();
expect(
tester.widget<EditableText>(input).controller.text,
'from terminal',
);
expect(app.terminalTyped, isEmpty);
await app.stop(tester);
},
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
);
testWidgets('floating chats saved by an older build come back as windows', (
tester,
) async {
@@ -93,6 +93,31 @@ void main() {
expect(find.widgetWithText(TextButton, 'demo'), findsOneWidget);
});
testWidgets('file sorting uses a sort icon and preserves direction', (
tester,
) async {
final controller = await pump(tester);
expect(find.byTooltip('Sort'), findsOneWidget);
expect(find.byIcon(Icons.sort), findsOneWidget);
expect(controller.sort.key, FilesSortKey.name);
expect(controller.sort.ascending, isTrue);
await tester.tap(find.byTooltip('Sort'));
await tester.pumpAndSettle();
await tester.tap(find.text('size'));
await tester.pumpAndSettle();
expect(controller.sort.key, FilesSortKey.size);
expect(controller.sort.ascending, isTrue);
await tester.tap(find.byTooltip('Sort'));
await tester.pumpAndSettle();
await tester.tap(find.text('size ↑'));
await tester.pumpAndSettle();
expect(controller.sort.key, FilesSortKey.size);
expect(controller.sort.ascending, isFalse);
});
testWidgets('text tap opens shared viewer and fetches inline URL', (
tester,
) async {
@@ -232,7 +232,7 @@ void main() {
});
testWidgets(
'on macOS Ctrl+Y in a terminal stays with it; Cmd+Y and Option+Y toggle',
'on macOS Ctrl+Y from a terminal raises chat; Cmd+Y and Option+Y toggle',
(tester) async {
await wide(tester);
final typing = FocusNode();
@@ -256,12 +256,12 @@ void main() {
typing.requestFocus();
await tester.pump();
await _chord(tester, LogicalKeyboardKey.controlLeft);
expect(h.manager.groupShown(chatWindowKind), isTrue);
expect(typed, contains(LogicalKeyboardKey.keyY));
await _chord(tester, LogicalKeyboardKey.metaLeft);
expect(h.manager.groupShown(chatWindowKind), isFalse);
await _chord(tester);
expect(typed, isNot(contains(LogicalKeyboardKey.keyY)));
await _chord(tester, LogicalKeyboardKey.metaLeft);
expect(h.manager.groupShown(chatWindowKind), isTrue);
await _chord(tester);
expect(h.manager.groupShown(chatWindowKind), isFalse);
},
variant: const TargetPlatformVariant({TargetPlatform.macOS}),
);
@@ -29,6 +29,10 @@ void main() {
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.linux),
isTrue,
);
expect(
chord({LogicalKeyboardKey.controlLeft}, TargetPlatform.macOS),
isTrue,
);
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.linux), isFalse);
expect(chord({LogicalKeyboardKey.metaLeft}, TargetPlatform.macOS), isTrue);
expect(
@@ -47,6 +47,36 @@ void main() {
expect(tester.getRect(find.byType(ProbeContent)).top, greaterThan(80));
});
testWidgets('the outline covers the full window and uses the theme palette', (
tester,
) async {
manager.open('probe', 'a');
await pumpProbe(tester, manager);
final outline = find.byType(WindowOutline);
expect(outline, findsOneWidget);
expect(tester.getSize(outline), const Size(360, 420));
final decoration =
tester
.widget<DecoratedBox>(
find.descendant(
of: outline,
matching: find.byType(DecoratedBox),
),
)
.decoration
as BoxDecoration;
expect(
decoration.border,
Border.all(
color: Theme.of(
tester.element(find.byType(WindowOutline)),
).colorScheme.outlineVariant,
),
);
expect(decoration.borderRadius, BorderRadius.circular(windowCornerRadius));
});
testWidgets('the app behind takes input everywhere outside a window', (
tester,
) async {
@@ -139,6 +139,25 @@ void main() {
expect(manager.groupShown('chat'), isTrue);
});
test('toggleOrRaiseGroup brings a visible group over another window', () {
final a = manager.open('chat', 'a');
manager.open('chat', 'b');
final terminal = manager.open('terminal', 'terminal');
expect(manager.active?.id, terminal.id);
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
expect(manager.active?.contentId, 'b');
expect(manager.groupShown('chat'), isTrue);
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
expect(manager.groupShown('chat'), isFalse);
expect(manager.active?.contentId, 'terminal');
expect(manager.toggleOrRaiseGroup('chat'), isTrue);
expect(manager.active?.contentId, 'b');
expect(manager.byId(a.id), isNotNull);
});
test('close remembers the frame for the content and tells the kind', () {
final a = manager.open('chat', 'a');
manager.setFrame(a.id, const Rect.fromLTWH(300, 200, 500, 400));