Repository navigation
feat(explorer): paste clipboard images into local and remote folders - #27806
marinhooodev wants to merge 20 commits into
Conversation
Reveal the imported file through the existing Explorer reveal flow so a collapsed destination folder expands and selects it. Record the paste in the Explorer undo/redo history, retaining a bounded private snapshot so Redo restores the same pixels without rereading the clipboard. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…-image Resolve useFileExplorerImport.ts against the runtime file client split: the import flow lives in use-file-explorer-import-operation.ts, which now imports from runtime-file-import-client and runtime-file-mutation-client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A paste sent while the pane is still attaching its shell is cancelled as a stale target, which made the terminal focus scenario flaky. Wait for a shell round-trip first, as the other terminal E2E specs do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to
|
|
@coderabbitai Thanks for the review. About the one inconclusive pre-merge check (Docstring Coverage, 22.41% vs. the 80% threshold): I'm leaving it as is on purpose.
This review raised no other findings (Merge Risk: Minimal), so nothing from it is still open. For maintainers: the GitHub Actions workflows for |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd --hidden --exclude .git '^AGENTS\.md$' . --exec sh -c 'printf "\n--- %s ---\n" "$1"; cat "$1"' sh {}Length of output: 28811
I accept leaving the docstrings unchanged. Adding docstrings solely to reach 80% would not fit that guidance. The Docstring Coverage result remains below the threshold, but it does not establish a code defect. The fork-workflow approval is separate from the review result. Based on your reported ✏️ Learnings added
You are interacting with an AI system. |
…-image Port the existing-parent upload rule into the runtime file-mutations module that replaced the per-command runtime classes (stablyai#27582), and declare files.upload-existing-parent.v1 beside the other file-mutation capability in runtime-capability-constants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reader Explorer image paste called clipboard.readImage() directly, so a CleanShot screenshot stored as JPEG bytes under macOS public.png pasted nothing. Use readClipboardNativeImage, which chat paste adopted in stablyai#29685. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…name Capability constants now live in runtime-capability-constants, so the bundler no longer emits a protocol-version chunk for the host probe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ELI5
Copy an image, select a folder in Files, and paste. Orca saves it there as a PNG. Today, an image that exists only on the clipboard (a screenshot, an image copied from a browser) cannot be pasted into the Files explorer at all. With this change, Ctrl+V / Cmd+V or Paste Image creates
pasted-image.pngin that folder without overwriting anything, expands the folder, and selects the new file. Explorer Undo removes it; Redo puts the same image back.What Changed
pasted-image copy.png, …). The workspace owner and connection generation are captured before any asynchronous work, so a reconnect or workspace switch cannot redirect the write to another host.files.upload-existing-parent.v1; an older remote host gets a clear "update required" error before any upload.Why
Screenshots and browser images often exist only on the clipboard, so today they must be saved somewhere else and then imported. Reusing the existing import pipeline instead of adding a new transfer path keeps host ownership, no-clobber writes, filename rules, and SSH behavior identical to drag-and-drop import. Undo/redo hooks into the history Explorer already has instead of introducing a separate one.
Linked Issue
Fixes #27804
Related: #12929 and #9443 cover copying existing files. This PR handles clipboard pixels only, so it does not close them.
Visual Proof
Same automated gesture and fixture on Windows: select Clipboard demo, then Ctrl+V. Before uses clean
mainatae0ff631; after uses this branch. The clipboard holds controlled native image pixels. Screenshots come from real hidden Electron renderers, not mockups.Before: the folder stays empty.
After:
pasted-image.pngis created and selected.Remote: a Windows desktop connected to a Linux folder over managed SSH. Keyboard and menu paste create two byte-identical PNGs without overwriting the first.
Testing
Manual (Windows 11, local folder workspace, dev build of this branch after merging
mainat25f87544): Ctrl+V into a folder; paste into a collapsed folder, which expands and selects the new PNG; Paste Image from a folder row, a file row (saves to its parent), and the tree background (saves to the root); a second paste createspasted-image copy.png; Ctrl+Z removes the pasted image and Ctrl+Shift+Z restores it. macOS, Linux desktop, and SSH were not tested by hand; they are covered by the automated runs below.After merging current
main(6dd7ab55), on Windows (Node 24.14.0, pnpm 12.8.1, Bun 1.4.2, Electron 43.7.8). This merge was validated by the automated runs below, not by hand:pnpm buildpassed: desktop, WSL guest, CLI, web, mobile web, and the native Windows binaries.pnpm typecheckand the seven changed-code quality checks pass (0 new findings across 62 changed files).pnpm lint: every step passes exceptaudit:code-quality:native, which reports fiveimport/no-cyclewarnings inmobile/src/transportandmobile/src/terminal/document. Cleanmainreports the same five; this branch does not touchmobile/, and the same audit oversrc,config, andtestspasses.main(symlink permissions and POSIX paths on Windows). Linux Docker: the 18 files plus the upstream file-mutation, local-provider, and macOS clipboard suites, 223 passed.files.upload-existing-parent.v1; chat, editor, and terminal keeping their paste; and managed SSH from Windows into a Linux container running anorcadbuilt from this merge.The pre-commit formatter also reformatted
repository-project-operations-part-02.spec.tsin the merge commit;oxfmt --checkflags that file onmain.Earlier on this branch, before the undo/redo follow-up and the merge (
d613ca74):pnpm buildpassed: desktop, CLI, web, mobile web, and the native Windows CLI launcher.Known local limitation: the repository-wide
pnpm testis not green on this Windows machine for reasons unrelated to this change (SQLite cleanup locks, symlink permissions, POSIX shell assumptions); two cleanmainruns reproduced the same failure classes. None of the changed test files failed. CI on Linux covers the full suite.pnpm typecheck:e2ereports 686 existing diagnostics, the same count as cleanmain, none in the image-paste files.To reproduce the controlled local, history, paired-host, capability, and focus cases:
System clipboard and Edge specs require their explicit clipboard opt-in (
ORCA_E2E_SYSTEM_CLIPBOARD_IMAGE=1,ORCA_E2E_BROWSER_CLIPBOARD_IMAGE=1); their helpers capture and restore the clipboard. The SSH spec requiresORCA_E2E_SSH_DOCKER=1andORCA_E2E_ORCAD_CONVERT_TEMPLATEpointing to a Linux template built from this checkout. All Electron runs used isolated profiles andORCA_BACKGROUND_LAUNCH=1.AI Disclosure
Implemented and tested with AI coding agents: OpenAI Codex (GPT-6) for the feature and most of the test suite, and Claude Code (Claude Sonnet 5.5 for the reveal and undo/redo follow-up; Claude Opus 5.5 for merging current
mainand the final validation). The automated checks and screenshots above were run by the agents. The manual testing above was done by the author.Review
AI agent review of the final diff:
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance. Covered in Review above: older remote hosts are refused cleanly instead of failing silently, and web/mobile clients are untouched.
Out of scope: web/mobile clipboard access, generic file copy/paste, and undo/redo for arbitrary binary edits. Undo/redo of this image paste is included. Images from native screenshot tools and image editors were not validated separately; they use the same native clipboard image path. The missing-capability test changes the advertised capabilities of a disposable host; it does not run a historical server binary.
Author: @marinhooodev · X: @marinhoo___
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)This is one feature, but about 3,700 of the ~4,600 added lines are tests (unit, Electron, paired-host, and SSH), so the size box is left unchecked. Build, typecheck, and lint pass locally after the merge (apart from the existing
mobile/warnings above), and the focused unit tests pass on Windows and Linux. The fullpnpm testrelies on CI (see the Windows limitation above).