Merge branch 'worktree-agent-ae3af4174afca7f4d'

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 12:59:07 +00:00
26 changed files with 722 additions and 60 deletions
@@ -7,7 +7,9 @@ import 'package:flutter/widgets.dart';
import 'chat_attachment_picker.dart';
import 'chat_clipboard_paste.dart';
/// The macOS Runner's pasteboard reader (macos/Runner/MainFlutterWindow.swift).
/// The desktop Runners' clipboard reader: macOS's
/// (macos/Runner/MainFlutterWindow.swift) and Linux's
/// (linux/runner/clipboard_files.cc).
const MethodChannel chatClipboardFilesChannel = MethodChannel(
'pipelines/clipboard_files',
);
@@ -17,7 +19,7 @@ const MethodChannel chatClipboardFilesChannel = MethodChannel(
///
/// Flutter's own [Clipboard] carries text only, so a native host reads the
/// pasteboard through the Runner. Each subscription watches for the platform
/// paste shortcut (Cmd+V). When its composer may take the paste it consumes
/// paste shortcut (Cmd+V on macOS, Ctrl+V on Linux). When its composer may take the paste it consumes
/// the key, asks the Runner for the pasteboard's files (Finder file URLs, else
/// a copied or screenshot image) and hands them over; a pasteboard without
/// files pastes its text into the composer instead, so the consumed key never
@@ -46,13 +48,14 @@ ChatClipboardPaste nativeChatClipboardPaste({
);
/// Whether the held modifiers make V the host's paste shortcut: Cmd alone on
/// macOS.
bool chatIsNativePasteShortcut() {
/// macOS; Ctrl on Linux, also with Super held (Omarchy's universal Super+V
/// sends Ctrl+V while Super is down).
bool chatIsNativePasteShortcut([TargetPlatform? platform]) {
final keys = HardwareKeyboard.instance;
return keys.isMetaPressed &&
!keys.isControlPressed &&
!keys.isAltPressed &&
!keys.isShiftPressed;
if (keys.isAltPressed || keys.isShiftPressed) return false;
return (platform ?? defaultTargetPlatform) == TargetPlatform.linux
? keys.isControlPressed
: keys.isMetaPressed && !keys.isControlPressed;
}
Future<void> _readPasteboard(
@@ -121,4 +124,5 @@ String chatNothingToPasteMessage(List<String> types) => types.isEmpty
/// Whether [platform] has a Runner that answers [chatClipboardFilesChannel].
bool chatHostReadsClipboardFiles(TargetPlatform platform) =>
!kIsWeb && platform == TargetPlatform.macOS;
!kIsWeb &&
(platform == TargetPlatform.macOS || platform == TargetPlatform.linux);
@@ -5,7 +5,7 @@ import 'chat_clipboard_paste_native.dart';
/// Native clipboard-file paste.
///
/// macOS reads the pasteboard through its Runner
/// macOS and Linux read the clipboard through their Runners
/// ([nativeChatClipboardPaste]). Other native hosts have no pasteboard reader
/// yet: they report that missing capability rather than pretending no paste
/// happened, and the composer keeps the host field's own text paste.