fix(terminal): map image paste to native provider bindings - #409
Merged
Conversation
DeadWaveWave
marked this pull request as ready for review
September 10, 2026 15:57
# Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Change Scope
📝 What Does This PR Do?
Fixes #402.
Fixes #406.
Desktop terminal paste now distinguishes native images from text and maps image gestures to the provider's native image binding. Previously the text-only clipboard path could swallow image paste. Text keeps its existing normalization and bracketed-paste encoding; image triggers are raw terminal input.
Windows Alt+V aliases are normalized only for identified Pi, Kimi, Codex, or Claude Code. Unidentified Windows shells retain Alt+V. macOS Cmd+V with an image emits Ctrl+V even for unidentified terminals, matching OMP's native binding. Pi/Kimi provider hints now survive persistence, and the input bridge reads changing provider identity without recreating the terminal.
Scope: the provider CLI reads the native clipboard itself, so this works for local desktop CLI sessions. Remote desktop providers cannot read the local clipboard; browser clients retain text-only paste. This does not transfer image files or inspect custom provider keybindings. E2E verifies native clipboard presence and terminal input bytes, not attachment/upload inside every external CLI.
🏗️ Large Change Spec (Required if "Large Change" is checked)
1. Context & Business Logic
One clipboard boundary reports text and native image presence, and one terminal handler routes the platform gesture. Provider mappings follow the upstream Pi, OMP, Codex, Claude Code, and Kimi references recorded in
docs/terminal/CLIPBOARD_INPUT.md. Native image bytes stay in the system clipboard; no temporary files or durable image state are introduced.2. State Ownership & Invariants
Main owns clipboard access; the renderer terminal handler owns gesture routing and pending delivery; the provider CLI owns image attachment. Existing provider metadata remains the identity source.
3. Verification Plan & Regression Layer
Unit/contract coverage verifies mapping, clipboard IPC, disposal, current provider identity, persisted Pi/Kimi hints, and text encoding. macOS E2E writes a real native image then verifies Cmd+V PTY bytes and subsequent bracketed text paste. Windows E2E covers Pi, Kimi, Codex, and Claude Code with both Alt+V and Ctrl+V; all four provider cases passed on Windows CI.
Final-version validation:
faff57c6e34f08b30c6e73388dbd1faa00f53678, including all macOS shards, Ubuntu checks/E2E shards, Windows platform E2E, and Web Canvas continuity.gh pr checks 409also confirmed all PR checks passed. The local first-run failure and independent recheck below remain recorded separately; this PR stays draft and the local full-gate checkbox stays unchecked.pnpm line-check:staged, secret/naming/style/format checks, lint, and typecheck passed.OPENCOVE_REQUIRE_STAGED=1 pnpm pre-commitexited 1: full E2E had 322 passed, 83 skipped, 1 failed (27.1 minutes), with zero retries and no crash fallback.app-header.primary-sidebar-toggle.spec.ts:390Agent ring equality assertion: green at the first sample and amber after hover. Sidebar reveal, width, and idle checks passed. No clipboard operation occurred in that test.faff57c6e34f08b30c6e73388dbd1faa00f53678: 42 passed, 3 skipped. All fourworkspace-canvas.terminal-image-paste.windows.spec.tscases (Pi, Kimi, Codex, and Claude Code) actually executed and passed. This platform result does not erase the local full-gate failure recorded above.✅ Delivery & Compliance Checklist
pnpm pre-commitis completely green.CLA.md).DEVELOPMENT.mdarchitectural boundaries.📸 Screenshots / Visual Evidence
The native clipboard E2E asserts exact PTY input bytes and no canvas image node, followed by preserved text paste; this change has no layout changes. The first failing sidebar screenshot and trace remain in the local Playwright report. Review-only images are not committed. CLA status is left to the repository check.