Skip to content

fix: forward validated editor clipboard writes to the owning terminal - #51

Open
ibrmora wants to merge 1 commit into
zenbu-labs:mainfrom
ibrmora:fix/clipboard-bridge
Open

ibrmora wants to merge 1 commit into
zenbu-labs:mainfrom
ibrmora:fix/clipboard-bridge

Conversation

@ibrmora

@ibrmora ibrmora commented Nov 3, 2026

Copy link
Copy Markdown

Fixes #50.

Motivation

I use tode with code-server inside Herdr on Linux. Editor-menu Copy/Cut and Explorer path copying did not reliably become available when I pasted into another terminal pane. These application-owned operations need a separate route from keyboard selection copying.

Changes

  • Capture trusted main-frame Copy/Cut text synchronously.
  • Notify after successful plain-text Clipboard API writes, treating those signals as untrusted.
  • Require an exact match from awaited native read-back, or isolated read-back with an already-granted permission.
  • Forward only to the owning registered window and reject results invalidated by lifecycle or newer accepted messages.
  • Preserve theme/timing messages, editor settings, existing permission configuration, and native paste. Do not enable copy-on-selection.

Verification

  • npm test: 167 passed, including 39 new compiled-source clipboard tests.
  • npm run typecheck: passed.
  • The suite also passed from a clean committed Git export using cached declared dependencies.
  • Negative checks caught bypassed validation, unawaited native reads, and disconnected daemon routing.

Implementation and tests were AI-assisted. I live-tested and confirmed the equivalent installed workaround; this newer source build has not been launched as a replacement. The source tests use mocked Electron/terminal endpoints and do not establish cross-platform native behavior.

Scope

The Pixel 0.0.23 pin is unchanged. Complete keyboard coverage needs the separate Pixel fix in zenbu-labs/terminal-browser#245 and zenbu-labs/terminal-browser#246, a Pixel release, and a terminal-code dependency update. This PR does not claim to close macOS/cmux #24.

Main-frame nonempty plain text only; no image, rich-text or iframe support, and no global clipboard-ordering guarantee. The main-world Clipboard API wrapper is observable by page scripts.

Capture trusted main-frame Copy/Cut events synchronously and validate successful Clipboard API notifications with awaited native or permission-gated isolated read-back. Preserve theme/timing IPC and invalidate pending reads on lifecycle or sequence changes. Add compiled-source preload, bridge, and daemon regression tests.
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ibrmora is attempting to deploy a commit to the zenbu-labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor-menu Copy/Cut and Explorer Copy Path do not reach the terminal clipboard on Linux

1 participant