Merge branch 'main' into pipelines/run-20261112-2323-read-chat-replies-aloud-with-word-highli-e079

This commit is contained in:
2026-11-13 01:29:09 +00:00
18 changed files with 668 additions and 126 deletions
@@ -48,12 +48,6 @@ mixin _ChatScreenPaneMenu on State<ChatScreen>, _ChatScreenWorkspace
label: 'Add chat pane',
enabled: true,
),
if (tiled)
(
action: SessionPaneAction.openChats,
label: 'Open chats ($panes)',
enabled: true,
),
if (tiled && showsListBesideDetail(context))
(
action: SessionPaneAction.centerStage,
@@ -69,12 +63,6 @@ mixin _ChatScreenPaneMenu on State<ChatScreen>, _ChatScreenWorkspace
'(${chatPaneMoveShortcutLabel(move.direction)})',
enabled: moves[move.direction] != null,
),
if (pane != null && tiled)
(
action: SessionPaneAction.closePane,
label: 'Close pane',
enabled: true,
),
if (WindowScope.maybeOf(context) != null)
(
action: SessionPaneAction.chatDetails,
@@ -82,11 +70,6 @@ mixin _ChatScreenPaneMenu on State<ChatScreen>, _ChatScreenWorkspace
enabled: true,
),
(action: SessionPaneAction.files, label: 'Files', enabled: true),
(
action: SessionPaneAction.runCommand,
label: chatShellRunActionLabel,
enabled: true,
),
if (_paneCommands.hasFinished(id))
(
action: SessionPaneAction.dismissFinished,
@@ -99,6 +82,13 @@ mixin _ChatScreenPaneMenu on State<ChatScreen>, _ChatScreenWorkspace
label: terminalOpenActionLabel,
enabled: true,
),
// Closing comes last.
if (pane != null && tiled)
(
action: SessionPaneAction.closePane,
label: 'Close pane',
enabled: true,
),
];
}
@@ -106,6 +106,8 @@ class ChatThreadHeader extends StatelessWidget {
if (action is! SegmentedOverflowable) action,
if (settingsEntry != null || menuActions.isNotEmpty)
SegmentedMoreButton(
sheetTitle: title.isEmpty ? 'Chat' : title,
sheetSubtitle: folder.isEmpty ? null : folder,
entries: [
?settingsEntry,
for (final action in menuActions) action.overflowEntry,
@@ -1467,6 +1467,10 @@ class _ChatThreadViewState extends State<ChatThreadView> {
);
}
/// A pane control that closes the pane: listed last in the menu.
static bool _closes(Widget control) =>
control is ChatBarAction && control.destructive;
Widget _buildHeader(
JsonMap? session,
bool inShellBar,
@@ -1484,6 +1488,12 @@ class _ChatThreadViewState extends State<ChatThreadView> {
final folder = directory
.split(RegExp(r'[/\\]'))
.lastWhere((part) => part.isNotEmpty, orElse: () => '');
final openTerminal = terminalOpenMenuAction(
context,
gateway: widget.gateway,
directory: directory,
onRefused: _terminalRefused,
);
return ChatThreadHeader(
key: const Key('chat-thread-header'),
chatColor: chatSessionColor(session),
@@ -1514,8 +1524,9 @@ class _ChatThreadViewState extends State<ChatThreadView> {
materialIcon: _filesVisible ? Icons.folder : Icons.folder_outlined,
),
// A narrow layout's terminal button, beside Files; wide keeps the
// shell bar's.
?terminalChatBarAction(context),
// shell bar's. Where the menu already offers the chat's terminal
// (Open in terminal) there is no second terminal entry.
if (openTerminal == null) ?terminalChatBarAction(context),
],
moreActions: [
?widget.sidebarControl,
@@ -1536,16 +1547,12 @@ class _ChatThreadViewState extends State<ChatThreadView> {
onPressed: _openInfo,
materialIcon: Icons.info_outline,
),
...widget.paneControls,
chatShellRunMenuAction(onPressed: _runShellFromMenu),
...widget.paneControls.where((c) => !_closes(c)),
if (_shellRuns.finishedIds.isNotEmpty)
chatShellDismissAllMenuAction(onPressed: _dismissFinishedShellRuns),
?terminalOpenMenuAction(
context,
gateway: widget.gateway,
directory: directory,
onRefused: _terminalRefused,
),
?openTerminal,
// Closing comes last.
...widget.paneControls.where(_closes),
],
controls: [
// Labelled, so a narrow bar's settings sheet shows their names.
+29 -4
View File
@@ -11,6 +11,9 @@ import 'files_entry_actions.dart';
import 'files_upload_notice.dart';
import 'files_viewer.dart';
import 'files_header.dart';
import 'files_models.dart';
import 'files_preview.dart';
import '../../artifacts/domain/artifact_kind.dart';
import '../../../ui/layout/app_overflow_menu.dart';
import '../../terminal/terminal_open_action.dart';
import '../../terminal/terminal_scope.dart';
@@ -160,6 +163,10 @@ class _FilesPanelState extends State<FilesPanel> {
/// Open and Download for a file, then Rename, Move and Delete for any entry.
Widget _menu(DirectoryEntry entry) => AppOverflowMenu<FileAction>(
label: entry.isDir ? 'Folder actions' : 'File actions',
sheetTitle: entry.name,
sheetSubtitle: entry.isDir
? 'Folder'
: '${artifactKindLabel(artifactKind(fileContentType(entry.name), entry.name))} · ${fileSizeLabel(entry.size)}',
onSelected: (_, action) => switch (action) {
FileAction.open => _open(entry),
FileAction.download => widget.viewer.download(
@@ -179,19 +186,37 @@ class _FilesPanelState extends State<FilesPanel> {
},
actions: [
if (!entry.isDir) ...const [
AppMenuAction(value: FileAction.open, label: 'Open'),
AppMenuAction(value: FileAction.download, label: 'Download'),
AppMenuAction(
value: FileAction.open,
label: 'Open',
icon: Icons.open_in_new,
),
AppMenuAction(
value: FileAction.download,
label: 'Download',
icon: Icons.download_outlined,
),
],
if (entry.isDir && TerminalScope.maybeOf(context) != null)
const AppMenuAction(
value: FileAction.terminal,
label: terminalOpenActionLabel,
icon: Icons.terminal,
),
const AppMenuAction(value: FileAction.rename, label: 'Rename…'),
const AppMenuAction(value: FileAction.move, label: 'Move…'),
const AppMenuAction(
value: FileAction.rename,
label: 'Rename…',
icon: Icons.edit_outlined,
),
const AppMenuAction(
value: FileAction.move,
label: 'Move…',
icon: Icons.drive_file_move_outlined,
),
const AppMenuAction(
value: FileAction.delete,
label: 'Delete…',
icon: Icons.delete_outline,
destructive: true,
),
],
+1 -7
View File
@@ -22,7 +22,6 @@ import 'package:flutter/services.dart';
import '../../core/api_gateway.dart';
import '../../core/servers/server_scope.dart';
import '../../shell/windows/window_scope.dart';
import 'shell/chat_shell_command.dart';
import 'shell/chat_shell_dismiss.dart';
import '../terminal/terminal_open_action.dart';
import 'ui/sessions/session_pane_menu.dart';
@@ -440,12 +439,6 @@ class _ChatScreenState extends State<ChatScreen>
onPressed: () => _addPane(paneContext),
materialIcon: Icons.add_box_outlined,
),
if (_workspace.paneCount > 1)
ChatBarAction(
label: 'Open chats (${_workspace.paneCount})',
onPressed: () => _pickPane(paneContext),
materialIcon: Icons.view_quilt_outlined,
),
if (_workspace.paneCount > 1 && showsListBesideDetail(context))
chatCenterStageAction(ChatCenterStageController.instance),
...chatPaneMoveActions(
@@ -458,6 +451,7 @@ class _ChatScreenState extends State<ChatScreen>
label: 'Close pane',
onPressed: () => _closePane(pane.id),
materialIcon: Icons.close,
destructive: true,
),
],
),
@@ -8,6 +8,7 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
required this.onPressed,
required this.materialIcon,
this.identifier,
this.destructive = false,
});
final String label;
@@ -16,12 +17,16 @@ class ChatBarAction extends StatelessWidget implements SegmentedOverflowable {
final String? identifier;
/// Closes or removes something; menus list it last, in the error colour.
final bool destructive;
/// A narrow bar moves it into its More menu, under the bar's host's icon.
@override
SegmentedOverflowEntry get overflowEntry => SegmentedOverflowEntry(
label: label,
icon: materialIcon,
onPressed: onPressed,
destructive: destructive,
);
@override
@@ -53,21 +53,27 @@ class SessionActionsButton extends StatelessWidget {
return AppOverflowMenu<Object>(
label: sessionActionsLabel(session, duplicateTitles),
sheetTitle: chatSessionTitle(session),
sheetSubtitle: '${session['directory'] ?? ''}'.trim().isEmpty
? null
: '${session['directory']}',
actionsBuilder: () => [
if (allowOpenBeside)
const AppMenuAction<Object>(
value: SessionAction.openBeside,
label: 'Open to the right',
icon: Icons.vertical_split_outlined,
),
if (allowOpenBelow)
const AppMenuAction<Object>(
value: SessionAction.openBelow,
label: 'Open below',
icon: Icons.horizontal_split_outlined,
),
if (allowFloat)
AppMenuAction<Object>(
value: SessionAction.float,
label: 'Float (${chatFloatShortcutLabel()})',
icon: Icons.picture_in_picture_alt_outlined,
),
for (final choice
in paneMenu?.choicesFor(context, session) ??
@@ -76,9 +82,16 @@ class SessionActionsButton extends StatelessWidget {
value: choice.action,
label: choice.label,
enabled: choice.enabled,
icon: _paneIcon(choice.action),
destructive: choice.action == SessionPaneAction.closePane,
),
for (final item in _items(session))
AppMenuAction<Object>(value: item.action, label: item.label),
AppMenuAction<Object>(
value: item.action,
label: item.label,
icon: item.icon,
destructive: item.action == SessionAction.close,
),
],
onSelected: (context, value) {
if (value is SessionAction) {
@@ -91,19 +104,51 @@ class SessionActionsButton extends StatelessWidget {
}
}
List<({SessionAction action, String label})> _items(JsonMap session) {
IconData _paneIcon(SessionPaneAction action) => switch (action) {
SessionPaneAction.addPane => Icons.add_box_outlined,
SessionPaneAction.openChats => Icons.view_quilt_outlined,
SessionPaneAction.centerStage => Icons.center_focus_strong_outlined,
SessionPaneAction.moveUp => Icons.arrow_upward,
SessionPaneAction.moveDown => Icons.arrow_downward,
SessionPaneAction.moveLeft => Icons.arrow_back,
SessionPaneAction.moveRight => Icons.arrow_forward,
SessionPaneAction.closePane => Icons.close,
SessionPaneAction.chatDetails => Icons.info_outline,
SessionPaneAction.files => Icons.folder_outlined,
SessionPaneAction.runCommand => Icons.terminal,
SessionPaneAction.openTerminal => Icons.terminal,
SessionPaneAction.dismissFinished => Icons.clear_all,
};
List<({SessionAction action, String label, IconData icon})> _items(
JsonMap session,
) {
final isClosed = session['closed_at'] != null;
final starred = session['starred'] == true;
return [
(
action: SessionAction.star,
label: session['starred'] == true ? 'Unstar' : 'Star',
label: starred ? 'Unstar' : 'Star',
icon: starred ? Icons.star : Icons.star_outline,
),
(
action: SessionAction.color,
label: 'Colour…',
icon: Icons.palette_outlined,
),
(action: SessionAction.rename, label: 'Rename…', icon: Icons.edit_outlined),
(
action: SessionAction.hide,
label: 'Hide on this device',
icon: Icons.visibility_off_outlined,
),
(action: SessionAction.color, label: 'Colour…'),
(action: SessionAction.rename, label: 'Rename…'),
isClosed
? (action: SessionAction.reopen, label: 'Reopen')
: (action: SessionAction.close, label: 'Close chat…'),
(action: SessionAction.hide, label: 'Hide on this device'),
? (action: SessionAction.reopen, label: 'Reopen', icon: Icons.restore)
: (
action: SessionAction.close,
label: 'Close chat…',
icon: Icons.close,
),
];
}